summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Jones <carpaski@gentoo.org>2003-04-27 21:16:50 +0000
committerNicholas Jones <carpaski@gentoo.org>2003-04-27 21:16:50 +0000
commit3f004fa56cc5d7b74b9ef60af267d50b0c14c9ad (patch)
tree70886d20efe642847ff6c43fa041ee8457f2a741
parentCorrected a syntax error (diff)
downloadportage-cvs-3f004fa56cc5d7b74b9ef60af267d50b0c14c9ad.tar.gz
portage-cvs-3f004fa56cc5d7b74b9ef60af267d50b0c14c9ad.tar.bz2
portage-cvs-3f004fa56cc5d7b74b9ef60af267d50b0c14c9ad.zip
Almost 48_pre3
Lots of little fixes. Mostly repoman. See ChangeLog
-rw-r--r--ChangeLog58
-rwxr-xr-xbin/dodoc4
-rwxr-xr-xbin/ebuild.sh11
-rwxr-xr-xbin/emerge7
-rwxr-xr-xbin/etc-update4
-rwxr-xr-xbin/prepstrip10
-rwxr-xr-xbin/repoman424
-rw-r--r--pym/cvstree.py25
-rw-r--r--pym/output.py4
-rw-r--r--pym/portage.py159
10 files changed, 447 insertions, 259 deletions
diff --git a/ChangeLog b/ChangeLog
index ac00e43..89ba9d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,56 @@
# ChangeLog for Portage; the Gentoo Linux ports system
# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/ChangeLog,v 1.448 2003/04/09 14:36:59 carpaski Exp $
-
-*portage-2.0.47-r15 (09 Mar 2003): New digests/manifests, touchups.
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/ChangeLog,v 1.449 2003/04/27 21:16:46 carpaski Exp $
+
+ 27 Apr 2003; Nicholas Jones <carpaski@gentoo.org> portage.py: Fix for
+ listdir() running on a non-existant dir -- returns None. Sets generated
+ files to the portage group -- Manifest & digests. Some coloring additions.
+ Handling of 'strict' features added. TEMPORARY addition of 'manifest' USE
+ flag so this can go mainstream now. Fixes in doebuild() to get unmerge
+ working again for ebuild. Debug code added to findname to help figuring
+ out the seemingly random tracebacks -- suspect is pkgsplit(). Unmasking
+ code for package.mask added in -- works just like mask, and can override
+ specific versions or ranges -- One per line: /etc/portage/package.unmask.
+ Security fix for python cPickle code -- mtimedb could create arbitrary
+ execution of code bug. Global update notices/info.
+
+ 27 Apr 2003; Nicholas Jones <carpaski@gentoo.org> cvstree.py: Added in
+ 'removed' status checks.
+
+ 27 Apr 2003; Nicholas Jones <carpaski@gentoo.org> repoman: Added in more
+ cvs checks. /space/cvsroot is now complained about.
+
+ 27 Apr 2003; Nicholas Jones <carpaski@gentoo.org> emerge: Added in
+ PORTAGE_CALLER support to identify it as a 'do_update()' candidate.
+
+ 27 Apr 2003; Nicholas Jones <carpaski@gentoo.org> dodoc: Check sizes to
+ prevent 0 byte files from being added.
+
+ 16 Apr 2003; Nicholas Jones <carpaski@gentoo.org> repoman: Added CVS/Root
+ checks to ensure Manifests will be correct. Fixed local use-flag bug.
+ Commented out the no-stable code, as it can't be implemented well as is.
+
+ 16 Apr 2003; Nicholas Jones <carpaski@gentoo.org> prepstrip: Fixed a
+ problem where files were not being stripped.
+
+ 16 Apr 2003; Nicholas Jones <carpaski@gentoo.org> ebuild.sh: Added in
+ a call to 'make -n' when under the --debug flag.
+
+*portage-2.0.48_pre1 (10 Apr 2003): Digests & Repoman
+
+ 10 Apr 2003; Nicholas Jones <carpaski@gentoo.org> prepstrip: fix it so
+ that it actually strips and provides reasonable info.
+
+ 10 Apr 2003; Nicholas Jones <carpaski@gentoo.org> repoman: Added short
+ option for pretend. Added pretend capability to the majority of the
+ commit code. Bug fix for local IUSE code. Added in support for removed
+ cvs files.
+
+ 10 Apr 2003; Nicholas Jones <carpaski@gentoo.org> portage.py: Changed
+ 'manifest' to 'Manifest'. Removed the requirement that Manifests exist --
+ complain about it, but only die if 'strict' is set.
+
+*portage-2.0.47-r15 (09 Apr 2003): New digests/manifests, touchups.
09 Apr 2003; Nicholas Jones <carpaski@gentoo.org> bin/*: Fixes for Cross-
compiling.
@@ -16,7 +64,7 @@
09 Apr 2003; Nicholas Jones <carpaski@gentoo.org> portage.py: Fixed hole
in the listdir code that occured on cache expiration in the -r14 changes.
-*portage-2.0.47-r14 (09 Mar 2003):
+*portage-2.0.47-r14 (09 Apr 2003):
09 Apr 2003; Nicholas Jones <carpaski@gentoo.org> bin/*: Removed DEBUGBUILD
in favor of FEATURES/RESTRICT settings of nostrip.
@@ -41,7 +89,7 @@
devs and repoman. Added 'PORTAGE_CALLER' env var to prevent repeated
running of unnecessary functions.
-*portage-2.0.47-r13 (02 Mar 2003): Fixes & Security -- Repoman+Digests
+*portage-2.0.47-r13 (02 Apr 2003): Fixes & Security -- Repoman+Digests
02 Apr 2003; Nicholas Jones <carpaski@gentoo.org> emerge: Added debug to
the dep selection code in depgraph.
diff --git a/bin/dodoc b/bin/dodoc
index c35bd10..a81afca 100755
--- a/bin/dodoc
+++ b/bin/dodoc
@@ -1,10 +1,10 @@
#!/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/dodoc,v 1.4 2003/02/22 16:59:08 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/dodoc,v 1.5 2003/04/27 21:16:47 carpaski Exp $
for x in "$@" ; do
- if [ -e "${x}" ] ; then
+ if [ -s "${x}" ] ; then
if [ ! -d "${D}usr/share/doc/${PF}" ] ; then
install -d "${D}usr/share/doc/${PF}"
fi
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 1331fea..7ab9e98 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.123 2003/04/09 14:36:59 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.124 2003/04/27 21:16:47 carpaski Exp $
if [ "$*" != "depend" ] && [ "$*" != "clean" ]; then
if [ -f ${T}/successful ]; then
@@ -308,6 +308,15 @@ econf() {
einstall() {
if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
+ if [ ! -z "${PORTAGE_DEBUG}" ]; then
+ make -n prefix=${D}/usr \
+ datadir=${D}/usr/share \
+ infodir=${D}/usr/share/info \
+ localstatedir=${D}/var/lib \
+ mandir=${D}/usr/share/man \
+ sysconfdir=${D}/etc \
+ "$@" install
+ fi
make prefix=${D}/usr \
datadir=${D}/usr/share \
infodir=${D}/usr/share/info \
diff --git a/bin/emerge b/bin/emerge
index f822c0b..17868f7 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1,9 +1,12 @@
#!/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.206 2003/04/09 12:08:41 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.207 2003/04/27 21:16:48 carpaski Exp $
-import os,sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback,atexit
+import os
+os.environ["PORTAGE_CALLER"]="emerge"
+
+import sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback,atexit
from stat import *
from output import *
if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true"]):
diff --git a/bin/etc-update b/bin/etc-update
index c410358..3b71a86 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -8,7 +8,9 @@
# Leo Lipelis <aeoo@gentoo.org>
# Karl Trygve Kalleberg <karltk@gentoo.org>
#
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/etc-update,v 1.7 2003/03/14 04:26:44 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/etc-update,v 1.8 2003/04/27 21:16:50 carpaski Exp $
+
+export PORTAGE_CALLER="etc-update"
function get_config() {
item=$1
diff --git a/bin/prepstrip b/bin/prepstrip
index 487f452..c3875c8 100755
--- a/bin/prepstrip
+++ b/bin/prepstrip
@@ -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/prepstrip,v 1.10 2003/04/09 14:36:59 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/prepstrip,v 1.11 2003/04/27 21:16:50 carpaski Exp $
if [ "${FEATURES//*nostrip*/tree}" == "true" ] || [ "${RESTRICT//*nostrip*/true}" == "true" ] ; then
echo "nostrip"
@@ -14,20 +14,20 @@ else
STRIP=strip
fi
-echo -n "strip: "
+echo "strip: "
for x in "$@"; do # "$@" quotes each element... Plays nice with spaces.
if [ -d "${x}" ]; then
# We only want files. So make a pass for each directory and call again.
- find "${x}" -type f \( -perm +0111 -or -regex '\.so$|\.so\.' \) |
+ find "${x}" -type f \( -perm +0111 -or -regex '\.so$|\.so\.' \) -print0 |
xargs -0 -r -n500 prepstrip
else
f=$(file "${x}")
if [ -z "${f/*SB executable*/}" ]; then
- echo -n "${x}"
+ echo " ${x}"
${STRIP} "${x}"
fi
if [ -z "${f/*SB shared object*/}" ]; then
- echo -n "${x}"
+ echo " ${x}"
${STRIP} --strip-debug "${x}"
fi
fi
diff --git a/bin/repoman b/bin/repoman
index 9cc3a2a..270f602 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1,7 +1,7 @@
#!/usr/bin/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/repoman,v 1.22 2003/04/09 14:36:59 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/repoman,v 1.23 2003/04/27 21:16:50 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)
@@ -38,7 +38,7 @@ modeshelp={
"commit":"Scan current directory tree for QA issues; if OK, commit via cvs"
}
options=["--pretend","--help","--commitmsg","--commitmsgfile"]
-shortoptions={"-m":"--commitmsg","-M":"--commitmsgfile"}
+shortoptions={"-m":"--commitmsg","-M":"--commitmsgfile","-p":"--pretend"}
optionshelp={
"--pretend":"Don't actually perform commit or fix steps; just show what would be done.",
"--help" :"Show this screen",
@@ -200,9 +200,35 @@ try:
myrepofile=open("CVS/Repository")
myreporoot=myrepofile.readline()[:-1]
myrepofile.close()
+ myrepofile=open("CVS/Root")
+ myreporootpath=string.split(myrepofile.readline()[:-1], ":")[-1]
+ myrepofile.close()
except:
err("Error grabbing repository information; exiting.")
+if myreporootpath=="/space/cvsroot":
+ print
+ print
+ print red("You're using the wrong cvsroot. For Manifests to be correct, you must")
+ print red("use the same base cvsroot path that the servers use. Please try the")
+ print red("following script to remedy this:")
+ print
+ print "cd my_cvs_tree"
+ print
+ print "rm -Rf [a-z]*"
+ print "cvs up"
+ print
+ print "find ./ -type f -regex '.*/CVS/Root$' -print0 | xargs -0r sed \\"
+ print " -i 's:/space/cvsroot$:/home/cvsroot:'"
+ print
+ print red("You must clear and re-update your tree as all header tags will cause")
+ print red("problems in manifests for all rsync and /home/cvsroot users.")
+ print
+ print "You should do this to any other gentoo trees your have as well,"
+ print "excluding the deletions. 'gentoo-src' should be /home/cvsroot."
+ print
+ sys.exit(123)
+
try: # Determine if we're in PORTDIR... If not tell portage to accomodate.
mydir=os.getcwd()
if portage.settings["PORTDIR"][-1]!="/":
@@ -258,7 +284,7 @@ try:
for mypos in range(0,len(mylist)):
mysplit=mylist[mypos].split()[0]
myuse=string.split(mysplit,":")
- if myuse==2:
+ if len(myuse)==2:
luselist.append(myuse[1])
except:
err("Couldn't read from use.local.desc")
@@ -492,9 +518,10 @@ for x in scanlist:
fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey)
# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
- if not portage.portdb.xmatch("bestmatch-visible",x):
- stats["ebuild.nostable"]+=1
- fails["ebuild.nostable"].append(x)
+ # XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.
+ #if not portage.portdb.xmatch("bestmatch-visible",x):
+ # stats["ebuild.nostable"]+=1
+ # fails["ebuild.nostable"].append(x)
if not portage.portdb.xmatch("list-visible",x):
stats["ebuild.allmasked"]+=1
fails["ebuild.allmasked"].append(x)
@@ -564,215 +591,234 @@ else:
print turquoise("Please fix these important QA issues first.")
print green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n"
sys.exit(1)
+
if "--pretend" in myoptions:
- print
- retval=os.system("/usr/bin/cvs -qn update")
- print
- print "Dry-run cvs update complete."
print green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n"
- else:
- if fails["digest.missing"]:
- print green("Creating missing digests...")
- for x in fails["digest.missing"]:
- xs=string.split(x,"/")
- del xs[-2]
- myeb=string.join(xs[:-1],"/")+"/"+xs[-1][7:]
+ if fails["digest.missing"]:
+ print green("Creating missing digests...")
+ for x in fails["digest.missing"]:
+ xs=string.split(x,"/")
+ del xs[-2]
+ myeb=string.join(xs[:-1],"/")+"/"+xs[-1][7:]
+ if "--pretend" in myoptions:
+ print "(ebuild "+portage.settings["PORTDIR"]+"/"+myeb+".ebuild digest)"
+ else:
os.system("ebuild "+portage.settings["PORTDIR"]+"/"+myeb+".ebuild digest")
- mycvstree=cvstree.getentries("./",recursive=1)
- if not mycvstree:
- print "!!! It seems we don't have a cvs tree?"
- sys.exit(3)
-
- myunadded=cvstree.findunadded(mycvstree,recursive=1,basedir="./")
- myautoadd=[]
- if myunadded:
- for x in range(len(myunadded)-1,-1,-1):
- xs=string.split(myunadded[x],"/")
- if xs[-1]=="manifest":
- # It's a manifest... auto add
- myautoadd+=[myunadded[x]]
- del myunadded[x]
- elif len(xs[-1])>=7:
- if xs[-1][:7]=="digest-":
- del xs[-2]
- myeb=string.join(xs[:-1]+[xs[-1][7:]],"/")+".ebuild"
- if os.path.exists(myeb):
- # Ebuild exists for digest... So autoadd it.
- myautoadd+=[myunadded[x]]
- del myunadded[x]
+ mycvstree=cvstree.getentries("./",recursive=1)
+ if not mycvstree:
+ print "!!! It seems we don't have a cvs tree?"
+ sys.exit(3)
+
+ myunadded=cvstree.findunadded(mycvstree,recursive=1,basedir="./")
+ myautoadd=[]
+ if myunadded:
+ for x in range(len(myunadded)-1,-1,-1):
+ xs=string.split(myunadded[x],"/")
+ if xs[-1]=="Manifest":
+ # It's a manifest... auto add
+ myautoadd+=[myunadded[x]]
+ del myunadded[x]
+ elif len(xs[-1])>=7:
+ if xs[-1][:7]=="digest-":
+ del xs[-2]
+ myeb=string.join(xs[:-1]+[xs[-1][7:]],"/")+".ebuild"
+ if os.path.exists(myeb):
+ # Ebuild exists for digest... So autoadd it.
+ myautoadd+=[myunadded[x]]
+ del myunadded[x]
-
- if myautoadd:
- print ">>> Auto-Adding missing digests..."
+ if myautoadd:
+ print ">>> Auto-Adding missing digests..."
+ if "--pretend" in myoptions:
+ print "(/usr/bin/cvs add "+string.join(myautoadd)+")"
+ retval=0
+ else:
retval=os.system("/usr/bin/cvs add "+string.join(myautoadd))
- if retval:
- print "!!! Exiting on cvs (shell) error code:",retval
- sys.exit(retval)
-
+ if retval:
+ print "!!! Exiting on cvs (shell) error code:",retval
+ sys.exit(retval)
- if myunadded:
- print red("!!! The following files are in your cvs tree but are not added to the master")
- print red("!!! tree. Please remove them from the cvs tree or add them to the master tree.")
- for x in myunadded:
- print " ",x
- print
- print
- sys.exit(1)
+ if myunadded:
+ print red("!!! The following files are in your cvs tree but are not added to the master")
+ print red("!!! tree. Please remove them from the cvs tree or add them to the master tree.")
+ for x in myunadded:
+ print " ",x
+ print
+ print
+ sys.exit(1)
- mymissing=cvstree.findmissing(mycvstree,recursive=1,basedir="./")
- if mymissing:
- print "The following files are obviously missing from your cvs tree"
- print "and are being fetched so we can continue:"
- for x in mymissing:
- print " ",x
+ mymissing=cvstree.findmissing(mycvstree,recursive=1,basedir="./")
+ if mymissing:
+ print "The following files are obviously missing from your cvs tree"
+ print "and are being fetched so we can continue:"
+ for x in mymissing:
+ print " ",x
+ if "--pretend" in myoptions:
+ print "(/usr/bin/cvs -q up "+string.join(mymissing)+")"
+ retval=0
+ else:
retval=os.system("/usr/bin/cvs -q up "+string.join(mymissing))
- if retval:
- print "!!! Exiting on cvs (shell) error code:",retval
- sys.exit(retval)
- del mymissing
+ if retval:
+ print "!!! Exiting on cvs (shell) error code:",retval
+ sys.exit(retval)
+ del mymissing
- print "Performing a "+green("cvs -n up")+" with a little magic grep to check for updates."
- retval=getstatusoutput("/usr/bin/cvs -n up 2>&1 | egrep '^[^\?] .*' | egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'")
+ print "Performing a "+green("cvs -n up")+" with a little magic grep to check for updates."
+ retval=getstatusoutput("/usr/bin/cvs -n up 2>&1 | egrep '^[^\?] .*' | egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'")
- mylines=string.split(retval[1], "\n")
- myupdates=[]
- for x in mylines:
- if not x:
- continue
- if x[0] not in "UPMA": # Updates,Patches,Modified,Added
- print red("!!! Please fix the following issues reported from cvs: ")+green("(U and P are ok)")
- print red("!!! Note: This is a pretend/no-modify pass...")
- print retval[1]
- print
- sys.exit(1)
- elif x[0] in ["U","P"]:
- myupdates+=[x[2:]]
-
- if myupdates:
- print green("Fetching trivial updates...")
- retval=os.system("/usr/bin/cvs up "+string.join(myupdates))
- if retval!=0:
- print "!!! cvs exited with an error. Terminating."
- sys.exit(retval)
-
- mycvstree=cvstree.getentries("./",recursive=1)
- mychanged=cvstree.findchanged(mycvstree,recursive=1,basedir="./")
- mynew=cvstree.findnew(mycvstree,recursive=1,basedir="./")
- if not (mychanged or mynew):
- print
- print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"\n"
- print
- print "(Didn't find any changed files...)"
+ mylines=string.split(retval[1], "\n")
+ myupdates=[]
+ for x in mylines:
+ if not x:
+ continue
+ if x[0] not in "UPMAR": # Updates,Patches,Modified,Added,Removed
+ print red("!!! Please fix the following issues reported from cvs: ")+green("(U and P are ok)")
+ print red("!!! Note: This is a pretend/no-modify pass...")
+ print retval[1]
print
- sys.exit(0)
-
- myupdates=mychanged+mynew
- myheaders=[]
- mydirty=[]
- headerstring="'\$(Header|Id)"
- headerstring+=".*\$'"
- for myfile in myupdates:
- myout=getstatusoutput("egrep -q "+headerstring+" "+myfile)
- if myout[0]==0:
- myheaders.append(myfile)
-
- print "*",green(str(len(myupdates))),"files being committed...",green(str(len(myheaders))),"have headers that will change."
- print "*","Files with headers will cause the manifests to be made and recommited."
- print "myupdates:",myupdates
- print "myheaders:",myheaders
- print
- unlinkfile=0
- if not (commitmessage or commitmessagefile):
- print "Please enter a CVS commit message at the prompt:"
- try:
- commitmessage=raw_input(green("> "))
- except KeyboardInterrupt:
- exithandler()
- if not commitmessagefile:
- unlinkfile=1
- commitmessagefile="/tmp/.repoman.msg"
- mymsg=open(commitmessagefile,"w")
- mymsg.write(commitmessage)
- mymsg.close()
-
- try:
- mymsg=open(commitmessagefile,"r")
- commitmessage=mymsg.read()
- mymsg.close()
- except Exception,e:
- print "!!! Failed to open commit message file."
- print "!!!",e
sys.exit(1)
+ elif x[0] in ["U","P"]:
+ myupdates+=[x[2:]]
+
+ if myupdates:
+ print green("Fetching trivial updates...")
+ if "--pretend" in myoptions:
+ print "(/usr/bin/cvs up "+string.join(myupdates)+")"
+ retval=0
+ else:
+ retval=os.system("/usr/bin/cvs up "+string.join(myupdates))
+ if retval!=0:
+ print "!!! cvs exited with an error. Terminating."
+ sys.exit(retval)
+
+ mycvstree=cvstree.getentries("./",recursive=1)
+ mychanged=cvstree.findchanged(mycvstree,recursive=1,basedir="./")
+ mynew=cvstree.findnew(mycvstree,recursive=1,basedir="./")
+ myremoved=cvstree.findremoved(mycvstree,recursive=1,basedir="./")
+ if not (mychanged or mynew or myremoved):
print
- print green("Using commit message:")
- print green("------------------------------------------------------------------------------")
- print commitmessage
- print green("------------------------------------------------------------------------------")
+ print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"\n"
print
+ print "(Didn't find any changed files...)"
+ print
+ sys.exit(0)
+
+ myupdates=mychanged+mynew
+ myheaders=[]
+ mydirty=[]
+ headerstring="'\$(Header|Id)"
+ headerstring+=".*\$'"
+ for myfile in myupdates:
+ myout=getstatusoutput("egrep -q "+headerstring+" "+myfile)
+ if myout[0]==0:
+ myheaders.append(myfile)
+
+ print "*",green(str(len(myupdates))),"files being committed...",green(str(len(myheaders))),"have headers that will change."
+ print "*","Files with headers will cause the manifests to be made and recommited."
+ print "myupdates:",myupdates
+ print "myheaders:",myheaders
+ print
+ unlinkfile=0
+ if not (commitmessage or commitmessagefile):
+ print "Please enter a CVS commit message at the prompt:"
+ try:
+ commitmessage=raw_input(green("> "))
+ except KeyboardInterrupt:
+ exithandler()
+ if not commitmessagefile:
+ unlinkfile=1
+ commitmessagefile="/tmp/.repoman.msg"
+ mymsg=open(commitmessagefile,"w")
+ mymsg.write(commitmessage)
+ mymsg.close()
- retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile)
- if retval:
- print "!!! Exiting on cvs (shell) error code:",retval
- sys.exit(retval)
+ try:
+ mymsg=open(commitmessagefile,"r")
+ commitmessage=mymsg.read()
+ mymsg.close()
+ except Exception,e:
+ print "!!! Failed to open commit message file."
+ print "!!!",e
+ sys.exit(1)
+ print
+ print green("Using commit message:")
+ print green("------------------------------------------------------------------------------")
+ print commitmessage
+ print green("------------------------------------------------------------------------------")
+ print
- mychanges=[]
- if myheaders:
- mydone=[]
- if repolevel==3: # In a package dir
- portage.settings["O"]="./"
+ if "--pretend" in myoptions:
+ print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")"
+ retval=0
+ else:
+ retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile)
+ if retval:
+ print "!!! Exiting on cvs (shell) error code:",retval
+ sys.exit(retval)
+
+ mychanges=[]
+ if myheaders or myremoved or mynew:
+ myfiles=myheaders+myremoved+mynew
+ mydone=[]
+ if repolevel==3: # In a package dir
+ portage.settings["O"]="./"
+ portage.digestgen([],manifestonly=1)
+ elif repolevel==2: # In a category dir
+ for x in myfiles:
+ xs=string.split(x,"/")
+ if xs[0]==".":
+ xs=xs[1:]
+ if xs[0] in mydone:
+ continue
+ mydone.append(xs[0])
+ portage.settings["O"]="./"+xs[0]
portage.digestgen([],manifestonly=1)
- elif repolevel==2: # In a category dir
- for x in myheaders:
- xs=string.split(x,"/")
- if xs[0]==".":
- xs=xs[1:]
- if xs[0] in mydone:
- continue
- mydone.append(xs[0])
- portage.settings["O"]="./"+xs[0]
- portage.digestgen([],manifestonly=1)
- elif repolevel==1: # repo-cvsroot
- print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
- for x in myheaders:
- xs=string.split(x,"/")
- if xs[0]==".":
- xs=xs[1:]
- if string.join(xs[:2],"/") in mydone:
- continue
- mydone.append(string.join(xs[:2],"/"))
- portage.settings["O"]="./"+string.join(xs[:2],"/")
- portage.digestgen([],manifestonly=1)
- else:
- print red("I'm confused... I don't know where I am!")
- sys.exit(1)
+ elif repolevel==1: # repo-cvsroot
+ print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
+ for x in myfiles:
+ xs=string.split(x,"/")
+ if xs[0]==".":
+ xs=xs[1:]
+ if string.join(xs[:2],"/") in mydone:
+ continue
+ mydone.append(string.join(xs[:2],"/"))
+ portage.settings["O"]="./"+string.join(xs[:2],"/")
+ portage.digestgen([],manifestonly=1)
+ else:
+ print red("I'm confused... I don't know where I am!")
+ sys.exit(1)
- mysigs=[]
- for x in mychanges:
- print "redigest:",x
+ mysigs=[]
+ for x in mychanges:
+ if "--pretend" in myoptions:
+ print "(/usr/sbin/ebuild "+x+".ebuild digest)"
+ else:
os.system("/usr/sbin/ebuild "+x+".ebuild digest")
- y = string.split(x,"/")
- if "sign" in portage.features:
- gpgcmd="gpg -ab --yes "+portage.settings["GPG_OPTIONS"]+" "
- sigfile=y[:-1]+"/files/digest-"+y[-1]
- os.system(gpgcmd+sigfile)
- mysigs+=[sigfile]
-
+ y = string.split(x,"/")
if "sign" in portage.features:
- if os.system("/usr/bin/cvs -q add "+string.join(mysigs)):
- print red("!!! Seem to have had a problem adding the signatures...")
+ gpgcmd="gpg -ab --yes "+portage.settings["GPG_OPTIONS"]+" "
+ sigfile=y[:-1]+"/files/digest-"+y[-1]
+ os.system(gpgcmd+sigfile)
+ mysigs+=[sigfile]
+
+ if "sign" in portage.features:
+ if os.system("/usr/bin/cvs -q add "+string.join(mysigs)):
+ print red("!!! Seem to have had a problem adding the signatures...")
+ if "--pretend" in myoptions:
+ print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")"
+ else:
retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile)
if retval:
print "!!! Exiting on cvs (shell) error code:",retval
sys.exit(retval)
-
- if unlinkfile:
- os.unlink(commitmessagefile)
- print
- print "CVS commit complete."
- print green("RepoMan sez:"), "\"If everyone were like you, I'd be out of business!\"\n"
- sys.exit(retval)
+
+ if unlinkfile:
+ os.unlink(commitmessagefile)
+ print
+ print "CVS commit complete."
+ print green("RepoMan sez:"), "\"If everyone were like you, I'd be out of business!\"\n"
sys.exit(0)
diff --git a/pym/cvstree.py b/pym/cvstree.py
index ef4ba6b..fa5bf89 100644
--- a/pym/cvstree.py
+++ b/pym/cvstree.py
@@ -1,7 +1,7 @@
# cvstree.py -- cvs tree utilities
# Copyright 1998-2003 Gentoo Technologies, Inc.
# Distributed under the GNU Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.2 2003/04/09 12:08:41 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.3 2003/04/27 21:16:50 carpaski Exp $
import string,os,time,sys
from stat import *
@@ -86,7 +86,8 @@ def findmissing(entries,recursive=0,basedir=""):
for myfile in entries["files"].keys():
if "cvs" in entries["files"][myfile]["status"]:
if "exists" not in entries["files"][myfile]["status"]:
- mylist.append(basedir+myfile)
+ if "removed" not in entries["files"][myfile]["status"]:
+ mylist.append(basedir+myfile)
if recursive:
for mydir in entries["dirs"].keys():
mylist+=findmissing(entries["dirs"][mydir],recursive,basedir+mydir)
@@ -108,6 +109,21 @@ def findunadded(entries,recursive=0,basedir=""):
mylist+=findunadded(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
+def findremoved(entries,recursive=0,basedir=""):
+ """(entries,recursive=0,basedir="")
+ Recurses the entries tree to find all elements that are in flagged for cvs
+ deletions. Returns a list of paths, optionally prepended with a basedir."""
+ if basedir and basedir[-1]!="/":
+ basedir=basedir+"/"
+ mylist=[]
+ for myfile in entries["files"].keys():
+ if "removed" in entries["files"][myfile]["status"]:
+ mylist.append(basedir+myfile)
+ if recursive:
+ for mydir in entries["dirs"].keys():
+ mylist+=findremoved(entries["dirs"][mydir],recursive,basedir+mydir)
+ return mylist
+
def findall(entries, recursive=0, basedir=""):
"""(entries,recursive=0,basedir="")
Recurses the entries tree to find all new, changed, missing, and unadded
@@ -119,7 +135,8 @@ def findall(entries, recursive=0, basedir=""):
mychanged = findchanged(entries,recursive,basedir)
mymissing = findmissing(entries,recursive,basedir)
myunadded = findunadded(entries,recursive,basedir)
- return [mynew, mychanged, mymissing, myunadded]
+ myremoved = findremoved(entries,recursive,basedir)
+ return [mynew, mychanged, mymissing, myunadded, myremoved]
def getentries(mydir,recursive=0):
"""(basedir,recursive=0)
@@ -168,6 +185,8 @@ def getentries(mydir,recursive=0):
entries["files"][mysplit[1]]["flags"]=mysplit[4]
entries["files"][mysplit[1]]["tags"]=mysplit[5]
entries["files"][mysplit[1]]["status"]=["cvs"]
+ if entries["files"][mysplit[1]]["revision"][0]=="-":
+ entries["files"][mysplit[1]]["status"]+=["removed"]
for file in os.listdir(mydir):
if file=="CVS":
continue
diff --git a/pym/output.py b/pym/output.py
index 1b0e744..43d6c15 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -1,6 +1,6 @@
-# Copyright 1998-2002 Daniel Robbins, Gentoo Technologies, Inc.
+# 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/output.py,v 1.14 2003/03/23 00:13:27 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/output.py,v 1.15 2003/04/27 21:16:50 carpaski Exp $
import os
diff --git a/pym/portage.py b/pym/portage.py
index bdbfb2b..71d7936 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.
+# 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.315 2003/04/09 14:36:59 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.316 2003/04/27 21:16:50 carpaski Exp $
-VERSION="2.0.47-r13"
+VERSION="2.0.48_pre4"
from stat import *
from commands import *
@@ -83,7 +83,10 @@ def listdir(mypath,recursive=0,filesonly=0,ignorecvs=0,ignorelist=[]):
cached_mtime, list, ftype = dircache[mypath]
else:
cached_mtime, list, ftype = -1, [], []
- mtime = os.stat(mypath)[ST_MTIME]
+ if os.path.isdir(mypath):
+ mtime = os.stat(mypath)[ST_MTIME]
+ else:
+ return None
if mtime != cached_mtime:
list = os.listdir(mypath)
ftype = []
@@ -1196,7 +1199,7 @@ def digestgen(myarchives,overwrite=1,manifestonly=0):
# portage files -- p(ortagefiles)basedir
pbasedir=settings["O"]+"/"
- manifestfn=pbasedir+"manifest"
+ manifestfn=pbasedir+"Manifest"
if not manifestonly:
if not os.path.isdir(settings["FILESDIR"]):
@@ -1226,11 +1229,16 @@ def digestgen(myarchives,overwrite=1,manifestonly=0):
mysize=mydigests[myarchive][1]
outfile.write("MD5 "+mymd5+" "+myarchive+" "+str(mysize)+"\n")
outfile.close()
+ try:
+ os.chown(digestfn,os.getuid(),portage_gid)
+ os.chmod(digestfn,0664)
+ except Exception,e:
+ print e
print green(">>> Generating manifest file...")
mypfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1)
- if "manifest" in mypfiles:
- del mypfiles[mypfiles.index("manifest")]
+ if "Manifest" in mypfiles:
+ del mypfiles[mypfiles.index("Manifest")]
mydigests=digestCreate(mypfiles, pbasedir)
if mydigests==None: # There was a problem, exit with an errorcode.
@@ -1247,6 +1255,11 @@ def digestgen(myarchives,overwrite=1,manifestonly=0):
mysize=mydigests[mypfile][1]
outfile.write("MD5 "+mymd5+" "+mypfile+" "+str(mysize)+"\n")
outfile.close()
+ try:
+ os.chown(manifestfn,os.getuid(),portage_gid)
+ os.chmod(manifestfn,0664)
+ except Exception,e:
+ print e
if "cvs" in features:
mycvstree=cvstree.getentries(pbasedir, recursive=1)
@@ -1297,11 +1310,12 @@ def digestCheckFiles(myfiles, mydigests, basedir, note=""):
"""
for x in myfiles:
if not mydigests.has_key(x):
- print "!!! No message digest entry found for file \""+x+".\""
+ print
+ print red("!!! No message digest entry found for file \""+x+".\"")
print "!!! Most likely a temporary problem. Try 'emerge rsync' again later."
print "!!! If you are certain of the authenticity of the file then you may type"
print "!!! the following to generate a new digest:"
- print "!!! ebuild /usr/portage/category/package/package-version.ebuild digest"
+ print "!!! ebuild /usr/portage/category/package/package-version.ebuild digest"
return 0
myfile=basedir+"/"+x
if not os.path.exists(myfile):
@@ -1312,9 +1326,10 @@ def digestCheckFiles(myfiles, mydigests, basedir, note=""):
mymd5=perform_md5(myfile)
if mymd5 != mydigests[x][0]:
print
- print red("!!! A file is corrupt or incomplete. (Digests do not match)")
+ print red("!!! File is corrupt or incomplete. (Digests do not match)")
print green(">>> our recorded digest:"),mydigests[x][0]
print green(">>> your file's digest:"),mymd5
+ print red("!!! File does not exist:"),myfile
print
return 0
else:
@@ -1331,49 +1346,62 @@ def digestcheck(myfiles,strict=0):
# portage files -- p(ortagefiles)basedir
pbasedir=settings["O"]+"/"
- manifestfn=pbasedir+"manifest"
+ manifestfn=pbasedir+"Manifest"
if not (os.path.exists(digestfn) and os.path.exists(manifestfn)):
if "digest" in features:
- print ">>> No package digest/manifest file found."
+ print ">>> No package digest/Manifest file found."
print ">>> \"digest\" mode enabled; auto-generating new digest..."
return digestgen(myfiles)
else:
+ if not os.path.exists(manifestfn):
+ if strict:
+ print red("!!! No package manifest found:"),manifestfn
+ return 0
+ else:
+ print "--- No package manifest found:",manifestfn
if not os.path.exists(digestfn):
print "!!! No package digest file found:",digestfn
- if not os.path.exists(manifestfn):
- print "!!! No package manifest file found:",manifestfn
- print "!!! Type \"ebuild foo.ebuild digest\" to generate it/them."
- return 0
+ print "!!! Type \"ebuild foo.ebuild digest\" to generate it."
+ return 0
mydigests=digestParseFile(digestfn)
if mydigests==None:
print "!!! Failed to parse digest file:",digestfn
return 0
mymdigests=digestParseFile(manifestfn)
- if mymdigests==None:
- print "!!! Failed to parse manifest file:",manifestfn
- return 0
-
- # Check the portage-related files here.
- mymfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1)
- for x in range(len(mymfiles)-1,-1,-1):
- if mymfiles[x]=='manifest': # We don't want the manifest in out list.
- del mymfiles[x]
- continue
- if mymfiles[x] not in mymdigests.keys():
- print "!!! Security Violation: A file exists that is not in the manifest."
- print "!!! File:",mymfile[x]
+ if "manifest" not in features:
+ # XXX: Remove this when manifests become mainstream.
+ pass
+ elif mymdigests==None:
+ print "!!! Failed to parse manifest file:",manifestfn
if strict:
return 0
+ else:
+ # Check the portage-related files here.
+ mymfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1)
+ for x in range(len(mymfiles)-1,-1,-1):
+ if mymfiles[x]=='Manifest': # We don't want the manifest in out list.
+ del mymfiles[x]
+ continue
+ if mymfiles[x] not in mymdigests.keys():
+ print red("!!! Security Violation: A file exists that is not in the manifest.")
+ print "!!! File:",mymfiles[x]
+ if strict:
+ return 0
- if not digestCheckFiles(mymfiles, mymdigests, pbasedir, "manifest"):
- print ">>> Please ensure you have sync'd properly. Please try '"+bold("emerge sync")+"' and"
- print ">>> optionally examine the file(s) for corruption. "+bold("A sync will fix most cases.")
- return 0
+ if not digestCheckFiles(mymfiles, mymdigests, pbasedir, "files "):
+ if strict:
+ print ">>> Please ensure you have sync'd properly. Please try '"+bold("emerge sync")+"' and"
+ print ">>> optionally examine the file(s) for corruption. "+bold("A sync will fix most cases.")
+ print
+ return 0
+ else:
+ print "--- Manifest check failed. 'strict' not enabled; ignoring."
+ print
# Just return the status, as it's the last check.
- return digestCheckFiles(myfiles, mydigests, basedir, "tarballs")
+ return digestCheckFiles(myfiles, mydigests, basedir, "src_uri")
# parse actionmap to spawn ebuild with the appropriate args
def spawnebuild(mydo,actionmap,debug,alwaysdep=0):
@@ -1387,14 +1415,15 @@ def spawnebuild(mydo,actionmap,debug,alwaysdep=0):
mycommand="/usr/sbin/ebuild.sh "
return spawn(mycommand + mydo,debug,
actionmap[mydo]["args"][0],
- actionmap[mydo]["args"][1]
- )
+ actionmap[mydo]["args"][1])
def doebuild(myebuild,mydo,myroot,debug=0,listonly=0):
global settings
- if mydo not in ["help","clean","prerm","postrm","preinst","postinst","config","touch","setup",
- "depend","fetch","digest","unpack","compile","install","rpm","qmerge","merge","package"]:
+ if mydo not in ["help","clean","prerm","postrm","preinst","postinst",
+ "config","touch","setup","depend","fetch","digest",
+ "unpack","compile","install","rpm","qmerge","merge",
+ "package","unmerge"]:
print "!!! Please specify a valid command."
return 1
if not os.path.exists(myebuild):
@@ -1622,7 +1651,7 @@ def doebuild(myebuild,mydo,myroot,debug=0,listonly=0):
#since we are calling "digest" directly, recreate the digest even if it already exists
return (not digestgen(checkme,overwrite=1))
- if not digestcheck(checkme):
+ if not digestcheck(checkme, ("strict" in features)):
return 1
#initial dep checks complete; time to process main commands
@@ -3230,8 +3259,18 @@ class portdbapi(dbapi):
return myloc
except (OSError,IOError):
pass
- # XXX Catch invalid names? XXX #
- return self.root+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
+
+ # XXX Why are there errors here? XXX
+ try:
+ myret=self.root+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
+ except:
+ print "!!! There has been an error. Please report this via IRC or bugs.gentoo.org"
+ print "!!! mycpv: "+mycpv
+ print "!!! mysplit: "+mysplit
+ print "!!! psplit: "+psplit
+ print
+ sys.exit(1)
+ return myret
def aux_get(self,mycpv,mylist,strict=0,metacachedir=None):
"stub code for returning auxilliary db information, such as SLOT, DEPEND, etc."
@@ -3588,8 +3627,9 @@ class portdbapi(dbapi):
print "visible(): package.mask entry \""+x+"\" is invalid, ignoring..."
continue
for y in mymatches:
- while y in newlist:
- newlist.remove(y)
+ if not (unmaskdict.has_key(mycp) and (y in unmaskdict[mycp])):
+ while y in newlist:
+ newlist.remove(y)
if revmaskdict.has_key(mycp):
for x in revmaskdict[mycp]:
#important: only match against the still-unmasked entries...
@@ -4678,7 +4718,9 @@ mtimedbkeys=[
]
mtimedbfile=root+"var/cache/edb/mtimedb"
try:
- mtimedb=cPickle.load(open(mtimedbfile))
+ mypickle=cPickle.Unpickler(open(mtimedbfile))
+ mypickle.find_global=None
+ mtimedb=mypickle.load()
if mtimedb.has_key("old"):
mtimedb["updates"]=mtimedb["old"]
del mtimedb["old"]
@@ -4697,7 +4739,9 @@ for x in mtimedb.keys():
del mtimedb[x]
def do_upgrade(mykey):
- sys.stderr.write("Performing Global Updates: "+mykey+"\n")
+ sys.stderr.write(green("Performing Global Updates: ")+bold(mykey)+"\n")
+ sys.stderr.write("(Could take a couple minutes if you have a lot of binary packages.)\n")
+ sys.stderr.write(" "+bold(".")+"='update pass' "+bold("*")+"='binary update' "+bold("@")+"='/var/db update'\n")
processed=1
#remove stale virtual entries (mappings for packages that no longer exist)
myvirts=grabdict("/var/cache/edb/virtuals")
@@ -4747,7 +4791,7 @@ def do_upgrade(mykey):
writedict(myvirts,"/var/cache/edb/virtuals")
if (secpass==2) and (not os.environ.has_key("SANDBOX_ACTIVE")):
- if settings["PORTAGE_CALLER"] not in ["repoman","ebuild"]:
+ if settings["PORTAGE_CALLER"] in ["emerge"]:
#only do this if we're root and not running repoman/ebuild digest
updpath=os.path.normpath(settings["PORTDIR"]+"/profiles/updates")
didupdate=0
@@ -4831,18 +4875,35 @@ else:
categories=[]
pkgmasklines=grabfile(settings["PORTDIR"]+"/profiles/package.mask")
+pkgmasklines+=grabfile("/etc/portage/profiles/package.mask")
+
+pkgunmasklines=grabfile("/etc/portage/package.unmask");
+
if profiledir:
pkglines=grabfile(profiledir+"/packages")
else:
pkglines=[]
+
+unmaskdict={}
+for x in pkgunmasklines:
+ mycatpkg=dep_getkey(x)
+ # Get each unmasked ebuild.
+ for y in db["/"]["porttree"].dbapi.xmatch("match-all", x):
+ if not unmaskdict.has_key(mycatpkg):
+ unmaskdict[mycatpkg]=[y]
+ else:
+ unmaskdict[mycatpkg].append(y)
+del pkgunmasklines
+
maskdict={}
for x in pkgmasklines:
mycatpkg=dep_getkey(x)
- if not maskdict.has_key(mycatpkg):
- maskdict[mycatpkg]=[x]
- else:
+ if maskdict.has_key(mycatpkg):
maskdict[mycatpkg].append(x)
+ else:
+ maskdict[mycatpkg]=[x]
del pkgmasklines
+
revmaskdict={}
for x in pkglines:
mycatpkg=dep_getkey(x)