aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/manpages/gbp-create-remote-repo.sgml11
-rw-r--r--docs/manpages/gbp.conf.sgml31
-rw-r--r--gbp.conf8
-rw-r--r--gbp/config.py6
-rw-r--r--gbp/scripts/create_remote_repo.py36
5 files changed, 85 insertions, 7 deletions
diff --git a/docs/manpages/gbp-create-remote-repo.sgml b/docs/manpages/gbp-create-remote-repo.sgml
index e680f9e8..93cf9268 100644
--- a/docs/manpages/gbp-create-remote-repo.sgml
+++ b/docs/manpages/gbp-create-remote-repo.sgml
@@ -25,6 +25,7 @@
<arg><option>--remote-url-pattern=</option><replaceable>url-pattern</replaceable></arg>
<arg><option>--remote-name=</option><replaceable>name</replaceable></arg>
<arg><option>--template-dir=</option><replaceable>directory</replaceable></arg>
+ <arg><option>--remote-config=</option><replaceable>config</replaceable></arg>
<arg><option>--[no-]pristine-tar</option></arg>
<arg><option>--debian-branch=</option><replaceable>branch_name</replaceable></arg>
<arg><option>--upstream-branch=</option><replaceable>branch_name</replaceable></arg>
@@ -78,6 +79,16 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--remote-config</option>=<replaceable>config</replaceable>
+ </term>
+ <listitem>
+ <para>Name of a config file section in <filename>gbp.conf</filename>
+ that specifies the above paramters. See <xref linkend="gbp.man.gbp.conf">
+ manpage for details.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--debian-branch</option>=<replaceable>branch_name</replaceable>
</term>
<listitem>
diff --git a/docs/manpages/gbp.conf.sgml b/docs/manpages/gbp.conf.sgml
index e0330d73..09999beb 100644
--- a/docs/manpages/gbp.conf.sgml
+++ b/docs/manpages/gbp.conf.sgml
@@ -58,6 +58,11 @@
[&lt;command&gt;]
# Specific sections for each command, like &git-buildpackage;
key = value
+
+ [remote-config &lt;name&gt;]
+ # Specific sections for a remote configuration. This can be used several
+ # times to set up remote configuration for gbp-create-remote-repo
+ key = value
</programlisting>
<para>
@@ -125,6 +130,32 @@ can't be configured via gbp.conf.
</para>
</note>
+<para>
+<xref linkend="gbp.man.gbp.create.remote.repo"> can additionally parse remote site
+configurations from <filename>gbp.conf</filename>. For example a configration like:
+</para>
+
+<programlisting>
+[remote-config pkg-libvirt]
+# Location of the repository
+remote-url-pattern = ssh://git.debian.org/git/pkg-libvirt/%(pkg)s
+# Template dir to passed to git-init
+template-dir = /srv/alioth.debian.org/chroot/home/groups/pkg-libvirt/git-template
+</programlisting>
+
+<para>
+Can be used to create remote repositories for the pkg-libvirt project using:
+</para>
+
+<programlisting>
+gbp-create-remote-repo --remote-config=pkg-libvirt
+</programlisting>
+
+<para>
+This can be useful if you're often creating new remote repositores for
+different projects.
+</para>
+
</refsect1>
<refsect1>
<title>EXAMPLES</title>
diff --git a/gbp.conf b/gbp.conf
index f5c689cb..a283ed25 100644
--- a/gbp.conf
+++ b/gbp.conf
@@ -117,3 +117,11 @@
[gbp-create-remote-repo]
# disable remote branch tracking
#track = False
+
+# Sample config to create remote repositore using gbp-create-remote-repo:
+[remote-config pkg-libvirt]
+# Location of the repository
+remote-url-pattern = ssh://git.debian.org/git/pkg-libvirt/%(pkg)s
+# Template dir to passed to git-init
+template-dir = /srv/alioth.debian.org/chroot/home/groups/pkg-libvirt/git-template
+
diff --git a/gbp/config.py b/gbp/config.py
index 960d4b2e..35c78b40 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -126,6 +126,7 @@ class GbpOptionParser(OptionParser):
'pbuilder-autoconf' : 'True',
'pbuilder-options': '',
'template-dir': '',
+ 'remote-config': '',
}
help = {
'debian-branch':
@@ -210,7 +211,9 @@ class GbpOptionParser(OptionParser):
'pbuilder-options':
"Options to pass to pbuilder, default is '%(pbuilder-options)s'",
'template-dir':
- "Template directory used by git init, default is %(template-dir)s",
+ "Template directory used by git init, default is '%(template-dir)s'",
+ 'remote-config':
+ "Remote defintion in gbp.conf used to create the remote repository",
}
def_config_files = [ '/etc/git-buildpackage/gbp.conf',
@@ -358,6 +361,7 @@ class GbpOptionParser(OptionParser):
neg_help = "negates '--%s%s'" % (self.prefix, option_name)
self.add_config_file_option(option_name="no-%s" % option_name, dest=dest, help=neg_help, action="store_false")
+
class GbpOptionGroup(OptionGroup):
def add_config_file_option(self, option_name, dest, help=None, **kwargs):
"""
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py
index c26551b8..1e6b3f8a 100644
--- a/gbp/scripts/create_remote_repo.py
+++ b/gbp/scripts/create_remote_repo.py
@@ -225,10 +225,30 @@ def push_branches(remote, branches):
gitPush([remote['url'], '--tags'])
-def parse_args(argv):
+def parse_args(argv, sections=[]):
+ """
+ Parse the command line arguments and config files.
+
+ @param argv: the command line arguments
+ @type argv: C{list} of C{str}
+ @param sections: additional sections to add to the config file parser
+ besides the command name
+ @type sections: C{list} of C{str}
+ """
+
+ # We simpley handle the template section as an additional config file
+ # section to parse, this makes e.g. --help work as expected:
+ for arg in argv:
+ if arg.startswith('--remote-config='):
+ sections = ['remote-config %s' % arg.split('=',1)[1]]
+ break
+ else:
+ sections = []
+
parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
usage='%prog [options] - '
- 'create a remote repository')
+ 'create a remote repository',
+ sections=sections)
branch_group = GbpOptionGroup(parser,
"branch options",
"branch layout and tracking options")
@@ -257,8 +277,8 @@ def parse_args(argv):
help="The name of the remote, default is 'origin'")
parser.add_config_file_option(option_name="template-dir",
dest="template_dir")
- parser.add_config_file_option(option_name="remote-template",
- dest="remote_template")
+ parser.add_config_file_option(option_name="remote-config",
+ dest="remote_config")
(options, args) = parser.parse_args(argv)
@@ -270,9 +290,13 @@ def main(argv):
changelog = 'debian/changelog'
cmd = []
- options, args = parse_args(argv)
- gbp.log.setup(options.color, options.verbose)
+ try:
+ options, args = parse_args(argv)
+ except Exception as e:
+ print >>sys.stderr, "%s" % e
+ return 1
+ gbp.log.setup(options.color, options.verbose)
try:
repo = DebianGitRepository(os.path.curdir)
except GitRepositoryError: