summaryrefslogtreecommitdiffstats
path: root/listpackages.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:08:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:08:26 +0000
commit59845ba9b3df5df775cf8c5a65d30375b984e3c7 (patch)
tree6c5c6d57676acf601505f35e53194e5e7a86f0c3 /listpackages.pl
parentInitial commit. (diff)
downloadtasksel-upstream/3.68+deb11u1.tar.xz
tasksel-upstream/3.68+deb11u1.zip
Adding upstream version 3.68+deb11u1.upstream/3.68+deb11u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xlistpackages.pl51
1 files changed, 51 insertions, 0 deletions
diff --git a/listpackages.pl b/listpackages.pl
new file mode 100755
index 0000000..c3b9fce
--- /dev/null
+++ b/listpackages.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+#
+# listpackages directory [field]
+#
+# This program spits out a list of all the packages listed in the tasks.
+#
+# If you go to auric, this command is then useful:
+#
+# for package in $(listpackages); do
+# madison -s testing -a "i386 all" $package >/dev/null || echo "No $package!"
+# done
+#
+# Or to see just key packages:
+#
+# listpackages tasks key
+
+my $dir=shift or die "no directory specified\n";
+my @toshow=qw{packages-list key};
+@toshow=@ARGV if @ARGV;
+
+use File::Find;
+find(\&processfile, $dir);
+
+sub processfile {
+ my $file=$_; # File::Find craziness.
+ $file eq 'po' && -d $file && ($File::Find::prune = 1);
+ return if $File::Find::dir=~/\.(svn|git)/;
+ return unless $file =~ /^[-+_.a-z0-9]+$/ and -f $file;
+ open (IN, $file) or die "$file: $!";
+ my %fields;
+ my $field="";
+ while (<IN>) {
+ chomp;
+ next if /^\s*#/;
+ s/#.*//;
+
+ if (/^\s/) {
+ $fields{$field}.="\n$_";
+ }
+ else {
+ ($field, my $value)=split(/:\s*/, $_, 2);
+ $field=lc($field);
+ $fields{$field}=$value;
+ }
+ }
+ close IN;
+
+ my @list;
+ push @list, split(' ', $fields{$_}) foreach @toshow;
+ print join("\n", @list)."\n" if @list;
+}