aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Penders <alain@gentoo.org>2003-03-03 14:58:09 +0000
committerAlain Penders <alain@gentoo.org>2003-03-03 14:58:09 +0000
commit953538122a713048f6a1baae5cb6b55965aa9b7d (patch)
tree3306919d920056ff04f98e1cd16e7b6dd9bacfc4
parentCopied in 1.117 (version after -r8) (diff)
downloadportage-cvs-portage_2_1.tar.gz
portage-cvs-portage_2_1.tar.bz2
portage-cvs-portage_2_1.zip
Merged in changes from 2.0.47-r8portage_2_1
-rwxr-xr-xbin/emerge55
-rwxr-xr-xbin/repoman30
-rw-r--r--pym/portage.py70
3 files changed, 110 insertions, 45 deletions
diff --git a/bin/emerge b/bin/emerge
index 0ba7d29..1aa204c 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1,7 +1,7 @@
#!/usr/bin/env python2.2
# 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.178.2.11 2003/02/25 16:31:39 alain Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.178.2.12 2003/03/03 14:58:09 alain Exp $
import os,sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback
from stat import *
@@ -92,13 +92,16 @@ for x in cmdline:
myopts.append(x)
elif x[2:] in actions:
if x[2:]=="rsync":
- print
- print red("*** --rsync has been deprecated.")
- print red("*** Please use '--sync' instead.")
+ #print
+ #print red("*** --rsync has been deprecated.")
+ #print red("*** Please use '--sync' instead.")
+ x="--sync"
if myaction:
+ if myaction not in ["system", "world"]:
+ myaction="--"+myaction
print
print red("!!!")+green(" Multiple actions requested... Please choose one only.")
- print red("!!!")+" '"+darkgreen("--"+myaction)+"' "+red("or")+" '"+darkgreen(x)+"'"
+ print red("!!!")+" '"+darkgreen(myaction)+"' "+red("or")+" '"+darkgreen(x)+"'"
print
sys.exit(1)
myaction=x[2:]
@@ -106,19 +109,22 @@ for x in cmdline:
print "!!! Error:",x,"is an invalid option."
sys.exit(1)
elif (not myaction) and (x in actions):
- print red("*** Deprecated use of action '"+x+"'")
- if myaction=="rsync":
- print red("*** Please use '--sync' instead.")
- else:
- print red("*** Please use '--"+x+"' instead.")
+ if x not in ["system", "world"]:
+ #print red("*** Deprecated use of action '"+x+"'")
+ if x=="rsync":
+ #print red("*** Please use '--sync' instead.")
+ x="sync"
+ #else:
+ #print red("*** Please use '--"+x+"' instead.")
if myaction:
print
print red("!!!")+green(" Multiple actions requested... Please choose one only.")
- print red("!!! '")+darkgreen("--"+myaction)+"' "+red("or")+" '"+darkgreen("--"+x)+"'"
+ #print red("!!! '")+darkgreen("--"+myaction)+"' "+red("or")+" '"+darkgreen("--"+x)+"'"
+ print red("!!! '")+darkgreen(myaction)+"' "+red("or")+" '"+darkgreen(x)+"'"
print
sys.exit(1)
myaction=x
- elif x[-1]=="/":
+ elif x[-1]=="/":
# this little conditional helps tab completion
myfiles.append(x[:-1])
else:
@@ -1465,6 +1471,7 @@ def post_emerge(retval=0):
procount=procount+1
print " "+yellow("* IMPORTANT:")+"",len(files),"config files in",x,"need updating."
if procount:
+ #print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."
print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."
print
sys.exit(retval)
@@ -1475,7 +1482,7 @@ if "--debug" in myopts:
if myaction in ["sync","rsync"] and (not "--help" in myopts):
if "--pretend" in myopts:
- print "emerge: the \"sync\" and \"rsync\" actions do not support \"--pretend.\""
+ print "emerge: the \"sync\" action does not support \"--pretend.\""
sys.exit(1)
emergelog(" === rsync")
@@ -1486,7 +1493,7 @@ if myaction in ["sync","rsync"] and (not "--help" in myopts):
print ">>>",myportdir,"not found, creating it."
os.makedirs(myportdir,0755)
syncuri=ctx.settings["SYNC"]
- os.umask(022)
+ os.umask(0022)
if syncuri[:8]=="rsync://":
if not os.path.exists("/usr/bin/rsync"):
print "!!! /usr/bin/rsync does not exist, so rsync support is disabled."
@@ -1506,7 +1513,6 @@ if myaction in ["sync","rsync"] and (not "--help" in myopts):
print "!!! RSYNC_EXCLUDEFROM specified, but file does not exist."
mycommand=mycommand+" "+syncuri+"/* "+myportdir
print ">>> starting rsync with "+syncuri+"..."
- #protect users that did not set a default umask
exitcode=portage.spawn(ctx, mycommand,free=1)
#if the exit code of rsync is 12 retry to rsync till
#we have reached RSYNC_RETRIES or the default of 3 retries
@@ -1554,11 +1560,23 @@ if myaction in ["sync","rsync"] and (not "--help" in myopts):
sys.exit(1)
if os.path.exists(myportdir+"/metadata/cache"):
print "\n>>> Updating Portage cache... ",
+ os.umask(0002)
if os.path.exists(ctx.get_cachedir()):
- portage.spawn(ctx, "rm -rf "+ctx.get_cachedir(),free=1)
+ portage.spawn(ctx, "rm -Rf "+ctx.get_cachedir(),free=1)
+ try:
+ os.mkdir(ctx.get_cachedir())
+ os.chown(ctx.get_cachedir(), os.getuid(), ctx.get_portage_gid())
+ os.chmod(ctx.get_cachedir(), 06775)
+ os.umask(002)
+ except:
+ pass
mynodes=ctx.portdb.cp_all()
for x in mynodes:
myxsplit=x.split("/")
+ if not os.path.exists(ctx.get_cachedir()+"/"+myxsplit[0]):
+ os.mkdir(ctx.get_cachedir()+"/"+myxsplit[0])
+ os.chown(ctx.get_cachedir()+"/"+myxsplit[0], os.getuid(), ctx.get_portage_gid())
+ os.chmod(ctx.get_cachedir()+"/"+myxsplit[0], 06775)
mymatches=ctx.portdb.xmatch("match-all",x)
for y in mymatches:
update_spinner()
@@ -1566,6 +1584,7 @@ if myaction in ["sync","rsync"] and (not "--help" in myopts):
ignored=ctx.portdb.aux_get(y,[],metacachedir=myportdir+"/metadata/cache")
except:
pass
+ portage.spawn(ctx, "chmod -R g+rw "+ctx.get_cachedir(), free=1)
sys.stdout.write("\b\b ...done!\n\n")
sys.stdout.flush()
@@ -1602,7 +1621,7 @@ elif myaction=="regen":
elif "config"==myaction:
emergelog(" === config")
print
- print "Currently, \'config\' is a --help option only."
+ print "Currently, \'config\' is a help option only."
print
# INFO action
elif "info"==myaction:
@@ -1659,7 +1678,7 @@ elif "unmerge"==myaction or "prune"==myaction or "clean"==myaction:
elif "depclean"==myaction:
# Kill packages that aren't explicitly merged or are required as a
- # dependancy of another package. World file is explicit.
+ # dependency of another package. World file is explicit.
print
print red("*** WARNING ***")+" : DEPCLEAN CAN SERIOUSLY IMPAIR YOUR SYSTEM. USE CAUTION."
diff --git a/bin/repoman b/bin/repoman
index d838085..b71cdb3 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -2,13 +2,13 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Author: Daniel Robbins <drobbins@gentoo.org>
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.5.2.4 2003/02/25 16:31:39 alain Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.5.2.5 2003/03/03 14:58:09 alain Exp $
# Next to do: dep syntax checking in ebuilds, mask files
# Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems)
# that last one is tricky because multiple profiles need to be checked.
-import os,sys,string,signal,portage,readline
+import os,sys,string,signal,readline,portage
from output import *
exename=os.path.basename(sys.argv[0])
version="1.2"
@@ -129,6 +129,30 @@ try:
myrepofile.close()
except:
err("Error grabbing repository information; exiting.")
+
+try: # Determine if we're in PORTDIR... If not tell portage to accomodate.
+ mydir=os.getcwd()
+ if mydir!=ctx.settings["PORTDIR"][:len(mydir)]:
+ # We're not in the PORTDIR
+ print
+ print darkred("We're not in PORTDIR..."),
+ while mydir!="/":
+ if os.path.exists(mydir+"/profiles/package.mask"):
+ # mydir == a PORTDIR root... We make PORTDIR = mydir.
+ print darkgreen("setting to:")+" "+bold(mydir)
+ os.environ["PORTDIR"]=mydir
+ reload(portage)
+ ctx = portage.PortageContext()
+ break;
+ else:
+ mydir=os.path.normpath(mydir+"/..")
+ if mydir=="/":
+ print darkred("unable to determine a PORTDIR.")
+except Exception, e:
+ print "!!! Error when determining valid(ity of) PORTDIR:"
+ print "!!!",e
+ pass
+
reporoot=None
for x in REPOROOTS:
if myreporoot[0:len(x)]==x:
@@ -274,7 +298,7 @@ for x in scanlist:
stats["ebuild.namenomatch"]=stats["ebuild.namenomatch"]+1
fails["ebuild.namenomatch"].append(x+"/"+y+".ebuild")
try:
- myaux=ctx.db["/"]["porttree"].dbapi.aux_get(catdir+"/"+y,allvars,strict=1)
+ myaux=ctx.db["/"]["porttree"].dbapi.aux_get(catdir+"/"+y,allvars,strict=1)
except KeyError:
stats["ebuild.syntax"]=stats["ebuild.syntax"]+1
fails["ebuild.syntax"].append(x+"/"+y+".ebuild")
diff --git a/pym/portage.py b/pym/portage.py
index adb0cee..f73d457 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1,9 +1,9 @@
# portage.py -- core Portage functionality
# Copyright 1998-2002 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.269.2.17 2003/02/25 16:31:39 alain Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.269.2.18 2003/03/03 14:58:09 alain Exp $
-VERSION="2.1.0_alpha4"
+VERSION="2.1.0_alpha8"
from stat import *
from commands import *
@@ -93,7 +93,8 @@ class PortageContext:
self.profiledir = "/etc/make.profile"
else:
self.profiledir = None
- print ">>> Note: /etc/make.profile/make.defaults isn't available; an 'emerge sync' will probably fix this."
+ print ">>> Note: /etc/make.profile/make.defaults isn't available."
+ print " An 'emerge sync' will probably fix this."
self.logger.info("/etc/make.profile/make.defaults isn't available; an 'emerge sync' will probably fix this.")
#
@@ -1467,7 +1468,11 @@ def doebuild(ctx, myebuild,mydo,myroot,debug=0,listonly=0):
return 1
ctx.settings.reset()
- ctx.settings["PORTAGE_DEBUG"]=str(debug)
+ if ctx.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.
+ ctx.settings["PORTAGE_DEBUG"]=str(ctx.debug)
#ctx.settings["ROOT"]=ctx.getRoot()
ctx.settings["ROOT"]=myroot
ctx.settings["STARTDIR"]=getcwd()
@@ -1534,7 +1539,8 @@ def doebuild(ctx, myebuild,mydo,myroot,debug=0,listonly=0):
# get possible slot information from the deps file
if mydo=="depend":
myso=getstatusoutput("/usr/sbin/ebuild.sh depend")
- if debug:
+ if ctx.settings.has_key("PORTAGE_DEBUG") and ctx.settings["PORTAGE_DEBUG"]=="1":
+ print
print myso[1]
return myso[0]
@@ -1554,13 +1560,26 @@ def doebuild(ctx, myebuild,mydo,myroot,debug=0,listonly=0):
os.chown(ctx.settings["T"],ctx.get_portage_uid(),ctx.get_portage_gid())
os.chmod(ctx.settings["T"],06770)
+ if not os.path.exists(ctx.settings["DISTDIR"]):
+ os.makedirs(ctx.settings["DISTDIR"])
+ if not os.path.exists(ctx.settings["DISTDIR"]+"/cvs-src"):
+ os.makedirs(ctx.settings["DISTDIR"]+"/cvs-src")
+ os.chown(ctx.settings["DISTDIR"]+"/cvs-src",0,ctx.get_portage_gid())
+ os.chmod(ctx.settings["DISTDIR"]+"/cvs-src",06770)
+ spawn("chgrp -R "+str(ctx.get_portage_gid())+" "+ctx.settings["DISTDIR"]+"/cvs-src", free=1)
+ spawn("chmod -R g+rw "+ctx.settings["DISTDIR"]+"/cvs-src", free=1)
+
if (ctx.has_feature("userpriv")) and (ctx.has_feature("ccache")):
if (not ctx.settings.has_key("CCACHE_DIR")) or (ctx.settings["CCACHE_DIR"]==""):
ctx.settings["CCACHE_DIR"]=ctx.settings["PORTAGE_TMPDIR"]+"/ccache"
if not os.path.exists(ctx.settings["CCACHE_DIR"]):
os.makedirs(ctx.settings["CCACHE_DIR"])
- os.chown(ctx.settings["CCACHE_DIR"],ctx.get_portage_uid(),ctx.get_portage_gid())
+ mystat=os.stat(ctx.settings["CCACHE_DIR"])
+ os.chown(ctx.settings["CCACHE_DIR"],ctx.get_portage_uid(),ctx.get_portage_gid())
os.chmod(ctx.settings["CCACHE_DIR"],06770)
+ if mystat[ST_GID]!=ctx.get_portage_gid():
+ spawn("chgrp -R "+str(ctx.get_portage_gid())+" "+ctx.settings["CCACHE_DIR"], free=1)
+ spawn("chmod -R g+rw "+ctx.settings["CCACHE_DIR"], free=1)
if not os.path.exists(ctx.settings["HOME"]):
os.makedirs(ctx.settings["HOME"])
@@ -3063,8 +3082,8 @@ def eclass(ctx, myeclass=None,mycpv=None,mymtime=None):
if myeclass != None:
if not ctx.mtimedb["eclass"].has_key(myeclass):
# Eclass doesn't exist.
- print "!!! eclass does not exist:",myeclass
- return None
+ print "!!! eclass '"+myeclass+"' in '"+myeclass+"' does not exist:"
+ raise KeyError
else:
if (mycpv!=None) and (mymtime!=None):
if mycpv not in ctx.mtimedb["packages"]:
@@ -3136,6 +3155,7 @@ class portdbapi(dbapi):
return myloc
except (OSError,IOError):
pass
+ # XXX Catch invalid names? XXX #
return self.root+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
def aux_get(self,mycpv,mylist,strict=0,metacachedir=None):
@@ -3159,7 +3179,7 @@ class portdbapi(dbapi):
try:
emtime=os.stat(myebuild)[ST_MTIME]
except:
- return None
+ raise KeyError
# first, we take a look at the size of the ebuild/cache entry to ensure we
# have a valid data, then we look at the mtime of the ebuild and the
@@ -3196,9 +3216,9 @@ class portdbapi(dbapi):
else:
if doebuild(self.ctx, myebuild,"depend","/"):
#depend returned non-zero exit code...
- if strict:
- sys.stderr.write(str(red("\naux_get():")+" (0) Error in",mycpv,"ebuild.\n"))
- raise KeyError
+ sys.stderr.write(str(red("\naux_get():")+" (0) Error in "+mycpv+" ebuild.\n"
+ " Check for syntax error or corruption in the ebuild. (--debug)\n\n"))
+ raise KeyError
doregen2=1
dmtime=0
@@ -3231,9 +3251,8 @@ class portdbapi(dbapi):
mylines=mycent.readlines()
mycent.close()
except (IOError, OSError):
- print red("\n\naux_get():")+" (1) couldn't open cache entry for",mycpv
- print " Check for syntax error or corruption in the ebuild."
- print
+ sys.stderr.write(str(red("\naux_get():")+" (1) Error in "+mycpv+" ebuild.\n"
+ " Check for syntax error or corruption in the ebuild. (--debug)\n\n"))
raise KeyError
#We now have the db
@@ -3256,8 +3275,7 @@ class portdbapi(dbapi):
myret=eclass(self.ctx, myeclass,mycpv,dmtime)
#print "eclass '",myeclass,"':",myret,doregen,doregen2
if myret==None:
- print red("\n\naux_get():")+' eclass "'+myeclass+'" from',mydbkey,"not found."
- print "!!! Eclass '"+myeclass+"'not found."
+ # eclass is missing... We'll die if it doesn't get fixed on regen
doregen2=1
break
if myret==0 and not usingmdcache:
@@ -3285,15 +3303,15 @@ class portdbapi(dbapi):
if doebuild(self.ctx, myebuild,"depend","/"):
#depend returned non-zero exit code...
- if strict:
- print red("\n\naux_get():")+" (0) Error in",mycpv,"ebuild."
- raise KeyError
+ sys.stderr.write(str(red("\naux_get():")+" (2) Error in "+mycpv+" ebuild.\n"
+ " Check for syntax error or corruption in the ebuild. (--debug)\n\n"))
+ raise KeyError
try:
os.utime(mydbkey,(emtime,emtime))
mycent=open(mydbkey,"r")
except (IOError, OSError):
- print red("\n\naux_get():")+" (2) couldn't open cache entry for",mycpv
- print " Check for syntax error or corruption in the ebuild."
+ sys.stderr.write(str(red("\naux_get():")+" (3) Error in "+mycpv+" ebuild.\n"
+ " Check for syntax error or corruption in the ebuild. (--debug)\n\n"))
raise KeyError
mylines=mycent.readlines()
mycent.close()
@@ -3314,7 +3332,11 @@ class portdbapi(dbapi):
os.unlink(mydbkey)
sys.exit(1)
for myeclass in myeclasses:
- eclass(self.ctx, myeclass,mycpv,emtime)
+ if eclass(self.ctx, myeclass,mycpv,emtime)==None:
+ # Eclass wasn't found.
+ print red("\n\naux_get():")+' eclass "'+myeclass+'" from',mydbkey,"not found."
+ print "!!! Eclass '"+myeclass+"' not found."
+ sys.exit(1)
try:
for x in range(0,len(self.auxdbkeys)):
self.auxcache[mycpv][self.auxdbkeys[x]]=mylines[x][:-1]
@@ -3518,7 +3540,7 @@ class portdbapi(dbapi):
auxerr=0
try:
myaux=self.ctx.db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS"])
- except (KeyError,IOError):
+ except (KeyError,IOError,TypeError):
return []
if not myaux[0]:
# KEYWORDS=""