From 33c39144a3d3a14f30cb7e6b2f6e1eb2ff6d64f7 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 22 Dec 2008 20:26:45 +0000 Subject: [PATCH] Merged from trunk -r12256:12275 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit | 12257 | Inside display_preserved_libs(), filter out consumers that | | zmedico | belong to the same package as the provider only if those | | | consumers are also preserved. | | 12258 | Fix DependencyArg.__str__() to ensure that str type is | | zmedico | always returned. | | 12259 | Bug #251616 - Inside _check_build_log(), remove unnecessary | | zmedico | .* patterns from regular expressions. These patterns trigger | | | extreme performance issues when matched against extremely | | | large lines such as those produced by dev-util/bzr test | | | suite when it uses \r to rewrite the same line thousands of | | | times. | | 12260 | Bug #251591 - Adjust the InheritAutotools pattern to treat | | zmedico | more things similar to whitespace. Now it recognizes escaped | | | newlines, || operators, and && operators. | | 12264 | Simplify the InheritAutotools pattern by using \b to match | | zmedico | word boundaries. | | 12265 | Adjust the EbuildNestedDie pattern so that it only matches | | zmedico | when ( is surrounded by whitespace. This filters out false | | | positives triggered by sed expressions in | | | net-analyzer/amap-5.2-r1 and | | | media-libs/libsndfile-1.0.17-r1. Thanks to Diego Pettenò | | | for reporting. | | 12270 | Remove the TaskScheduler.run() method since the constructor | | zmedico | replaces it with the QueueScheduler.run() method. | | 12271 | Update --depclean 'unsatisfied deps' message to recommend | | zmedico | the same emerge update command that's recommended earlier. | | | Thanks to Jeremy Olexa for reporting. | | 12272 | Fix --clean so that it considers all packages within a given | | zmedico | slot when it's deciding which packages to keep, rather than | | | just considering the ones matched by the given atom. Any | | | packages not matching the given atom are protected from | | | being unmerged. Thanks to Mart Raudsepp for | | | reporting. | | 12273 | Add support for the new DEFINED_PHASES metadata key which is | | zmedico | automatically generated from the set of phase functions that | | | are defined by the ebuild and any eclasses it may have | | | inherited. | | 12274 | Fix DEFINED_PHASES code to check for pkg_config and pkg_info | | zmedico | functions. | | 12275 | Remove code from unused config.load_infodir() method and | | zmedico | issue a deprecation warning if it's called. | svn path=/main/branches/prefix/; revision=12276 --- bin/ebuild.sh | 28 +++++++++++- pym/_emerge/__init__.py | 35 ++++++++++----- pym/portage/__init__.py | 78 +++------------------------------- pym/portage/cache/flat_list.py | 2 +- pym/portage/cache/metadata.py | 2 +- pym/repoman/checks.py | 6 +-- 6 files changed, 63 insertions(+), 88 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index e86f2f56a..2f0c0e9dd 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -2067,13 +2067,39 @@ ebuild_main() { auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE DESCRIPTION KEYWORDS INHERITED IUSE CDEPEND PDEPEND PROVIDE EAPI - PROPERTIES UNUSED_06 UNUSED_05 UNUSED_04 + PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04 UNUSED_03 UNUSED_02 UNUSED_01" #the extra $(echo) commands remove newlines unset CDEPEND # PREFIX HACK: ignore prefix, and then respect it again [[ -n ${EAPI/prefix/} ]] || EAPI="${EAPI}${EAPI:+ }0" + local eapi=$EAPI + + # alphabetically ordered by $EBUILD_PHASE value + local valid_phases + case $eapi in + 0|1) + valid_phases="src_compile pkg_config pkg_info src_install + pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm + pkg_setup src_test src_unpack" + ;; + *) + valid_phases="src_compile pkg_config src_configure pkg_info + src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst + src_prepare pkg_prerm pkg_setup src_test src_unpack" + ;; + esac + + DEFINED_PHASES= + for f in $valid_phases ; do + if [[ $(type -t $f) = function ]] ; then + f=${f#pkg_} + DEFINED_PHASES+=" ${f#src_}" + fi + done + [[ -n $DEFINED_PHASES ]] || DEFINED_PHASES=- + if [ -n "${dbkey}" ] ; then > "${dbkey}" for f in ${auxdbkeys} ; do diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 718c68aa2..e1d5a7010 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -3837,7 +3837,7 @@ class DependencyArg(object): self.root_config = root_config def __str__(self): - return self.arg + return str(self.arg) class AtomArg(DependencyArg): def __init__(self, atom=None, **kwargs): @@ -9141,9 +9141,6 @@ class TaskScheduler(object): def add(self, task): self._queue.add(task) - def run(self): - self._scheduler.schedule() - class JobStatusDisplay(object): _bound_properties = ("curval", "failed", "running") @@ -11109,7 +11106,14 @@ def unmerge(root_config, myopts, unmerge_action, if myslot not in slotmap: slotmap[myslot] = {} slotmap[myslot][localtree.dbapi.cpv_counter(mypkg)] = mypkg - + + for mypkg in vartree.dbapi.cp_list( + portage.dep_getkey(mymatch[0])): + myslot = vartree.getslot(mypkg) + if myslot not in slotmap: + slotmap[myslot] = {} + slotmap[myslot][vartree.dbapi.cpv_counter(mypkg)] = mypkg + for myslot in slotmap: counterkeys = slotmap[myslot].keys() if not counterkeys: @@ -11118,6 +11122,14 @@ def unmerge(root_config, myopts, unmerge_action, pkgmap[mykey]["protected"].add( slotmap[myslot][counterkeys[-1]]) del counterkeys[-1] + + for counter in counterkeys[:]: + mypkg = slotmap[myslot][counter] + if mypkg not in mymatch: + counterkeys.remove(counter) + pkgmap[mykey]["protected"].add( + slotmap[myslot][counter]) + #be pretty and get them in order of merge: for ckey in counterkeys: mypkg = slotmap[myslot][ckey] @@ -11542,15 +11554,16 @@ def display_preserved_libs(vardbapi): else: search_for_owners = set() for cpv in plibdata: - pkg_dblink = vardbapi._dblink(cpv) + internal_plib_keys = set(linkmap._obj_key(f) \ + for f in plibdata[cpv]) for f in plibdata[cpv]: if f in consumer_map: continue consumers = [] for c in linkmap.findConsumers(f): - # Filter out any consumers that belong - # to the same package as the provider. - if not pkg_dblink.isowner(c, pkg_dblink.myroot): + # Filter out any consumers that are also preserved libs + # belonging to the same package as the provider. + if linkmap._obj_key(c) not in internal_plib_keys: consumers.append(c) consumers.sort() consumer_map[f] = consumers @@ -12877,8 +12890,8 @@ def action_depclean(settings, trees, ldpath_mtimes, msg.append(" %s" % (parent,)) msg.append("") msg.append("Have you forgotten to run " + \ - good("`emerge --update --newuse --deep world`") + " prior to") - msg.append(("%s? It may be necessary to manually " + \ + good("`emerge --update --newuse --deep @system @world`") + " prior") + msg.append(("to %s? It may be necessary to manually " + \ "uninstall packages that no longer") % action) msg.append("exist in the portage tree since " + \ "it may not be possible to satisfy their") diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a796ecab4..816f84ce0 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1881,73 +1881,9 @@ class config(object): self.regenerate(use_cache=use_cache) def load_infodir(self,infodir): - self.modifying() - backup_pkg_metadata = dict(self.configdict["pkg"].iteritems()) - if "pkg" in self.configdict and \ - "CATEGORY" in self.configdict["pkg"]: - self.configdict["pkg"].clear() - self.configdict["pkg"]["CATEGORY"] = \ - backup_pkg_metadata["CATEGORY"] - else: - raise portage.exception.PortageException( - "No pkg setup for settings instance?") - - retval = 0 - found_category_file = False - if os.path.isdir(infodir): - if os.path.exists(infodir+"/environment"): - self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment" - - myre = re.compile('^[A-Z]+$') - null_byte = "\0" - for filename in listdir(infodir,filesonly=1,EmptyOnError=1): - if filename == "FEATURES": - # FEATURES from the build host shouldn't be interpreted as - # FEATURES on the client system. - continue - if filename == "CATEGORY": - found_category_file = True - continue - if myre.match(filename): - try: - file_path = os.path.join(infodir, filename) - mydata = open(file_path).read().strip() - if len(mydata) < 2048 or filename == "USE": - if null_byte in mydata: - writemsg("!!! Null byte found in metadata " + \ - "file: '%s'\n" % file_path, noiselevel=-1) - continue - if filename == "USE": - binpkg_flags = "-* " + mydata - self.configdict["pkg"][filename] = binpkg_flags - self.configdict["env"][filename] = mydata - else: - self.configdict["pkg"][filename] = mydata - self.configdict["env"][filename] = mydata - except (OSError, IOError): - writemsg("!!! Unable to read file: %s\n" % infodir+"/"+filename, - noiselevel=-1) - pass - retval = 1 - - # Missing or corrupt CATEGORY will cause problems for - # doebuild(), which uses it to infer the cpv. We already - # know the category, so there's no need to trust this - # file. Show a warning if the file is missing though, - # because it's required (especially for binary packages). - if not found_category_file: - writemsg("!!! CATEGORY file is missing: %s\n" % \ - os.path.join(infodir, "CATEGORY"), noiselevel=-1) - self.configdict["pkg"].update(backup_pkg_metadata) - retval = 0 - - # Always set known good values for these variables, since - # corruption of these can cause problems: - cat, pf = catsplit(self.mycpv) - self.configdict["pkg"]["CATEGORY"] = cat - self.configdict["pkg"]["PF"] = pf - - return retval + warnings.warn("portage.config.load_infodir() is deprecated", + DeprecationWarning) + return 1 def setcpv(self, mycpv, use_cache=1, mydb=None): """ @@ -4592,10 +4528,10 @@ def _check_build_log(mysettings, out=None): configure_opts_warn = [] configure_opts_warn_re = re.compile( - r'^configure: WARNING: Unrecognized options: .*') - am_maintainer_mode_re = re.compile(r'.*/missing --run .*') + r'^configure: WARNING: Unrecognized options: ') + am_maintainer_mode_re = re.compile(r'/missing --run ') am_maintainer_mode_exclude_re = \ - re.compile(r'.*/missing --run (autoheader|makeinfo)') + re.compile(r'/missing --run (autoheader|makeinfo)') make_jobserver_re = \ re.compile(r'g?make\[\d+\]: warning: jobserver unavailable:') @@ -7162,7 +7098,7 @@ auxdbkeys=[ 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'INHERITED', 'IUSE', 'CDEPEND', 'PDEPEND', 'PROVIDE', 'EAPI', - 'PROPERTIES', 'UNUSED_06', 'UNUSED_05', 'UNUSED_04', + 'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04', 'UNUSED_03', 'UNUSED_02', 'UNUSED_01', ] auxdbkeylen=len(auxdbkeys) diff --git a/pym/portage/cache/flat_list.py b/pym/portage/cache/flat_list.py index 65983393f..413d4d33d 100644 --- a/pym/portage/cache/flat_list.py +++ b/pym/portage/cache/flat_list.py @@ -11,7 +11,7 @@ class database(fs_template.FsBased): auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'IUSE', 'CDEPEND', - 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES') + 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES') def __init__(self, label, auxdbkeys, **config): super(database,self).__init__(label, auxdbkeys, **config) diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index 164761adb..86717e6c5 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -18,7 +18,7 @@ class database(flat_hash.database): auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'KEYWORDS', 'INHERITED', 'IUSE', 'CDEPEND', - 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES') + 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES') autocommits = True diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index c90b54f7b..7565039f2 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -177,7 +177,7 @@ class EbuildNestedDie(LineCheck): """Check ebuild for nested die statements (die statements in subshells""" repoman_check_name = 'ebuild.nesteddie' - nesteddie_re = re.compile(r'^[^#]*\([^)]*\bdie\b') + nesteddie_re = re.compile(r'^[^#]*\s\(\s[^)]*\bdie\b') def check(self, num, line): if self.nesteddie_re.match(line): @@ -242,8 +242,8 @@ class InheritAutotools(LineCheck): _autotools_funcs = ( "eaclocal", "eautoconf", "eautoheader", "eautomake", "eautoreconf", "_elibtoolize") - _autotools_func_re = re.compile(r'(^|\s)(' + \ - "|".join(_autotools_funcs) + ')(\s|$)') + _autotools_func_re = re.compile(r'\b(' + \ + "|".join(_autotools_funcs) + r')\b') # Exempt eclasses: # git - An EGIT_BOOTSTRAP variable may be used to call one of # the autotools functions. -- 2.26.2