from portage_exec import find_binary
FIND_EXTANT_CONFIGS = "find '%s' %s -iname '._cfg????_%s' ! -iname '.*~' ! -iname '.*.bak'"
-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:]*$"'
+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:]*$'"
# We need a secure scratch dir and python does silly verbose errors on the use of tempnam
oldmask = os.umask(0077)
# Diff for display
# %s old file
# %s new file
-diff="diff -Nu %s %s | less --no-init --QUIT-AT-EOF"
+diff="diff -Nu '%s' '%s' | less --no-init --QUIT-AT-EOF"
# Diff for interactive merges.
# %s output file
# %s old file
# %s new file
-merge="sdiff --suppress-common-lines --output=%s %s %s"
+merge="sdiff --suppress-common-lines --output='%s' '%s' '%s'"
# Automerge files comprising only CVS interpolations (e.g. Header or Id)
# (yes or no)
RCS_LOCK = 'rcs -ko -M -l'
RCS_PUT = 'ci -t-"Archived config file." -m"dispatch-conf update."'
RCS_GET = 'co'
-RCS_MERGE = 'rcsmerge -p -r' + RCS_BRANCH + ' %s >%s'
+RCS_MERGE = "rcsmerge -p -r" + RCS_BRANCH + " '%s' > '%s'"
-DIFF3_MERGE = 'diff3 -mE %s %s %s >%s'
+DIFF3_MERGE = "diff3 -mE '%s' '%s' '%s' > '%s'"
def read_config(mandatory_opts):
try:
for key in mandatory_opts:
if not opts.has_key(key):
if key == "merge":
- opts["merge"] = "sdiff --suppress-common-lines --output=%s %s %s"
+ 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,)
# Archive the current config file if it isn't already saved
if os.path.exists(archive) \
- and len(commands.getoutput('diff -aq %s %s' % (curconf,archive))) != 0:
+ and len(commands.getoutput("diff -aq '%s' '%s'" % (curconf,archive))) != 0:
suf = 1
while suf < 9 and os.path.exists(archive + '.' + str(suf)):
suf += 1