diff options
author | Nicholas Jones <carpaski@gentoo.org> | 2003-12-10 22:44:07 +0000 |
---|---|---|
committer | Nicholas Jones <carpaski@gentoo.org> | 2003-12-10 22:44:07 +0000 |
commit | 19dad1c413a665923567d2ca2749aff57b84756c (patch) | |
tree | 1f972ed776bfc163c45e92f325d8e7a3242293c0 | |
parent | Touchups and fixes to messages and warnings. repoman manifest fix. (diff) | |
download | portage-cvs-19dad1c413a665923567d2ca2749aff57b84756c.tar.gz portage-cvs-19dad1c413a665923567d2ca2749aff57b84756c.tar.bz2 portage-cvs-19dad1c413a665923567d2ca2749aff57b84756c.zip |
2.0.50 (internal enhancements and pkg* changes only) candidate.portage_2_0_50_pre1
Fixes for a few random bugs related to lockfiles and unmerging.
-rw-r--r-- | ChangeLog | 23 | ||||
-rwxr-xr-x | bin/chkcontents | 35 | ||||
-rwxr-xr-x | bin/ebuild.sh | 15 | ||||
-rwxr-xr-x | bin/emerge | 76 | ||||
-rwxr-xr-x | bin/repoman | 5 | ||||
-rw-r--r-- | pym/portage.py | 103 |
6 files changed, 167 insertions, 90 deletions
@@ -1,7 +1,26 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.490 2003/12/10 06:00:56 carpaski Exp $ - +# $Id: ChangeLog,v 1.491 2003/12/10 22:44:07 carpaski Exp $ + + 10 Dec 2003; Nicholas Jones <carpaski@gentoo.org> chkcontents: Uses portage + functions to do md5sum calcs. + + 10 Dec 2003; Nicholas Jones <carpaski@gentoo.org> ebuild.sh: Removed try() + as it isn't used, and was deprecated for a long while. Genone's fetching + size display added for --verbose. License display added. Added a little + debug for IUSE so we can figure out the binary package --verbose IUSE + issues that are randomly reported. XXXXXXXXXXXXXXXXXXX's 'buildsyspkg' + patch for building only system packages into tbz2s. Unmerge fix for new + settings instances. RSYNC_RATELIMIT added. + + 10 Dec 2003; Nicholas Jones <carpaski@gentoo.org> portage.py: ADA path + variables added to specials for env_update. Error messaeg correction for + make.defaults syntax errors. Unmerge now uses the environment file, if it + exists, to get the complete environment back to perform unmerge operations. + load_infodir() uses pkg settings completely now. Fixed the passing of + settings in unmerge and dblink. Fixed an issue regarding unlinking lockfiles + while inside of a sandbox. + 09 Dec 2003; Nicholas Jones <carpaski@gentoo.org> ebuild.sh, *.sh: Moved helper scripts into bin/functions and made them sourceable -- they now will die in cases where sub-parts fail. dodoc and keepdir are now diff --git a/bin/chkcontents b/bin/chkcontents index d3841fc..a65cd68 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -1,36 +1,16 @@ #!/usr/bin/python # 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/chkcontents,v 1.8 2003/10/13 07:43:38 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/chkcontents,v 1.9 2003/12/10 22:44:07 carpaski Exp $ # Very simple program to compare the md5sums of a package as listed # in /var/db/pkg/category/package/CONTENTS with the md5sums of the # actual programs on the system (and makes sure that symlinks point to # the right files). -import string, os.path, os -try: - import fchksum - def perform_checksum(filename): return fchksum.fmd5t(filename) -except ImportError: - import md5 - def md5_to_hex(md5sum): - hexform = "" - for ix in xrange(len(md5sum)): - hexform = hexform + "%02x" % ord(md5sum[ix]) - return(string.lower(hexform)) - - def perform_checksum(filename): - f = open(filename, 'rb') - blocksize=32768 - data = f.read(blocksize) - size = 0L - sum = md5.new() - while data: - sum.update(data) - size = size + len(data) - data = f.read(blocksize) - return (md5_to_hex(sum.digest()),size) +import string, os.path, os, sys +sys.path = ["/usr/lib/portage/pym"]+sys.path +import portage def CONTENTScheck(path): try: @@ -53,9 +33,12 @@ def CONTENTScheck(path): if (items[0] == 'obj'): md5stored = string.lower(items[2]) # fchksum.fmdft(file) returns the file's md5sum and the file's size - md5real = string.lower(perform_checksum(items[1])[0]) + md5real = string.lower(portage.perform_checksum(items[1])[0]) if (md5stored != md5real): - print "%s has md5sum of %s instead of %s" % (items[1],md5real, md5stored) + if md5real: + print "%s has md5sum of %s instead of %s" % (items[1], md5real, md5stored) + else: + print "%s is missing!" % items[1] elif (items[0] == 'sym'): link = items[1] target = items[3] diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 2230f35..ad5e5e5 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1,7 +1,7 @@ #!/bin/bash # 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/ebuild.sh,v 1.147 2003/12/10 06:00:56 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.148 2003/12/10 22:44:07 carpaski Exp $ if [ "$*" != "depend" ] && [ "$*" != "clean" ]; then if [ -f ${T}/successful ]; then @@ -420,19 +420,6 @@ pkg_postrm() return } -try() { - env "$@" - if [ "$?" != "0" ] - then - echo - echo '!!! '"ERROR: the $1 command did not complete successfully." - echo '!!! '"(\"$*\")" - echo '!!! '"Since this is a critical task, ebuild will be stopped." - echo - exit 1 - fi -} - # Used to generate the /lib/cpp and /usr/bin/cc wrappers gen_wrapper() { cat > $1 << END @@ -1,13 +1,13 @@ #!/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/emerge,v 1.236 2003/12/10 06:00:56 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.237 2003/12/10 22:44:07 carpaski Exp $ import os,sys os.environ["PORTAGE_CALLER"]="emerge" sys.path = ["/usr/lib/portage/pym"]+sys.path -import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,socket +import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,socket,types from stat import * from output import * @@ -259,6 +259,18 @@ def countdown(secs=5, doing="Starting"): time.sleep(1) print +# formats a size given in bytes nicely +def format_size(mysize): + if type(mysize) != types.IntType: + return mysize + mystr=str(mysize/1024) + mycount=len(mystr) + while (mycount > 3): + mycount-=3 + mystr=mystr[:mycount]+","+mystr[mycount:] + return mystr+" kB" + + def getgccversion(): """ rtype: C{str} @@ -513,7 +525,7 @@ class search: catpack=portage.pkgsplit(match)[0] if full_package: try: - desc, homepage = portage.portdb.aux_get(full_package,["DESCRIPTION","HOMEPAGE"]) + desc, homepage, license = portage.portdb.aux_get(full_package,["DESCRIPTION","HOMEPAGE","LICENSE"]) except KeyError: print "emerge: search: aux_get() failed, skipping" continue @@ -551,6 +563,7 @@ class search: print " ", darkgreen("Size of downloaded files:"),mysum[0] print " ", darkgreen("Homepage:")+" ",homepage print " ", darkgreen("Description:"),desc + print " ", darkgreen("License:")+" ",license print print # @@ -1106,6 +1119,7 @@ class depgraph: changelogs=[] p=[] intree=False + totalsize=0 for x in mylist: fetch=" " @@ -1172,8 +1186,14 @@ class depgraph: myoldbest=blue("["+myoldbest+"]") iuse="" + mysize=0 if "--verbose" in myopts: - iuse_split = string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " ") + try: + iuse_split = string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " ") + except: + portage.writemsg("!!! Error getting IUSE (report this to bugs.gentoo.org)\n") + portage.writemsg("!!! %s\n" % x) + iuse_split = [] iuse_split.sort() for ebuild_iuse in iuse_split: if not ebuild_iuse: @@ -1182,6 +1202,15 @@ class depgraph: iuse=iuse+red("+"+ebuild_iuse)+" " else: iuse=iuse+blue("-"+ebuild_iuse)+" " + if x[0] == "ebuild": + mysize=portage.portdb.getsize(x[2], debug=edebug) + if type(mysize) == types.IntType: + totalsize+=mysize + + if "--verbose" in myopts: + verboseadd=iuse+" "+format_size(mysize) + else: + verboseadd=iuse xs=portage.pkgsplit(x[2]) if xs[2]=="r0": @@ -1215,9 +1244,9 @@ class depgraph: if (oldlp-len(myprint)) > 0: myprint=myprint+" "*(oldlp-len(myprint)) myprint=myprint+myoldbest - myprint=myprint+darkgreen(" to "+x[1])+" "+iuse + myprint=myprint+darkgreen(" to "+x[1])+" "+verboseadd else: - myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+iuse + myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+verboseadd else: if "--columns" in myopts: myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(xs[0]) @@ -1226,12 +1255,12 @@ class depgraph: myprint=myprint+green(" ["+xs[1]+xs[2]+"] ") if (oldlp-len(myprint)) > 0: myprint=myprint+(" "*(oldlp-len(myprint))) - myprint=myprint+myoldbest+" "+iuse + myprint=myprint+myoldbest+" "+verboseadd else: if x[3]=="nomerge": - myprint=darkblue("[nomerge ] "+indent+x[2]+" "+myoldbest+" ")+iuse + myprint=darkblue("[nomerge ] "+indent+x[2]+" "+myoldbest+" ")+verboseadd else: - myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(x[2])+" "+myoldbest+" "+iuse + myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(x[2])+" "+myoldbest+" "+verboseadd p.append(myprint) if ("--tree" not in myopts): @@ -1263,6 +1292,10 @@ class depgraph: for x in p: print x + if "--verbose" in myopts: + print + print "Total size of downloads: "+format_size(totalsize) + if "--changelog" in myopts: print for revision,text in changelogs: @@ -1333,6 +1366,8 @@ class depgraph: if ("--pretend" not in myopts): sys.exit(1) + #buildsyspkg: I need mysysdict also on resume (moved from the else block) + mysysdict=genericdict(syslist) if ("--resume" in myopts): # We're resuming. print green("*** Resuming merge...") @@ -1343,7 +1378,6 @@ class depgraph: else: myfavs=portage.grabfile(portage.root+"var/cache/edb/world") myfavdict=genericdict(myfavs) - mysysdict=genericdict(syslist) for x in range(len(mylist)): if mylist[x][3]!="nomerge": # Add to the mergelist @@ -1384,6 +1418,10 @@ class depgraph: print ">>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+")",x[pkgindex],"to",x[1] emergelog(" >>> emerge ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" to "+x[1]) self.pkgsettings["EMERGE_FROM"] = x[0][:] + #buildsyspkg: Check if we need to _force_ binary package creation + issyspkg = ("buildsyspkg" in myfeat) \ + and mysysdict.has_key(portage.cpv_getkey(x[2])) \ + and not ("--buildpkg" in myopts) if x[0] in ["ebuild","blocks"]: if (x[0]=="blocks") and ("--fetchonly" not in myopts): raise Exception, "Merging a blocker" @@ -1395,7 +1433,11 @@ class depgraph: print returnme=1 continue - elif "--buildpkg" in myopts: + elif "--buildpkg" in myopts or issyspkg: + #buildsyspkg: Sounds useful to display something, but I don't know if we should also log it + if issyspkg: + print ">>> This is a system package, let's pack a rescue tarball." + #emergelog(">>> This is a system package, let's pack a rescue tarball.") #create pkg, then merge pkg emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Cleaning ("+x[pkgindex]+"::"+y+")") retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug) @@ -1519,6 +1561,8 @@ def unmerge(unmerge_action, unmerge_files): candidate_catpkgs=[] global_unmerge=0 + mysettings = portage.config(clone=portage.settings) + if not unmerge_files or "world" in unmerge_files or "system" in unmerge_files: if "unmerge"==unmerge_action: print @@ -1654,8 +1698,8 @@ def unmerge(unmerge_action, unmerge_files): return 0 #the real unmerging begins, after a short delay.... - if portage.settings["CLEAN_DELAY"]: - secs=string.atoi(portage.settings["CLEAN_DELAY"]) + if mysettings["CLEAN_DELAY"]: + secs=string.atoi(mysettings["CLEAN_DELAY"]) else: secs=5 countdown(secs, ">>> Unmerging") @@ -1666,7 +1710,7 @@ def unmerge(unmerge_action, unmerge_files): emergelog("=== Unmerging... ("+y+")") mysplit=string.split(y,"/") #unmerge... - retval=portage.unmerge(mysplit[0],mysplit[1],portage.root,unmerge_action not in ["clean","prune"]) + retval=portage.unmerge(mysplit[0],mysplit[1],portage.root,mysettings,unmerge_action not in ["clean","prune"]) if retval: emergelog(" !!! unmerge FAILURE: "+y) else: @@ -1813,6 +1857,8 @@ if myaction in ["sync","rsync"] and (not "--help" in myopts): rsynccommand=rsynccommand+" --exclude-from "+portage.settings["RSYNC_EXCLUDEFROM"] else: print "!!! RSYNC_EXCLUDEFROM specified, but file does not exist." + if portage.settings.has_key("RSYNC_RATELIMIT"): + rsynccommand = rsynccommand+ " --bwlimit="+portage.settings["RSYNC_RATELIMIT"]+" " servertimestampdir=portage.settings["PORTAGE_TMPDIR"]+"/sync/" @@ -2209,7 +2255,7 @@ else: if ("--resume" in myopts) and portage.mtimedb.has_key("resume"): myresumeopts=portage.mtimedb["resume"]["myopts"][:] if "--skipfirst" in myresumeopts: - del myresumeopts["--skipfirst"] + myresumeopts.remove("--skipfirst") for myopt in myopts: if myopt not in myresumeopts: myresumeopts.append(myopt) diff --git a/bin/repoman b/bin/repoman index edaf3f3..fe66255 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.38 2003/12/10 06:00:56 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.39 2003/12/10 22:44:07 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) @@ -1080,6 +1080,9 @@ else: if "--pretend" in myoptions: print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")" else: + mymsg=open(commitmessagefile,"a") + mymsg.write(" (Manifest recommit)") + mymsg.close() retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile) if retval: print "!!! Exiting on cvs (shell) error code:",retval diff --git a/pym/portage.py b/pym/portage.py index 916ac01..0dc3d4b 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.352 2003/12/10 06:00:57 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.353 2003/12/10 22:44:07 carpaski Exp $ VERSION="2.0.49-r17" @@ -545,7 +545,12 @@ def env_update(makelinks=1): continue pos=pos+1 - specials={"KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[],"INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[],"CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[]} + specials={ + "KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[], + "INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[], + "CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[], + "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[] + } env={} for x in fns: @@ -1022,9 +1027,10 @@ class config: if profiledir: self.mygcfg=getconfig("/etc/make.profile/make.defaults") if self.mygcfg==None: - writemsg("!!! Parse error in /etc/make.defaults. Never modify this file.\n") - writemsg("!!! 'emerge sync' may fix this. If it does not then please report\n") - writemsg("!!! this to bugs.gentoo.org and, if possible, a dev on #gentoo (IRC)\n") + writemsg("!!! Parse error in /etc/make.profile/make.defaults. Never modify this file.\n") + writemsg("!!! 'rm -Rf /usr/portage/profiles; emerge sync' may fix this. If it does\n") + writemsg("!!! not then please report this to bugs.gentoo.org and, if possible, a dev\n") + writemsg("!!! on #gentoo (irc.freenode.org)\n") sys.exit(1) self.configlist.append(self.mygcfg) self.configdict["defaults"]=self.configlist[-1] @@ -1116,8 +1122,11 @@ class config: else: writemsg("No pkg setup for settings instance?\n") sys.exit(17) - + if os.path.exists(infodir): + if os.path.exists(infodir+"/environment"): + self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment" + myre = re.compile('^[A-Z]+$') for filename in listdir(infodir,filesonly=1,EmptyOnError=1): if myre.match(filename): @@ -1125,9 +1134,9 @@ class config: mydata = string.strip(open(infodir+"/"+filename).read()) if len(mydata)<2048: if filename == "USE": - self[filename] = "-* "+mydata + self.configdict["pkg"][filename] = "-* "+mydata else: - self[filename] = mydata + self.configdict["pkg"][filename] = mydata except: writemsg("!!! Unable to read file: %s\n" % infodir+"/"+filename) pass @@ -1803,6 +1812,11 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0): mypv = os.path.basename(ebuild_path)[:-7] mycpv = cat+"/"+mypv + mysplit=pkgsplit(mypv,0) + if mysplit==None: + writemsg("!!! Error: PF is null '%s'; exiting.\n" % mypv) + return 1 + mysettings.reset() mysettings.setcpv(mycpv) @@ -1817,10 +1831,6 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0): writemsg("!!! doebuild: "+str(myebuild)+" not found for "+str(mydo)+"\n") return 1 - if myebuild[-7:]!=".ebuild": - writemsg("!!! doebuild: "+str(myebuild)+" does not appear to be an ebuild file.\n") - return 1 - if debug: # Otherwise it overrides emerge's settings. # We have no other way to set debug... debug can't be passed in # due to how it's coded... Don't overwrite this so we can use it. @@ -1838,11 +1848,6 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0): mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass" mysettings["SANDBOX_LOG"] = mycpv - mysplit=pkgsplit(mysettings["PF"],0) - if mysplit==None: - print "!!! Error: PF is null; exiting." - return 1 - mysettings["P"] = mysplit[0]+"-"+mysplit[1] mysettings["PN"] = mysplit[0] mysettings["PV"] = mysplit[1] @@ -1999,7 +2004,10 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0): return unmerge(mysettings["CATEGORY"],mysettings["PF"],myroot) # if any of these are being called, handle them -- running them out of the sandbox -- and stop now. - if mydo in ["help","clean","setup","prerm","postrm","preinst","postinst","config"]: + if mydo in ["help","clean","setup"]: + return spawn("/usr/sbin/ebuild.sh "+mydo,mysettings,debug,free=1) + elif mydo in ["prerm","postrm","preinst","postinst","config"]: + mysettings.load_infodir(pkg_dir) return spawn("/usr/sbin/ebuild.sh "+mydo,mysettings,debug,free=1) try: @@ -2222,9 +2230,8 @@ def merge(mycat,mypkg,pkgloc,infloc,myroot,mysettings,myebuild=None): mylink=dblink(mycat,mypkg,myroot,mysettings) return mylink.merge(pkgloc,infloc,myroot,myebuild) -def unmerge(cat,pkg,myroot,mytrimworld=1): - tmpsettings = config(clone=settings) - mylink=dblink(cat,pkg,myroot,tmpsettings) +def unmerge(cat,pkg,myroot,mysettings,mytrimworld=1): + mylink=dblink(cat,pkg,myroot,mysettings) if mylink.exists(): mylink.unmerge(trimworld=mytrimworld) mylink.delete() @@ -3378,13 +3385,17 @@ class dbapi: def invalidentry(self, mypath): match = re.search(".*/-MERGING-(.*)",mypath) if match: - writemsg(red("INCOMPLETE MERGE:")+match[0]+"\n") + writemsg(red("INCOMPLETE MERGE:")+mypath+"\n") else: if re.search("portage_lockfile$",mypath): - writemsg("Lockfile removed: %s\n" % mypath) - unlockfile((mypath,None,None)) + if not os.environ.has_key("PORTAGE_MASTER_PID"): + writemsg("Lockfile removed: %s\n" % mypath) + unlockfile((mypath,None,None)) + else: + # Nothing we can do about it. We're probably sandboxed. + pass else: - writemsg("!!! Invalid db entry: %s" % mypath) + writemsg("!!! Invalid db entry: %s\n" % mypath) @@ -3605,7 +3616,7 @@ class vardbapi(dbapi): continue ps=pkgsplit(x) if not ps: - self.dbapi.invalidentry(self.root+"var/db/pkg/"+mysplit[0]+"/"+x) + self.invalidentry(self.root+"var/db/pkg/"+mysplit[0]+"/"+x) continue if len(mysplit) > 1: if ps[0]==mysplit[1]: @@ -3628,7 +3639,7 @@ class vardbapi(dbapi): y = y[1:] mysplit=catpkgsplit(y) if not mysplit: - self.dbapi.invalidentry(self.root+"var/db/pkg/"+x) + self.invalidentry(self.root+"var/db/pkg/"+y) continue mykey=mysplit[0]+"/"+mysplit[1] if not mykey in returnme: @@ -4260,6 +4271,22 @@ class portdbapi(dbapi): returnme.append("") return returnme + def getsize(self,mypkg,debug=0): + # Pull the size of the downloads + mysum=0 + mydigest=self.finddigest(mypkg) + + mymd5s=digestParseFile(mydigest) + if not mymd5s: + if debug: + print "!!! Exception:",e + return "[empty/missing/bad digest]" + for myfile in mymd5s.keys(): + distfile=settings["DISTDIR"]+"/"+myfile + if not os.access(distfile, os.R_OK): + mysum+=int(mymd5s[myfile][1]) + return mysum + def cpv_exists(self,mykey): "Tells us whether an actual ebuild exists on disk (no masking)" cps2=mykey.split("/") @@ -4737,6 +4764,8 @@ class dblink: self.dbdir = self.dbpkgdir self.settings = mysettings + if self.settings==1: + raise ValueError self.myroot=myroot self.updateprotect() @@ -4862,14 +4891,24 @@ class dblink: if not pkgfiles: print "No package files given... Grabbing a set." pkgfiles=self.getcontents() + # Now, don't assume that the name of the ebuild is the same as the # name of the dir; the package may have been moved. myebuildpath=None - mystuff=listdir(self.dbdir,EmptyOnError=1) - for x in mystuff: - if x[-7:]==".ebuild": - myebuildpath=self.dbdir+"/"+x - break + + # We should use the environement file if possible, + # as it has all sourced files already included. + # XXX: Need to ensure it doesn't overwrite any important vars though. + if os.access(self.dbdir+"/environment.bz2", os.R_OK): + spawn("bzip2 -d "+self.dbdir+"/environment.bz2",self.settings,free=1) + + if not myebuildpath: + mystuff=listdir(self.dbdir,EmptyOnError=1) + for x in mystuff: + if x[-7:]==".ebuild": + myebuildpath=self.dbdir+"/"+x + break + #do prerm script if myebuildpath and os.path.exists(myebuildpath): a=doebuild(myebuildpath,"prerm",self.myroot,self.settings) |