From owner-freebsd-ports Wed Dec 20 2:34:28 2000 From owner-freebsd-ports@FreeBSD.ORG Wed Dec 20 02:34:25 2000 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.189]) by hub.freebsd.org (Postfix) with SMTP id A59B337B400 for ; Wed, 20 Dec 2000 02:34:22 -0800 (PST) Received: (qmail 5259 invoked by uid 1000); 20 Dec 2000 10:33:27 -0000 Date: Wed, 20 Dec 2000 12:33:26 +0200 From: Peter Pentchev To: Alfred Perlstein Cc: asami@FreeBSD.org, ports@FreeBSD.org Subject: Re: ports lockfile? Message-ID: <20001220123326.F644@ringworld.oblivion.bg> Mail-Followup-To: Alfred Perlstein , asami@FreeBSD.org, ports@FreeBSD.org References: <20001219113535.Q19572@fw.wintelcom.net> <20001220094157.C644@ringworld.oblivion.bg> <20001219235750.I19572@fw.wintelcom.net> <20001220121640.E644@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: <20001220121640.E644@ringworld.oblivion.bg>; from roam@orbitel.bg on Wed, Dec 20, 2000 at 12:16:41PM +0200 Sender: roam@ringworld.nanolink.com Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed, Dec 20, 2000 at 12:16:41PM +0200, Peter Pentchev wrote: > On Tue, Dec 19, 2000 at 11:57:50PM -0800, Alfred Perlstein wrote: [snip] > > > > Well here's the very tricky part that I really haven't worked out > > how to do this, the lockf program runs a program with the lock, so > > I need to make the lockf program run make again. > > > > If I define something when re-running the make then any recursive > > makes will have this defined right? So I won't be able to lock > > the dependancy makes. > > > > It'd be interesting to add an option to make so that it will lock > > the initial makefile used. That sounds pretty hackish so any > > alternative ideas would be welcome and helpful. > > I'm thinking along the lines of having a LOCKDIRS variable, listing > all locked dirs from all ports in the build process, then having > bsd.port.mk check for it *outside any targets*, if that is possible. > (most probably not.. just thinking out loud, please ignore the static ;) > If it is not defined, bsd.port.mk should do something like > > lockf Makefile make ${MAKEFLAGS} LOCKDIRS="${LOCKDIRS} ${.CURDIR}" > > I hope what I've written is at least vaguely understandable; fact is, > I myself am not very clear on what I mean :) Got no time to play > around with this right now, unfortunately :( Just tossing out > a wild idea.. More random thoughts about 'checking outside of any targets'. I think bsd.port.mk could perform a check for ${.CURDIR} being listed in ${LOCKDIRS} as near the start as possible, and set an appropriate flag variable. Later, all targets check this flag, and if there is no lock obtained, they simply revert to no-ops. This should avoid a possible problem with: make w/o lock - check for lock (LOCKDIRS), find none - flock make, adding .CURDIR to LOCKDIRS --- check for lock, detect one --- build --- exit releasing lock - proceed with build - oops! :) Now.. is there a way to do variable substitution so that we S// out a whole (whitespace-delimited) word (in this case, ${.CURDIR}) out of a variable (in this case, LOCKDIRS) ? The lock-check would then become something like .if ${LOCKDIR} == ${LOCKDIR:S,something about ${.CURDIR},,} # no lock - the S// substituted nothing # set a 'do the lockf and noop everything else' flag .else # set a 'locked, proceed as usual' flag (or just do not set the other one :) .endif G'luck, Peter -- If I were you, who would be reading this sentence? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message