From 9d51b8934c6205dc32883e3220b72ef1cffa0192 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 20 Jun 2008 11:29:14 +0000 Subject: [PATCH] Merged from trunk 10729:10735 | 10730 | Make emerge path search for multiple owners of directories. | | zmedico | This makes it possible to use `emerge /lib/modules` as a | | | decent substitute for module-rebuild. | | 10731 | Fix typo. | | zmedico | | | 10732 | Document the new emerge feature. | | zmedico | | | 10733 | update release notes/news | | genone | | | 10734 | revert accidential commit | | genone | | | 10735 | reenable warning about missing repository names | | genone | | svn path=/main/branches/prefix/; revision=10738 --- NEWS | 23 ++++++++++--- RELEASE-NOTES | 20 +++--------- man/emerge.1 | 8 ++++- pym/_emerge/__init__.py | 72 +++++++++++++++++++++++++++++------------ pym/_emerge/help.py | 2 +- 5 files changed, 82 insertions(+), 43 deletions(-) diff --git a/NEWS b/NEWS index 520f2c732..09da35b30 100644 --- a/NEWS +++ b/NEWS @@ -3,21 +3,28 @@ News (mainly features/major bug fixes) portage-2.2 ------------- +* It is now possible to use `emerge ` to reinstall the package that + installed a particular file. Package contents entries are indexed to + improve performance. A command such as `emerge /lib/modules` can serve + as a decent substitute for module-rebuild. * Namespace sanitizing: move all portage related code into portage.* namespace, rename portage_foo modules to portage.foo (but keep symlinks for compability) * Add license visibility filtering (GLEP 23) -* Enable "echo" and "save_summary" elog modules by default -* Fix -* handling in package.keywords to work as intended (reset the accepted - keywords list), also see RELEASE-NOTES. * Experimental support for preserving old library files on package upgrades based on FEATURES=preserve-libs -* Make elog functionality available to python code * Add support for news items (GLEP 42) * Add support for generic package sets (also see RELEASE-NOTES) portage-2.1.5 -================================== +------------- +* Blockers are now resolved automatically in many more cases + than before. When it's safe, blocked packages are uninstalled + automatically so that users are no longer inconvenienced with the + task. Automatically uninstalled packages are displayed in the merge + list, marked "uninstall" and highlighted in red. With the --tree + option enabled, it's possible to see which package(s) caused other + ones to be automatically uninstalled. * The dependency resolver now has a feedback mechanism that helps make atom selections more consistent with previous selections that have been added to the graph. This solves some common cases of bug #1343. @@ -28,6 +35,8 @@ portage-2.1.4 * After the initial setup phase, the original ebuild and eclasses are no longer needed because the same ebuild environment is reused for the entire lifecycle of the package, including uninstallation. +* The emerge --search action supports searching of both installed and binary packages + The --usepkg and --usepkgonly options control which repositories are searched. portage-2.1.3 ------------- @@ -44,6 +53,10 @@ portage-2.1.3 * PDEPEND is now installed as soon as possible so that it behaves more like RDEPEND. This makes PDEPEND more useful for breaking the dependency cycles that are sometimes triggered by RDEPEND and DEPEND. +* Enable "echo" and "save_summary" elog modules by default +* Fix -* handling in package.keywords to work as intended (reset the accepted + keywords list), also see RELEASE-NOTES. +* Make elog functionality available to python code portage-2.1.2 ------------- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6b15a2f72..a7ff16ad8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -22,15 +22,13 @@ portage-2.2 used without the prefix) - they may currently only include simple and versioned atoms or other sets, use conditionals or any-of constructs aren't possible yet - - emerge makes no difference atm whether you pass a setname or all atoms contained - in the set to it, this means that without options packages will be remerged if - already installed, or in the case of --unmerge all atoms in a set will be - unmerged even if they are depended upon by other packages. This may change in - future versions. - sets can be referenced either in other file-based sets or as argument to emerge, but not in ebuilds, config files or other tools at this time. + - packages won't be unmerged if they are referenced by an installed package + set (with the exception of the world set, and installed being determined + by the world_sets file). * "world" does no longer include "system" unconditionally, but you can add - "@system" to the worldfile to restore the old state. + "@system" to the world_sets file to restore the old state. portage-2.1.5 ================================== @@ -44,14 +42,6 @@ portage-2.1.5 variable to be accessed by pkg_postinst when it is called. Bug #226505 tracks all issues related to this phase execution order change. -* Blockers are now resolved automatically in many more cases - than before. When it's safe, blocked packages are uninstalled - automatically so that users are no longer inconvenienced with the - task. Automatically uninstalled packages are displayed in the merge - list, marked "uninstall" and highlighted in red. With the --tree - option enabled, it's possible to see which package(s) caused other - ones to be automatically uninstalled. - * The metadata-transfer feature is now disabled by default. This disables the "Updating Portage cache" routine that used to run at the tail end of each `emerge --sync` operation. If you use something like the sqlite module and @@ -94,8 +84,6 @@ portage-2.1.4 * There is no need to have a complete portage tree available when installing binary packages or uninstalling packages, but a warning message will still be displayed if it appears that a valid profile is not available. -* The emerge --search action supports searching of both installed and binary packages - The --usepkg and --usepkgonly options control which repositories are searched. portage-2.1.3 ================================== diff --git a/man/emerge.1 b/man/emerge.1 index b83b7ecbb..4f163701c 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -4,7 +4,7 @@ emerge \- Command\-line interface to the Portage system .SH "SYNOPSIS" .TP .BR emerge -[\fIoptions\fR] [\fIaction\fR] [\fIebuild\fR | \fItbz2file\fR | \fI@set\fR | \fIatom\fR] ... +[\fIoptions\fR] [\fIaction\fR] [\fIebuild\fR | \fItbz2file\fR | \fIfile\fR | \fI@set\fR | \fIatom\fR] ... .TP .BR emerge \fB\-\-sync\fR | \fB\-\-version\fR @@ -50,6 +50,12 @@ A \fItbz2file\fR must be a valid .tbz2 created with \fBebuild \-.ebuild package\fR or \fBemerge \-\-buildpkg [category/]\fR or \fBquickpkg /var/db/pkg//\fR. .TP +.BR file +A \fIfile\fR must be a file or directory that has been installed by one or +more packages. For directories that are owned by multiple packages, all +owning packages to be selected. See the portageq(1) owners command if you +would like to query the owners of one or more files or directories. +.TP .BR set A \fIset\fR is a convenient shorthand for a large group of packages. Two sets are currently always available: \fBsystem\fR diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 6c5c34162..7a1498671 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2576,6 +2576,7 @@ class depgraph(object): pkgsettings = self.pkgsettings[myroot] args = [] onlydeps = "--onlydeps" in self.myopts + lookup_owners = [] for x in myfiles: ext = os.path.splitext(x)[1] if ext==".tbz2": @@ -2648,26 +2649,9 @@ class depgraph(object): portage.writemsg(("\n\n!!! '%s' does not start with" + \ " $ROOT.\n") % x, noiselevel=-1) return 0, [] - relative_path = x[len(myroot):] - owner_cpv = None - for pkg, relative_path in \ - real_vardb._owners.iter_owners([relative_path]): - owner_cpv = pkg.mycpv - break - - if owner_cpv is None: - portage.writemsg(("\n\n!!! '%s' is not claimed " + \ - "by any package.\n") % x, noiselevel=-1) - return 0, [] - slot = vardb.aux_get(owner_cpv, ["SLOT"])[0] - if not slot: - # portage now masks packages with missing slot, but it's - # possible that one was installed by an older version - atom = portage.cpv_getkey(owner_cpv) - else: - atom = "%s:%s" % (portage.cpv_getkey(owner_cpv), slot) - args.append(AtomArg(arg=atom, atom=atom, - root_config=root_config)) + # Queue these up since it's most efficient to handle + # multiple files in a single iter_owners() call. + lookup_owners.append(x) else: if x in ("system", "world"): x = SETPREFIX + x @@ -2741,6 +2725,40 @@ class depgraph(object): args.append(AtomArg(arg=x, atom=atom, root_config=root_config)) + if lookup_owners: + relative_paths = [] + search_for_multiple = False + if len(lookup_owners) > 1: + search_for_multiple = True + + for x in lookup_owners: + if not search_for_multiple and os.path.isdir(x): + search_for_multiple = True + relative_paths.append(x[len(myroot):]) + + owners = set() + for pkg, relative_path in \ + real_vardb._owners.iter_owners(relative_paths): + owners.add(pkg.mycpv) + if not search_for_multiple: + break + + if not owners: + portage.writemsg(("\n\n!!! '%s' is not claimed " + \ + "by any package.\n") % lookup_owners[0], noiselevel=-1) + return 0, [] + + for cpv in owners: + slot = vardb.aux_get(cpv, ["SLOT"])[0] + if not slot: + # portage now masks packages with missing slot, but it's + # possible that one was installed by an older version + atom = portage.cpv_getkey(cpv) + else: + atom = "%s:%s" % (portage.cpv_getkey(cpv), slot) + args.append(AtomArg(arg=atom, atom=atom, + root_config=root_config)) + if "--update" in self.myopts: # Enable greedy SLOT atoms for atoms given as arguments. # This is currently disabled for sets since greedy SLOT @@ -9144,6 +9162,20 @@ def emerge_main(): if "--quiet" not in myopts: portage.deprecated_profile_check() + for root in trees: + if "porttree" in trees[root]: + db = trees[root]["porttree"].dbapi + paths = (db.mysettings["PORTDIR"]+" "+db.mysettings["PORTDIR_OVERLAY"]).split() + repos = db.getRepositories() + for r in repos: + p = db.getRepositoryPath(r) + try: + paths.remove(p) + except ValueError: + pass + for p in paths: + writemsg("WARNING: repository at %s is missing a repo_name entry\n" % p) + eclasses_overridden = {} for mytrees in trees.itervalues(): diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 1996a61ab..1ec7e96bc 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -9,7 +9,7 @@ from portage.output import bold, turquoise, green def shorthelp(): print bold("emerge:")+" the other white meat (command-line interface to the Portage system)" print bold("Usage:") - print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("dependency")+" ] [ ... ]" + print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("@set")+" | "+turquoise("atom")+" ] [ ... ]" print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >" print " "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >" print " "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]" -- 2.26.2