import gbp.rpm
from gbp.scripts.buildpackage_rpm import main as gbp_build
-from gbp.git import repository
+from gbp.git import repository, GitRepositoryError
from gbp.errors import GbpError
OSCRC_TEMPLATE = """[general]
localpkg.remove_all()
with utils.Workdir(workdir):
+ commit = opts.commit or 'HEAD'
relative_spec = specfile.replace('%s/' % workdir, '')
- if gbp_build(["argv[0] placeholder", "--git-export-only",
- "--git-ignore-new", "--git-builder=osc",
- "--git-export-dir=%s" % oscworkdir,
- "--git-packaging-dir=packaging",
- "--git-specfile=%s" % relative_spec]):
- msger.error("Failed to get packaging info from git tree")
+ try:
+ if gbp_build(["argv[0] placeholder", "--git-export-only",
+ "--git-ignore-new", "--git-builder=osc",
+ "--git-export-dir=%s" % oscworkdir,
+ "--git-packaging-dir=packaging",
+ "--git-specfile=%s" % relative_spec,
+ "--git-export=%s" % commit]):
+ msger.error("Failed to get packaging info from git tree")
+ except GitRepositoryError, excobj:
+ msger.error("Repository error: %s" % excobj)
localpkg.update_local()
default=None,
dest='spec',
help='Specify a spec file to use')
+ @cmdln.option('-c', '--commit',
+ default=None,
+ dest='commit',
+ help='Specify a commit to build')
def do_remotebuild(self, subcmd, opts, *args):
"""${cmd_name}: remote build package