summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-02-13 11:18:41 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-02-13 11:25:14 +0200
commitfc954aa57636836f60d3cdfe81b08cf29df4e27e (patch)
treead64a3ddb13b7577f01ab3a73bee42358827ce53
parentb8b3d220ec8b6f366a20b331ddf5db5e1ec04757 (diff)
downloadgit-buildpackage-fc954aa57636836f60d3cdfe81b08cf29df4e27e.tar.gz
git-buildpackage-fc954aa57636836f60d3cdfe81b08cf29df4e27e.tar.bz2
git-buildpackage-fc954aa57636836f60d3cdfe81b08cf29df4e27e.zip
rpm: store full path of spec file sources
Change-Id: I6f8a4bd98aa6051556cacb7ec7a771025c5f3880 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/rpm/__init__.py7
-rwxr-xr-xgbp/scripts/import_srpm.py2
-rw-r--r--tests/test_rpm.py2
3 files changed, 7 insertions, 4 deletions
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 18e74d82..c79ddf6b 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -245,7 +245,7 @@ class SpecFile(object):
"""Get all source tags as a dict"""
sources = {}
for src in self._sources().values():
- sources[src['num']] = os.path.basename(src['linevalue'])
+ sources[src['num']] = src['linevalue']
return sources
def _macro_replace(self, matchobj):
@@ -429,7 +429,7 @@ class SpecFile(object):
# workaround rpm parsing bug
if typ == 1 or typ == 9:
if num in sources:
- sources[num]['linevalue'] = os.path.basename(name)
+ sources[num]['linevalue'] = name
else:
gbp.log.err("BUG: failed to parse all 'Source' tags!")
elif typ == 2 or typ == 10:
@@ -783,7 +783,8 @@ class SpecFile(object):
orig = None
sources = self.sources()
for num, filename in sorted(sources.iteritems()):
- src = {'num': num, 'filename': os.path.basename(filename)}
+ src = {'num': num, 'filename': os.path.basename(filename),
+ 'uri': filename}
src['filename_base'], src['archive_fmt'], src['compression'] = \
parse_archive_filename(os.path.basename(filename))
if (src['filename_base'].startswith(self.name) and
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py
index 41779f0d..fd506654 100755
--- a/gbp/scripts/import_srpm.py
+++ b/gbp/scripts/import_srpm.py
@@ -332,7 +332,7 @@ def main(argv):
files = [os.path.basename(patch.path) \
for patch in spec.patchseries(unapplied=True, ignored=True)]
for filename in spec.sources().values():
- files.append(filename)
+ files.append(os.path.basename(filename))
files.append(os.path.join(spec.specdir, spec.specfile))
# Don't copy orig source archive, though
if spec.orig_src and spec.orig_src['filename'] in files:
diff --git a/tests/test_rpm.py b/tests/test_rpm.py
index f9f08dde..3e3a599e 100644
--- a/tests/test_rpm.py
+++ b/tests/test_rpm.py
@@ -103,6 +103,7 @@ class TestSpecFile(object):
orig = spec.orig_src
assert orig['filename'] == 'gbp-test-1.0.tar.bz2'
+ assert orig['uri'] == 'gbp-test-1.0.tar.bz2'
assert orig['filename_base'] == 'gbp-test-1.0'
assert orig['archive_fmt'] == 'tar'
assert orig['compression'] == 'bzip2'
@@ -124,6 +125,7 @@ class TestSpecFile(object):
orig = spec.orig_src
assert orig['filename'] == 'gbp-test2-3.0.tar.gz'
+ assert orig['uri'] == 'ftp://ftp.host.com/gbp-test2-3.0.tar.gz'
assert orig['archive_fmt'] == 'tar'
assert orig['compression'] == 'gzip'
assert orig['prefix'] == ''