Merged from trunk -r14463:14472
authorFabian Groffen <grobian@gentoo.org>
Fri, 2 Oct 2009 20:40:28 +0000 (20:40 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 2 Oct 2009 20:40:28 +0000 (20:40 -0000)
   | 14465    | Fix SyntaxError with Python 3 added in r14462.              |
   | arfrever |                                                             |

   | 14466    | Take regular expressions from portage.dep and use them to   |
   | zmedico  | reimplement portage.versions.pkgsplit(). This simplifies    |
   |          | the code and helps guarantee consistency package            |
   |          | name/version validation.                                    |

   | 14467    | Use a regular expression for SLOT validation inside         |
   | zmedico  | vardbapi.aux_get().                                         |

   | 14468    | Bug #286895 - Generate an eerror message when a directory   |
   | zmedico  | blocks merge of a regular file and the file is merged using |
   |          | a 'config protect' filename even though the path may not be |
   |          | among those covered by CONFIG_PROTECT.                      |

   | 14469    | Add --tolerant option (already in use on master rsync       |
   | zmedico  | mirror), requested by robbat2.                              |

   | 14470    | Remove libtool from RDEPEND.suspect list, since libltdl.so  |
   | zmedico  | is validly used by some packages at runtime. Thanks to      |
   |          | Samuli Suominen <ssuominen@g.o> for reporting.              |

   | 14471    | Bug #285191 - Remove the RDEPEND.implicit check because it  |
   | zmedico  | is invalid.                                                 |

   | 14472    | Bug #287333 - Fix the code from bug #252167 so it behaves   |
   | zmedico  | consistently regardless of the package (ebuild or binpkg)   |
   |          | being masked.                                               |

svn path=/main/branches/prefix/; revision=14473

bin/egencache
bin/repoman
man/egencache.1
man/repoman.1
pym/_emerge/Package.py
pym/_emerge/depgraph.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py
pym/portage/dep.py
pym/portage/versions.py
pym/repoman/checks.py

index 47f93c792755d6e0db6691dffe997a246f4adbd0..25a51d12ce97cc63c8b237622d4cf2850b39429e 100755 (executable)
@@ -67,6 +67,9 @@ def parse_args(args):
                action="store_true",
                help="enable rsync stat collision workaround " + \
                        "for bug 139134 (use with --update)")
+       parser.add_option("--tolerant",
+               action="store_true",
+               help="exit successfully if only minor errors occurred")
        parser.add_option("--ignore-default-opts",
                action="store_true",
                help="do not use the EGENCACHE_DEFAULT_OPTS environment variable")
@@ -343,6 +346,8 @@ def egencache_main(args):
                max_load=options.load_average,
                rsync=options.rsync)
        gen_cache.run()
+       if options.tolerant:
+               return os.EX_OK
        return gen_cache.returncode
 
 if __name__ == "__main__":
index 981998b057b7b5758330535d88949928de7cb906..db079f4913eb452449da42fd9ad2351e727a4a81 100755 (executable)
@@ -426,7 +426,6 @@ suspect_rdepend = frozenset([
        "sys-devel/bison",
        "sys-devel/dev86",
        "sys-devel/flex",
-       "sys-devel/libtool",
        "sys-devel/m4",
        "sys-devel/pmake",
        "x11-misc/bdftopcf",
index dbcc44e4bc35f5c18c45cb446e4bc098514adcb7..d0bd1014a58e5ac2a66dcc85afef04c2047ddfc1 100644 (file)
@@ -54,6 +54,11 @@ This option should only be needed for distribution via something like
 (see \fBbug 139134\fR). It's not needed with \fBgit\fR(1) since that uses a
 more thorough mechanism which allows it to detect changed inode numbers
 (described in \fIracy-git.txt\fR in the git technical docs).
+.TP
+.BR "\-\-tolerant"
+Exit successfully if only minor errors occurred, such as skipped cache
+updates due to ebuilds that either fail to source or are not sourced
+due to invalid Manifest entries.
 .SH "ENVIRONMENT OPTIONS"
 .TP
 \fBEGENCACHE_DEFAULT_OPTS\fR
index 52ef02a1e3d6c10b21584b4e1efd465353338a06..b074277496991f301dfb59a51b152e3fca80afc5 100644 (file)
@@ -186,10 +186,6 @@ Masked ebuilds with RDEPEND settings (matched against *all* ebuilds)
 .B RDEPEND.badmaskedindev
 Masked ebuilds with RDEPEND settings (matched against *all* ebuilds) in developing arch
 .TP
-.B RDEPEND.implicit
-RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND
-assignment
-.TP
 .B RDEPEND.suspect
 RDEPEND contains a package that usually only belongs in DEPEND
 .TP
index 472b1d37501ccc571762d551571b8039a04a1960..e07c8fc4b22e980d8379f82f1d1c586a260c130c 100644 (file)
@@ -212,7 +212,7 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
                elif k in self._use_conditional_keys:
                        try:
                                use_reduce(paren_reduce(v), matchall=1)
-                       except portage.exception.InvalidDependString, e:
+                       except portage.exception.InvalidDependString as e:
                                self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
 
        def _set_inherited(self, k, v):
index 551022b561be3724389f9f782a2bb3fa68f85a97..b6d01f9a3ce07bdaf46f5d49f151e8ad62a4d9ac 100644 (file)
@@ -2304,8 +2304,7 @@ class depgraph(object):
                                        reinstall_for_flags = None
 
                                        if not pkg.installed or \
-                                               (pkg.built and matched_packages and \
-                                               not (avoid_update and pkg.installed)):
+                                               (matched_packages and not avoid_update):
                                                # Only enforce visibility on installed packages
                                                # if there is at least one other visible package
                                                # available. By filtering installed masked packages
@@ -2323,8 +2322,8 @@ class depgraph(object):
                                                # with visible KEYWORDS when the installed
                                                # version is masked by KEYWORDS, but never
                                                # reinstall the same exact version only due
-                                               # to a KEYWORDS mask.
-                                               if built and matched_packages:
+                                               # to a KEYWORDS mask. See bug #252167.
+                                               if matched_packages:
 
                                                        different_version = None
                                                        for avail_pkg in matched_packages:
index f57c1c85e6757f88e4255f7ce7feea0512eb60db..2f9fb26df574d5f87b4134b3412ef17b27d65a59 100644 (file)
@@ -8183,7 +8183,7 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
                                        return None
        return deplist
 
-_cpv_key_re = re.compile('^' + dep._cpv + '$', re.VERBOSE)
+_cpv_key_re = re.compile('^' + versions._cpv + '$', re.VERBOSE)
 def cpv_getkey(mycpv):
        """Calls pkgsplit on a cpv and returns only the cp."""
        m = _cpv_key_re.match(mycpv)
index 38e10c15fc5dbeba3cc0106b00f1d25c608d2f78..1df5580c0fabe167c097b7a478d54b9e882ca734 100644 (file)
@@ -13,7 +13,7 @@ import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.checksum:_perform_md5_merge@perform_md5',
        'portage.dep:dep_getkey,isjustname,match_from_list,' + \
-               'use_reduce,paren_reduce',
+               'use_reduce,paren_reduce,_slot_re',
        'portage.elog:elog_process',
        'portage.elog.filtering:filter_mergephases,filter_unmergephases',
        'portage.locks:lockdir,unlockdir',
@@ -1967,10 +1967,12 @@ class vardbapi(dbapi):
                                        cache_data[aux_key] = mydata[aux_key]
                                self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data)
                                self._aux_cache["modified"].add(mycpv)
-               if not mydata['SLOT']:
-                       # Empty slot triggers InvalidAtom exceptions when generating slot
-                       # atoms for packages, so translate it to '0' here.
+
+               if _slot_re.match(mydata['SLOT']) is None:
+                       # Empty or invalid slot triggers InvalidAtom exceptions when
+                       # generating slot atoms for packages, so translate it to '0' here.
                        mydata['SLOT'] = _unicode_decode('0')
+
                return [mydata[x] for x in wants]
 
        def _aux_get(self, mycpv, wants, st=None):
@@ -4890,12 +4892,20 @@ class dblink(object):
                                protected = self.isprotected(mydest)
                                if mydmode != None:
                                        # destination file exists
-                                       cfgprot = 0
+                                       
                                        if stat.S_ISDIR(mydmode):
                                                # install of destination is blocked by an existing directory with the same name
-                                               cfgprot = 1
-                                               showMessage("!!! %s\n" % mydest,
-                                                       level=logging.ERROR, noiselevel=-1)
+                                               newdest = new_protect_filename(mydest, newmd5=mymd5)
+                                               msg = []
+                                               msg.append("")
+                                               msg.append("Installation of a regular file is blocked by a directory:")
+                                               msg.append("  '%s'" % mydest)
+                                               msg.append("This file will be merged with a different name:")
+                                               msg.append("  '%s'" % newdest)
+                                               msg.append("")
+                                               self._eerror("preinst", msg)
+                                               mydest = newdest
+
                                        elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])):
                                                # install of destination is blocked by an existing regular file,
                                                # or by a symlink to an existing regular file;
@@ -4903,6 +4913,7 @@ class dblink(object):
                                                # we only need to tweak mydest if cfg file management is in play.
                                                if protected:
                                                        # we have a protection path; enable config file management.
+                                                       cfgprot = 0
                                                        destmd5 = perform_md5(mydest, calc_prelink=1)
                                                        if mymd5 == destmd5:
                                                                #file already in place; simply update mtimes of destination
@@ -4927,8 +4938,9 @@ class dblink(object):
                                                                """A previously remembered update has been
                                                                accepted, so it is removed from confmem."""
                                                                del cfgfiledict[myrealdest]
-                                       if cfgprot:
-                                               mydest = new_protect_filename(mydest, newmd5=mymd5)
+
+                                                       if cfgprot:
+                                                               mydest = new_protect_filename(mydest, newmd5=mymd5)
 
                                # whether config protection or not, we merge the new file the
                                # same way.  Unless moveme=0 (blocking directory)
index 1fe4bc905fba7e73b1fd03dde43516b2020168e5..70d95e4849d4bf049b39a933bd266cf61409d2a5 100644 (file)
@@ -24,7 +24,7 @@ import portage.exception
 from portage.exception import InvalidData, InvalidAtom
 from portage.localization import _
 from portage.versions import catpkgsplit, catsplit, \
-       pkgcmp, pkgsplit, ververify, _version
+       pkgcmp, pkgsplit, ververify, _cp, _cpv
 import portage.cache.mappings
 
 if sys.hexversion >= 0x3000000:
@@ -806,28 +806,18 @@ def dep_getusedeps( depend ):
 
 # \w is [a-zA-Z0-9_]
 
-# 2.1.1 A category name may contain any of the characters [A-Za-z0-9+_.-].
-# It must not begin with a hyphen or a dot.
-_cat = r'[\w+][\w+.-]*'
-
-# 2.1.2 A package name may contain any of the characters [A-Za-z0-9+_-].
-# It must not begin with a hyphen,
-# and must not end in a hyphen followed by one or more digits.
-_pkg = r'[\w+][\w+-]*?'
-
 # 2.1.3 A slot name may contain any of the characters [A-Za-z0-9+_.-].
 # It must not begin with a hyphen or a dot.
-_slot = r':([\w+][\w+.-]*)'
+_slot = r'([\w+][\w+.-]*)'
+_slot_re = re.compile('^' + _slot + '$', re.VERBOSE)
 
 _use = r'\[.*\]'
 _op = r'([=~]|[><]=?)'
