Merged from trunk -r12256:12275
authorFabian Groffen <grobian@gentoo.org>
Mon, 22 Dec 2008 20:26:45 +0000 (20:26 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 22 Dec 2008 20:26:45 +0000 (20:26 -0000)
   | 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ò    |
   |         | <flameeyes@g.o> 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 <darkside@g.o> 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 <leio@g.o> 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
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/cache/flat_list.py
pym/portage/cache/metadata.py
pym/repoman/checks.py

index e86f2f56aeba77509a8bb38b8adb3a8c6a30c206..2f0c0e9dd3a53a7837554e067473b88bf7cac303 100755 (executable)
@@ -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
index 718c68aa238ce807ad58d685d8e597c86b4346d7..e1d5a7010920f1d9d05dadbb7a6d12a63195815e 100644 (file)
@@ -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")
index a796ecab45f6b47bffdb4592c44f7e823732fa60..816f84ce0221879e9c782448605a7e59f8fce7ca 100644 (file)
@@ -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)
index 65983393f5e91fa974158fdcb1443b93980f1c01..413d4d33d164ad4193f50214be871173af470e5f 100644 (file)
@@ -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)
index 164761adbd90f09494a088917e357bed1bb0a384..86717e6c528dc576da88d1b4cf2498ccc5d3495a 100644 (file)
@@ -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
 
index c90b54f7bbcd8f3d778758c2ba649f9bb5ba1333..7565039f274af031be89299a7336ae4e8034e35a 100644 (file)
@@ -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.