aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2004-01-16 00:53:13 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2004-01-16 00:53:13 +0000
commit5503479a648c8b263fc7c3030e287aabfb15e8a3 (patch)
treeef4306a0b36112aa1942b3838ddaef5ae3a1729f /genhdlist
parent55bfde1fe25bde0d04b76821501feb860d1ee595 (diff)
downloadrpmtools-5503479a648c8b263fc7c3030e287aabfb15e8a3.tar
rpmtools-5503479a648c8b263fc7c3030e287aabfb15e8a3.tar.gz
rpmtools-5503479a648c8b263fc7c3030e287aabfb15e8a3.tar.bz2
rpmtools-5503479a648c8b263fc7c3030e287aabfb15e8a3.tar.xz
rpmtools-5503479a648c8b263fc7c3030e287aabfb15e8a3.zip
- add --dest option
- fix dir parsing
Diffstat (limited to 'genhdlist')
-rw-r--r--genhdlist12
1 files changed, 8 insertions, 4 deletions
diff --git a/genhdlist b/genhdlist
index 00e4ea1..a9e6a68 100644
--- a/genhdlist
+++ b/genhdlist
@@ -27,7 +27,7 @@ use File::Find;
use File::Path;
use Getopt::Long;
-my ($noclean, $nooutput, $dontdie, $suffix) = (0, 0, 0, "", ".");
+my ($noclean, $nooutput, $dontdie, $suffix, $dest) = (0, 0, 0, "");
my $tmpdir = (-d "$ENV{HOME}/tmp" ? "$ENV{HOME}/tmp" : $ENV{TMPDIR} || "/tmp") . "/.build_hdlist";
sub usage {
@@ -36,6 +36,7 @@ Usage: $0 [options] [dir...]
Options:
--help print this message and exit
--headersdir dir put temporary files in dir
+ --dest build index from this dir
-s silent mode
--nobadrpm do not stop on bad rpm
--noclean keep cache files
@@ -49,6 +50,7 @@ GetOptions(
'noclean' => \$noclean,
'headersdir=s' => \$tmpdir,
'fermetagueule|s' => \$nooutput,
+ 'dest=s' => \$dest,
'nobadrpm' => \$dontdie,
'suffix=s' => \$suffix,
);
@@ -56,16 +58,17 @@ GetOptions(
my $urpm = new URPM;
my $index = "hdlist$suffix.cz";
my $synthesis = "synthesis.$index";
-my @dir = @ARGV || (".");
+my @dir = @ARGV ? @ARGV : (".");
-#chdir $rootdistrib or die "can't chdir in directory $rootdistrib";
+grep { m!^/! } @dir and die "Directory path to parse should be relative";
+
+$dest and chdir $dest or die "can't chdir in directory $dest";
rmtree($tmpdir) unless $noclean;
mkpath($tmpdir);
my @rpms;
sub wanted {
if (-f $_ && $_ =~ /^.*\.rpm$/ ) {
- #print "$File::Find::name\n" unless $nooutput;
push(@rpms, $File::Find::name);
}
}
@@ -73,6 +76,7 @@ sub wanted {
# get rpm list
open(LIST, "> list$suffix") or die "can't create list file: $!";
foreach my $dir (@dir) {
+ print "parsing $dir\n" unless $nooutput;
@rpms=();
File::Find::find({wanted => \&wanted}, $dir);
$urpm->parse_rpms_build_headers(dir => $tmpdir,