Package: devscripts
Version: 2.16.1
Severity: wishlist
User: devscri...@packages.debian.org
Usertags: debsnap
Tags: patch

It will be nice to just list versions (for source and binary).

What do you think about patch like one here.

Osamu

>From a84839692d75877de10ff1b620dbb85dd32d47fd Mon Sep 17 00:00:00 2001
From: Osamu Aoki <os...@debian.org>
Date: Sun, 6 Mar 2016 23:36:31 +0900
Subject: [PATCH] debsnap: Add --list option

---
 scripts/debsnap.1  |  4 ++++
 scripts/debsnap.pl | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/scripts/debsnap.1 b/scripts/debsnap.1
index 217c1ac..306b4e8 100644
--- a/scripts/debsnap.1
+++ b/scripts/debsnap.1
@@ -45,6 +45,10 @@ Report on the \fBdebsnap\fP configuration being used and progress during the
 download operation.  Please always use this option when reporting bugs.
 
 .TP
+.BR \-\-list
+Don't dwnload but just list versions.
+
+.TP
 .BR \-\-binary
 Download binary packages instead of source packages.
 
diff --git a/scripts/debsnap.pl b/scripts/debsnap.pl
index 50749fb..b40a9f7 100755
--- a/scripts/debsnap.pl
+++ b/scripts/debsnap.pl
@@ -84,6 +84,7 @@ The following options are supported:
                                         Default is ./source-<package name>
     -f, --force                         Force overwriting an existing
                                         destdir
+    --list                              Don't download but just list versions
     --binary                            Download binary packages instead of
                                         source packages
     -a <architecture>,
@@ -216,7 +217,7 @@ sub keep_version($)
 read_conf(@ARGV);
 Getopt::Long::Configure('gnu_compat');
 Getopt::Long::Configure('no_ignore_case');
-GetOptions(\%opt, 'verbose|v', 'destdir|d=s', 'force|f', 'help|h', 'version', 'first=s', 'last=s', 'binary', 'architecture|a=s@') || usage(1);
+GetOptions(\%opt, 'verbose|v', 'destdir|d=s', 'force|f', 'help|h', 'version', 'first=s', 'last=s', 'list', 'binary', 'architecture|a=s@') || usage(1);
 
 usage(0) if $opt{help};
 usage(1) unless @ARGV;
@@ -277,7 +278,17 @@ unless (@versions) {
     warn "$progname: No matching versions found for $package\n";
     $warnings++;
 }
-if ($opt{binary}) {
+if ($opt{list}) {
+    foreach my $version (@versions) {
+	if ($opt{binary}) {
+	    print "$version->{binary_version}\n";
+	}
+	else {
+	    print "$version->{version}\n";
+	}
+    } 
+}
+elsif ($opt{binary}) {
     foreach my $version (@versions) {
 	my $src_json = fetch_json_page("$opt{baseurl}/mr/package/$version->{source}/$version->{version}/binfiles/$version->{name}/$version->{binary_version}?fileinfo=1");
 
-- 
2.7.0

Reply via email to