-_cp = '(' + _cat + '/' + _pkg + '(-' + _version + ')?)'
-_cpv = '(' + _cp + '-' + _version + ')'
 
 _atom_re = re.compile('^(?P<without_use>(?:' +
        '(?P<op>' + _op + _cpv + ')|' +
        '(?P<star>=' + _cpv + r'\*)|' +
-       '(?P<simple>' + _cp + '))(?:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE)
+       '(?P<simple>' + _cp + '))(:' + _slot + ')?)(' + _use + ')?$', re.VERBOSE)
 
 def isvalidatom(atom, allow_blockers=False):
        """
index 06ca9fd8c426d90265afdc58d56eb2ef8440977a..8b5ad3422aa333512b42f9259aec48b8d518dbdf 100644 (file)
@@ -5,10 +5,28 @@
 
 import re
 
+
+# \w is [a-zA-Z0-9_]
+
+# 2.1.1 A category name may contain any of the characters [A-Za-z0-9+_.-].
+# It must not begin with a hyphen or a dot.
+_cat = r'[\w+][\w+.-]*'
+
+# 2.1.2 A package name may contain any of the characters [A-Za-z0-9+_-].
+# It must not begin with a hyphen,
+# and must not end in a hyphen followed by one or more digits.
+_pkg = r'[\w+][\w+-]*?'
+
+_v = r'(cvs\.)?(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)'
 # PREFIX hack: -r(\d+) -> -r(\d+|0\d+\.\d+) (see below)
-_version = r'(cvs\.)?(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)(-r(\d+|0\d+\.\d+))?'
+_rev = r'(\d+|0\d+\.\d+)'
+_vr = _v + '(-r(' + _rev + '))?'
 
-ver_regexp = re.compile("^" + _version + "$")
+_cp = '(' + _cat + '/' + _pkg + '(-' + _vr + ')?)'
+_cpv = '(' + _cp + '-' + _vr + ')'
+_pv = '(?P<pn>' + _pkg + '(?P<pn_inval>-' + _vr + ')?)' + '-(?P<ver>' + _v + ')(-r(?P<rev>' + _rev + '))?'
+
+ver_regexp = re.compile("^" + _vr + "$")
 suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$")
 suffix_value = {"pre": -2, "p": 0, "alpha": -4, "beta": -3, "rc": -1}
 endversion_keys = ["pre", "p", "alpha", "beta", "rc"]
@@ -231,23 +249,15 @@ def pkgcmp(pkg1, pkg2):
                return None
        return vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:]))
 
-pkgcache={}
+_pv_re = re.compile('^' + _pv + '$', re.VERBOSE)
 
 def pkgsplit(mypkg,silent=1):
-       try:
-               if not pkgcache[mypkg]:
-                       return None
-               return pkgcache[mypkg]
-       except KeyError:
-               pass
-       myparts=mypkg.split("-")
-       
-       if len(myparts)<2:
-               if not silent:
-                       print(_("!!! Name error in %s: missing a version or name part.") % mypkg)
-               pkgcache[mypkg]=None
+
+       m = _pv_re.match(mypkg)
+       if m is None:
                return None
 
+<<<<<<< .working
        #verify rev
        revok=0
        myrev=myparts[-1]
@@ -275,8 +285,19 @@ def pkgsplit(mypkg,silent=1):
                        return myval
        else:
                pkgcache[mypkg]=None
+=======
+       if m.group('pn_inval') is not None:
+               # package name appears to have a version-like suffix
+>>>>>>> .merge-right.r14472
                return None
 
+       rev = m.group('rev')
+       if rev is None:
+               rev = '0'
+       rev = 'r' + rev
+
+       return  (m.group('pn'), m.group('ver'), rev) 
+
 catcache={}
 def catpkgsplit(mydata,silent=1):
        """
index bfb2625450a0b901b5ea623b53bae1f31c6e63f5..5058ec77e0de14ab2967df67577a9b3a7472a1cd 100644 (file)
@@ -268,37 +268,6 @@ class EbuildQuotedA(LineCheck):
                if match:
                        return "Quoted \"${A}\" on line: %d"
 
-class ImplicitRuntimeDeps(LineCheck):
-       """
-       Detect the case where DEPEND is set and RDEPEND is unset in the ebuild,
-       since this triggers implicit RDEPEND=$DEPEND assignment.
-       """
-
-       _assignment_re = re.compile(r'^\s*(R?DEPEND)=')
-
-       def new(self, pkg):
-               # RDEPEND=DEPEND is no longer available in EAPI=3
-               if pkg.metadata['EAPI'] in ('0', '1', '2'):
-                       self.repoman_check_name = 'RDEPEND.implicit'
-               else:
-                       self.repoman_check_name = 'EAPI.incompatible'
-               self._rdepend = False
-               self._depend = False
-
-       def check(self, num, line):
-               if not self._rdepend:
-                       m = self._assignment_re.match(line)
-                       if m is None:
-                               pass
-                       elif m.group(1) == "RDEPEND":
-                               self._rdepend = True
-                       elif m.group(1) == "DEPEND":
-                               self._depend = True
-
-       def end(self):
-               if self._depend and not self._rdepend:
-                       yield 'RDEPEND is not explicitly assigned'
-
 class InheritAutotools(LineCheck):
        """
        Make sure appropriate functions are called in
@@ -493,7 +462,7 @@ _constant_checks = tuple((c() for c in (
        EbuildAssignment, EbuildUselessDodoc,
        EbuildUselessCdS, EbuildNestedDie,
        EbuildPatches, EbuildQuotedA, EapiDefinition,
-       IUseUndefined, ImplicitRuntimeDeps, InheritAutotools,
+       IUseUndefined, InheritAutotools,
        EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS,
        DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue,
        SrcCompileEconf, Eapi3IncompatibleFuncs, Eapi3GoneVars)))