summaryrefslogtreecommitdiff
path: root/gbp/scripts/import_srpm.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-01-09 14:06:39 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-05 14:20:06 +0300
commit4e02c93cb50774ac0f6f553f7857efb20f456a5c (patch)
tree9750b0b5afa9706d45d11d3235f1533a1a6a59e9 /gbp/scripts/import_srpm.py
parent9f0acd1e691518cb031707bc4affdd262a5e5335 (diff)
downloadgit-buildpackage-4e02c93cb50774ac0f6f553f7857efb20f456a5c.tar.gz
git-buildpackage-4e02c93cb50774ac0f6f553f7857efb20f456a5c.tar.bz2
git-buildpackage-4e02c93cb50774ac0f6f553f7857efb20f456a5c.zip
import-srpm: enhance spec guessing
Use package name (in case of src.rpm) or directory name (in case of dir) as the preferred name of the spec file. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts/import_srpm.py')
-rwxr-xr-xgbp/scripts/import_srpm.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py
index 574d01e8..269101d9 100755
--- a/gbp/scripts/import_srpm.py
+++ b/gbp/scripts/import_srpm.py
@@ -274,13 +274,18 @@ def main(argv):
prefix='pkgextract_')
gbp.log.info("Extracting src rpm to '%s'" % dirs['pkgextract'])
src.unpack(dirs['pkgextract'])
+ preferred_spec = src.name + '.spec'
srpm = dirs['pkgextract']
+ elif os.path.isdir(srpm):
+ preferred_spec = os.path.basename(srpm.rstrip('/')) + '.spec'
+ else:
+ preferred_spec = None
# Find and parse spec file
if os.path.isdir(srpm):
gbp.log.debug("Trying to import an unpacked srpm from '%s'" % srpm)
dirs['src'] = os.path.abspath(srpm)
- spec = parse_spec(guess_spec(srpm, True))
+ spec = parse_spec(guess_spec(srpm, True, preferred_spec))
else:
gbp.log.debug("Trying to import an srpm from '%s' with spec "\
"file '%s'" % (os.path.dirname(srpm), srpm))