tags 846567 + patch thanks Hi,
> I wonder if we shouldn't better use the git clone notation tough: > > gbp import-dsc <what-to-import> <where-to-import-to> Agreed. > Could you respin the patch and update the manpage too? […] > We also need to follow up in gbp-import-srpm and gbp-import-dscs but > that can happen in additional patches (later). No problem. Updated patch attached: commit f3690ac2f57f54ef8a16db26d66d532996710e7c Author: Chris Lamb <la...@debian.org> Date: Sun Dec 4 09:37:24 2016 +0000 Add ability to specify the clone target to gbp-import-{dsc,srpm} Signed-off-by: Chris Lamb <la...@debian.org> docs/manpages/gbp-import-dsc.sgml | 6 +++++- docs/manpages/gbp-import-srpm.sgml | 7 ++++++- gbp/scripts/import_dsc.py | 13 +++++++------ gbp/scripts/import_srpm.py | 7 ++++--- 4 files changed, 22 insertions(+), 11 deletions(-) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
>From f3690ac2f57f54ef8a16db26d66d532996710e7c Mon Sep 17 00:00:00 2001 From: Chris Lamb <la...@debian.org> Date: Sun, 4 Dec 2016 09:37:24 +0000 Subject: [PATCH] Add ability to specify the clone target to gbp-import-{dsc,srpm} Signed-off-by: Chris Lamb <la...@debian.org> --- docs/manpages/gbp-import-dsc.sgml | 6 +++++- docs/manpages/gbp-import-srpm.sgml | 7 ++++++- gbp/scripts/import_dsc.py | 13 +++++++------ gbp/scripts/import_srpm.py | 7 ++++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/docs/manpages/gbp-import-dsc.sgml b/docs/manpages/gbp-import-dsc.sgml index 5476b0e..89caf79 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 d51ae7d..83ccbae 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 aa734e8..130ed70 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 c4b3a48..64a636a 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 -- 2.10.2