Changeset 13 for trunk


Ignore:
Timestamp:
11/07/05 16:32:17 (19 years ago)
Author:
kdeugau
Message:

/trunk

Checkpoint
Tweaked handling of location of temp dir; subbed $tmpdir and %{_tmpdir}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r12 r13  
    4747        );
    4848my $topdir = "/usr/src/debian";
    49 my $buildroot = "/var/tmp/%{name}-%{version}-%{release}.root".int(rand(99998)+1);
     49my $buildroot = "%{_tmppath}/%{name}-%{version}-%{release}.root".int(rand(99998)+1);
    5050
    5151# "Constants"
     
    108108
    109109die "Not enough arguments\n" if #$argv == 0;
     110
     111# Snag some environment data
     112my $tmpdir;
     113if (defined $ENV{TMP} && $ENV{TMP} =~ /^(\/var)?\/tmp$/) {
     114  $tmpdir = $ENV{TMP};
     115} else {
     116  $tmpdir = "/var/tmp";
     117}
    110118
    111119##main
     
    439447
    440448  # create script filename
    441   my $prepscriptfile = "/var/tmp/deb-tmp.prep.".int(rand(99998)+1);
     449  my $prepscriptfile = "$tmpdir/deb-tmp.prep.".int(rand(99998)+1);
    442450  sysopen(PREPSCRIPT, $prepscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
    443451        or die $!;
     
    464472
    465473  # create script filename
    466   my $buildscriptfile = "/var/tmp/deb-tmp.build.".int(rand(99998)+1);
     474  my $buildscriptfile = "$tmpdir/deb-tmp.build.".int(rand(99998)+1);
    467475  sysopen(BUILDSCRIPT, $buildscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
    468476        or die $!;
     
    490498
    491499  # create script filename
    492   my $installscriptfile = "/var/tmp/deb-tmp.inst.".int(rand(99998)+1);
     500  my $installscriptfile = "$tmpdir/deb-tmp.inst.".int(rand(99998)+1);
    493501  sysopen(INSTSCRIPT, $installscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
    494502        or die $!;
     
    520528
    521529  # create script filename
    522   my $debscriptfile = "/var/tmp/deb-tmp.pkg.".int(rand(99998)+1);
     530  my $debscriptfile = "$tmpdir/deb-tmp.pkg.".int(rand(99998)+1);
    523531  sysopen(DEBSCRIPT, $debscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
    524532        or die $!;
     
    658666  if ($section =~ /g/) {
    659667    $macrostring =~ s/\%\{_topdir\}/$topdir/g;
    660     $macrostring =~ s'%{_tmppath}'/var/tmp'g;
     668    $macrostring =~ s|%{_tmppath}|$tmpdir|g;
    661669    $macrostring =~ s'%{_docdir}'/usr/share/doc'g;
    662670  } # done with globals section
Note: See TracChangeset for help on using the changeset viewer.