aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChris Lamb <lamby@debian.org>2016-12-04 09:37:24 +0000
committerGuido Günther <agx@sigxcpu.org>2016-12-04 19:14:58 +0100
commit03276df5b9391dc877521cd6c3553ca071157991 (patch)
treef2c2349f48bf49f940c52a58fbf5211cb521fd15
parentab76828948592f975bdb77fd603cc7160cef339d (diff)
Add ability to specify the clone target to gbp-import-{dsc,srpm}
Closes: #846567 Signed-off-by: Chris Lamb <lamby@debian.org>
-rw-r--r--docs/manpages/gbp-import-dsc.sgml6
-rw-r--r--docs/manpages/gbp-import-srpm.sgml7
-rw-r--r--gbp/scripts/import_dsc.py13
-rwxr-xr-xgbp/scripts/import_srpm.py7
4 files changed, 22 insertions, 11 deletions
diff --git a/docs/manpages/gbp-import-dsc.sgml b/docs/manpages/gbp-import-dsc.sgml
index 5476b0e6..89caf796 100644
--- a/docs/manpages/gbp-import-dsc.sgml
+++ b/docs/manpages/gbp-import-dsc.sgml
@@ -1,3 +1,5 @@
+FIXME
+
<refentry id="man.gbp.import.dsc">
<refentryinfo>
<address>
@@ -35,6 +37,7 @@
<arg><option>--upstream-branch=</option><replaceable>branch_name</replaceable></arg>
<arg><option>--upstream-tag=</option><replaceable>tag-format</replaceable></arg>
<arg choice="plain"><replaceable>debian-source.dsc</replaceable></arg>
+ <arg choice="opt"><replaceable>target</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
&gbp-import-dsc;
@@ -58,7 +61,8 @@
<para>
If the command is run from within an existing repository, it will import
into this; if not, a new repository named as the Debian source package is
- created.
+ created. You can override the location of the new repository by specifying
+ the optional <replaceable>target</replaceable> argument.
</para>
</refsect1>
<refsect1>
diff --git a/docs/manpages/gbp-import-srpm.sgml b/docs/manpages/gbp-import-srpm.sgml
index d51ae7d1..83ccbae3 100644
--- a/docs/manpages/gbp-import-srpm.sgml
+++ b/docs/manpages/gbp-import-srpm.sgml
@@ -1,3 +1,5 @@
+FIXME
+
<refentry id="man.gbp.import.srpm">
<refentryinfo>
<address>
@@ -36,6 +38,7 @@
<arg><option>--upstream-tag=</option><replaceable>TAG-FORMAT</replaceable></arg>
<arg><option>--native</option></arg>
<arg choice="plain"><replaceable>SRPM</replaceable></arg>
+ <arg choice="opt"><replaceable>target</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
&gbp-import-srpm;
@@ -54,7 +57,9 @@
&gbp-import-srpm; imports an RPM source package into a &git; repository,
notes the package version in the commit logs, and commits the change. All
information, including package name, version and upstream source is
- automatically detected from the source package. The tool supports importing
+ automatically detected from the source package but you can override the
+ location of the new repository by optionally specifying the
+ <replaceable>target</replaceable> argument. The tool supports importing
both archived (src.rpm files) or unpacked (directory) source RPMs.
</para>
</refsect1>
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index aa734e8a..130ed700 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -216,7 +216,7 @@ def disable_pristine_tar(options, reason):
def build_parser(name):
try:
parser = GbpOptionParserDebian(command=os.path.basename(name), prefix='',
- usage='%prog [options] /path/to/package.dsc')
+ usage='%prog [options] /path/to/package.dsc [<target>]')
except GbpError as err:
gbp.log.err(err)
return None
@@ -293,7 +293,7 @@ def main(argv):
return ExitCodes.parse_error
try:
- if len(args) != 1:
+ if len(args) > 2:
gbp.log.err("Need to give exactly one package to import. Try --help.")
raise GbpError
try:
@@ -324,12 +324,13 @@ def main(argv):
print_dsc(src)
if needs_repo:
- if os.path.exists(src.pkg):
+ target = args[1] if len(args) >= 2 else src.pkg
+ if os.path.exists(target):
raise GbpError("Directory '%s' already exists. If you want to import into it, "
"please change into this directory otherwise move it away first."
- % src.pkg)
+ % target)
gbp.log.info("No git repository found, creating one.")
- repo = DebianGitRepository.create(src.pkg)
+ repo = DebianGitRepository.create(target)
os.chdir(repo.path)
if repo.bare:
@@ -429,7 +430,7 @@ def main(argv):
gbpc.RemoveTree(dirs[d])()
if not ret and not skipped:
- gbp.log.info("Version '%s' imported under '%s'" % (src.version, src.pkg))
+ gbp.log.info("Version '%s' imported under '%s'" % (src.version, repo.path))
return ret
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py
index c4b3a488..64a636a5 100755
--- a/gbp/scripts/import_srpm.py
+++ b/gbp/scripts/import_srpm.py
@@ -122,7 +122,7 @@ def build_parser(name):
parser = GbpOptionParserRpm(command=os.path.basename(name),
prefix='',
usage='%prog [options] /path/to/package'
- '.src.rpm')
+ '.src.rpm [<target>]')
except GbpError as err:
gbp.log.err(err)
return None
@@ -261,7 +261,8 @@ def main(argv):
except GitRepositoryError:
gbp.log.info("No git repository found, creating one.")
is_empty = True
- repo = RpmGitRepository.create(spec.name)
+ target = args[1] if len(args) == 2 else spec.name
+ repo = RpmGitRepository.create(target)
os.chdir(repo.path)
if repo.bare:
@@ -460,7 +461,7 @@ def main(argv):
del_tmpdir()
if not ret and not skipped:
- gbp.log.info("Version '%s' imported under '%s'" % (ver_str, spec.name))
+ gbp.log.info("Version '%s' imported under '%s'" % (ver_str, repo.path))
return ret