Lines 14-20
Link Here
|
14 |
# |
14 |
# |
15 |
|
15 |
|
16 |
from stat import * |
16 |
from stat import * |
17 |
import os, sys, string, re, commands |
17 |
import os, sys, string, re, commands, shutil |
18 |
sys.path = ["/usr/lib/portage/pym"]+sys.path |
18 |
sys.path = ["/usr/lib/portage/pym"]+sys.path |
19 |
|
19 |
|
20 |
import portage, dispatch_conf |
20 |
import portage, dispatch_conf |
Lines 37-43
Link Here
|
37 |
count = 0 |
37 |
count = 0 |
38 |
|
38 |
|
39 |
if os.path.exists(LOG_CHANGES_TO): |
39 |
if os.path.exists(LOG_CHANGES_TO): |
40 |
os.rename(LOG_CHANGES_TO, LOG_CHANGES_TO + '.old') |
40 |
shutil.move(LOG_CHANGES_TO, LOG_CHANGES_TO + '.old') |
41 |
|
41 |
|
42 |
self.options = dispatch_conf.read_config(MANDATORY_OPTS) |
42 |
self.options = dispatch_conf.read_config(MANDATORY_OPTS) |
43 |
|
43 |
|
Lines 150-156
Link Here
|
150 |
merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) |
150 |
merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) |
151 |
print |
151 |
print |
152 |
os.system (MERGE % (merged, conf ['current'], newconf)) |
152 |
os.system (MERGE % (merged, conf ['current'], newconf)) |
153 |
os.rename (merged, mrgconf) |
153 |
shutil.move (merged, mrgconf) |
154 |
mystat = os.lstat(conf['new']) |
154 |
mystat = os.lstat(conf['new']) |
155 |
os.chmod(mrgconf, mystat[ST_MODE]) |
155 |
os.chmod(mrgconf, mystat[ST_MODE]) |
156 |
os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) |
156 |
os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) |
Lines 184-190
Link Here
|
184 |
the diff of what changed into the LOG_CHANGES_TO file.""" |
184 |
the diff of what changed into the LOG_CHANGES_TO file.""" |
185 |
os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + LOG_CHANGES_TO) |
185 |
os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + LOG_CHANGES_TO) |
186 |
try: |
186 |
try: |
187 |
os.rename (newconf, curconf) |
187 |
shutil.move (newconf, curconf) |
188 |
except (IOError, os.error), why: |
188 |
except (IOError, os.error), why: |
189 |
print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \ |
189 |
print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \ |
190 |
(newconf, curconf, str(why)) |
190 |
(newconf, curconf, str(why)) |