Merged from trunk 4796:4810
authorFabian Groffen <grobian@gentoo.org>
Tue, 24 Oct 2006 20:00:06 +0000 (20:00 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 24 Oct 2006 20:00:06 +0000 (20:00 -0000)
Add some ACCEPT_LICENSE docs.

Put the package.keywords docs in alphabetical order with the others.

Add some package.license docs.

Add news about ACCEPT_LICENSE and package.license.

Make config.load_infodir also load the data into the env layer in order
to ensure that it has preference over what may have been there.

Don't limit the size of USE in config.load_infodir.

Add package.license to the list of files.

Don't put -* in the env layer, since that layer isn't part of the
incremental stacking in regenerate.

In getmaskingstatus(), add missing check for * in acceptable_licenses.

Don't display the "Please update portage" message in --quiet mode.
Thanks to solar.

Remove paths from _eclasses_ serialization in the cache.  This makes the
mtimes of the eclasses the only thing that distinguishes them, but the
probablility of collision is negligible.  This same _eclasses_ format
will be used to serialize eclass mtimes in cache that is distributed via
the rsync mirrors.  The deserialization code can handle mixtures of both
the old and new formats.

Enable recognition of _mtime_ that doesn't rely on cache mtime mangling.

Add ACCEPT_LICENSE back to incrementals so that profiles can affect it.

Disable ACCEPT_LICENSE support until the details of license groups are
decided and implemented.

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

NEWS
bin/emerge
man/make.conf.5
man/portage.5
pym/cache/flat_hash.py
pym/cache/template.py
pym/eclass_cache.py
pym/portage.py
pym/portage_const.py

diff --git a/NEWS b/NEWS
index fa295cd7efcfee551235e14a85cea870ee239249..a5ecef4ae86ffcdf96f4b6406fa7182ba9e21453 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ News (mainly features/major bug fixes)
 portage-2.1.2
 ------------
 
+* ACCEPT_LICENSE and package.license allow packages with unaccepted licenses to
+  be masked.
 * Ebuilds support default USE flags via +flag in IUSE.
 * New-style virtuals are now usable for packages that depend on themselves for
   bootstrap.
index aed9c1be65746ae31c1a9e2f3068d122c804bc52..e0a05f32bc2474765bc8324c68d6882da0035917 100755 (executable)
@@ -2098,7 +2098,7 @@ class depgraph:
                                else:
                                        myversion = "%s-%s" % (mysplit[1], mysplit[2])
 
-                               if myversion != portage.VERSION :
+                               if myversion != portage.VERSION and "--quiet" not in self.myopts:
                                        if "--emptytree" in self.myopts:
                                                p.append(colorize("WARN", "***")+" Please update portage to the above version before proceeding.")
                                                p.append("    Failure to do so may result in failed or improper merges.")
index eb04a85332a6a95a6f937bc26aaa411b9b83a336..dc382fd64a942bd80b7b94598a4cc732236f5438 100644 (file)
@@ -29,6 +29,12 @@ set this to '~ppc'.  This is an incremental variable.  Only define a
 .br
 Defaults to the value of $ARCH.
 .TP
+\fBACCEPT_LICENSE\fR = \fI[space delimited list of licenses]\fR
+Specify acceptable licenses for installed packages.  Any packages with
+unaccepted licenses will be masked.  The default value is "*", which means to
+accept all licenses.  Licenses can be accepted for individual packages via the
+package.license file.  See \fBportage\fR(5) for more information.
+.TP
 \fBBUILD_PREFIX\fR = \fI[path]\fR
 Defines the location of the package working directory. 
 .br
index 156bbdd0b73a8b255f20346b9608495c8a833cc6..74ae5335d5522bb7c977f58b5bce9f6201158884 100644 (file)
@@ -42,9 +42,10 @@ virtuals
 .nf
 bashrc
 modules
+package.keywords
+package.license
 package.mask
 package.unmask
-package.keywords
 package.use
 mirrors
 categories
@@ -374,34 +375,9 @@ portage will not be able to detect that cache regeneration is necessary.  If
 the user would like to modify eclasses, it is safe to use metadata_overlay
 together with PORTDIR_OVERLAY in \fBmake.conf\fR.
 .TP
-.BR package.mask
-A list of package atoms to mask.  Useful if specific versions of packages do
-not work well for you.  For example, you swear by the Nvidia drivers, but only
-versions earlier than 1.0.4496.  No problem!
-
-.I Format:
-.nf
-\- comments begin with #
-\- one DEPEND atom per line
-.fi
-
-.I Example:
-.nf
-# mask out versions 1.0.4496 of the nvidia
-# drivers and later
->=media\-video/nvidia\-kernel\-1.0.4496
->=media\-video/nvidia\-glx\-1.0.4496
-.fi
-.TP
-.BR package.unmask
-Just like package.mask above, except here you list packages you want to 
-unmask.  Useful for overriding the global package.mask file (see 
-below).  Note that this does not override packages that are masked via 
-KEYWORDS.
-.TP
 .BR package.keywords
 Per\-package KEYWORDS.  Useful for mixing unstable packages in with a normally 
-stable machine or vice versa.  This will allow you to augment ACCEPT_KEYWORDS 
+stable system or vice versa.  This will allow ACCEPT_KEYWORDS to be augmented
 for a single package.
 
 .nf
@@ -435,6 +411,50 @@ package.keywords like this:
 
 games-fps/quake3-demo -*
 .TP
+.BR package.license
+Per\-package acceptance of licenses.  This is useful if a license needs to be
+accepted for a single package but should not be accepted for any package.  See
+\fIACCEPT_LICENSE\fR in \fBmake.conf\fR(5) for global license acceptance.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line followed by additional licenses
+.fi
+
+.I Example:
+.nf
+# accept the zlib license just for the zlib package
+sys-libs/zlib ZLIB
+# accept any license for mplayer
+media\-video/mplayer *
+.fi
+.TP
+.BR package.mask
+A list of package atoms to mask.  Useful if specific versions of packages do
+not work well for you.  For example, you swear by the Nvidia drivers, but only
+versions earlier than 1.0.4496.  No problem!
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line
+.fi
+
+.I Example:
+.nf
+# mask out versions 1.0.4496 of the nvidia
+# drivers and later
+>=media\-video/nvidia\-kernel\-1.0.4496
+>=media\-video/nvidia\-glx\-1.0.4496
+.fi
+.TP
+.BR package.unmask
+Just like package.mask above, except here you list packages you want to 
+unmask.  Useful for overriding the global package.mask file (see 
+below).  Note that this does not override packages that are masked via 
+KEYWORDS.
+.TP
 .BR package.use
 Per\-package USE flags.  Useful for tracking local USE flags or for 
 enabling USE flags for certain packages only.  Perhaps you develop GTK 
index 408d33273d11319bb35ef27b80d0e3dfba5520fd..26861e49456cc03d36548e4930955e3d213fdc88 100644 (file)
@@ -26,7 +26,10 @@ class database(fs_template.FsBased):
                        myf = open(fp, "r")
                        try:
                                d = self._parse_data(myf, cpv)
-                               d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
+                               if "_mtime_" not in d:
+                                       """Backward compatibility with old cache that uses mtime
+                                       mangling."""
+                                       d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
                                return d
                        finally:
                                myf.close()
index c33e92b59b20383cc379d249849f7b6df205f623..0e2a5f36829d9bb2dd5b385ca3c32e0596712783 100644 (file)
@@ -151,7 +151,8 @@ class database(object):
 
 def serialize_eclasses(eclass_dict):
        """takes a dict, returns a string representing said dict"""
-       return "\t".join(["%s\t%s\t%s" % (k, v[0], str(v[1])) for k,v in eclass_dict.items()])
+       return "\t".join(["%s\t%s" % (k, str(v)) \
+               for k, v in eclass_dict.iteritems()])
 
 def reconstruct_eclasses(cpv, eclass_string):
        """returns a dict when handed a string generated by serialize_eclasses"""
@@ -159,10 +160,20 @@ def reconstruct_eclasses(cpv, eclass_string):
        if eclasses == [""]:
                # occasionally this occurs in the fs backends.  they suck.
                return {}
-       if len(eclasses) % 3 != 0:
+       
+       if len(eclasses) % 2 != 0 and len(eclasses) % 3 != 0:
                raise cache_errors.CacheCorruption(cpv, "_eclasses_ was of invalid len %i" % len(eclasses))
        d={}
-       for x in range(0, len(eclasses), 3):
-               d[eclasses[x]] = (eclasses[x + 1], long(eclasses[x + 2]))
+       has_paths = False
+       try:
+               long(eclasses[1])
+       except ValueError:
+               has_paths = True
+       if has_paths:
+               for x in range(0, len(eclasses), 3):
+                       d[eclasses[x]] = long(eclasses[x + 2])
+       else:
+               for x in range(0, len(eclasses), 2):
+                       d[eclasses[x]] = long(eclasses[x + 1])
        del eclasses
        return d
index 8d2a2bb813325121803b30e39869de95db0a6023..904e63261d21de39bb0b765175707a6826bfede1 100644 (file)
@@ -15,6 +15,7 @@ class cache:
                self.porttree_root = porttree_root
 
                self.eclasses = {} # {"Name": ("location","_mtime_")}
+               self._eclass_locations = {}
 
                # screw with the porttree ordering, w/out having bash inherit match it, and I'll hurt you.
                # ~harring
@@ -38,6 +39,7 @@ class cache:
 
        def update_eclasses(self):
                self.eclasses = {}
+               self._eclass_locations = {}
                eclass_len = len(".eclass")
                for x in [normalize_path(os.path.join(y,"eclass")) for y in self.porttrees]:
                        if not os.path.isdir(x):
@@ -48,13 +50,14 @@ class cache:
                                except OSError:
                                        continue
                                ys=y[:-eclass_len]
-                               self.eclasses[ys] = (x, long(mtime))
+                               self.eclasses[ys] = long(mtime)
+                               self._eclass_locations[ys] = x
        
        def is_eclass_data_valid(self, ec_dict):
                if not isinstance(ec_dict, dict):
                        return False
-               for eclass, tup in ec_dict.iteritems():
-                       if eclass not in self.eclasses or tuple(tup) != self.eclasses[eclass]:
+               for eclass, mtime in ec_dict.iteritems():
+                       if eclass not in self.eclasses or mtime != self.eclasses[eclass]:
                                return False
 
                return True
@@ -68,7 +71,8 @@ class cache:
                                print "ec=",ec_dict
                                print "inherits=",inherits
                                raise
-                       if from_master_only and self.eclasses[x][0] != self._master_eclass_root:
+                       if from_master_only and \
+                               self._eclass_locations[x] != self._master_eclass_root:
                                return None
 
                return ec_dict
index 84edad8f222794c1e8181a37253cc107ba66f797..605ff5d000dd3dabaf6f38cc313d8dd1848506d7 100644 (file)
@@ -1240,12 +1240,15 @@ class config:
                                        self.pkeywordsdict[cp][key] = pkgdict[key]
                                
                                #package.license
+                               """
+                               # Wait until license groups are ready before enabling this.
                                licdict = grabdict_package(
                                        os.path.join(abs_user_config, "package.license"),
                                        recursive=1)
                                for k, v in licdict.iteritems():
                                        self._plicensedict.setdefault(
                                                dep_getkey(k), {})[k] = v
+                               """
 
                                #package.unmask
                                pkgunmasklines = grabfile_package(
@@ -1339,8 +1342,11 @@ class config:
 
                        self.regenerate()
                        self.features = portage_util.unique_array(self["FEATURES"].split())
+
                        
-                       self._accept_license = set(self.get("ACCEPT_LICENSE", "*").split())
+                       # Wait until license groups are ready before enabling this.
+                       #self._accept_license = set(self.get("ACCEPT_LICENSE", "*").split())
+                       self._accept_license = set(["*"])
 
                        if "gpg" in self.features:
                                if not os.path.exists(self["PORTAGE_GPG_DIR"]) or \
@@ -1497,11 +1503,14 @@ class config:
                                if myre.match(filename):
                                        try:
                                                mydata = string.strip(open(infodir+"/"+filename).read())
-                                               if len(mydata)<2048:
+                                               if len(mydata) < 2048 or filename == "USE":
                                                        if filename == "USE":
-                                                               self.configdict["pkg"][filename] = "-* "+mydata
+                                                               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
                                                # CATEGORY is important because it's used in doebuild
                                                # to infer the cpv.  If it's corrupted, it leads to
                                                # strange errors later on, so we'll validate it and
@@ -3955,12 +3964,13 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
 
        settings.setcpv(mycpv, mydb=portdb)
        acceptable_licenses = settings.acceptable_licenses(mycpv)
-       def str_matches(myatom):
-               return myatom in acceptable_licenses
-       license_req = dep_check(mylicense, None, settings,
-               str_matches=str_matches)[1]
-       if license_req:
-               rValue.append(" ".join(license_req) + " license(s)")
+       if "*" not in acceptable_licenses:
+               def str_matches(myatom):
+                       return myatom in acceptable_licenses
+               license_req = dep_check(mylicense, None, settings,
+                       str_matches=str_matches)[1]
+               if license_req:
+                       rValue.append(" ".join(license_req) + " license(s)")
        
        return rValue
 
index 11259e4e2a697a99037bf13fdf5ff9140bd59bc1..46b6e1cae82b4394ae4fbf7290e8a53be116d4b5 100644 (file)
@@ -48,7 +48,8 @@ CONFIG_MEMORY_FILE      = PRIVATE_PATH + "/config"
 COLOR_MAP_FILE          = USER_CONFIG_PATH + "/color.map"
 
 INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES",
-       "ACCEPT_KEYWORDS", "CONFIG_PROTECT_MASK", "CONFIG_PROTECT", "PRELINK_PATH",
+       "ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
+       "CONFIG_PROTECT_MASK", "CONFIG_PROTECT", "PRELINK_PATH",
        "PRELINK_PATH_MASK"]
 EBUILD_PHASES           = ["setup", "unpack", "compile", "test", "install",
                           "preinst", "postinst", "prerm", "postrm", "other"]