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-11-14 14:47:21 +0200
commit029fe4d463b674dae0e9e460084d920ab2384717 (patch)
treea3217ab2b87a32353ce675ec0d1dcce25570c92f
parent2300f25516748ee58ab9258e7831b06b58884d46 (diff)
downloadgit-buildpackage-029fe4d463b674dae0e9e460084d920ab2384717.tar.gz
git-buildpackage-029fe4d463b674dae0e9e460084d920ab2384717.tar.bz2
git-buildpackage-029fe4d463b674dae0e9e460084d920ab2384717.zip
buildpackage-rpm: handle invalid keys in orig prefix
Gracefully handle invalid keys in the --git-orig-prefix format string. 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']