aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-03-08 18:17:51 +0100
committerGuido Günther <agx@sigxcpu.org>2012-03-08 18:35:53 +0100
commit38870d5c28b8c8082984361a1331a427cc6ba754 (patch)
treeb517ca4fc7936ac33a1048e83933636facb4fcc9
parentf6b9f674f0bc6ae77669de8b968d0ef759341cd0 (diff)
git-import-dscs: allow to ignore gbp.conf files stored in the repository
Closes: #660898
-rw-r--r--docs/manpages/git-import-dscs.sgml11
-rw-r--r--gbp/scripts/import_dscs.py24
2 files changed, 31 insertions, 4 deletions
diff --git a/docs/manpages/git-import-dscs.sgml b/docs/manpages/git-import-dscs.sgml
index f14a433..5ba8b0d 100644
--- a/docs/manpages/git-import-dscs.sgml
+++ b/docs/manpages/git-import-dscs.sgml
@@ -20,6 +20,7 @@
<refsynopsisdiv>
<cmdsynopsis>
&git-import-dscs;
+ <arg><option>options</option></arg>
<arg><option>git-import-dsc options</option></arg>
<arg choice="plain"><replaceable>pkg_1.dsc</replaceable></arg>
<arg choice="plain"><replaceable>pkg_2.dsc</replaceable></arg>
@@ -31,6 +32,7 @@
<cmdsynopsis>
&git-import-dscs;
<arg choice="req">--debsnap</arg>
+ <arg><option>options</option></arg>
<arg><option>git-import-dsc options</option></arg>
<arg choice="req"><replaceable>package</replaceable></arg>
</cmdsynopsis>
@@ -60,6 +62,15 @@
<para>Fetch snapshots from snapshots.debian.org using debsnap.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--ignore-repo-config</option>
+ </term>
+ <listitem>
+ <para>Ignore <filename>gbp.conf</filename> files stored in the git
+repository itself. This can be useful to ignore branch informations and other
+options shipped in the package source.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>
All other options are passed on verbatim to &git-import-dsc;.
diff --git a/gbp/scripts/import_dscs.py b/gbp/scripts/import_dscs.py
index aecab29..7cc19f3 100644
--- a/gbp/scripts/import_dscs.py
+++ b/gbp/scripts/import_dscs.py
@@ -25,6 +25,7 @@ from gbp.deb import parse_dsc, DscFile, DpkgCompareVersions
from gbp.errors import GbpError
from gbp.git import GitRepository, GitRepositoryError
from gbp.scripts import import_dsc
+from gbp.config import GbpOptionParser
import gbp.log
class DscCompareVersions(DpkgCompareVersions):
@@ -64,12 +65,24 @@ def fetch_snapshots(pkg, downloaddir):
return [os.path.join(downloaddir, dsc) for dsc in dscs]
+def set_gbp_conf_files():
+ """
+ Filter out all gbp.conf files that are local to the git repository and set
+ GBP_CONF_FILES accordingly so git-import-dsc will only use these.
+ """
+ files = GbpOptionParser.get_config_files()
+ global_config = [ f for f in files if f.startswith('/') ]
+ gbp_conf_files = ':'.join(global_config)
+ os.environ['GBP_CONF_FILES'] = gbp_conf_files
+ gbp.log.debug("Setting GBP_CONF_FILES to '%s'" % gbp_conf_files)
def print_help():
- print """Usage:
- git-import-dscs [git-import-dsc options] /path/to/dsc1 [/path/to/dsc2] ...
-or
- git-import-dscs --debsnap [git-import-dsc options] package
+ print """Usage: git-import-dscs [options] [git-import-dsc options] /path/to/dsc1 [/path/to/dsc2] ...
+ git-import-dscs --debsnap [options] [git-import-dsc options] package
+
+Options:
+
+ --ignore-repo-config: ignore gbp.conf in git repo
"""
@@ -88,6 +101,9 @@ def main(argv):
verbose = True
gbp.log.setup(False, verbose)
+ if '--ignore-repo-config' in import_args:
+ set_gbp_conf_files()
+ import_args.remove('--ignore-repo-config')
# Not using Configparser since we want to pass all unknown options
# unaltered to git-import-dsc
if '--debsnap' in import_args: