aboutsummaryrefslogtreecommitdiffstats
path: root/rpmtools.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-01-16 16:39:20 +0000
committerFrancois Pons <fpons@mandriva.com>2001-01-16 16:39:20 +0000
commit738b780f9dc91ea137fd20e79b1369e169060b58 (patch)
tree7f56b93b3c72b80d9d8c9fa22a14f0b6e7ad8674 /rpmtools.pm
parent8e2e4d4a24ca75a8041e80e3a0bae1befaf0eeaf (diff)
downloadrpmtools-738b780f9dc91ea137fd20e79b1369e169060b58.tar
rpmtools-738b780f9dc91ea137fd20e79b1369e169060b58.tar.gz
rpmtools-738b780f9dc91ea137fd20e79b1369e169060b58.tar.bz2
rpmtools-738b780f9dc91ea137fd20e79b1369e169060b58.tar.xz
rpmtools-738b780f9dc91ea137fd20e79b1369e169060b58.zip
add build_hdlist method.
increase version to 0.03.
Diffstat (limited to 'rpmtools.pm')
-rw-r--r--rpmtools.pm46
1 files changed, 43 insertions, 3 deletions
diff --git a/rpmtools.pm b/rpmtools.pm
index 50ac88e..583a473 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
require DynaLoader;
@ISA = qw(DynaLoader);
-$VERSION = '0.02';
+$VERSION = '0.03';
bootstrap rpmtools $VERSION;
@@ -74,6 +74,8 @@ sub new {
info => {},
depslist => [],
provides => {},
+ tmpdir => $ENV{TMPDIR} || "/tmp",
+ noclean => 0,
}, $class;
}
@@ -102,6 +104,35 @@ sub read_hdlists {
1;
}
+#- build an hdlist from a list of files.
+sub build_hdlist {
+ my ($params, $hdlist, @rpms) = @_;
+ my ($work_dir, %names) = "$params->{tmpdir}/.build_hdlist";
+
+ #- build a working directory which will hold rpm headers.
+ -d $work_dir or mkdir $work_dir, 0755 or die "cannot create working directory $work_dir\n";
+ chdir $work_dir;
+
+ foreach (@rpms) {
+ my ($key, $name) = /(([^\/]*)-[^-]*-[^-]*\.[^\/\.]*)\.rpm$/ or next;
+ system("rpm2header '$_' > $key") unless -e $key;
+ $? == 0 or unlink($key), die "bad rpm $_\n";
+ -s $key or unlink($key), die "bad rpm $_\n";
+ push @{$names{$name} ||= []}, $key;
+ }
+
+ open B, "| packdrake -b9s '$hdlist' 400000";
+ foreach (@{$params->{depslist}}) {
+ if (my $keys = delete $names{$_->{name}}) {
+ print B "$_\n" foreach @$keys;
+ }
+ }
+ foreach (values %names) {
+ print B "$_\n" foreach @$_;
+ }
+ close B or die "packdrake failed\n";
+}
+
#- read one or more rpm files.
sub read_rpms {
my ($params, @rpms) = @_;
@@ -221,8 +252,7 @@ sub compute_depslist {
}
}
#- setup, filesystem and basesystem should be at the beginning.
- @ordered{qw(ld.so readline termcap libtermcap bash sash glibc
- setup filesystem basesystem)} =
+ @ordered{qw(ldconfig readline termcap libtermcap bash sash glibc setup filesystem basesystem)} =
(100000, 90000, 80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000);
#- compute base flag, consists of packages which are required without
@@ -399,6 +429,16 @@ sub keep_only_cleaned_provides_files {
$params->{depslist} = [];
}
+#- reset params to allow other entries.
+sub clean {
+ my ($params) = @_;
+
+ $params->{use_base_flag} = 0;
+ $params->{info} = {};
+ $params->{depslist} = [];
+ $params->{provides} = {};
+}
+
#- read provides, first is key, after values.
sub read_provides {
my ($params, $FILE) = @_;