summaryrefslogtreecommitdiffstats
path: root/bin/rdeps
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rdeps')
-rwxr-xr-xbin/rdeps28
1 files changed, 24 insertions, 4 deletions
diff --git a/bin/rdeps b/bin/rdeps
index 83578f6..13016a5 100755
--- a/bin/rdeps
+++ b/bin/rdeps
@@ -12,6 +12,7 @@ no indirect;
use autovivification;
use English qw(-no_match_vars);
+use Getopt::Long;
use LWP::Simple;
use POSIX qw(strftime);
@@ -23,7 +24,7 @@ my @rdeps;
sub read_list
{
- my ($list, $dep, $is_src) = @_;
+ my ($list, $dep, $bin, $is_src) = @_;
foreach my $para (split(m{\n\n}, get($list))) {
my $package = undef;
@@ -43,9 +44,14 @@ sub read_list
}
next if not defined($source);
map({ $_ =~ s{[\s(].*$}{}; } @deps); # Vim: )
+ if ($bin) {
+ $package .= ' (src:' . $source . ')';
+ } else {
+ $package = $source;
+ }
if (grep(m{^\Q$dep\E$}, @deps) and not
- grep(m{^\Q$source\E$}, @rdeps)) {
- push(@rdeps, $source);
+ grep(m{^\Q$package\E$}, @rdeps)) {
+ push(@rdeps, $package);
}
}
@@ -63,9 +69,23 @@ sub usage
sub main
{
+ my %opts;
my $dep;
my @manifest;
+ Getopt::Long::Configure('no_ignore_case', 'bundling', 'gnu_compat',
+ 'no_getopt_compat');
+ if (not GetOptions(\%opts,
+ 'b|binary',
+ 'h|help',
+ )) {
+ usage(*STDERR);
+ return 1;
+ }
+ if (exists($opts{'h'})) {
+ usage(*STDERR);
+ return 0;
+ }
if ($#ARGV lt 0) {
usage(*STDERR);
return 1;
@@ -75,7 +95,7 @@ sub main
@manifest = split(m{\n}, get($BASE_URL . '/Manifest'));
foreach my $aps (@manifest) {
read_list($BASE_URL . '/' . $aps . '/Packages', $dep,
- ($aps =~ m{^src/}));
+ exists($opts{'b'}), ($aps =~ m{^src/}));
}
STDOUT->print(join("\n", sort(@rdeps)));