aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-06-18 15:57:58 +0000
committerFrancois Pons <fpons@mandriva.com>2002-06-18 15:57:58 +0000
commited94a2cad345d6b1a631f7cedf683a0be9be96c6 (patch)
tree209a7e5d6d4750df5869cf1f137eebc9675d0f27 /genhdlist
parenteaae50adaa99db6a8d285f5a9122228a88484d2f (diff)
downloadrpmtools-ed94a2cad345d6b1a631f7cedf683a0be9be96c6.tar
rpmtools-ed94a2cad345d6b1a631f7cedf683a0be9be96c6.tar.gz
rpmtools-ed94a2cad345d6b1a631f7cedf683a0be9be96c6.tar.bz2
rpmtools-ed94a2cad345d6b1a631f7cedf683a0be9be96c6.tar.xz
rpmtools-ed94a2cad345d6b1a631f7cedf683a0be9be96c6.zip
4.3-3mdk (added genhdlist)
Diffstat (limited to 'genhdlist')
-rw-r--r--genhdlist51
1 files changed, 51 insertions, 0 deletions
diff --git a/genhdlist b/genhdlist
new file mode 100644
index 0000000..0521947
--- /dev/null
+++ b/genhdlist
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+use strict;
+use URPM;
+use URPM::Build;
+use File::Find;
+use File::Path;
+
+my $urpm = new URPM;
+my $tmpdir = "/tmp/genhdlist";
+my $index="hdlist.cz";
+my $synthesis="synthesis.$index";
+my $dir = @ARGV[0] or die "usage: genhdlist <dir>";
+
+chdir $dir or die "can't chdir in directory $dir";
+
+# get rpm list
+my @rpms;
+File::Find::find({wanted => \&wanted}, ".");
+sub wanted {
+ if (-f $_ && $_ =~ /^.*\.rpm$/ ) {
+ print "$File::Find::name\n";
+ push(@rpms, $File::Find::name);
+ }
+}
+if (!@rpms) {
+ print "no rpms found, aborting\n";
+ exit(0);
+}
+
+# create index file
+mkpath($tmpdir);
+$urpm->parse_rpms_build_headers(dir => $tmpdir,
+ rpms => \@rpms);
+@{$urpm->{depslist}} > 0 or die "nothing read";
+$urpm->build_hdlist(start => 0,
+ end => $#{$urpm->{depslist}},
+ dir => $tmpdir,
+ hdlist => $index,
+ ratio => 9);
+rmtree($tmpdir);
+
+# create synthesis file
+$urpm->build_synthesis(start => 0,
+ end => $#{$urpm->{depslist}},
+ synthesis => $synthesis);
+
+# create list file
+open(LIST, "> list") or die "can't create list file list: $!";
+foreach my $rpm (@rpms) { print LIST "$rpm\n" };
+close(LIST);