diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-21 06:26:44 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-21 07:34:28 (EST) |
commit | 5b113acdcf2eeba2baee2dd16fc2ffb8454c943e (patch) | |
tree | ccc3308f0f0c1689ea5c79f8f20b6cc4a6062192 /bin/rdeps | |
parent | 0dd678a4433bf7091fcb2513d974a119872cded6 (diff) |
Diffstat (limited to 'bin/rdeps')
-rwxr-xr-x | bin/rdeps | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -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))); |