summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-07-16 17:15:44 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-07-21 13:02:49 +0000
commit81f4628b66b5c19fc71792932330d4a63d68a92d (patch)
treec3859be7f0a9eec891cd23f85286c75bae77ff11
parentfd1e8f6ac79624e8541968f926826eec597a9d1d (diff)
downloadgit-buildpackage-81f4628b66b5c19fc71792932330d4a63d68a92d.tar.gz
git-buildpackage-81f4628b66b5c19fc71792932330d4a63d68a92d.tar.bz2
git-buildpackage-81f4628b66b5c19fc71792932330d4a63d68a92d.zip
buildpackage-rpm: handle invalid keys in orig prefix
Gracefully handle invalid keys in the --git-orig-prefix format string. Change-Id: I1948ed7b34cdd806a0154d8cf354c5095388988f Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-xgbp/scripts/buildpackage_rpm.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index be938aae..efc344d6 100755
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -599,10 +599,13 @@ def main(argv):
spec.specdir = os.path.abspath(spec_dir)
if options.orig_prefix != 'auto':
- options.orig_prefix = options.orig_prefix % dict(spec.version,
- version=RpmPkgPolicy.compose_full_version(spec.version),
- name=spec.name,
- vendor=options.vendor)
+ try:
+ options.orig_prefix %= dict(spec.version,
+ version=RpmPkgPolicy.compose_full_version(spec.version),
+ name=spec.name, vendor=options.vendor)
+ except KeyError as err:
+ raise GbpError("Unknown key %s in orig prefix format "
+ "string" % err)
elif spec.orig_src:
options.orig_prefix = spec.orig_src['prefix']