diff options
author | 2005-04-17 09:01:56 +0000 | |
---|---|---|
committer | 2005-04-17 09:01:56 +0000 | |
commit | 255f5e82162c01c181948fe34ca4d32343681d47 (patch) | |
tree | 70020d05f2ef3322ac7cefda06c75c13100c6483 | |
parent | eclass_config treachery. Check for the eclass_cache.eclasses wasn't properly... (diff) | |
download | portage-cvs-255f5e82162c01c181948fe34ca4d32343681d47.tar.gz portage-cvs-255f5e82162c01c181948fe34ca4d32343681d47.tar.bz2 portage-cvs-255f5e82162c01c181948fe34ca4d32343681d47.zip |
pym/portage_exec.py: Added checks to see if the sandbox is executable and
disabled when it isn't.
bin/dispatch-conf cnf/dispatch-conf.conf pym/dispatch-conf.py: Made the
merge command configurable. Fixed a bug that caused conflicts to make their
way into the final configuration file. Made the config archive dir
automatically created if there is nothing in the way.
pym/output.py: Reverted the feature to make use of screen titles.
bin/emerge: Made detection of --ask capability use stdin instead of stdout.
pym/portage.py: Removed ChangeLog and metadata.xml from Manifest creation
and checking. Quietened failed mtimedb writes. Added patch to allow
fetching to read-only DISTDIR. Added logic to detect changing between
userpriv and non-userpriv and update the ccache permissions at each change.
Applied patch from #69763 to allow fetching to a read-only distfiles dir.
cnf/make.globals*: Removed vars not directly related to portage.
Architecture specific ones are going into the relevant profiles. USE_ORDER
and CONFIG_PROTECT* will likely be going into base.
-rw-r--r-- | ChangeLog | 32 | ||||
-rwxr-xr-x | bin/dispatch-conf | 13 | ||||
-rwxr-xr-x | bin/emerge | 6 | ||||
-rw-r--r-- | cnf/dispatch-conf.conf | 8 | ||||
-rw-r--r-- | cnf/make.globals | 50 | ||||
-rw-r--r-- | pym/dispatch_conf.py | 17 | ||||
-rw-r--r-- | pym/output.py | 15 | ||||
-rw-r--r-- | pym/portage.py | 89 | ||||
-rw-r--r-- | pym/portage_exec.py | 8 |
9 files changed, 151 insertions, 87 deletions
@@ -1,6 +1,6 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.796.2.94 2005/04/16 23:49:19 ferringb Exp $ +# $Id: ChangeLog,v 1.796.2.95 2005/04/17 09:01:54 jstubbs Exp $ MAJOR CHANGES in 2.0.51: 1. /var/cache/edb/virtuals is no longer used at all. It's calculated now. @@ -11,6 +11,36 @@ touche up, mtime wasn't being properly checked (thanks to swegener for catching it). + 17 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> pym/portage_exec.py + pym/portage.py: Added checks to see if the sandbox is executable and disabled + when it isn't. + + 17 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> bin/dispatch-conf + cnf/dispatch-conf.conf pym/dispatch-conf.py: Made the merge command + configurable. Fixed a bug that caused conflicts to make their way into the + final configuration file. Made the config archive dir automatically created + if there is nothing in the way. + + 17 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> pym/output.py: Reverted the + feature to make use of screen titles. + + 17 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> bin/emerge: Made detection + of --ask capability use stdin instead of stdout. + + 15 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> pym/portage.py: Removed + ChangeLog and metadata.xml from Manifest creation and checking. Quietened + failed mtimedb writes. Added patch to allow fetching to read-only DISTDIR. + Added logic to detect changing between userpriv and non-userpriv and + update the ccache permissions at each change. + + 15 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> cnf/make.globals*: Removed + vars not directly related to portage. Architecture specific ones are going + into the relevant profiles. USE_ORDER and CONFIG_PROTECT* will likely be + going into base. + + 14 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> pym/portage.py: Applied + patch from #69763 to allow fetching to a read-only distfiles dir. + 13 Apr 2005; Jason Stubbs <jstubbs@gentoo.org> bin/repoman: Downgraded the nesteddie check to a warning as it sometimes has false positives. diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 84517da..98a1049 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -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/dispatch-conf,v 1.7.2.7 2005/04/12 12:23:41 jstubbs Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/dispatch-conf,v 1.7.2.8 2005/04/17 09:01:55 jstubbs Exp $ # # dispatch-conf -- Integrate modified configs, post-emerge @@ -23,7 +23,6 @@ FIND_EXTANT_CONFIGS = "find %s/ -iname '._cfg????_*' | sed -e 's://:/:g'" DIFF_CONTENTS = 'diff -Nu %s %s' DIFF_CVS_INTERP = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"' DIFF_WSCOMMENTS = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"' -MERGE = 'sdiff --suppress-common-lines --output=%s %s %s' # We need a secure scratch dir and python does silly verbose errors on the use of tempnam oldmask = os.umask(0077) @@ -52,7 +51,7 @@ def cleanup(mydir=SCRATCH_DIR): shutil.rmtree(SCRATCH_DIR) atexit.register(cleanup) -MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments' ] +MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments', 'merge' ] class dispatch: options = {} @@ -101,15 +100,15 @@ class dispatch: mrgconf = re.sub(r'\._cfg', '._mrg', conf['new']) archive = os.path.join(self.options['archive-dir'], conf['current'].lstrip('/')) if self.options['use-rcs'] == 'yes': - dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf) + mrgfail = dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf) else: - dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf) + mrgfail = dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf) if os.path.exists(archive + '.dist'): unmodified = len(commands.getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0 else: unmodified = 0 if os.path.exists(mrgconf): - if len(commands.getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0: + if mrgfail or len(commands.getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0: os.unlink(mrgconf) newconf = conf['new'] else: @@ -187,7 +186,7 @@ class dispatch: elif c == 'm': merged = SCRATCH_DIR+"/"+os.path.basename(conf['current']) print - os.system (MERGE % (merged, conf ['current'], newconf)) + os.system (conf['merge'] % (merged, conf ['current'], newconf)) shutil.copyfile(merged, mrgconf) os.remove(merged) mystat = os.lstat(conf['new']) @@ -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.345.2.23 2005/04/13 15:28:37 jstubbs Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.24 2005/04/17 09:01:55 jstubbs Exp $ import os,sys os.environ["PORTAGE_CALLER"]="emerge" @@ -363,7 +363,7 @@ if ("--pretend" in myopts) and ("--ask" in myopts): # forbid --ask when not in a terminal # note: this breaks `emerge --ask | tee logfile`, but that doesn't work anyway. -if ("--ask" in myopts) and (not sys.stdout.isatty()): +if ("--ask" in myopts) and (not sys.stdin.isatty()): portage.writemsg("!!! \"--ask\" should only be used in a terminal. Exiting.\n") sys.exit(1) @@ -1050,7 +1050,7 @@ class depgraph: myfavorites.append(mykey) else: try: - mykey=portage.dep_expand(x,portage.portdb) + mykey=portage.dep_expand(x,mydb=portage.portdb) except ValueError, errpkgs: print "\n\n!!! The short ebuild name \"" + x + "\" is ambiguous. Please specify" print "!!! one of the following fully-qualified ebuild names instead:\n" diff --git a/cnf/dispatch-conf.conf b/cnf/dispatch-conf.conf index 8e88936..6636dae 100644 --- a/cnf/dispatch-conf.conf +++ b/cnf/dispatch-conf.conf @@ -10,8 +10,16 @@ archive-dir=/etc/config-archive use-rcs=no # Diff for display +# %s old file +# %s new file diff="diff -Nu %s %s" +# Diff for interactive merges. +# %s output file +# %s old file +# %s new file +merge="sdiff --suppress-common-lines --output=%s %s %s" + # Pager for diff display pager="less --no-init --QUIT-AT-EOF" diff --git a/cnf/make.globals b/cnf/make.globals index 652193f..eece513 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -1,6 +1,6 @@ # 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/cnf/make.globals,v 1.56.2.2 2005/01/13 01:06:27 carpaski Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/cnf/make.globals,v 1.56.2.3 2005/04/17 09:01:55 jstubbs Exp $ # System-wide defaults for the Portage system # ***************************** @@ -12,57 +12,49 @@ # ** USE, CONFIG_*, and FEATURES are incremental ** # *************************************************** -GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" + +# Default rsync mirror SYNC="rsync://rsync.gentoo.org/gentoo-portage" -# Host-type -CHOST=i686-pc-linux-gnu -PORTAGE_TMPDIR=/var/tmp +# Default distfiles mirrors +GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" +# Repository Paths PORTDIR=/usr/portage -DISTDIR=${PORTDIR}/distfiles -PKGDIR=${PORTDIR}/packages -RPMDIR=${PORTDIR}/rpm -CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config" -CONFIG_PROTECT_MASK="/etc/gconf" +DISTDIR=/usr/portage/distfiles +PKGDIR=/usr/portage/packages +RPMDIR=/usr/portage/rpm -# Options passed to make during the build process -MAKEOPTS="-j2" +# Temporary build directory +PORTAGE_TMPDIR=/var/tmp # Fetching command (5 tries, passive ftp for firewall compatibility) FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp -P \${DISTDIR} \${URI}" RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp -P \${DISTDIR} \${URI}" -CFLAGS="-O2 -mcpu=i686 -pipe" -CXXFLAGS=${CFLAGS} - -# Debug build -- if defined, binaries won't be stripped -#DEBUGBUILD=true - -# Default maintainer options -#FEATURES="digest sandbox noclean noauto buildpkg usersandbox" # Default user options -FEATURES="sandbox distlocks ccache autoaddcvs" - -# By default output colored text where possible, set to "true" to output only -#black&white text -NOCOLOR="false" +FEATURES="sandbox distlocks" +# Default chunksize for binhost comms PORTAGE_BINHOST_CHUNKSIZE="3000" -USE_EXPAND="VIDEO_CARDS INPUT_DEVICES LINGUAS" # By default wait 5 secs before cleaning a package CLEAN_DELAY="5" -# Set to yes automatically run "emerge --clean" after each merge -# Important, as without this you may experience missing symlinks when -# downgrading libraries during a batch (world/system) update. + +# By default wait 10 secs on an important warning +EMERGE_WARNING_DELAY="10" + +# Automatically clean installed packages after they are updated. +# This option will be removed and forced to yes. AUTOCLEAN="yes" # Number of times 'emerge --sync' will run before giving up. RSYNC_RETRIES="3" + # Number of seconds rsync will wait before timing out. RSYNC_TIMEOUT="180" + # ***************************** # ** DO NOT EDIT THIS FILE ** # *************************************************** diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py index 77272f5..6f13da3 100644 --- a/pym/dispatch_conf.py +++ b/pym/dispatch_conf.py @@ -1,8 +1,8 @@ # archive_conf.py -- functionality common to archive-conf and dispatch-conf # Copyright 2003-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/dispatch_conf.py,v 1.3.2.1 2005/01/16 02:35:33 carpaski Exp $ -cvs_id_string="$Id: dispatch_conf.py,v 1.3.2.1 2005/01/16 02:35:33 carpaski Exp $"[5:-2] +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/dispatch_conf.py,v 1.3.2.2 2005/04/17 09:01:55 jstubbs Exp $ +cvs_id_string="$Id: dispatch_conf.py,v 1.3.2.2 2005/04/17 09:01:55 jstubbs Exp $"[5:-2] # Library by Wayne Davison <gentoo@blorf.net>, derived from code # written by Jeremy Wohl (http://igmus.org) @@ -35,7 +35,9 @@ def read_config(mandatory_opts): if not opts.has_key(key): print >> sys.stderr, 'dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal' % (key,) - if not (os.path.exists(opts['archive-dir']) and os.path.isdir(opts['archive-dir'])): + if not os.path.exists(opts['archive-dir']): + os.mkdir(opts['archive-dir']) + elif not os.path.isdir(opts['archive-dir']): print >> sys.stderr, 'dispatch-conf: Config archive dir [%s] must exist; fatal' % (opts['archive-dir'],) sys.exit(1) @@ -63,6 +65,7 @@ def rcs_archive(archive, curconf, newconf, mrgconf): os.system(RCS_LOCK + ' ' + archive) os.system(RCS_PUT + ' ' + archive) + ret = 0 if newconf != '': os.system(RCS_GET + ' -r' + RCS_BRANCH + ' ' + archive) has_branch = os.path.exists(archive) @@ -78,11 +81,12 @@ def rcs_archive(archive, curconf, newconf, mrgconf): if has_branch: if mrgconf != '': # This puts the results of the merge into mrgconf. - os.system(RCS_MERGE % (archive, mrgconf)) + ret = os.system(RCS_MERGE % (archive, mrgconf)) mystat = os.lstat(newconf) os.chmod(mrgconf, mystat[ST_MODE]) os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) os.rename(archive, archive + '.dist.new') + return ret def file_archive(archive, curconf, newconf, mrgconf): @@ -125,13 +129,16 @@ def file_archive(archive, curconf, newconf, mrgconf): print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ (newconf, archive + '.dist.new', str(why)) + ret = 0 if mrgconf != '' and os.path.exists(archive + '.dist'): # This puts the results of the merge into mrgconf. - os.system(DIFF3_MERGE % (curconf, archive + '.dist', newconf, mrgconf)) + ret = os.system(DIFF3_MERGE % (curconf, archive + '.dist', newconf, mrgconf)) mystat = os.lstat(newconf) os.chmod(mrgconf, mystat[ST_MODE]) os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) + return ret + def rcs_archive_post_process(archive): """Check in the archive file with the .dist.new suffix on the branch diff --git a/pym/output.py b/pym/output.py index 5d04ccd..41cb0e4 100644 --- a/pym/output.py +++ b/pym/output.py @@ -1,7 +1,7 @@ # 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/output.py,v 1.24.2.3 2005/02/06 02:48:44 jstubbs Exp $ -cvs_id_string="$Id: output.py,v 1.24.2.3 2005/02/06 02:48:44 jstubbs Exp $"[5:-2] +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/output.py,v 1.24.2.4 2005/04/17 09:01:55 jstubbs Exp $ +cvs_id_string="$Id: output.py,v 1.24.2.4 2005/04/17 09:01:55 jstubbs Exp $"[5:-2] import os,sys,re @@ -96,12 +96,11 @@ def xtermTitle(mystr): if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty(): myt=os.environ["TERM"] legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode"] - if (myt in legal_terms) or myt.startswith("xterm") or myt.startswith("screen"): - sys.stderr.write("\x1b]2;"+str(mystr)+"\x07") - sys.stderr.flush() - if (myt.startswith("screen")): - sys.stderr.write("\x1bk"+str(mystr)+"\x1b\\") - sys.stderr.flush() + for term in legal_terms: + if myt.startswith(term): + sys.stderr.write("\x1b]2;"+str(mystr)+"\x07") + sys.stderr.flush() + break def xtermTitleReset(): if havecolor and dotitles and os.environ.has_key("TERM"): diff --git a/pym/portage.py b/pym/portage.py index 8d4fa5c..2e255d5 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1,10 +1,10 @@ # 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.524.2.55 2005/04/16 23:49:19 ferringb Exp $ -cvs_id_string="$Id: portage.py,v 1.524.2.55 2005/04/16 23:49:19 ferringb Exp $"[5:-2] +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.524.2.56 2005/04/17 09:01:55 jstubbs Exp $ +cvs_id_string="$Id: portage.py,v 1.524.2.56 2005/04/17 09:01:55 jstubbs Exp $"[5:-2] -VERSION="$Revision: 1.524.2.55 $"[11:-2] + "-cvs" +VERSION="$Revision: 1.524.2.56 $"[11:-2] + "-cvs" # =========================================================================== # START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF IMPORT @@ -1192,6 +1192,13 @@ class config: if "maketest" in self.features and "test" not in self.features: self.features.append("test") + if not portage_exec.sandbox_capable and "sandbox" in self.features or "usersandbox" in self.features: + writemsg(red("!!! Problem with sandbox binary. Disabling...\n\n")) + if "sandbox" in self.features: + self.features.remove("sandbox") + if "usersandbox" in self.features: + self.features.remove("usersandbox") + self.features.sort() self["FEATURES"] = " ".join(["-*"]+self.features) self.backup_changes("FEATURES") @@ -1610,6 +1617,16 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", if listonly or ("distlocks" not in features): use_locks = 0 + fetch_to_ro = 0 + if "skiprocheck" in features: + fetch_to_ro = 1 + + if not os.access(mysettings["DISTDIR"],os.W_OK) and fetch_to_ro: + if use_locks: + writemsg(red("!!! You are fetching to a read-only filesystem, you should turn locking off")); + writemsg("!!! This can be done by adding -distlocks to FEATURES in /etc/make.conf"); +# use_locks = 0 + # local mirrors are always added if custommirrors.has_key("local"): mymirrors += custommirrors["local"] @@ -1739,8 +1756,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", can_fetch=True if not os.access(mysettings["DISTDIR"]+"/",os.W_OK): - print "!!! No write access to %s" % mysettings["DISTDIR"]+"/" - can_fetch=False + if not fetch_to_ro: + print "!!! No write access to %s" % mysettings["DISTDIR"]+"/" + can_fetch=False else: mystat=os.stat(mysettings["DISTDIR"]+"/") if mystat.st_gid != portage_gid: @@ -1852,7 +1870,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # check if we can actually write to the directory/existing file. if fetched!=2 and os.path.exists(mysettings["DISTDIR"]+"/"+myfile) != \ - os.access(mysettings["DISTDIR"]+"/"+myfile, os.W_OK): + os.access(mysettings["DISTDIR"]+"/"+myfile, os.W_OK) and not fetch_to_ro: writemsg(red("***")+" Lack write access to %s, failing fetch\n" % str(mysettings["DISTDIR"]+"/"+myfile)) fetched=0 break @@ -1880,7 +1898,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", myret=spawn(myfetch,mysettings,free=1) finally: #if root, -always- set the perms. - if os.path.exists(mysettings["DISTDIR"]+"/"+myfile) and (fetched != 1 or os.getuid() == 0): + if os.path.exists(mysettings["DISTDIR"]+"/"+myfile) and (fetched != 1 or os.getuid() == 0) \ + and os.access(mysettings["DISTDIR"]+"/",os.W_OK): if os.stat(mysettings["DISTDIR"]+"/"+myfile).st_gid != portage_gid: try: os.chown(mysettings["DISTDIR"]+"/"+myfile,-1,portage_gid) @@ -2068,8 +2087,8 @@ def digestgen(myarchives,mysettings,overwrite=1,manifestonly=0): print green(">>> Generating manifest file...") mypfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1,EmptyOnError=1) mypfiles=cvstree.apply_cvsignore_filter(mypfiles) - if "Manifest" in mypfiles: - del mypfiles[mypfiles.index("Manifest")] + for x in ["Manifest", "ChangeLog", "metadata.xml"]: + mypfiles.remove(x) mydigests=digestCreate(mypfiles, pbasedir) if mydigests==None: # There was a problem, exit with an errorcode. @@ -2229,10 +2248,12 @@ def digestcheck(myfiles, mysettings, strict=0): # Check the portage-related files here. mymfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1,EmptyOnError=1) manifest_files = mymdigests.keys() + for x in ["Manifest", "ChangeLog", "metadata.xml"]: + while x in mymfiles: + mymfiles.remove(x) + while x in manifest_files: + manifest_files.remove(x) 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] in manifest_files: manifest_files.remove(mymfiles[x]) elif len(cvstree.apply_cvsignore_filter([mymfiles[x]]))==0: @@ -2485,33 +2506,37 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["CCACHE_DIR"]=mysettings["PORTAGE_TMPDIR"]+"/ccache" if not os.path.exists(mysettings["CCACHE_DIR"]): os.makedirs(mysettings["CCACHE_DIR"]) - mystat = os.stat(settings["CCACHE_DIR"]) + mystat = os.stat(mysettings["CCACHE_DIR"]) if ("userpriv" in features): - if mystat[ST_GID] != portage_gid: - spawn("chown -R "+str(portage_uid)+":"+str(portage_gid)+" "+settings["CCACHE_DIR"], free=1) - spawn("chmod -R ug+rw "+settings["CCACHE_DIR"], free=1) + if mystat[stat.ST_UID] != portage_gid or ((mystat[stat.ST_MODE]&02070)!=02070): + spawn("chgrp -R "+str(portage_gid)+" "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chown "+str(portage_uid)+":"+str(portage_gid)+" "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chmod -R u+rw "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chmod -R g+rw "+mysettings["CCACHE_DIR"], mysettings, free=1) else: - if mystat[ST_GID] != 0: - spawn("chown -R 0:0 "+settings["CCACHE_DIR"], free=1) - spawn("chmod -R ug+rw "+settings["CCACHE_DIR"], free=1) + if mystat[stat.ST_UID] != 0 or ((mystat[stat.ST_MODE]&02070)!=02070): + spawn("chgrp -R "+str(portage_gid)+" "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chown 0:"+str(portage_gid)+" "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chmod -R u+rw "+mysettings["CCACHE_DIR"], mysettings, free=1) + spawn("chmod -R g+rw "+mysettings["CCACHE_DIR"], mysettings, free=1) except OSError, e: print "!!! File system problem. (ReadOnly? Out of space?)" print "!!! Perhaps: rm -Rf",mysettings["BUILD_PREFIX"] print "!!!",str(e) return 1 - try: - mystat=os.stat(mysettings["CCACHE_DIR"]) - if (mystat[stat.ST_GID]!=portage_gid) or ((mystat[stat.ST_MODE]&02070)!=02070): - print "*** Adjusting ccache permissions for portage user..." - os.chown(mysettings["CCACHE_DIR"],portage_uid,portage_gid) - os.chmod(mysettings["CCACHE_DIR"],02770) - spawn("chown -R "+str(portage_uid)+":"+str(portage_gid)+" "+mysettings["CCACHE_DIR"],mysettings, free=1) - spawn("chmod -R g+rw "+mysettings["CCACHE_DIR"],mysettings, free=1) - except SystemExit, e: - raise - except: - pass + #try: + # mystat=os.stat(mysettings["CCACHE_DIR"]) + # if (mystat[stat.ST_GID]!=portage_gid) or ((mystat[stat.ST_MODE]&02070)!=02070): + # print "*** Adjusting ccache permissions for portage user..." + # os.chown(mysettings["CCACHE_DIR"],portage_uid,portage_gid) + # os.chmod(mysettings["CCACHE_DIR"],02770) + # spawn("chown -R "+str(portage_uid)+":"+str(portage_gid)+" "+mysettings["CCACHE_DIR"],mysettings, free=1) + # spawn("chmod -R g+rw "+mysettings["CCACHE_DIR"],mysettings, free=1) + #except SystemExit, e: + # raise + #except: + # pass if "distcc" in features: try: @@ -7286,7 +7311,7 @@ def portageexit(): except SystemExit, e: raise except Exception, e: - writemsg("Failed to write to mtimedb: %(reason)s\n" % {"reason":str(e)}) + pass try: os.chown(mymfn,uid,portage_gid) diff --git a/pym/portage_exec.py b/pym/portage_exec.py index 073c1e3..5c7d932 100644 --- a/pym/portage_exec.py +++ b/pym/portage_exec.py @@ -1,8 +1,8 @@ # 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_exec.py,v 1.13.2.3 2005/01/16 02:35:33 carpaski Exp $ -cvs_id_string="$Id: portage_exec.py,v 1.13.2.3 2005/01/16 02:35:33 carpaski Exp $"[5:-2] +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.13.2.4 2005/04/17 09:01:56 jstubbs Exp $ +cvs_id_string="$Id: portage_exec.py,v 1.13.2.4 2005/04/17 09:01:56 jstubbs Exp $"[5:-2] import os,types,atexit,string,stat import signal @@ -33,6 +33,8 @@ atexit.register(cleanup) from portage_const import BASH_BINARY,SANDBOX_BINARY,SANDBOX_PIDS_FILE +sandbox_capable = (os.path.exists(SANDBOX_BINARY) and os.access(SANDBOX_BINARY, os.X_OK)) + def spawn_bash(mycommand,env={},debug=False,opt_name=None,**keywords): args=[BASH_BINARY] if not opt_name: @@ -46,6 +48,8 @@ def spawn_bash(mycommand,env={},debug=False,opt_name=None,**keywords): return spawn(args,env=env,opt_name=opt_name,**keywords) def spawn_sandbox(mycommand,uid=None,opt_name=None,**keywords): + if not sandbox_capable: + return spawn_bash(mycommand,opt_name=opt_name,**keywords) args=[SANDBOX_BINARY] if not opt_name: opt_name=mycommand.split()[0] |