Mailinglist Archive: yast-commit (595 mails)

< Previous Next >
[yast-commit] r54241 - in /trunk/yast2: library/packages/src/PackageSystem.ycp package/yast2.changes
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Wed, 17 Dec 2008 14:23:43 -0000
  • Message-id: <20081217142344.3F1D2F4D01@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Wed Dec 17 15:23:43 2008
New Revision: 54241

URL: http://svn.opensuse.org/viewcvs/yast?rev=54241&view=rev
Log:
- PackageSystem::DoInstallAndRemove() - check the system and offer
to fix it when there are inconsistencies, do not commit the
changes if there are unresolved dependencies (bnc#439373)

Modified:
trunk/yast2/library/packages/src/PackageSystem.ycp
trunk/yast2/package/yast2.changes

Modified: trunk/yast2/library/packages/src/PackageSystem.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackageSystem.ycp?rev=54241&r1=54240&r2=54241&view=diff
==============================================================================
--- trunk/yast2/library/packages/src/PackageSystem.ycp (original)
+++ trunk/yast2/library/packages/src/PackageSystem.ycp Wed Dec 17 15:23:43 2008
@@ -102,7 +102,31 @@
return DoInstallAndRemove([], packages);
}

-global boolean DoInstallAndRemove(list<string> toinstall, list<string>
toremove) {
+boolean SelectPackages(list<string> toinstall, list<string> toremove)
+{
+ boolean ok = true;
+
+ foreach (string p, toinstall, {
+ if(ok == true)
+ if(Pkg::PkgInstall(p) != true) {
+ y2error("Package %1 install failed: %2", p, Pkg::LastError());
+ ok = false;
+ }
+ });
+ if(ok != true) return false;
+
+ foreach (string p, toremove, {
+ if(ok == true)
+ if(Pkg::PkgDelete(p) != true) {
+ y2error("Package %1 delete failed: %2", p, Pkg::LastError());
+ ok = false;
+ }
+ });
+
+ return ok;
+}
+
+boolean DoInstallAndRemoveInt(list<string> toinstall, list<string> toremove) {
y2debug ("toinstall: %1, toremove: %2", toinstall, toremove);
if (!PackageLock::Check ())
{
@@ -115,6 +139,8 @@

import "Label";
import "Popup";
+ import "PackagesUI";
+
// licenses: #35250
map<string, string> licenses = Pkg::PkgGetLicensesToConfirm (toinstall);
if (size (licenses) > 0)
@@ -167,45 +193,121 @@
last_op_canceled = false;
}

+
// check if the database is consistent before packages are added
boolean packages_consistent = Pkg::PkgSolveCheckTargetOnly();
- // reset the solver - disable the fixsystem solver mode (bnc#439373)
- Pkg::SetSolverFlags($["reset":true]);
- // reset the preselected transactions
- Pkg::PkgApplReset();
+ boolean transact = Pkg::IsAnyResolvable(`any, `to_install) ||
Pkg::IsAnyResolvable(`any, `to_remove);

- foreach (string p, toinstall, {
- if(ok == true)
- if(Pkg::PkgInstall(p) != true) {
- y2error("Package %1 install failed: %2", p, Pkg::LastError());
- ok = false;
+ y2internal("Target solved: %1, something to transact: %2",
packages_consistent, transact);
+
+ if (!SelectPackages(toinstall, toremove))
+ {
+ return false;
+ }
+
+ boolean packager_displayed = false;
+
+ // display an error message and advice to manually fix the system
+ if (!packages_consistent || transact)
+ {
+ y2warning("The current system is not consistent");
+
+ string message = _("The current system is not consistent,
+some packages have unresolved dependencies.");
+
+ if (!packages_consistent)
+ {
+ message = message + "\n\n" + _("Automatic resolving failed, manual
dependency resolving is needed.");
+ }
+
+ if (transact)
+ {
+ message = message + "\n\n" + _("Yast has automatically added or
removed some packages,
+check the changes scheduled to fix the system
+in the package manager.");
+ }
+
+
+ message = message + "\n\n" + _("Start the package manager and fix the
problems
+or skip fixing and install the already confirmed packages only?");
+
+ symbol fixsystem = Popup::AnyQuestion3(Label::WarningMsg(), message,
Label::ContinueButton(),
+ Label::SkipButton(), Label::AbortButton(), `focus_yes);
+
+ y2milestone("Fixsystem answer: %1", fixsystem);
+
+ // the 3rd button ("Abort" label in this case)
+ if (fixsystem == `retry)
+ {
+ y2milestone("Aborting package installation");
+ // do not install anything, abort
+ return false;
+ }
+ else if (fixsystem == `yes)
+ {
+ // disable repomanagement during installation
+ boolean repomgmt = !Mode::installation();
+ // start the package selector
+ symbol ret = PackagesUI::RunPackageSelector($[ "enable_repo_mgr" :
repomgmt, "mode" : `summaryMode ]);
+
+ y2internal("Package selector returned: %1", ret);
+
+ // do not install anything
+ if (ret == `cancel || ret == `close)
+ {
+ y2milestone("Aborting package installation");
+ return false;
}
- });
- if(ok != true) return false;

- foreach (string p, toremove, {
- if(ok == true)
- if(Pkg::PkgDelete(p) != true) {
- y2error("Package %1 delete failed: %2", p, Pkg::LastError());
- ok = false;
+ packager_displayed = true;
+ }
+ // `no = do not fix the system, install the required packages only
+ // and ignore the inconsistencies
+ else if (fixsystem == `no)
+ {
+ y2milestone("Resetting the preselected packages");
+ // reset the solver - disable the fixsystem solver mode (bnc#439373)
+ Pkg::SetSolverFlags($["reset":true]);
+ // reset the preselected transactions to fix the problems
+ Pkg::PkgApplReset();
+
+ // reselect the packages again after the reset
+ if (!SelectPackages(toinstall, toremove))
+ {
+ return false;
}
- });
- if(ok != true) return false;
+ }
+ else
+ {
+ y2internal("Unknown result %1, aborting", fixsystem);
+ return false;
+ }
+ }

- // remember the current flags
- map<string,any> solver_flags = Pkg::GetSolverFlags();
- // do not install recommended packages for already installed packages
(bnc#445476)
- Pkg::SetSolverFlags($["ignoreAlreadyRecommended":true]);
boolean solved = Pkg::PkgSolve(false);
- // restore the original flags
- Pkg::SetSolverFlags(solver_flags);

- if(solved != true) {
+ if(solved != true)
+ {
y2error("Package solve failed: %1", Pkg::LastError());
- if (packages_consistent)
+
+ // error message, after pressing [OK] the package manager is displayed
+ Report::Error(_("There are unresolved dependencies which need
+to be solved manually in the package manager."));
+
+ // disable repomanagement during installation
+ boolean repomgmt = !Mode::installation();
+ // start the package selector
+ symbol ret = PackagesUI::RunPackageSelector($[ "enable_repo_mgr" :
repomgmt, "mode" : `summaryMode ]);
+
+ y2internal("Package selector returned: %1", ret);
+
+ // do not fix the system
+ if (ret == `cancel || ret == `close)
{
return false;
}
+
+ packager_displayed = true;
}

// is a package or a patch selected for installation?
@@ -246,9 +348,34 @@
SCR::RegisterNewAgents();
}

+ // check if the required packages have been installed
+ // (user could deselect or uninstall them in the packager widget)
+ if (packager_displayed && !InstalledAll(toinstall))
+ {
+ y2error("Required packages have not been installed");
+ return false;
+ }
+
return true;
}

+global boolean DoInstallAndRemove(list<string> toinstall, list<string>
toremove)
+{
+ // remember the current solver flags
+ map<string,any> solver_flags = Pkg::GetSolverFlags();
+
+ // do not install recommended packages for already installed packages
(bnc#445476)
+ Pkg::SetSolverFlags($["ignoreAlreadyRecommended":true]);
+
+ boolean ret = DoInstallAndRemoveInt(toinstall, toremove);
+
+ // restore the original flags
+ Pkg::SetSolverFlags(solver_flags);
+
+ return ret;
+}
+
+
/**
* Is a package available?
* @return true if yes (nil = no package source available)

Modified: trunk/yast2/package/yast2.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=54241&r1=54240&r2=54241&view=diff
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Wed Dec 17 15:23:43 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Dec 17 14:35:22 CET 2008 - lslezak@xxxxxxx
+
+- PackageSystem::DoInstallAndRemove() - check the system and offer
+ to fix it when there are inconsistencies, do not commit the
+ changes if there are unresolved dependencies (bnc#439373)
+
+-------------------------------------------------------------------
Wed Dec 17 14:16:19 CET 2008 - locilka@xxxxxxx

- Escaping parameters when calling /usr/bin/genDDNSkey

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages