diff options
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | bin/emerge | 25 | ||||
-rwxr-xr-x | bin/repoman | 1 | ||||
-rw-r--r-- | pym/portage.py | 126 | ||||
-rw-r--r-- | pym/portage_const.py | 5 |
5 files changed, 20 insertions, 139 deletions
@@ -3,8 +3,6 @@ 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. diff --git a/bin/emerge b/bin/emerge index 495215393..cfa1b1995 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1363,30 +1363,15 @@ class depgraph: print "\n!!! "+red("All ebuilds that could satisfy ")+green(xinfo)+red(" have been masked.") print "!!! One of the following masked packages is required to complete your request:" oldcomment = "" - shown_licenses = [] for p in alleb: mreasons = portage.getmaskingstatus(p, settings=pkgsettings, portdb=portdb) print "- "+p+" (masked by: "+string.join(mreasons, ", ")+")" - if "package.mask" in mreasons: - comment = portage.getpmaskcomment(p, - settings=pkgsettings, portdb=portdb) - if comment and comment != oldcomment: - print comment - oldcomment = comment - licdict = portage.getlicensetexts(p, settings=pkgsettings, portdb=portdb, onlymasked=True) - for lic in licdict.keys(): - if lic+" license" in mreasons and not lic in shown_licenses: - if len(licdict[lic][1]) > 2000: - print "Please read the text of license %s in %s" % (lic, licdict[lic][0]) - print - else: - print "License text for license %s:" % lic - print - print licdict[lic][1] - print - shown_licenses.append(lic) - + comment = portage.getmaskingreason(p, + settings=pkgsettings, portdb=portdb) + if comment and comment != oldcomment: + print comment + oldcomment = comment print print "For more information, see MASKED PACKAGES section in the emerge man page or " print "refer to the Gentoo Handbook." diff --git a/bin/repoman b/bin/repoman index 4e8f7fc14..9f853073d 100755 --- a/bin/repoman +++ b/bin/repoman @@ -477,7 +477,6 @@ if quiet < 2: print "PORTDIR_OVERLAY = \""+os.environ["PORTDIR_OVERLAY"]+"\"" # Now that PORTDIR_OVERLAY is properly overridden, create the portdb. -os.environ["ACCEPT_LICENSE"] = "*" repoman_settings = portage.config(local_config=False, config_incrementals=portage_const.INCREMENTALS) trees = portage.create_trees() diff --git a/pym/portage.py b/pym/portage.py index 760d9358c..9aa3f94c5 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -916,9 +916,6 @@ class config: self.dirVirtuals = copy.deepcopy(clone.dirVirtuals) self.treeVirtuals = copy.deepcopy(clone.treeVirtuals) self.features = copy.deepcopy(clone.features) - - self._accept_license = copy.deepcopy(clone._accept_license) - self._plicensedict = copy.deepcopy(clone._plicensedict) else: # backupenv is for calculated incremental variables. @@ -1184,7 +1181,6 @@ class config: self.pusedict = {} self.pkeywordsdict = {} - self._plicensedict = {} self.punmaskdict = {} abs_user_config = os.path.join(config_root, USER_CONFIG_PATH.lstrip(os.path.sep)) @@ -1237,17 +1233,6 @@ class config: if not self.pkeywordsdict.has_key(cp): self.pkeywordsdict[cp] = {} 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( @@ -1342,11 +1327,6 @@ class config: self.regenerate() self.features = portage_util.unique_array(self["FEATURES"].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 \ not os.path.isdir(self["PORTAGE_GPG_DIR"]): @@ -1598,16 +1578,6 @@ class config: if has_changed: self.reset(keeping_pkg=1,use_cache=use_cache) - def acceptable_licenses(self, cpv): - cpdict = self._plicensedict.get(dep_getkey(cpv), None) - if not cpdict: - return self._accept_license.copy() - plicenses = self._accept_license.copy() - matches = match_to_list(cpv, cpdict.keys()) - for atom in matches: - plicenses.update(cpdict[atom]) - return plicenses - def setinst(self,mycpv,mydbapi): self.modifying() if len(self.virtuals) == 0: @@ -3614,7 +3584,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, return_all_deps=False): """Takes an unreduced and reduced deplist and removes satisfied dependencies. Returned deplist contains steps that must be taken to satisfy dependencies.""" - + if trees is None: + global db + trees = db writemsg("ZapDeps -- %s\n" % (use_binaries), 2) if not reduced or unreduced == ["||"] or \ (not return_all_deps and dep_eval(reduced)): @@ -3635,17 +3607,6 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, deps = unreduced[1:] satisfieds = reduced[1:] - if trees is None: - # We don't have trees to check availability against, so we - # just default to the first choice. - if isinstance(deps[0], list): - atoms = dep_zapdeps(deps[0], satisfieds[0], myroot, - use_binaries=use_binaries, trees=trees, - return_all_deps=return_all_deps) - else: - atoms = [deps[0]] - return atoms - # Our preference order is for an the first item that: # a) contains all unmasked packages with the same key as installed packages # b) contains all unmasked packages @@ -3755,8 +3716,7 @@ def dep_expand(mydep, mydb=None, use_cache=1, settings=None): mydep, mydb=mydb, use_cache=use_cache, settings=settings) + postfix def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, - use_cache=1, use_binaries=0, myroot="/", trees=None, str_matches=None, - return_all_deps=False): + use_cache=1, use_binaries=0, myroot="/", trees=None, return_all_deps=False): """Takes a depend string and parses the condition.""" edebug = mysettings.get("PORTAGE_DEBUG", None) == "1" #check_config_instance(mysettings) @@ -3812,13 +3772,12 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, mysplit = _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, use=use, mode=mode, myuse=myuse, use_cache=use_cache, use_binaries=use_binaries, myroot=myroot, trees=trees, - str_matches=str_matches, return_all_deps=return_all_deps) + return_all_deps=return_all_deps) except portage_exception.ParseError, e: return [0, str(e)] mysplit2=mysplit[:] - mysplit2 = dep_wordreduce(mysplit2, mysettings, mydbapi, mode, - str_matches=str_matches, use_cache=use_cache) + mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache) if mysplit2 is None: return [0,"Invalid token"] @@ -3839,24 +3798,19 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, writemsg("mydict: %s\n" % (mydict), 1) return [1,mydict.keys()] -def dep_wordreduce(mydeplist, mysettings, mydbapi, mode, str_matches=None, - use_cache=1): +def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1): "Reduces the deplist to ones and zeros" mypos=0 deplist=mydeplist[:] while mypos<len(deplist): if type(deplist[mypos])==types.ListType: #recurse - deplist[mypos] = dep_wordreduce(deplist[mypos], mysettings, - mydbapi, mode, str_matches=str_matches, use_cache=use_cache) + deplist[mypos]=dep_wordreduce(deplist[mypos],mysettings,mydbapi,mode,use_cache=use_cache) elif deplist[mypos]=="||": pass else: mykey = dep_getkey(deplist[mypos]) - if str_matches is not None: - mykey = deplist[mypos] - deplist[mypos] = str_matches(mykey) - elif mysettings and mysettings.pprovideddict.has_key(mykey) and \ + if mysettings and mysettings.pprovideddict.has_key(mykey) and \ match_from_list(deplist[mypos], mysettings.pprovideddict[mykey]): deplist[mypos]=True else: @@ -3973,34 +3927,7 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None): else: return mykey -def getlicensetexts(mycpv, settings=None, portdb=None, onlymasked=True): - if portdb is None: - portdb = globals()["portdb"] - if settings is None: - settings = config(clone=globals()["settings"]) - - license_data = portdb.aux_get(mycpv, ["LICENSE"])[0] - settings.setcpv(mycpv, mydb=portdb) - acceptable_licenses = settings.acceptable_licenses(mycpv) - - def str_matches(myatom): - return (not onlymasked) and (myatom in acceptable_licenses) - - license_list = dep_check(license_data, None, settings, - str_matches=str_matches)[1] - if onlymasked and "*" in acceptable_licenses: - license_list = [] - - rValue = {} - for lic in license_list: - # Account for overlays here? How? - licfilename = os.path.join(settings["PORTDIR"], "licenses", lic) - fd = open(licfilename, "r") - rValue[lic] = (licfilename, fd.read()) - fd.close() - return rValue - -def getpmaskcomment(mycpv, settings=None, portdb=None): +def getmaskingreason(mycpv, settings=None, portdb=None): from portage_util import grablines if settings is None: settings = globals()["settings"] @@ -4045,12 +3972,10 @@ def getpmaskcomment(mycpv, settings=None, portdb=None): return comment i = i + 1 return None -# Compability name -getmaskingreason=getpmaskcomment def getmaskingstatus(mycpv, settings=None, portdb=None): if settings is None: - settings = config(clone=globals()["settings"]) + settings = globals()["settings"] if portdb is None: portdb = globals()["portdb"] mysplit = catpkgsplit(mycpv) @@ -4090,8 +4015,7 @@ def getmaskingstatus(mycpv, settings=None, portdb=None): rValue.append("package.mask") # keywords checking - mygroups, mylicense, eapi = portdb.aux_get(mycpv, - ["KEYWORDS", "LICENSE", "EAPI"]) + mygroups, eapi = portdb.aux_get(mycpv, ["KEYWORDS", "EAPI"]) if not eapi_is_supported(eapi): return ["required EAPI %s, supported EAPI %s" % (eapi, portage_const.EAPI)] mygroups = mygroups.split() @@ -4130,17 +4054,6 @@ def getmaskingstatus(mycpv, settings=None, portdb=None): if kmask: rValue.append(kmask+" keyword") - - settings.setcpv(mycpv, mydb=portdb) - acceptable_licenses = settings.acceptable_licenses(mycpv) - 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 += [x+" license" for x in license_req] - return rValue class packagetree: @@ -5590,17 +5503,16 @@ class portdbapi(dbapi): newlist=[] pkgdict = self.mysettings.pkeywordsdict - aux_keys = ["KEYWORDS", "LICENSE", "EAPI"] for mycpv in mylist: #we need to update this next line when we have fully integrated the new db api auxerr=0 keys = None try: - keys, license, eapi = self.aux_get(mycpv, aux_keys) + keys, eapi = self.aux_get(mycpv, ["KEYWORDS", "EAPI"]) except KeyError: pass except portage_exception.PortageException, e: - writemsg("!!! Error: aux_get('%s', %s)\n" % (mycpv, aux_keys), + writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv, noiselevel=-1) writemsg("!!! %s\n" % str(e), noiselevel=-1) @@ -5637,16 +5549,6 @@ class portdbapi(dbapi): hasstable = True if not match and ((hastesting and "~*" in pgroups) or (hasstable and "*" in pgroups)): match=1 - acceptable_licenses = self.mysettings.acceptable_licenses(mycpv) - if "*" not in acceptable_licenses: - def str_matches(myatom): - return myatom in acceptable_licenses - if "?" in license: - self.mysettings.setcpv(mycpv, mydb=self) - reqd = dep_check(license, None, self.mysettings, - str_matches=str_matches)[1] - if reqd: - match = 0 if match and eapi_is_supported(eapi): newlist.append(mycpv) return newlist diff --git a/pym/portage_const.py b/pym/portage_const.py index b90d1e29e..faf20c2c3 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -41,10 +41,7 @@ CUSTOM_MIRRORS_FILE = USER_CONFIG_PATH+"/mirrors" CONFIG_MEMORY_FILE = PRIVATE_PATH + "/config" COLOR_MAP_FILE = USER_CONFIG_PATH + "/color.map" -INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES", - "ACCEPT_KEYWORDS", "ACCEPT_LICENSE", - "CONFIG_PROTECT_MASK", "CONFIG_PROTECT", "PRELINK_PATH", - "PRELINK_PATH_MASK"] +INCREMENTALS=["USE","USE_EXPAND","USE_EXPAND_HIDDEN","FEATURES","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"] |