aboutsummaryrefslogtreecommitdiff
path: root/git_buildpackage
diff options
context:
space:
mode:
Diffstat (limited to 'git_buildpackage')
-rw-r--r--git_buildpackage/__init__.py25
-rw-r--r--git_buildpackage/config.py11
2 files changed, 24 insertions, 12 deletions
diff --git a/git_buildpackage/__init__.py b/git_buildpackage/__init__.py
index 29fe7b2..09a33f8 100644
--- a/git_buildpackage/__init__.py
+++ b/git_buildpackage/__init__.py
@@ -138,24 +138,33 @@ class GitPull(GitCommand):
"""Wrap git-pull"""
def __init__(self, repo, branch):
GitCommand.__init__(self,'pull', [repo, branch])
- self.run_error="Couldn't pull %s to %s" % (branch, repo)
+ self.run_error = "Couldn't pull %s to %s" % (branch, repo)
class GitTag(GitCommand):
"""Wrap git-tag"""
- def __init__(self):
- GitCommand.__init__(self,'tag')
-
- def __call__(self, tag):
- self.run_error="Couldn't tag %s" % (tag,)
- GitCommand.__call__(self, [tag])
+ def __init__(self, sign_tag=False, keyid=None):
+ GitCommand.__init__(self,'tag')
+ self.sign_tag = sign_tag
+ self.keyid = keyid
+
+ def __call__(self, version, msg="Tagging %(version)s"):
+ self.run_error="Couldn't tag %s" % (version,)
+ if self.sign_tag:
+ if self.keyid:
+ sign_opts = [ '-u', self.keyid ]
+ else:
+ sign_opts = [ '-s' ]
+ else:
+ sign_opts = []
+ GitCommand.__call__(self, sign_opts+[ '-m', msg % locals(), version])
class GitAdd(GitCommand):
"""Wrap git-add to add new files"""
def __init__(self):
GitCommand.__init__(self,'add')
- self.run_error="Couldn't add files"
+ self.run_error = "Couldn't add files"
class GitCommitAll(GitCommand):
diff --git a/git_buildpackage/config.py b/git_buildpackage/config.py
index 3a2c69d..f909b2f 100644
--- a/git_buildpackage/config.py
+++ b/git_buildpackage/config.py
@@ -22,9 +22,12 @@ class GBPOptionParser(OptionParser):
@cvar config_files: list of config files we parse
@type config_files: list
"""
- defaults={ 'builder': 'debuild',
+ defaults={ 'builder' : 'debuild',
'debian-branch' : 'debian',
'upstream-branch' : 'upstream',
+ 'upstream-branch' : 'upstream',
+ 'sign-tags' : '', # empty means False
+ 'keyid' : '',
}
config_files=['/etc/git-buildpackage/gbp.conf',
os.path.expanduser('~/.gbp.conf'),
@@ -45,7 +48,7 @@ class GBPOptionParser(OptionParser):
OptionParser.__init__(self, usage=usage)
- def add_config_file_option(self, option_name, dest, help):
+ def add_config_file_option(self, option_name, dest, help, **kwargs):
"""
set a option for the command line parser, the default is read from the config file
@var option_name: name of the option
@@ -56,6 +59,6 @@ class GBPOptionParser(OptionParser):
@type help: string
"""
OptionParser.add_option(self,"--%s%s" % (self.prefix, option_name), dest=dest,
- default=self.config[option_name], help=help % self.config)
-
+ default=self.config[option_name],
+ help=help % self.config, **kwargs)