diff options
author | Jason Stubbs <jstubbs@gentoo.org> | 2005-06-04 11:15:12 +0000 |
---|---|---|
committer | Jason Stubbs <jstubbs@gentoo.org> | 2005-06-04 11:15:12 +0000 |
commit | 9ddd7d2c4763888c737030b03c04076c3a58e101 (patch) | |
tree | 50fd3be246ca1c07a5854c3ddc8b00bc19be87dc | |
parent | make sure we filter $D when searching for $BUILDDIR in scanelf RPATH output (diff) | |
download | portage-cvs-9ddd7d2c4763888c737030b03c04076c3a58e101.tar.gz portage-cvs-9ddd7d2c4763888c737030b03c04076c3a58e101.tar.bz2 portage-cvs-9ddd7d2c4763888c737030b03c04076c3a58e101.zip |
Brought forward fixes from stable
-rw-r--r-- | ChangeLog | 5 | ||||
-rwxr-xr-x | bin/dispatch-conf | 27 | ||||
-rw-r--r-- | pym/dispatch_conf.py | 24 |
3 files changed, 36 insertions, 20 deletions
@@ -1,12 +1,15 @@ # ChangeLog for Portage; the Gentoo Linux ports system # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Id: ChangeLog,v 1.987 2005/05/29 14:48:11 vapier Exp $ +# $Id: ChangeLog,v 1.988 2005/06/04 11:15:12 jstubbs Exp $ MAJOR CHANGES in 2.0.51: 1. /var/cache/edb/virtuals is no longer used at all. It's calculated now. 2. /var/cache/edb/world is now /var/lib/portage/world. 3. /etc/portage/profile/virtuals is _USER_ configs only. + 06 Jun 2005; Jason Stubbs <jstubbs@gentoo.org> bin/dispatch-conf + pym/dispatch_conf.py: Brought forward updates in stable. + 29 May 2005; Mike Frysinger <vapier@gentoo.org> bin/ebuild-default-functions.sh: Add some banner messages to the compile / package steps. diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 133c50f..46b75a4 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.15 2005/03/23 12:34:30 jstubbs Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/dispatch-conf,v 1.16 2005/06/04 11:15:12 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(mydir) atexit.register(cleanup) -MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments' ] +MANDATORY_OPTS = [ 'archive-dir', 'diff', 'replace-cvs', 'replace-wscomments', 'merge' ] class dispatch: options = {} @@ -61,11 +60,13 @@ class dispatch: confs = [] count = 0 + self.options = dispatch_conf.read_config(MANDATORY_OPTS) if self.options.has_key("log-file"): if os.path.exists(self.options["log-file"]): - shutil.move(self.options["log-file"], self.options["log-file"] + '.old') + shutil.copyfile(self.options["log-file"], self.options["log-file"] + '.old') + os.remove(self.options["log-file"]) else: self.options["log-file"] = "/dev/null" @@ -99,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: @@ -158,10 +159,10 @@ class dispatch: while 1: if show_new_diff: - os.system((self.options['diff'] + '| %s') % (conf['new'], mrgconf, self.options['pager'])) + os.system((self.options['diff']) % (conf['new'], mrgconf)) show_new_diff = 0 else: - os.system((self.options['diff'] + '| %s') % (conf['current'], newconf, self.options['pager'])) + os.system((self.options['diff']) % (conf['current'], newconf)) print print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current']) @@ -185,8 +186,9 @@ class dispatch: elif c == 'm': merged = SCRATCH_DIR+"/"+os.path.basename(conf['current']) print - os.system (MERGE % (merged, conf ['current'], newconf)) - shutil.move (merged, mrgconf) + os.system (self.options['merge'] % (merged, conf ['current'], newconf)) + shutil.copyfile(merged, mrgconf) + os.remove(merged) mystat = os.lstat(conf['new']) os.chmod(mrgconf, mystat[ST_MODE]) os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) @@ -220,7 +222,8 @@ class dispatch: the diff of what changed into the configured log file.""" os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + self.options["log-file"]) try: - shutil.move(newconf, curconf) + shutil.copyfile(newconf, curconf) + os.remove(newconf) except (IOError, os.error), why: print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \ (newconf, curconf, str(why)) diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py index 3c529cb..79ad46d 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.4 2005/02/26 06:35:20 jstubbs Exp $ -cvs_id_string="$Id: dispatch_conf.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $"[5:-2] +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/dispatch_conf.py,v 1.5 2005/06/04 11:15:12 jstubbs Exp $ +cvs_id_string="$Id: dispatch_conf.py,v 1.5 2005/06/04 11:15:12 jstubbs Exp $"[5:-2] # Library by Wayne Davison <gentoo@blorf.net>, derived from code # written by Jeremy Wohl (http://igmus.org) @@ -33,9 +33,14 @@ def read_config(mandatory_opts): for key in 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 key == "merge": + opts["merge"] = "sdiff --suppress-common-lines --output=%s %s %s" + else: + print >> sys.stderr, 'dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal' % (key,) + + 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 +68,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 +84,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 +132,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 |