summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-06 20:13:24 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-06 20:13:24 +0000
commitf4ce3dfd0cdb56217723f7ddbaf227dc5325d258 (patch)
tree954e6789f99e41c958782ccf5ad45320b3aeda5e
parentUse shlex for better splitting of FETCHCOMMAND. (trunk r6489:6490) (diff)
downloadportage-multirepo-f4ce3dfd0cdb56217723f7ddbaf227dc5325d258.tar.gz
portage-multirepo-f4ce3dfd0cdb56217723f7ddbaf227dc5325d258.tar.bz2
portage-multirepo-f4ce3dfd0cdb56217723f7ddbaf227dc5325d258.zip
Use shlex for better splitting of PORTAGE_RSYNC_OPTS and PORTAGE_RSYNC_EXTRA_OPTS. (trunk r6491:6492)
svn path=/main/branches/2.1.2/; revision=6493
-rwxr-xr-xbin/emerge24
1 files changed, 15 insertions, 9 deletions
diff --git a/bin/emerge b/bin/emerge
index 2de42f5b..01506e08 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -3806,7 +3806,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
mytimeout=180
rsync_opts = []
-
+ import shlex, StringIO
if settings["PORTAGE_RSYNC_OPTS"] == "":
portage.writemsg("PORTAGE_RSYNC_OPTS empty or unset, using hardcoded defaults\n")
rsync_opts.extend([
@@ -3833,7 +3833,11 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
# defaults.
portage.writemsg("Using PORTAGE_RSYNC_OPTS instead of hardcoded defaults\n", 1)
- rsync_opts.extend(settings["PORTAGE_RSYNC_OPTS"].split())
+ lexer = shlex.shlex(StringIO.StringIO(
+ settings.get("PORTAGE_RSYNC_OPTS","")), posix=True)
+ lexer.whitespace_split = True
+ rsync_opts.extend(lexer)
+ del lexer
for opt in ("--recursive", "--times"):
if opt not in rsync_opts:
@@ -3942,8 +3946,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
user_name=""
updatecache_flg=True
all_rsync_opts = set(rsync_opts)
- all_rsync_opts.update(
- settings.get("PORTAGE_RSYNC_EXTRA_OPTS","").split())
+ lexer = shlex.shlex(StringIO.StringIO(
+ settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")), posix=True)
+ lexer.whitespace_split = True
+ extra_rsync_opts = list(lexer)
+ del lexer
+ all_rsync_opts.update(extra_rsync_opts)
family = socket.AF_INET
if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts:
family = socket.AF_INET
@@ -4001,8 +4009,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
if mytimestamp != 0 and "--quiet" not in myopts:
print ">>> Checking server timestamp ..."
- rsynccommand = " ".join(["/usr/bin/rsync", " ".join(rsync_opts),
- settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")])
+ rsynccommand = ["/usr/bin/rsync"] + rsync_opts + extra_rsync_opts
if "--debug" in myopts:
print rsynccommand
@@ -4015,7 +4022,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
# connection attempt to an unresponsive server which rsync's
# --timeout option does not prevent.
if True:
- mycommand = rsynccommand.split()
+ mycommand = rsynccommand[:]
mycommand.append(dosyncuri.rstrip("/") + \
"/metadata/timestamp.chk")
mycommand.append(tmpservertimestampfile)
@@ -4090,8 +4097,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
print
elif (servertimestamp == 0) or (servertimestamp > mytimestamp):
# actual sync
- mycommand=rsynccommand+" "+dosyncuri+"/ "+myportdir
- mycommand = mycommand.split()
+ mycommand = rsynccommand + [dosyncuri+"/", myportdir]
exitcode = portage.portage_exec.spawn(mycommand,
env=settings.environ())
if exitcode in [0,1,3,4,11,14,20,21]: