summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'gbp')
-rw-r--r--gbp/config.py24
-rw-r--r--gbp/scripts/buildpackage_rpm.py26
2 files changed, 49 insertions, 1 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 02b9254..79404df 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -611,6 +611,12 @@ class GbpOptionParserRpm(GbpOptionParser):
'patch-export-squash-until' : '',
'spec-vcs-tag' : '',
'orig-prefix' : 'auto',
+ 'mock' : 'False',
+ 'mock-results-pat' : 'results/%(dist)s/%(target_arch)s/',
+ 'dist' : '',
+ 'arch' : '',
+ 'mock-root' : '',
+ 'mock-options' : '',
})
help = dict(GbpOptionParser.help)
@@ -665,6 +671,24 @@ class GbpOptionParserRpm(GbpOptionParser):
'orig-prefix':
"Prefix (dir) to be used when generating/importing tarballs, "
"default is '%(orig-prefix)s'",
+ 'mock':
+ ("Invoke git-mock for building, "
+ "default is '%(mock)s'"),
+ 'dist':
+ ("Build for this distribution when using git-mock. E.g.: epel-6, "
+ "default is '%(dist)s'"),
+ 'arch':
+ ("Build for this architecture when using git-mock, "
+ "default is '%(arch)s'"),
+ 'mock-root':
+ ("The mock root (-r) name for building with git-mock: <dist>-<arch>, "
+ "default is '%(mock-root)s'"),
+ 'mock-options':
+ ("Options to pass to mock, "
+ "default is '%(mock-options)s'"),
+ 'mock-result-pat':
+ ("Pattern describing the subdirectory under which mock will write results, "
+ "default is '%(mock-results-pat)s'"),
})
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py
index dcfa3ac..c29a83f 100644
--- a/gbp/scripts/buildpackage_rpm.py
+++ b/gbp/scripts/buildpackage_rpm.py
@@ -293,7 +293,7 @@ def is_native(repo, options):
def setup_builder(options, builder_args):
- """setup everything to use git-pbuilder"""
+ """setup everything pathes for rpmbuild"""
if options.builder.startswith('rpmbuild'):
if len(builder_args) == 0:
builder_args.append('-ba')
@@ -310,6 +310,23 @@ def setup_builder(options, builder_args):
options.spec_dir = ''
+def setup_mock(options):
+ """setup everything to use git-mock"""
+ if options.use_mock:
+ options.builder = 'git-mock'
+ options.cleaner = '/bin/true'
+ os.environ['DIST'] = options.mock_dist
+ if options.mock_arch:
+ os.environ['ARCH'] = options.mock_arch
+ if options.mock_root:
+ os.environ['GIT_MOCK_ROOT'] = options.mock_root
+ os.environ['GIT_MOCK_EXPORT_DIR'] = options.export_dir
+ # FIXME: get that option defined:
+ #os.environ['GIT_MOCK_RESULTS_PAT'] = options.mock_results_pat
+ if options.mock_options:
+ os.environ['GIT_MOCK_OPTIONS'] = options.mock_options
+
+
def update_tag_str_fields(fields, tag_format_str, repo, commit_info):
"""Update string format fields for packaging tag"""
fields['nowtime'] = datetime.now().strftime(RpmPkgPolicy.tag_timestamp_format)
@@ -447,6 +464,12 @@ def parse_args(argv, prefix, git_treeish=None):
help="hook run after a successful build, default is '%(postbuild)s'")
cmd_group.add_config_file_option(option_name="posttag", dest="posttag",
help="hook run after a successful tag operation, default is '%(posttag)s'")
+ cmd_group.add_boolean_config_file_option(option_name="mock", dest="use_mock")
+ #cmd_group.add_config_file_option(option_name="mock-results-pat", dest="mock_results_pat")
+ cmd_group.add_config_file_option(option_name="dist", dest="mock_dist")
+ cmd_group.add_config_file_option(option_name="arch", dest="mock_arch")
+ cmd_group.add_config_file_option(option_name="mock-root", dest="mock_root")
+ cmd_group.add_config_file_option(option_name="mock-options", dest="mock_options")
cmd_group.add_boolean_config_file_option(option_name="hooks", dest="hooks")
export_group.add_option("--git-no-build", action="store_true",
dest="no_build",
@@ -568,6 +591,7 @@ def main(argv):
if not options.tag_only:
# Setup builder opts
setup_builder(options, builder_args)
+ setup_mock(options)
# Generate patches, if requested
if options.patch_export and not is_native(repo, options):