summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-06 16:43:23 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:47:19 +0200
commitfee13bd79856b3d3cb03d752ede2ff9f19beb060 (patch)
tree9afcb87f5a599f621c0361dccbd40569819debe6 /gbp/scripts
parentaa8d0d998a00f0e626022f5bb0451347d5132825 (diff)
downloadgit-buildpackage-fee13bd79856b3d3cb03d752ede2ff9f19beb060.tar.gz
git-buildpackage-fee13bd79856b3d3cb03d752ede2ff9f19beb060.tar.bz2
git-buildpackage-fee13bd79856b3d3cb03d752ede2ff9f19beb060.zip
rpm: change guess_spec() to return SpecFile object
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts')
-rwxr-xr-xgbp/scripts/buildpackage_rpm.py10
-rwxr-xr-xgbp/scripts/import_orig_rpm.py14
-rwxr-xr-xgbp/scripts/pq_rpm.py28
3 files changed, 23 insertions, 29 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index 56c6b893..b57c5285 100755
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -514,12 +514,12 @@ def main(argv):
options.packaging_dir = os.path.dirname(specfile)
if not os.path.exists(specfile):
raise rpm.NoSpecError("Failed to export specfile: %s" % options.spec_file)
+ spec = rpm.SpecFile(specfile)
else:
- specfile = rpm.guess_spec(os.path.join(dump_dir, options.packaging_dir),
- True,
- os.path.basename(repo.path) + '.spec')
- spec = rpm.SpecFile(specfile)
- gbp.log.debug("Using spec file '%s'" % specfile)
+ spec = rpm.guess_spec(os.path.join(dump_dir, options.packaging_dir),
+ True,
+ os.path.basename(repo.path) + '.spec')
+ gbp.log.debug("Using spec file '%s'" % spec.specfile)
if not options.tag_only:
# Setup builder opts
diff --git a/gbp/scripts/import_orig_rpm.py b/gbp/scripts/import_orig_rpm.py
index 62edd145..b208ad12 100755
--- a/gbp/scripts/import_orig_rpm.py
+++ b/gbp/scripts/import_orig_rpm.py
@@ -25,8 +25,8 @@ import gbp.tmpfile as tempfile
import gbp.command_wrappers as gbpc
import string
from gbp.pkg import parse_archive_filename
-from gbp.rpm import (RpmUpstreamSource, SpecFile, NoSpecError, parse_spec,
- guess_spec, guess_spec_repo)
+from gbp.rpm import (RpmUpstreamSource, SpecFile, NoSpecError, guess_spec,
+ guess_spec_repo)
from gbp.rpm.policy import RpmPkgPolicy
from gbp.rpm.git import (GitRepositoryError, RpmGitRepository)
from gbp.config import GbpOptionParserRpm, GbpOptionGroup, no_upstream_branch_msg
@@ -48,17 +48,17 @@ def detect_name_and_version(repo, source, options):
# Try to find the source package name
try:
- spec = parse_spec(guess_spec(os.path.join(repo.path, options.packaging_dir),
- True,
- os.path.basename(repo.path) + '.spec'))
+ preferred_fn = os.path.basename(repo.path) + '.spec'
+ spec = guess_spec(os.path.join(repo.path, options.packaging_dir), True,
+ preferred_fn)
sourcepackage = spec.name
except NoSpecError:
try:
# Check the spec file from the repository, in case
# we're not on the packaging-branch (but upstream, for
# example).
- specfile = guess_spec_repo(repo, options.packaging_branch, options.packaging_dir)
- spec = SpecFile(specfile)
+ spec = guess_spec_repo(repo, options.packaging_branch,
+ options.packaging_dir)
sourcepackage = spec.name
except NoSpecError:
if options.interactive:
diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py
index cf7b29ad..aba63537 100755
--- a/gbp/scripts/pq_rpm.py
+++ b/gbp/scripts/pq_rpm.py
@@ -185,13 +185,11 @@ def export_patches(repo, branch, options):
# Find and parse .spec file
try:
if options.spec_file != 'auto':
- specfilename = options.spec_file
options.packaging_dir = os.path.dirname(specfilename)
+ spec = SpecFile(options.packaging_dir)
else:
- specfilename = guess_spec(options.packaging_dir,
- True,
- os.path.basename(repo.path) + '.spec')
- spec = SpecFile(specfilename)
+ spec = guess_spec(options.packaging_dir, True,
+ os.path.basename(repo.path) + '.spec')
except KeyError:
raise GbpError, "Can't parse spec"
@@ -293,13 +291,11 @@ def import_spec_patches(repo, branch, options):
# Find and parse .spec file
try:
if options.spec_file != 'auto':
- specfilename = options.spec_file
- options.packaging_dir = os.path.dirname(specfilename)
+ options.packaging_dir = os.path.dirname(options.spec_file)
+ spec = SpecFile(options.spec_file)
else:
- specfilename = guess_spec(options.packaging_dir,
- True,
- os.path.basename(repo.path) + '.spec')
- spec = SpecFile(specfilename)
+ spec = guess_spec(options.packaging_dir, True,
+ os.path.basename(repo.path) + '.spec')
except KeyError:
raise GbpError, "Can't parse spec"
@@ -352,13 +348,11 @@ def rebase_pq(repo, branch, options):
# Find and parse .spec file
try:
if options.spec_file != 'auto':
- specfilename = options.spec_file
- options.packaging_dir = os.path.dirname(specfilename)
+ options.packaging_dir = os.path.dirname(options.spec_file)
+ spec = SpecFile(options.spec_file)
else:
- specfilename = guess_spec(options.packaging_dir,
- True,
- os.path.basename(repo.path) + '.spec')
- spec = SpecFile(specfilename)
+ spec = guess_spec(options.packaging_dir, True,
+ os.path.basename(repo.path) + '.spec')
except KeyError:
raise GbpError, "Can't parse spec"