summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-03 10:43:50 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-03 10:43:50 +0000
commitfcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a (patch)
tree912f9502a97c434756b0949c58ec7af4e61f0039
parentb3369bf1b86ef6ccedd73cedf1f8f4c52a19caf4 (diff)
downloadurpmi-fcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a.tar
urpmi-fcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a.tar.gz
urpmi-fcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a.tar.bz2
urpmi-fcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a.tar.xz
urpmi-fcf1eb1899c53d56bdd77dae1c4dd99d07f2ae8a.zip
Provide our own tempdir function, that doesn't require File::Temp if it's not installed on the system
-rw-r--r--urpm/sys.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 01abaf2b..d398120f 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -1,5 +1,7 @@
package urpm::sys;
+# $Id$
+
use strict;
#- find used mount point from a pathname, use a optional mode to allow
@@ -150,4 +152,18 @@ sub apply_delta_rpm {
-e $rpm ? $rpm : '';
}
+our $tempdir_template = '/tmp/urpm.XXXXXX';
+sub mktempdir {
+ my $tmpdir;
+ eval { require File::Temp };
+ if ($@) {
+ #- fall back to external command (File::Temp not in perl-base)
+ $tmpdir = qx(mktemp -d $tempdir_template);
+ chomp $tmpdir;
+ } else {
+ $tmpdir = File::Temp::tempdir($tempdir_template);
+ }
+ return $tmpdir;
+}
+
1;