From db0946c1c4c73406a8a0b95100e37fecbd3f1f88 Mon Sep 17 00:00:00 2001 From: Nicholas Jones Date: Sun, 21 Dec 2003 08:03:26 +0000 Subject: mysigs fix and touchups. rewrite of match_from_list. --- ChangeLog | 46 ++++++++++++-------- bin/repoman | 3 +- pym/portage.py | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++------ tarball.sh | 4 +- 4 files changed, 156 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19eaf60..143c3c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,36 +1,48 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.496 2003/12/19 03:56:21 nakano Exp $ +# $Id: ChangeLog,v 1.497 2003/12/21 08:03:26 carpaski Exp $ + + 20 Dec 2003; Nicholas Jones portage.py: Rewrote + match_from_list -- Simplified and made pkgcmp and match_from_list + properly compare package names. + + 20 Dec 2003; Nicholas Jones repoman: Fix for mysigs + traceback when signing. + + 20 Dec 2003; Nicholas Jones portage.py: Added + PYTHONPATH to the specials list -- created a colon_seperated list. + Fixed reset() in class config so that you can specify keeping the + pkg dictionary when resetting the values. 19 Dec 2003; Masatomo Nakano repoman: Added check - whether "ebuild foo.ebuild digest" succeeds. + whether "ebuild foo.ebuild digest" succeeds. 19 Dec 2003; Nicholas Jones portage.py: Fix for - pkg settings being maintained after an unmerge. + pkg settings being maintained after an unmerge. 19 Dec 2003; Nicholas Jones pym/portage_db_*: Moved - to using cPickle instead of marshal. More standardization of the API. + to using cPickle instead of marshal. More standardization of the API. 18 Dec 2003; Masatomo Nakano repoman: Added virtual - dependency check on each arch. + dependency check on each arch. 17 Dec 2003; Nicholas Jones portage.py: Fixed a - permission issue involving $T and userpriv. Lockfile touchup. - - 17 Dec 2003; Nicholas Jones portage_db_*: Added - templates and db for cache interfaces. Presently have a anydbm and a - flat file interface working. See the test for operations. + permission issue involving $T and userpriv. Lockfile touchup. + + 17 Dec 2003; Nicholas Jones portage_db_*: Added + templates and db for cache interfaces. Presently have a anydbm and a + flat file interface working. See the test for operations. 15 Dec 2003; Nicholas Jones emerge: Added a call - to portageq that causes python to create optimized modules prior to it - ending up inside the sandbox. Added more output and logging to sync. - + to portageq that causes python to create optimized modules prior to it + ending up inside the sandbox. Added more output and logging to sync. + 15 Dec 2003; Nicholas Jones prepstrip: 'tree' is not - the same as 'true'. - + the same as 'true'. + 15 Dec 2003; Nicholas Jones portage.py: invalid - settings in package.keywords caused a traceback -- fixed with error message. - + settings in package.keywords caused a traceback -- fixed with error message. + *portage-2.0.50_pre1 (12 Dec 2003): API change + enhancements 10 Dec 2003; Nicholas Jones chkcontents: Uses portage diff --git a/bin/repoman b/bin/repoman index e9d1c4e..aa1e42d 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1,7 +1,7 @@ #!/usr/bin/python -O # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.42 2003/12/19 03:56:22 nakano Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.43 2003/12/21 08:03:26 carpaski Exp $ # Next to do: dep syntax checking in mask files # Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems) @@ -1095,6 +1095,7 @@ else: gpgcmd+= "--default-key "+repoman_settings["PORTAGE_GPG_KEY"]+" " mychanges=[] + mysigs=[] if myheaders or myupdates or myremoved or mynew: myfiles=myheaders+myupdates+myremoved+mynew mydone=[] diff --git a/pym/portage.py b/pym/portage.py index ac059ca..b2172b0 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1,7 +1,7 @@ # portage.py -- core Portage functionality # Copyright 1998-2003 Daniel Robbins, Gentoo Technologies, Inc. # Distributed under the GNU Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.357 2003/12/19 02:03:42 nakano Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.358 2003/12/21 08:03:26 carpaski Exp $ VERSION="2.0.49-r17" @@ -549,8 +549,15 @@ def env_update(makelinks=1): "KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[], "INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[], "CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[], - "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[] + "PYTHONPATH":[], "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[] } + colon_seperated = [ + "ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH", + "LDPATH", "PATH", + "PRELINK_PATH", "PRELINK_PATH_MASK", + "PYTHON_PATH", + ] + env={} for x in fns: @@ -565,7 +572,7 @@ def env_update(makelinks=1): # process PATH, CLASSPATH, LDPATH for myspec in specials.keys(): if myconfig.has_key(myspec): - if myspec in ["LDPATH","PATH","PRELINK_PATH","PRELINK_PATH_MASK"]: + if myspec in colon_seperated: specials[myspec].extend(string.split(varexpand(myconfig[myspec]),":")) else: specials[myspec].append(varexpand(myconfig[myspec])) @@ -631,11 +638,11 @@ def env_update(makelinks=1): getstatusoutput("cd / ; /sbin/ldconfig -X -r "+root) del specials["LDPATH"] - penvnotice ="# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n" - penvnotice+="# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n" - cenvnotice=penvnotice; - penvnotice+="# GO INTO /etc/profile NOT /etc/profile.env\n\n" - cenvnotice+="# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n" + penvnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n" + penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n" + cenvnotice = penvnotice[:]; + penvnotice += "# GO INTO /etc/profile NOT /etc/profile.env\n\n" + cenvnotice += "# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n" #create /etc/profile.env for bash support outfile=open(root+"/etc/profile.env","w") @@ -1103,7 +1110,7 @@ class config: else: raise KeyError, "No such key defined in environment: %s" % key - def reset(self): + def reset(self,keeping_pkg=0): "reset environment to original settings" for x in self.configlist[-1].keys(): if x not in self.backupenv.keys(): @@ -1113,8 +1120,9 @@ class config: else: del self.configdict["env"][x] self.modifiedkeys = [] - for x in self.configdict["pkg"].keys(): - del self.configdict["pkg"][x] + if not keeping_pkg: + for x in self.configdict["pkg"].keys(): + del self.configdict["pkg"][x] self.regenerate() def load_infodir(self,infodir): @@ -1155,7 +1163,7 @@ class config: self.puse = "" self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file self.configdict["pkg"]["USE"] = self.puse[:] # this gets appended to USE - self.reset() + self.reset(keeping_pkg=1) def regenerate(self,useonly=0): global incrementals,usesplit,profiledir @@ -2570,6 +2578,8 @@ def vercmp(val1,val2): def pkgcmp(pkg1,pkg2): """if returnval is less than zero, then pkg2 is newer than pkg1, zero if equal and positive if older.""" + if pkg1[0] != pkg2[0]: + return None mycmp=vercmp(pkg1[1],pkg2[1]) if mycmp>0: return 1 @@ -3132,7 +3142,106 @@ def best_match_to_list(mypkg,mylist): bestm = x return bestm -def match_from_list(mydep,mylist): +def catsplit(mydep): + return mydep.split("/", 1) + +def get_operator(mydep): + """ + returns '~', '=', '>', '<', '=*', '>=', or '<=' + """ + if mydep[0] == "~": + operator = "~" + elif mydep[0] == "=": + if mydep[-1] == "*": + operator = "=*" + else: + operator = "=" + elif mydep[0] in "><": + if mydep[1] == "=": + operator = mydep[0:2] + else: + operator = mydep[0] + return operator + +def match_from_list(mydep,candidate_list): + if mydep[0] == "!": + mydep = mydep[1:] + + mycpv = dep_getcpv(mydep) + mycpv_cps = catpkgsplit(mycpv) # Can be None if not specific + + if not mycpv_cps: + cat,pkg = catsplit(mycpv) + ver = None + rev = None + else: + cat,pkg,ver,rev = mycpv_cps + if mydep == mycpv: + raise KeyError, "Specific key requires and operator (%s)" % (mydep) + + if ver and rev: + operator = get_operator(mydep) + else: + operator = None + + mylist = [] + + if operator == None: + for x in candidate_list: + xs = pkgsplit(x) + if xs == None: + if x != mycpv: + continue + elif xs[0] != mycpv: + continue + mylist.append(x) + + elif operator == "=": # Exact match + if mycpv in candidate_list: + mylist = [mycpv] + + elif operator == "=*": # glob match + # The old verion ignored _tag suffixes... This one doesn't. + for x in candidate_list: + if x[0:len(mycpv)] == mycpv: + mylist.append(x) + + elif operator == "~": # version, any revision, match + for x in candidate_list: + xs = catpkgsplit(x) + if xs[0:2] != mycpv_cps[0:2]: + continue + if xs[2] != ver: + continue + mylist.append(x) + + elif operator in [">", ">=", "<", "<="]: + for x in candidate_list: + result = pkgcmp(pkgsplit(x), [cat+"/"+pkg,ver,rev]) + if result == None: + continue + elif operator == ">": + if result > 0: + mylist.append(x) + elif operator == ">=": + if result >= 0: + mylist.append(x) + elif operator == "<": + if result < 0: + mylist.append(x) + elif operator == "<=": + if result <= 0: + mylist.append(x) + else: + raise KeyError, "Unknown operator: %s" % mydep + else: + raise KeyError, "Unknown operator: %s" % mydep + + + return mylist + + +def match_from_list_original(mydep,mylist): """(dep,list) Reduces the list down to those that fit the dep """ diff --git a/tarball.sh b/tarball.sh index 16ad885..2ad3c31 100755 --- a/tarball.sh +++ b/tarball.sh @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/Attic/tarball.sh,v 1.176 2003/12/15 23:40:25 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/Attic/tarball.sh,v 1.177 2003/12/21 08:03:26 carpaski Exp $ if [ -z "$1" ]; then echo @@ -46,6 +46,8 @@ cp ChangeLog ${DEST} cd ${DEST} find -name CVS -exec rm -rf {} \; find -name '*~' -exec rm -rf {} \; +find -name '*.pyc' -exec rm -rf {} \; +find -name '*.pyo' -exec rm -rf {} \; chown -R root:root ${DEST} cd $TMP rm -f ${PKG}-${V}/bin/emerge.py ${PKG}-${V}/bin/{pmake,sandbox} ${PKG}-${V}/{bin,pym}/*.py[oc] -- cgit v1.2.3-65-gdbad