From owner-cvs-all Wed Jan 3 4:23:16 2001 From owner-cvs-all@FreeBSD.ORG Wed Jan 3 04:23:10 2001 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.189]) by hub.freebsd.org (Postfix) with SMTP id 2A2BC37B402 for ; Wed, 3 Jan 2001 04:23:07 -0800 (PST) Received: (qmail 57974 invoked by uid 1000); 3 Jan 2001 12:21:57 -0000 Date: Wed, 3 Jan 2001 14:21:57 +0200 From: Peter Pentchev To: Neil Blakey-Milner , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: ports/Tools/scripts/mkptools mkpbuild mkpinstall Message-ID: <20010103142157.D54743@ringworld.oblivion.bg> Mail-Followup-To: Neil Blakey-Milner , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org References: <200101031116.f03BGlq39072@freefall.freebsd.org> <20010103141000.B54743@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010103141000.B54743@ringworld.oblivion.bg>; from roam@orbitel.bg on Wed, Jan 03, 2001 at 02:10:01PM +0200 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Jan 03, 2001 at 02:10:01PM +0200, Peter Pentchev wrote: > On Wed, Jan 03, 2001 at 03:16:47AM -0800, Neil Blakey-Milner wrote: > > nbm 2001/01/03 03:16:46 PST > > > > Modified files: > > Tools/scripts/mkptools mkpbuild mkpinstall > > Log: > > As a quick fix, use /tmp instead of the currently hardcoded /usr/tmp. > > How about the attached patch to check for a user-specified temp dir? > (this is one of my first attempts at style(.perl)-ish Perl code, so > feel free to flame or point at manpages :) Or maybe rather this.. (smacks forehead).. G'luck, Peter -- This sentence every third, but it still comprehensible. Index: ports/Tools/scripts/mkptools/mkpbuild =================================================================== RCS file: /home/ncvs/ports/Tools/scripts/mkptools/mkpbuild,v retrieving revision 1.2 diff -u -r1.2 mkpbuild --- ports/Tools/scripts/mkptools/mkpbuild 2001/01/03 11:16:46 1.2 +++ ports/Tools/scripts/mkptools/mkpbuild 2001/01/03 12:20:54 @@ -27,11 +27,24 @@ use strict; -my ($user, $origdir, $portname, $tmpdir, $wdpdir, $predir, $hmake); +sub testdir (@) { + my $d; # currently tested dir + + foreach $d (@_) { + next unless defined($d); + return $d if ((-d $d) && (-w $d)); + } + return ""; +} + +my ($user, $origdir, $portname, $tmpbase, $tmpdir, $wdpdir, $predir, $hmake); chomp ($user = `logname`); chomp ($origdir = `pwd`); chomp ($portname = `basename $origdir`); -$tmpdir = "/tmp/$user.$portname"; +$tmpbase = testdir($ENV{'TMPDIR'}, $ENV{'TMP'}, + '/usr/tmp', '/tmp', '/var/tmp'); +($tmpbase eq "") and die("No temp dir, please define either TMPDIR or TMP\n"); +$tmpdir = "$tmpbase/$user.$portname"; $wdpdir = "$tmpdir/wdp"; $predir = "$tmpdir/prefix"; Index: ports/Tools/scripts/mkptools/mkpinstall =================================================================== RCS file: /home/ncvs/ports/Tools/scripts/mkptools/mkpinstall,v retrieving revision 1.2 diff -u -r1.2 mkpinstall --- ports/Tools/scripts/mkptools/mkpinstall 2001/01/03 11:16:46 1.2 +++ ports/Tools/scripts/mkptools/mkpinstall 2001/01/03 12:20:54 @@ -27,11 +27,24 @@ use strict; -my ($user, $origdir, $portname, $tmpdir, $wdpdir, $predir, $hmake); +sub testdir (@) { + my $d; # currently tested dir + + foreach $d (@_) { + next unless defined($d); + return $d if ((-d $d) && (-w $d)); + } + return ""; +} + +my ($user, $origdir, $portname, $tmpbase, $tmpdir, $wdpdir, $predir, $hmake); chomp ($user = `logname`); chomp ($origdir = `pwd`); chomp ($portname = `basename $origdir`); -$tmpdir = "/tmp/$user.$portname"; +$tmpbase = testdir($ENV{'TMPDIR'}, $ENV{'TMP'}, + '/usr/tmp', '/tmp', '/var/tmp'); +($tmpbase eq "") and die("No temp dir, please define either TMPDIR or TMP\n"); +$tmpdir = "$tmpbase/$user.$portname"; $wdpdir = "$tmpdir/wdp"; $predir = "$tmpdir/prefix"; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message