From: DongHun Kwak Date: Tue, 10 Jan 2017 05:46:13 +0000 (+0900) Subject: Imported Upstream version 1.12.30 X-Git-Tag: upstream/1.12.30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F109419%2F1;p=platform%2Fupstream%2Fzypper.git Imported Upstream version 1.12.30 Change-Id: Ib6c7a878e211b30a757de48d80e5130bd2ab33c4 Signed-off-by: DongHun Kwak --- diff --git a/VERSION.cmake b/VERSION.cmake index 860711e..ed1957e 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -34,7 +34,7 @@ # SET(VERSION_MAJOR "1") SET(VERSION_MINOR "12") -SET(VERSION_PATCH "29") +SET(VERSION_PATCH "30") -# LAST RELEASED: 1.12.29 +# LAST RELEASED: 1.12.30 #======= diff --git a/package/zypper.changes b/package/zypper.changes index 85ca361..2f2688d 100644 --- a/package/zypper.changes +++ b/package/zypper.changes @@ -1,4 +1,27 @@ ------------------------------------------------------------------- +Wed Jan 27 13:34:22 CET 2016 - ma@suse.de + +- Propagate repo refresh errors even if main action succeeded + (bsc#961719) +- Fix misaligned TAB stops in colored prompts (bsc#948566) +- version 1.12.30 + +------------------------------------------------------------------- +Sun Jan 24 01:14:09 CET 2016 - ma@suse.de + +- Update zypper-po.tar.bz2 + +------------------------------------------------------------------- +Thu Jan 21 01:15:51 CET 2016 - ma@suse.de + +- Update sle-zypper-po.tar.bz2 + +------------------------------------------------------------------- +Thu Jan 21 01:14:12 CET 2016 - ma@suse.de + +- Update zypper-po.tar.bz2 + +------------------------------------------------------------------- Wed Jan 20 15:05:47 CET 2016 - ma@suse.de - Enhance guessing of 'obs://' URLs on openSUSE Leap (bnc#959804) diff --git a/po/sle-zypper-po.tar.bz2 b/po/sle-zypper-po.tar.bz2 index e40b6d9..ce44c92 100644 Binary files a/po/sle-zypper-po.tar.bz2 and b/po/sle-zypper-po.tar.bz2 differ diff --git a/po/zypper-po.tar.bz2 b/po/zypper-po.tar.bz2 index 641eb59..65e454b 100644 Binary files a/po/zypper-po.tar.bz2 and b/po/zypper-po.tar.bz2 differ diff --git a/src/Zypper.cc b/src/Zypper.cc index 5f50ddc..0e147b3 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -210,7 +210,8 @@ Zypper::Zypper() , _argv( NULL ) , _out_ptr( NULL ) , _command( ZypperCommand::NONE ) -, _exit_code( ZYPPER_EXIT_OK ) +, _exitCode( ZYPPER_EXIT_OK ) +, _refreshCode( ZYPPER_EXIT_OK ) , _running_shell( false ) , _running_help( false ) , _exit_requested( false ) diff --git a/src/Zypper.h b/src/Zypper.h index f9f488a..c45e526 100644 --- a/src/Zypper.h +++ b/src/Zypper.h @@ -227,11 +227,18 @@ public: { if ( !_rm ) _rm.reset( new RepoManager( _gopts.rm_options ) ); return *_rm; } - int exitCode() const { return _exit_code; } + int exitCode() const { return _exitCode; } void setExitCode( int exit ) { WAR << "setExitCode " << exit << endl; - _exit_code = exit; + _exitCode = exit; } + + int refreshCode() const { return _refreshCode; } + void setRefreshCode( int exit ) { + WAR << "setRefreshCode " << exit << endl; + _refreshCode = exit; + } + bool runningShell() const { return _running_shell; } bool runningHelp() const { return _running_help; } bool exitRequested() const { return _exit_requested; } @@ -317,7 +324,8 @@ private: ArgList _arguments; std::string _command_help; - int _exit_code; + int _exitCode; + int _refreshCode; // do_init_repos hack! bool _running_shell; bool _running_help; bool _exit_requested; diff --git a/src/main.cc b/src/main.cc index 1e5aa6c..6e86ea6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -107,5 +107,9 @@ int main( int argc, char **argv ) return ZYPPER_EXIT_ERR_BUG; } - return Zypper::instance()->main( argc, argv ); + Zypper & zypper( *Zypper::instance() ); + int exitcode = zypper.main( argc, argv ); + if ( !exitcode ) + exitcode = zypper.refreshCode(); // propagate refresh errors even if main action succeeded + return exitcode; } diff --git a/src/output/OutNormal.cc b/src/output/OutNormal.cc index c08ae95..52dfc54 100644 --- a/src/output/OutNormal.cc +++ b/src/output/OutNormal.cc @@ -358,11 +358,48 @@ void OutNormal::prompt( PromptId id, const std::string & prompt, const PromptOpt else cout << startdesc << endl; - ColorStream cout( std::cout, ColorContext::PROMPT ); // scoped color on std::cout + std::ostringstream pstr; + ColorStream cout( pstr, ColorContext::PROMPT ); // scoped color on std::cout + cout << prompt; if ( ! poptions.empty() ) cout << " " << ColorString( poptions.optionString() ); - cout << ": " << std::flush; + cout << ": "; + + if ( do_colors() ) + { + // bsc#948566: Terminal is dumb and simply counts the amount of printable + // characters. If the number of printable characters within ansi SGR sequences + // is not a multiple of 8, tab stops are not computed correctly. We use + // superfluous resets ("\033[0m"; 3 printable chars) to fill up. + // Better ideas are welcome. + size_t invis = 0; + bool insgr = false; + for ( char ch : pstr.str() ) + { + if ( insgr ) + { + ++invis; + if ( ch == 'm' ) + insgr = false; + } + else if ( ch == '\033' ) + insgr = true; + } + invis %= 8; + + if ( invis ) + { + // "\033[0m" has 3 printable chars: + // ( resets[to fill] * 3 ) % 8 == to fill + // 0 1 2 3 4 5 6 7 + static const size_t resets[] = { 0,3,6,1,4,7,2,5 }; + for ( size_t i = resets[8-invis]; i; --i ) + cout << ansi::Color::SGRReset(); + } + } + + std::cout << pstr.str() << std::flush; // prompt ends with newline (user hits ) unless exited abnormaly _newline = true; } diff --git a/src/repos.cc b/src/repos.cc index c4d9267..e8420bc 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -727,6 +727,7 @@ void do_init_repos( Zypper & zypper, const Container & container ) ++it; } + unsigned skip_count = 0; for ( std::list::iterator it = gData.repos.begin(); it != gData.repos.end(); ++it ) { RepoInfo repo( *it ); @@ -761,11 +762,12 @@ void do_init_repos( Zypper & zypper, const Container & container ) if ( refresh_raw_metadata( zypper, repo, false ) || build_cache( zypper, repo, false ) ) { WAR << "Skipping repository '" << repo.alias() << "' because of the above error." << endl; - zypper.out().info( str::Format(_("Skipping repository '%s' because of the above error.")) % repo.asUserString(), - Out::QUIET ); + zypper.out().warning( str::Format(_("Skipping repository '%s' because of the above error.")) % repo.asUserString(), + Out::QUIET ); it->setEnabled( false ); contentcheck = false; + ++skip_count; } } // non-root user @@ -798,6 +800,7 @@ void do_init_repos( Zypper & zypper, const Container & container ) it->setEnabled( false ); contentcheck = false; + ++skip_count; } } // non-root user @@ -818,7 +821,8 @@ void do_init_repos( Zypper & zypper, const Container & container ) it->setEnabled( false ); contentcheck = false; - } + ++skip_count; + } } } @@ -839,6 +843,17 @@ void do_init_repos( Zypper & zypper, const Container & container ) } } } + + if ( skip_count ) + { + zypper.out().error(_("Some of the repositories have not been refreshed because of an error.") ); + // TODO: A user abort during repo refresh as well as unavailable metadata + // should probably lead to ZYPPER_EXIT_ERR_ZYPP right here. Ignored refresh + // errors may continue. For now at least remember the refresh error to prevent + // a 0 exit code after the action completed. (bsc#961719, bsc#961724, et.al.) + // zypper.setExitCode( ZYPPER_EXIT_ERR_ZYPP ); + zypper.setRefreshCode( ZYPPER_EXIT_ERR_ZYPP ); + } } // ----------------------------------------------------------------------------