aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-30 15:56:47 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-30 15:56:47 +0000
commitbd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5 (patch)
tree8b80ec14a0b05ef6238fed844d2ff9a596e3b9e6
parent79458bc3071a469038a88cd3077d7068cd3e68c9 (diff)
downloadrpmtools-bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5.tar
rpmtools-bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5.tar.gz
rpmtools-bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5.tar.bz2
rpmtools-bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5.tar.xz
rpmtools-bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5.zip
Use a random temp directory. Remove --headersdir option.
-rw-r--r--genhdlist18
1 files changed, 3 insertions, 15 deletions
diff --git a/genhdlist b/genhdlist
index 44a7a4d..96360b4 100644
--- a/genhdlist
+++ b/genhdlist
@@ -9,9 +9,10 @@ use File::Find ();
use File::Path;
use Getopt::Long;
use Pod::Usage;
+use File::Temp qw(tempdir);
my ($nooutput, $nobadrpm, $md5sum, $subdir, $suffix, $dest) = (0, 0, 0, "", "", "");
-my $tmpdir = (-d "$ENV{HOME}/tmp" ? "$ENV{HOME}/tmp" : $ENV{TMPDIR} || "/tmp") . "/.build_hdlist";
+my $tmpdir_tpl = (-d "$ENV{HOME}/tmp" ? "$ENV{HOME}/tmp" : $ENV{TMPDIR} || "/tmp") . "/.build_hdlistXXXXX";
sub usage () {
pod2usage({ -verbose => 1 });
@@ -19,7 +20,6 @@ sub usage () {
GetOptions(
'dest=s' => \$dest,
- 'headersdir=s' => \$tmpdir,
'help|h' => sub { usage(); exit 0 },
list => \my $list,
nobadrpm => \$nobadrpm,
@@ -51,10 +51,7 @@ if ($subdir) {
-d $subdir && -w _ && -x _
or die "$subdir isn't a writable directory, bailing out\n";
}
-!-e $tmpdir or -o _
- or die "$tmpdir is not owned by you, bailing out\n";
-rmtree($tmpdir) unless $noclean;
-mkpath($tmpdir);
+my $tmpdir = tempdir($tmpdir_tpl, CLEANUP => !$noclean);
my @rpms;
my %rpmslist;
@@ -109,7 +106,6 @@ $urpm->build_hdlist(
hdlist => $hdlist,
ratio => 9,
);
-rmtree($tmpdir) unless $noclean;
# create synthesis file
$urpm->build_synthesis(
@@ -144,10 +140,6 @@ genhdlist - generates an hdlist file
Build indexes from this directory (that is, chdir's to this directory
before operation).
-=item --headersdir dir
-
-Put temporary files in directory.
-
=item --list
Creates a list file.
@@ -189,10 +181,6 @@ If the option B<--list> is given, it will also generate a F<list> file containin
the relative paths to all RPMs. Consequently, the paths to the directories
passed to F<genhdlist> must be relative ones.
-The temporary header directory (overriden by B<--headersdir>) defaults to
-F<~/tmp/.build_hdlist>, then F<$TMPDIR/.build_hdlist> and
-F</tmp/.build_hdlist>.
-
=head1 SEE ALSO
gendistrib(1), parsehdlist(1)