From bd1830ae01b2317d5cc425dd4d7d0fda2ccfaee5 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 30 Sep 2005 15:56:47 +0000 Subject: Use a random temp directory. Remove --headersdir option. --- genhdlist | 18 +++--------------- 1 file 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 file containin the relative paths to all RPMs. Consequently, the paths to the directories passed to F 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. - =head1 SEE ALSO gendistrib(1), parsehdlist(1) -- cgit v1.2.1