diff options
author | Nicholas Jones <carpaski@gentoo.org> | 2004-11-15 21:42:50 +0000 |
---|---|---|
committer | Nicholas Jones <carpaski@gentoo.org> | 2004-11-15 21:42:50 +0000 |
commit | 95c1a6f619f64c59bd97a85c2a82a9f6837efaba (patch) | |
tree | 0ff3603b8d7e0552bc5e2509e7cbfffbbf600b03 | |
parent | bug #70225, sandbox_pids_file potential overflow. (diff) | |
download | portage-cvs-95c1a6f619f64c59bd97a85c2a82a9f6837efaba.tar.gz portage-cvs-95c1a6f619f64c59bd97a85c2a82a9f6837efaba.tar.bz2 portage-cvs-95c1a6f619f64c59bd97a85c2a82a9f6837efaba.zip |
Fixes for GSO changes for gpg.
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | bin/emerge | 3 | ||||
-rw-r--r-- | pym/portage.py | 21 | ||||
-rw-r--r-- | pym/portage_exception.py | 9 | ||||
-rw-r--r-- | pym/portage_gpg.py | 38 | ||||
-rw-r--r-- | pym/xpak.py | 4 |
6 files changed, 42 insertions, 40 deletions
@@ -1,12 +1,17 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.874 2004/11/15 02:21:19 ferringb Exp $ +# $Id: ChangeLog,v 1.875 2004/11/15 21:42:49 carpaski Exp $ MAJOR CHANGES in 2.0.51: 1. /var/cache/edb/virtuals is no longer used at all. It's calculated now. 2. /var/cache/edb/world is now /var/lib/portage/world. 3. /etc/portage/profile/virtuals is _USER_ configs only. + 15 Nov 2004; Nicholas Jones <carpaski@gentoo.org> portage.py, portage_gpg.py: + Fixes for the gso changes in gpg. Removed the 'virtuals' file handling + which caused an empty file to be recreated. Added XXX marks on potentially + bad calls. + 14 Nov 2004; Brian Harring <ferringb@gentoo.org> spec/emerge.syntax: Bye bye emerge.syntax, we hardly knew ye. @@ -1,7 +1,7 @@ #!/usr/bin/python -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.360 2004/11/14 05:45:57 genone Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.361 2004/11/15 21:42:49 carpaski Exp $ import os,sys os.environ["PORTAGE_CALLER"]="emerge" @@ -2586,6 +2586,7 @@ if myaction in ["sync","rsync","metadata"] and (not "--help" in myopts): if (os.path.exists(cachedir) and os.path.exists(cachedir+"/app-portage")): # removed old style cache. + # XXX: Compat Code, and Potentially bad. portage.spawn("rm -Rf "+cachedir+"/*",portage.settings,free=1) # save timestamp.chk for next timestamp check. diff --git a/pym/portage.py b/pym/portage.py index 3e04e05..afc0fdf 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1,7 +1,7 @@ # portage.py -- core Portage functionality # Copyright 1998-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.559 2004/11/15 05:25:35 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.560 2004/11/15 21:42:49 carpaski Exp $ # =========================================================================== # START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF @@ -2159,7 +2159,6 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea # retval=ebuild.ebuild_handler().process_phase(mydo, mysettings,myebuild,myroot,debug=debug,listonly=listonly,fetchonly=fetchonly,cleanup=cleanup,dbkey=None,use_cache=1,fetchall=0,tree="porttree",allstages=allstages,use_info_env=use_info_env) return retval - expandcache={} @@ -3877,12 +3876,12 @@ class portdbapi(dbapi): self.manifestVerifyLevel = portage_gpg.EXISTS if "strict" in self.mysettings.features: self.manifestVerifyLevel = portage_gpg.MARGINAL - self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel,self.home=mysettings["HOME"]) + self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel) elif "severe" in self.mysettings.features: self.manifestVerifyLevel = portage_gpg.TRUSTED - self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", requireSignedRing=True, minimumTrust=self.manifestVerifyLevel,self.home=mysettings["HOME"]) + self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", requireSignedRing=True, minimumTrust=self.manifestVerifyLevel) else: - self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel,self.home=mysettings["HOME"]) + self.manifestVerifier = portage_gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel) #self.root=settings["PORTDIR"] self.porttree_root = porttree_root @@ -4165,7 +4164,7 @@ class portdbapi(dbapi): elif self.manifestVerifier: if not self.manifestVerifier.verify(myManifestPath): # Verification failed the desired level. - raise portage_exception.UntrustedSignature, "Untrusted Manifest: %(manifest)s" % {"manifest":myManifestPath} + raise portage_exception.UntrustedSignature, "Untrusted/Missing signature on Manifest: %(manifest)s" % {"manifest":myManifestPath} if ("severe" in self.mysettings.features) and \ (mys != portage_gpg.fileStats(myManifestPath)): @@ -6266,8 +6265,6 @@ def do_upgrade(mykey): processed=1 #remove stale virtual entries (mappings for packages that no longer exist) - myvirts=grabdict("/var/cache/edb/virtuals") - update_files={} file_contents={} myxfiles = ["package.mask","package.unmask","package.keywords","package.use"] @@ -6312,13 +6309,6 @@ def do_upgrade(mykey): #update world entries, if any. worldlist[x]=dep_transform(worldlist[x],mysplit[1],mysplit[2]) - #update virtuals: - for myvirt in myvirts.keys(): - for mypos in range(0,len(myvirts[myvirt])): - if myvirts[myvirt][mypos]==mysplit[1]: - #update virtual to new name - myvirts[myvirt][mypos]=mysplit[2] - #update /etc/portage/packages.* for x in file_contents: for mypos in range(0,len(file_contents[x])): @@ -6363,7 +6353,6 @@ def do_upgrade(mykey): for x in worldlist: myworld.write(x+"\n") myworld.close() - writedict(myvirts,"/var/cache/edb/virtuals") print "" exit_callbacks = [] diff --git a/pym/portage_exception.py b/pym/portage_exception.py index 8f9b99f..6598142 100644 --- a/pym/portage_exception.py +++ b/pym/portage_exception.py @@ -1,6 +1,6 @@ # Copyright 1998-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exception.py,v 1.8 2004/10/19 04:58:42 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exception.py,v 1.9 2004/11/15 21:42:50 carpaski Exp $ class PortageException(Exception): """General superclass for portage exceptions""" @@ -9,6 +9,13 @@ class PortageException(Exception): def __str__(self): return repr(self.value) +class UnknownCondition(PortageException): + """Corruption indication""" + def __init__(self,value): + self.value = value[:] + def __str__(self): + return repr(self.value) + class CorruptionError(PortageException): """Corruption indication""" def __init__(self,value): diff --git a/pym/portage_gpg.py b/pym/portage_gpg.py index 43b50bb..2863931 100644 --- a/pym/portage_gpg.py +++ b/pym/portage_gpg.py @@ -1,7 +1,7 @@ # portage_gpg.py -- core Portage functionality # Copyright 2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_gpg.py,v 1.9 2004/11/15 05:22:04 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_gpg.py,v 1.10 2004/11/15 21:42:50 carpaski Exp $ import os import copy @@ -11,10 +11,12 @@ import portage_checksum import portage_exec GPG_BINARY = "/usr/bin/gpg" -GPG_OPTIONS = " --lock-never --no-random-seed-file --no-greeting --no-sig-cache " -GPG_VERIFY_FLAGS = " --verify " -GPG_KEYDIR = " --homedir '%s' " -GPG_KEYRING = " --keyring '%s' " +GPG_OPTIONS = ["--lock-never","--no-random-seed-file", + "--no-greeting", "--no-sig-cache"] +GPG_VERIFY_FLAGS = ["--verify"] + +GPG_KEYDIR = "--homedir" +GPG_KEYRING = "--keyring" UNTRUSTED = 0 EXISTS = UNTRUSTED + 1 @@ -30,21 +32,13 @@ def fileStats(filepath): class FileChecker: - def __init__(self,keydir=None,keyring=None,requireSignedRing=False,minimumTrust=EXISTS,home=None): + def __init__(self,keydir=None,keyring=None,requireSignedRing=False,minimumTrust=EXISTS): self.minimumTrust = TRUSTED # Default we require trust. For rings. self.keydir = None self.keyring = None self.keyringPath = None self.keyringStats = None self.keyringIsTrusted = False - if home==None: - try: - home=os.environ["HOME"] - except KeyError: - import traceback - traceback.print_stack() - raise Exception("no home var specified, and it ain't in the env. we're screwed") - self.home=home if (keydir != None): # Verify that the keydir is valid. @@ -110,17 +104,17 @@ class FileChecker: if not os.path.isfile(filename): raise portage_exception.CommandNotFound, filename - command = GPG_BINARY + GPG_VERIFY_FLAGS + GPG_OPTIONS + command = [GPG_BINARY] + GPG_VERIFY_FLAGS + GPG_OPTIONS if self.keydir: - command += GPG_KEYDIR % (self.keydir) + command += [GPG_KEYDIR] + [self.keydir] if self.keyring: - command += GPG_KEYRING % (self.keyring) + command += [GPG_KEYRING] + [self.keyring] if sigfile: - command += " '"+sigfile+"'" - command += " '"+filename+"'" + command += [sigfile] + command += [filename] - result,output = portage_exec.spawn_get_output(command,raw_exit_code=True,env={"HOME":self.home}) + result,output = portage_exec.spawn_get_output(command,raw_exit_code=True,collect_fds=[1,2]) signal = result & 0xff result = (result >> 8) @@ -129,6 +123,10 @@ class FileChecker: raise SignalCaught, "Signal: %d" % (signal) trustLevel = UNTRUSTED + + if len(output) == 0: + raise portage_exception.UnknownCondition, "GPG generated no output: exited with %d" % (result) + if result == 0: trustLevel = TRUSTED #if output.find("WARNING") != -1: diff --git a/pym/xpak.py b/pym/xpak.py index 20d1c06..d6bb381 100644 --- a/pym/xpak.py +++ b/pym/xpak.py @@ -1,6 +1,6 @@ # Copyright 2001-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/xpak.py,v 1.13 2004/10/11 04:12:02 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/xpak.py,v 1.14 2004/11/15 21:42:50 carpaski Exp $ # The format for a tbz2/xpak: # @@ -239,6 +239,7 @@ class tbz2: if not self.scan(): raise IOError if cleanup and os.path.exists(datadir): + # XXX: Potentially bad os.system("rm -Rf "+datadir+"/*") if not os.path.exists(datadir): os.makedirs(datadir) @@ -261,6 +262,7 @@ class tbz2: myfile.flush() myfile.close() if cleanup: + # XXX: Potentially bad os.system("rm -Rf "+datadir) return 1 |