#95 fedpkg import fails with Source with spaces in name
Closed: Fixed Opened by orion.

{{{
Source1: http://www.ecma-international.org/publications/files/ECMA-ST/Office Open XML 1st edition Part 4 (PDF).zip

fedpkg import /export/home/orion/redhat/apache-poi-3.7/apache-poi-3.7-0.5.beta3.fc14.src.rpm
Traceback (most recent call last):
File "/usr/bin/fedpkg", line 1086, in
args.command(args)
File "/usr/bin/fedpkg", line 490, in import_srpm
uploadfiles = pyfedpkg.import_srpm(args.srpm, path=args.path)
File "/usr/lib/python2.7/site-packages/pyfedpkg/init.py", line 582, in import_srpm
rv = repo.index.add(files)
File "/usr/lib/python2.7/site-packages/git/index.py", line 250, in clear_cache_if_not_raised
rval = func(self, args, kwargs)
File "/usr/lib/python2.7/site-packages/git/index.py", line 268, in check_default_index
return func(self,
args, **kwargs)
File "/usr/lib/python2.7/site-packages/git/index.py", line 989, in add
self._flush_stdin_and_wait(proc, ignore_stdout=True) # ignore stdout
File "/usr/lib/python2.7/site-packages/git/index.py", line 1228, in _flush_stdin_and_wait
proc.wait()
File "/usr/lib/python2.7/site-packages/git/cmd.py", line 95, in wait
raise GitCommandError(self.args, status, self.proc.stderr.read())
git.errors.GitCommandError: 'git update-index --add --replace --verbose --stdin' returned exit status 128: error: Office: does not exist and --remove not passed
fatal: Unable to process path Office
}}}


Tried this:

{{{
--- init.py.orig 2010-10-10 23:24:49.000000000 -0600
+++ init.py 2010-11-10 09:41:18.217131964 -0700
@@ -303,7 +303,7 @@
if error:
log.error(error)
raise FedpkgError('Error querying srpm')
- contents = output.split()
+ contents = output.split('\n')
# Cycle through the stuff and sort correctly by its extension
for file in contents:
if file.rsplit('.')[-1] in UPLOADEXTS:
}}}

but am now getting:

{{{
Traceback (most recent call last):
File "/usr/bin/fedpkg", line 1086, in
args.command(args)
File "/usr/bin/fedpkg", line 490, in import_srpm
uploadfiles = pyfedpkg.import_srpm(args.srpm, path=args.path)
File "/usr/lib/python2.7/site-packages/pyfedpkg/init.py", line 582, in import_srpm
rv = repo.index.add(files)
File "/usr/lib/python2.7/site-packages/git/index.py", line 250, in clear_cache_if_not_raised
rval = func(self, args, kwargs)
File "/usr/lib/python2.7/site-packages/git/index.py", line 268, in check_default_index
return func(self,
args, **kwargs)
File "/usr/lib/python2.7/site-packages/git/index.py", line 993, in add
entries_added.extend(self.entries[(f,0)] for f in added_files)
File "/usr/lib/python2.7/site-packages/git/index.py", line 993, in
entries_added.extend(self.entries[(f,0)] for f in added_files)
KeyError: ('.git/index', 0)
}}}

This seems to do the trick:

{{{
--- init.py.orig 2010-10-10 23:24:49.000000000 -0600
+++ init.py 2010-11-10 09:57:14.555642489 -0700
@@ -303,12 +303,12 @@
if error:
log.error(error)
raise FedpkgError('Error querying srpm')
- contents = output.split()
+ contents = output.split('\n')
# Cycle through the stuff and sort correctly by its extension
for file in contents:
if file.rsplit('.')[-1] in UPLOADEXTS:
uploadfiles.append(file)
- else:
+ elif file:
files.append(file)

 return((name, files, uploadfiles))

@@ -535,7 +535,7 @@
# 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')
    }}}

The split by "\n" seems to put an empty entry into contents, hence the check for file being "true"

Next step is building srpms and downloading the file:

{{{
@@ -630,8 +630,9 @@
if os.path.exists(outfile):
if _verify_file(outfile, csum, LOOKASIDEHASH):
continue
- url = '%s/%s/%s/%s/%s' % (LOOKASIDE, module, file, csum,
- file)
+ urlfile = file.replace(' ','%20')
+ url = '%s/%s/%s/%s/%s' % (LOOKASIDE, module, urlfile , csum,
+ urlfile)
# There is some code here for using pycurl, but for now,
# just use subprocess
#output = open(file, 'wb')
@@ -653,7 +654,7 @@
#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):
}}}

Oops, forgot this snippet too, parsing sources:

{{{
@@ -622,7 +622,7 @@
outdir = path
for archive in archives:
try:
- csum, file = archive.split()
+ csum, sep, file = archive.rstrip('\n').partition(' ')
except ValueError:
raise FedpkgError('Malformed sources file.')
# See if we already have a valid copy downloaded
}}}

Ok, I've applied these patches, or slight variations of them. Will be in the next bugfix build. Thanks for this!

Metadata