1 |
#!/usr/bin/perl |
2 |
# |
3 |
# |
4 |
|
5 |
use strict; |
6 |
use MGATools::rpmsrate; |
7 |
|
8 |
my $output_file; |
9 |
$ARGV[0] =~ /-o/ and do { shift @ARGV; $output_file = shift }; |
10 |
|
11 |
$ARGV[1] or print "\nUsage: |
12 |
clean-rpmsrate [options] <rpmsrate file> <RPMs dir 1> <RPMs dir 2> ... <RPMs dir n> |
13 |
|
14 |
options: |
15 |
-o file: output file\n\n" and exit(); |
16 |
|
17 |
my $rpmsrate_raw_file = shift @ARGV; |
18 |
|
19 |
my %rpm; |
20 |
foreach my $dir (@ARGV) { |
21 |
chdir($dir); |
22 |
$rpm{$dir} = [ map { s!\.rpm$!!; $_ } glob "*.rpm" ]; |
23 |
} |
24 |
chdir($ENV{PWD}); # in case -o referes to a relative path |
25 |
|
26 |
cleanrpmsrate($rpmsrate_raw_file, $output_file, \%rpm); |