Author: jkupec
Date: Wed Jun 20 16:54:17 2007
New Revision: 5815
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5815&view=rev
Log:
merged bugfixes from trunk
Modified:
branches/SuSE-Linux-10_2-Branch/zypper/ (props changed)
branches/SuSE-Linux-10_2-Branch/zypper/doc/zypper.8
branches/SuSE-Linux-10_2-Branch/zypper/package/zypper.changes
branches/SuSE-Linux-10_2-Branch/zypper/src/Makefile.am
branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc
branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.h
branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc
branches/SuSE-Linux-10_2-Branch/zypper/zypper.spec.in
Modified: branches/SuSE-Linux-10_2-Branch/zypper/doc/zypper.8
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/doc/zypper.8?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/doc/zypper.8 (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/doc/zypper.8 Wed Jun 20 16:54:17 2007
@@ -20,7 +20,7 @@
.TP
.B shell (sh)
Starts a shell for entering multiple commands in one session.
-(NEW, beware of bugs!)
+End it by "exit", "quit", or Ctrl-D.
.LP
.B Package Management Commands
@@ -250,6 +250,9 @@
.TP
.B /var/lib/zypp/cache
Directory for storing metadata contained in installation sources.
+.TP
+.B ~/.zypper_history
+Command history for the shell.
.SH "EXIT CODES"
.LP
Modified: branches/SuSE-Linux-10_2-Branch/zypper/package/zypper.changes
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/package/zypper.changes?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/package/zypper.changes (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/package/zypper.changes Wed Jun 20 16:54:17 2007
@@ -1,4 +1,39 @@
-------------------------------------------------------------------
+Wed Jun 20 16:41:57 CEST 2007 - jkupec@suse.cz
+
+- Merged revisions 4714,4720-4721,4724-4727,4730-4754,4758-4797,4799-4804,4806-4810,4812-4837,4839-4846,4848-4849,4851,4854-4940,4945-4953,4955-4957,4961-4963,4965-4967,4969-4971,4974-5028,5030-5060,5062-5078,5080-5308,5310-5450,5452,5454-5666,5671-5697,5699-5710,5712-5714,5716-5732,5734-5737,5740,5742-5748,5750-5757,5761-5765,5767-5768,5770-5780,5783,5786-5787,5789-5791,5793,5795-5797,5799,5801,5803,5805-5813 via svnmerge from
+http://svn.opensuse.org/svn/zypp/trunk/zypper
+
+........
+ r4969 | mvidner | 2007-02-05 17:03:44 +0100 (Mon, 05 Feb 2007) | 3 lines
+
+ Shell: added command line editing with history (#232374);
+ exit on EOF (#230211, #235709).
+........
+ r4977 | mvidner | 2007-02-05 18:01:52 +0100 (Mon, 05 Feb 2007) | 2 lines
+
+ BuildRequires: readline-devel
+........
+ r5003 | mvidner | 2007-02-12 13:36:47 +0100 (Mon, 12 Feb 2007) | 2 lines
+
+ Do not allow to commit with unresolved dependency problems (#242736).
+........
+ r5016 | mvidner | 2007-02-13 10:53:33 +0100 (Tue, 13 Feb 2007) | 2 lines
+
+ Echo a newline after the user enters EOF.
+........
+ r5020 | mvidner | 2007-02-13 12:59:29 +0100 (Tue, 13 Feb 2007) | 2 lines
+
+ Added interactive resolution of resolver problems (#242736).
+........
+ r5021 | mvidner | 2007-02-13 14:12:46 +0100 (Tue, 13 Feb 2007) | 2 lines
+
+ Shrunk zypp-checkpatches (#224886).
+........
+
+- r5814
+
+-------------------------------------------------------------------
Mon Apr 2 10:44:20 CEST 2007 - jkupec@suse.cz
- Translation update (final translation round)
Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/Makefile.am?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/src/Makefile.am (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/src/Makefile.am Wed Jun 20 16:54:17 2007
@@ -61,10 +61,10 @@
zypper-getopt.h \
zypper-getopt.cc \
zmart.h
-zypper_LDADD = $(ZYPP_LIBS) -lboost_regex
+zypper_LDADD = $(ZYPP_LIBS) -lboost_regex -lreadline
if BUILD_CHECKPATCHES
-zypp_checkpatches_SOURCES = zypp-checkpatches.cc zmart-sources.cc \
+zypp_checkpatches_SOURCES = zypp-checkpatches.cc \
zypper-tabulator.h \
zypper-tabulator.cc \
zmart-updates.cc \
Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc Wed Jun 20 16:54:17 2007
@@ -217,7 +217,75 @@
}
}
-void show_problems () {
+// debugging
+static
+ostream& operator << (ostream & stm, ios::iostate state)
+{
+ return stm << (state & ifstream::eofbit ? "Eof ": "")
+ << (state & ifstream::badbit ? "Bad ": "")
+ << (state & ifstream::failbit ? "Fail ": "")
+ << (state == 0 ? "Good ": "");
+}
+
+//! @return true to retry solving now, false to cancel, indeterminate to continue
+tribool show_problem (bool non_interactive, const ResolverProblem & prob, ProblemSolutionList & todo)
+{
+ ostream& stm = cerr;
+ string det;
+ stm << _("Problem: ") << prob.description () << endl;
+ det = prob.details ();
+ if (!det.empty ())
+ stm << " " << det << endl;
+
+ int n;
+ ProblemSolutionList solutions = prob.solutions ();
+ ProblemSolutionList::iterator
+ bb = solutions.begin (),
+ ee = solutions.end (),
+ ii;
+ for (n = 1, ii = bb; ii != ee; ++n, ++ii) {
+ stm << format (_(" Solution %s: ")) % n << (*ii)->description () << endl;
+ det = (*ii)->details ();
+ if (!det.empty ())
+ stm << " " << det << endl;
+ }
+
+ if (non_interactive)
+ return false;
+
+ int reply;
+ do {
+ // input prompt
+ cerr << _("number, (r)etry or (c)ancel> ") << flush;
+ string reply_s = str::getline (cin, zypp::str::TRIM);
+
+ if (! cin.good()) {
+ cerr_v << "cin: " << cin.rdstate() << endl;
+ return false;
+ }
+ // translators: corresponds to (r)etry
+ if (reply_s == _("r"))
+ return true;
+ // translators: corresponds to (c)ancel
+ else if (reply_s == _("c"))
+ return false;
+
+ str::strtonum (reply_s, reply);
+ } while (reply <= 0 || reply >= n);
+
+ cerr << format (_("Applying solution %s")) % reply << endl;
+ ProblemSolutionList::iterator reply_i = solutions.begin ();
+ advance (reply_i, reply - 1);
+ todo.push_back (*reply_i);
+
+ tribool go_on = indeterminate; // continue with next problem
+ return go_on;
+}
+
+// return true to retry solving, false to cancel transaction
+bool show_problems (bool non_interactive)
+{
+ bool retry = true;
ostream& stm = cerr;
Resolver_Ptr resolver = zypp::getZYpp()->resolver();
ResolverProblemList rproblems = resolver->problems ();
@@ -225,23 +293,26 @@
b = rproblems.begin (),
e = rproblems.end (),
i;
- if (b != e) {
- cerr << _("Problems:") << endl;
+ ProblemSolutionList todo;
+ bool no_problem = b == e;
+ if (!no_problem) {
+ stm << format (_("%s Problems:")) % rproblems.size() << endl;
}
for (i = b; i != e; ++i) {
- stm << _("PROB ") << (*i)->description () << endl;
- stm << ": " << (*i)->details () << endl;
-
- ProblemSolutionList solutions = (*i)->solutions ();
- ProblemSolutionList::iterator
- bb = solutions.begin (),
- ee = solutions.end (),
- ii;
- for (ii = bb; ii != ee; ++ii) {
- stm << _(" SOL ") << (*ii)->description () << endl;
- stm << " : " << (*ii)->details () << endl;
+ stm << _("Problem: ") << (*i)->description () << endl;
+ }
+ for (i = b; i != e; ++i) {
+ stm << endl;
+ tribool stopnow = show_problem (non_interactive, *(*i), todo);
+ if (! indeterminate (stopnow)) {
+ retry = stopnow == true;
+ break;
}
}
+
+ if (retry)
+ resolver->applySolutions (todo);
+ return retry;
}
/**
@@ -367,11 +438,11 @@
dump_pool ();
}
-void resolve()
+bool resolve()
{
establish ();
cerr_v << _("Resolving dependencies...") << endl;
- God->resolver()->resolvePool();
+ return God->resolver()->resolvePool();
}
//! are there applicable patches?
@@ -695,9 +766,17 @@
* ZYPPER_EXIT_INF_RESTART_NEEDED - if one of patches to be installed needs package manager restart
*/
int solve_and_commit (bool non_interactive) {
- resolve();
-
- show_problems ();
+ while (true) {
+ bool success = resolve();
+ if (success)
+ break;
+
+ success = show_problems (non_interactive);
+ if (! success) {
+ // TODO cancel transaction?
+ return ZYPPER_EXIT_ERR_ZYPP; // #242736
+ }
+ }
// returns -1, 0, ZYPPER_EXIT_INF_REBOOT_NEEDED, or ZYPPER_EXIT_INF_RESTART_NEEDED
Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.h?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.h (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.h Wed Jun 20 16:54:17 2007
@@ -23,7 +23,6 @@
const std::string &name );
void mark_for_uninstall( const zypp::ResObject::Kind &kind,
const std::string &name );
-void show_problems();
int show_summary();
std::string calculate_token();
//! load all resolvables that the user wants
@@ -31,7 +30,7 @@
void load_target();
void load_sources();
void establish ();
-void resolve();
+bool resolve();
void dump_pool ();
void show_patches();
void patch_check();
Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc?rev=5815&r1=5814&r2=5815&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc (original)
+++ branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc Wed Jun 20 16:54:17 2007
@@ -15,6 +15,8 @@
#include <iterator>
#include