summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-06-30 21:33:42 +0000
committerZac Medico <zmedico@gentoo.org>2009-06-30 21:33:42 +0000
commitf2d79bd71046d1b5b9a9c949c667739159ab5c98 (patch)
tree4d872afadd1e984371a0a3ce58fa67ba156b7d8d
parentd7f6174284a3d97613c2f5b8cee48fccfd22dcf8 (diff)
downloadportage-f2d79bd71046d1b5b9a9c949c667739159ab5c98.tar.gz
portage-f2d79bd71046d1b5b9a9c949c667739159ab5c98.tar.bz2
portage-f2d79bd71046d1b5b9a9c949c667739159ab5c98.zip
Bug #275945 - Add a new --avoid-update which tries to avoid updating packages
which possible. Thanks to Sebastian Mingramm (few) <s.mingramm@gmx.de> for this patch. svn path=/main/trunk/; revision=13745
-rw-r--r--man/emerge.112
-rw-r--r--pym/_emerge/depgraph.py5
-rw-r--r--pym/_emerge/help.py11
-rw-r--r--pym/_emerge/main.py6
4 files changed, 34 insertions, 0 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index df054c9e9..a1dbcde73 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -90,6 +90,15 @@ option if you want to install a tbz2\fR. The packages are added
to the \fBworld\fR file at the end, so that they are considered for
later updating.
.TP
+.BR "\-\-avoid\-update "
+Tries to prevent package updates. This may not always be
+possible since new packages or new dependencies due to USE
+flag changes may require a newer version of an installed
+package. Furthermore, this option may lead to slot conflicts
+(Multiple package instances within a single package slot
+have been pulled into the dependency graph). It is not
+possible to use this option in such a case.
+.TP
.BR "\-\-clean " (\fB\-c\fR)
Cleans up the system by examining the installed packages and removing older
packages. This is accomplished by looking at each installed package and separating
@@ -364,6 +373,9 @@ A USE flag was turned off for a package.
USE flags may be toggled by your profile as well as your USE and package.use
settings.
+
+\fB\-\-avoid\-update\fR may prevent updates of installed packages without
+use flag changes. Note that \fB\-\-avoid-\update\fR may lead to slot conflicts.
.TP
.BR "\-\-noconfmem"
Causes portage to disregard merge records indicating that a config file
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 25e385521..de097c419 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2091,6 +2091,11 @@ class depgraph(object):
break
if len(matched_packages) > 1:
+ if "--avoid-update" in self.myopts:
+ for pkg in matched_packages:
+ if pkg.installed:
+ return pkg, existing_node
+
bestmatch = portage.best(
[pkg.cpv for pkg in matched_packages])
matched_packages = [pkg for pkg in matched_packages \
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index 950692136..1f4b5201e 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -235,6 +235,17 @@ def help(myaction,myopts,havecolor=1):
print " to the prompt, so an accidental press of the \"Enter\" key at any"
print " time prior to the prompt will be interpreted as a choice!"
print
+ print " "+green("--avoid-update")
+ desc = "Tries to prevent package updates. This may not always be" + \
+ " possible since new packages or new dependencies due to USE" + \
+ " flag changes may require a newer version of an installed" + \
+ " package. Furthermore, this option may lead to slot conflicts" + \
+ " (Multiple package instances within a single package slot" + \
+ " have been pulled into the dependency graph). It is not" + \
+ " possible to use this option in such a case."
+ for line in wrap(desc, desc_width):
+ print desc_indent + line
+ print
print " "+green("--buildpkg")+" ("+green("-b")+" short option)"
desc = "Tells emerge to build binary packages for all ebuilds processed in" + \
" addition to actually merging the packages. Useful for maintainers" + \
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index f73bc6db4..087493c4d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -65,6 +65,7 @@ options=[
"--searchdesc", "--selective",
"--skipfirst",
"--tree",
+"--avoid-update",
"--update",
"--usepkg", "--usepkgonly",
"--verbose",
@@ -1060,6 +1061,11 @@ def emerge_main():
noiselevel=-1)
return 1
+ if "--avoid-update" in myopts and "--update" in myopts:
+ writemsg("!!! conflicting options given: " + \
+ "--update and --avoid-update\n", noiselevel=-1)
+ return 1
+
if settings.get("PORTAGE_DEBUG", "") == "1":
spinner.update = spinner.update_quiet
portage.debug=1