Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 698316
Collapse All | Expand All

(-)a/bin/dispatch-conf (-1 / +6 lines)
Lines 29-35 import portage Link Here
29
portage._internal_caller = True
29
portage._internal_caller = True
30
from portage import os, shutil
30
from portage import os, shutil
31
from portage import _encodings, _unicode_decode
31
from portage import _encodings, _unicode_decode
32
from portage.dispatch_conf import diffstatusoutput, diff_mixed_wrapper
32
from portage.dispatch_conf import diffstatusoutput, diff_mixed_wrapper, perform_conf_update_hooks
33
from portage.process import find_binary, spawn
33
from portage.process import find_binary, spawn
34
from portage.util import writemsg, writemsg_stdout
34
from portage.util import writemsg, writemsg_stdout
35
35
Lines 382-392 class dispatch: Link Here
382
                encoding=_encodings["stdio"]) as f:
382
                encoding=_encodings["stdio"]) as f:
383
                f.write(output + "\n")
383
                f.write(output + "\n")
384
384
385
        perform_conf_update_hooks("pre-update", curconf)
386
385
        try:
387
        try:
386
            os.rename(newconf, curconf)
388
            os.rename(newconf, curconf)
387
        except (IOError, os.error) as why:
389
        except (IOError, os.error) as why:
388
            writemsg('dispatch-conf: Error renaming %s to %s: %s; fatal\n' % \
390
            writemsg('dispatch-conf: Error renaming %s to %s: %s; fatal\n' % \
389
                  (newconf, curconf, str(why)), noiselevel=-1)
391
                  (newconf, curconf, str(why)), noiselevel=-1)
392
            return
393
394
        perform_conf_update_hooks("post-update", curconf)
390
395
391
396
392
    def post_process(self, curconf):
397
    def post_process(self, curconf):
(-)a/lib/portage/dispatch_conf.py (-2 / +24 lines)
Lines 16-26 import subprocess Link Here
16
import sys
16
import sys
17
import tempfile
17
import tempfile
18
18
19
from collections import OrderedDict
20
19
import portage
21
import portage
20
from portage import _encodings, os, shutil
22
from portage import _encodings, os, shutil
21
from portage.env.loaders import KeyValuePairFileLoader
23
from portage.env.loaders import KeyValuePairFileLoader
22
from portage.localization import _
24
from portage.localization import _
23
from portage.util import shlex_split, varexpand
25
from portage.util import shlex_split, varexpand, _recursive_file_list
24
from portage.util.path import iter_parents
26
from portage.util.path import iter_parents
25
27
26
RCS_BRANCH = '1.1.1'
28
RCS_BRANCH = '1.1.1'
Lines 386-388 def file_archive_post_process(archive): Link Here
386
		if os.path.isdir(dest) and not os.path.islink(dest):
388
		if os.path.isdir(dest) and not os.path.islink(dest):
387
			_file_archive_rotate(dest)
389
			_file_archive_rotate(dest)
388
		os.rename(archive + '.dist.new', dest)
390
		os.rename(archive + '.dist.new', dest)
389
- 
391
392
def perform_conf_update_hooks(kind, conf):
393
	conf_update_dir = os.path.join(portage.settings["PORTAGE_CONFIGROOT"],
394
		portage.USER_CONFIG_PATH, "conf-update.d")
395
	hooks = OrderedDict()
396
	for filepath in _recursive_file_list(conf_update_dir):
397
		name = filepath.split(conf_update_dir)[1].lstrip(os.sep)
398
		if os.access(filepath, os.X_OK):
399
			hooks[filepath] = name
400
		else:
401
			writemsg_level(" %s %s hook: '%s' is not executable\n"
402
				       % (warn("*"), _dir, _unicode_decode(name),),
403
						level=logging.WARN, noiselevel=2)
404
405
	for filepath in hooks:
406
		retval = portage.process.spawn([filepath, kind, conf])
407
408
		if retval != os.EX_OK:
409
			writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"),
410
					_unicode_decode(_hooks[filepath]), filepath),
411
					level=logging.ERROR, noiselevel=-1)

Return to bug 698316