From bd5e3c6cd5b15fb8a5bfcf19bbcc779cd742fe3d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 31 Oct 2006 13:45:19 +0000 Subject: =?UTF-8?q?Add=20support=20for=20frozen=20config=20files=20for=20w?= =?UTF-8?q?hich=20updates=20are=20automatically=20zapped.=20=20Thanks=20to?= =?UTF-8?q?=20Bo=20=C3=98rsted=20Andresen=20for=20the=20initial=20patch=20?= =?UTF-8?q?from=20bug=20#151685.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/main/trunk/; revision=4887 --- bin/dispatch-conf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bin/dispatch-conf') diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 2309b680f..c9f3655f0 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -12,6 +12,9 @@ # dialog menus # +if not hasattr(__builtins__, "set"): + from sets import Set as set + from stat import * from random import * import atexit, commands, os, re, shutil, stat, string, sys @@ -105,6 +108,10 @@ class dispatch: return False + # config file freezing support + frozen_files = set(self.options.get("frozen-files", "").split()) + auto_zapped = [] + # # Remove new configs identical to current # and @@ -148,6 +155,18 @@ class dispatch: if os.path.exists(mrgconf): os.unlink(mrgconf) return False + elif conf['current'] in frozen_files: + """Frozen files are automatically zapped. The new config has + already been archived with a .new suffix. When zapped, it is + left with the .new suffix (post_process is skipped), since it + hasn't been merged into the current config.""" + auto_zapped.append(conf['current']) + os.unlink(conf['new']) + try: + os.unlink(mrgconf) + except OSError: + pass + return False elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split (): self.replace(newconf, conf['current']) self.post_process(conf['current']) @@ -238,6 +257,13 @@ class dispatch: else: continue + if auto_zapped: + print + print " One or more updates are frozen and have been automatically zapped:" + print + for frozen in auto_zapped: + print " * '%s'" % frozen + print def replace (self, newconf, curconf): """Replace current config with the new/merged version. Also logs -- cgit v1.2.3-1-g7c22