summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-12-01 11:49:28 -0800
committerJesse Keating <jkeating@redhat.com>2010-12-01 11:49:28 -0800
commit4f5adbf1c8ca7c7e4fd15e0c1b23f601c313b392 (patch)
tree7704e75e472a2260fd0769cd506acd015571900a /src
parentcd3e56bc505a35a71d324a656eb133586a30c59b (diff)
downloadfedora-packager-4f5adbf1c8ca7c7e4fd15e0c1b23f601c313b392.zip
fedora-packager-4f5adbf1c8ca7c7e4fd15e0c1b23f601c313b392.tar.gz
fedora-packager-4f5adbf1c8ca7c7e4fd15e0c1b23f601c313b392.tar.xz
Handle source files with spaces in them. Trac #85
Source files with spaces mean we have to be careful how we parse the sources file, and how we hand URLs off to curl. Good times.
Diffstat (limited to 'src')
-rw-r--r--src/pyfedpkg/__init__.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index d2783d6..59d65ad 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -303,7 +303,8 @@ def _srpmdetails(srpm):
raise FedpkgError(e)
if error:
raise FedpkgError('Error querying srpm:' % error)
- contents = output.split()
+ # Doing a strip and split here as splitting on \n gets me an extra entry
+ contents = output.strip().split('\n')
# Cycle through the stuff and sort correctly by its extension
for file in contents:
if file.rsplit('.')[-1] in UPLOADEXTS:
@@ -599,7 +600,7 @@ def import_srpm(srpm, path=None):
# Need a way to make sure the srpm name matches the repo some how.
# Get a list of files we're currently tracking
- ourfiles = repo.git.ls_files().split()
+ ourfiles = repo.git.ls_files().split('\n')
# Trim out sources and .gitignore
try:
ourfiles.remove('.gitignore')
@@ -744,7 +745,10 @@ def sources(path, outdir=None):
outdir = path
for archive in archives:
try:
- csum, file = archive.split()
+ # This strip / split is kind a ugly, but checksums shouldn't have
+ # two spaces in them. sources file might need more structure in the
+ # future
+ csum, file = archive.strip().split(' ', 1)
except ValueError:
raise FedpkgError('Malformed sources file.')
# See if we already have a valid copy downloaded
@@ -752,8 +756,8 @@ def sources(path, outdir=None):
if os.path.exists(outfile):
if _verify_file(outfile, csum, LOOKASIDEHASH):
continue
- url = '%s/%s/%s/%s/%s' % (LOOKASIDE, module, file, csum,
- file)
+ url = '%s/%s/%s/%s/%s' % (LOOKASIDE, module, file.replace(' ', '%20'),
+ csum, file.replace(' ', '%20'))
# There is some code here for using pycurl, but for now,
# just use subprocess
#output = open(file, 'wb')
@@ -775,7 +779,7 @@ def sources(path, outdir=None):
#output.close()
# These options came from Makefile.common.
# Probably need to support wget too
- command = ['curl', '-H', 'Pragma:', '-O', '-R', '-S', '--fail',
+ command = ['curl', '-H', 'Pragma:', '-o', file, '-R', '-S', '--fail',
'--show-error', url]
_run_command(command)
if not _verify_file(outfile, csum, LOOKASIDEHASH):