Package: reprepro
Version: 5.1.1-1
Severity: wishlist
Tags: patch

Hi,

Commands like 'list' require a codename as parameter. Since we
dynamically generate/delete distributions/codenames, I have to look into
conf/distributions for the correct codename. Instead of running

  sed -n 's/Codename: //p' conf/distributions

please add a 'listdistros' (or name it like you prefer) to list all
available codenames. A patch that adds a 'listdistros' command is
attached.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: benjamin.dr...@profitbricks.com
URL:  http://www.profitbricks.com

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
>From 64dc3914493b6c1f2c664f264bb806e33e5ea35f Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.dr...@profitbricks.com>
Date: Tue, 28 Feb 2017 15:34:14 +0100
Subject: [PATCH] Add listdistros command

Add a listdistros command which prints the available codenames.
---
 docs/reprepro.1               | 3 +++
 docs/reprepro.bash_completion | 3 ++-
 main.c                        | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/reprepro.1 b/docs/reprepro.1
index ff4a574..2ce75a4 100644
--- a/docs/reprepro.1
+++ b/docs/reprepro.1
@@ -536,6 +536,9 @@ For a format of the \fB.outlog\fP files generated for this script see the
 \fBmanual.html\fP shiped with reprepro.
 .SH COMMANDS
 .TP
+.BR listdistros
+Print the codenames of all configured distributions.
+.TP
 .BR export " [ " \fIcodenames\fP " ]"
 Generate all index files for the specified distributions.
 
diff --git a/docs/reprepro.bash_completion b/docs/reprepro.bash_completion
index 3c3e118..fb0a4b5 100644
--- a/docs/reprepro.bash_completion
+++ b/docs/reprepro.bash_completion
@@ -306,6 +306,7 @@ _reprepro()
 			includedsc\
 			includeudeb\
 			list\
+			listdistros\
 			listfilter\
 			listmatched\
 			ls\
@@ -415,7 +416,7 @@ _reprepro()
 			fi
 			;;
 
-		collectnewchecksums|cleanlists)
+		collectnewchecksums|cleanlists|listdistros)
 			return 0
 			;;
 
diff --git a/main.c b/main.c
index 18f05eb..d958a60 100644
--- a/main.c
+++ b/main.c
@@ -1203,6 +1203,13 @@ ACTION_B(y, n, y, buildneeded) {
 	}
 }
 
+ACTION_C(n, n, listdistros) {
+	for (struct distribution *d = alldistributions ; d != NULL ; d = d->next) {
+		printf("%s\n", d->codename);
+	}
+	return RET_OK;
+}
+
 static retvalue list_in_target(struct target *target, const char *packagename) {
 	retvalue r, result = RET_NOTHING;
 	struct package_cursor iterator;
@@ -3965,6 +3972,8 @@ static const struct action {
 		1, 1, "[-C <component>] [-A <architecture>] [-T <type>] ls <package-name>"},
 	{"lsbycomponent",	A_ROBact(lsbycomponent),
 		1, 1, "[-C <component>] [-A <architecture>] [-T <type>] lsbycomponent <package-name>"},
+	{"listdistros", 		A_C(listdistros),
+		0, 0, "listdistros"},
 	{"list", 		A_ROBact(list),
 		1, 2, "[-C <component>] [-A <architecture>] [-T <type>] list <codename> [<package-name>]"},
 	{"listfilter", 		A_ROBact(listfilter),
-- 
2.9.3

Reply via email to