aboutsummaryrefslogtreecommitdiffstats
path: root/rpmtools.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-01-17 15:47:46 +0000
committerFrancois Pons <fpons@mandriva.com>2001-01-17 15:47:46 +0000
commit21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6 (patch)
tree061d4aae9eee2fe51874c36d1d062c2fdb97bc30 /rpmtools.pm
parent74b93adcb26d80ee4b94c4f456a8a057541cd590 (diff)
downloadrpmtools-21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6.tar
rpmtools-21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6.tar.gz
rpmtools-21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6.tar.bz2
rpmtools-21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6.tar.xz
rpmtools-21b9bb0cfaba30cd82c2b402a1f8b58e237b23c6.zip
fixed volative current working directory in build_hdlist
and use of noclean options.
Diffstat (limited to 'rpmtools.pm')
-rw-r--r--rpmtools.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/rpmtools.pm b/rpmtools.pm
index 583a473..5d84acd 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -74,8 +74,10 @@ sub new {
info => {},
depslist => [],
provides => {},
- tmpdir => $ENV{TMPDIR} || "/tmp",
- noclean => 0,
+ options => {
+ tmpdir => $ENV{TMPDIR} || "/tmp",
+ noclean => 0,
+ },
}, $class;
}
@@ -107,11 +109,11 @@ sub read_hdlists {
#- build an hdlist from a list of files.
sub build_hdlist {
my ($params, $hdlist, @rpms) = @_;
- my ($work_dir, %names) = "$params->{tmpdir}/.build_hdlist";
+ my ($work_dir, %names) = "$params->{options}{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;
+ my $cwd = `pwd`; chdir $work_dir;
foreach (@rpms) {
my ($key, $name) = /(([^\/]*)-[^-]*-[^-]*\.[^\/\.]*)\.rpm$/ or next;
@@ -131,6 +133,8 @@ sub build_hdlist {
print B "$_\n" foreach @$_;
}
close B or die "packdrake failed\n";
+
+ chdir $cwd; system("rm", "-rf", $work_dir) unless $params->{options}{noclean};
}
#- read one or more rpm files.