aboutsummaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'gbp')
-rw-r--r--gbp/command_wrappers.py3
-rwxr-xr-xgbp/scripts/buildpackage.py5
-rw-r--r--gbp/scripts/buildpackage_rpm.py11
3 files changed, 14 insertions, 5 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index f4b00b8..aec3018 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -67,6 +67,9 @@ class Command(object):
"""
Wraps a shell command, so we don't have to store any kind of command
line options in one of the git-buildpackage commands
+
+ Note that it does not do any shell quoting even with shell=True so
+ you have to quote arguments yourself if necessary.
"""
def __init__(self, cmd, args=[], shell=False, extra_env=None, cwd=None,
capture_stderr=False,
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 6524f01..04c5e93 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -19,6 +19,7 @@
import errno
import os
+import pipes
import shutil
import sys
import time
@@ -727,7 +728,9 @@ def main(argv):
)(dir=build_dir)
# Finally build the package:
- RunAtCommand(options.builder, dpkg_args, shell=True,
+ RunAtCommand(options.builder,
+ [pipes.quote(arg) for arg in dpkg_args],
+ shell=True,
extra_env=Hook.md(build_env,
{'GBP_BUILD_DIR': build_dir})
)(dir=build_dir)
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index 5dde23b..b34617d 100644
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -19,6 +19,7 @@
"""Build an RPM package out of a Git repository"""
import os
+import pipes
import shutil
import sys
@@ -242,9 +243,9 @@ def setup_builder(options, builder_args):
if len(builder_args) == 0:
builder_args.append('-ba')
builder_args.extend([
- '--define "_topdir %s"' % os.path.abspath(options.export_dir),
- '--define "_specdir %%_topdir/%s"' % options.export_specdir,
- '--define "_sourcedir %%_topdir/%s"' % options.export_sourcedir])
+ '--define', "_topdir %s" % os.path.abspath(options.export_dir),
+ '--define', "_specdir %%_topdir/%s" % options.export_specdir,
+ '--define', "_sourcedir %%_topdir/%s" % options.export_sourcedir])
def packaging_tag_data(repo, commit, name, version, options):
@@ -580,7 +581,9 @@ def main(argv):
spec.specfile))
else:
builder_args.append(spec.specfile)
- RunAtCommand(options.builder, builder_args, shell=True,
+ RunAtCommand(options.builder,
+ [pipes.quote(arg) for arg in builder_args],
+ shell=True,
extra_env={'GBP_BUILD_DIR': export_dir}
)(dir=export_dir)
if options.postbuild: