From owner-freebsd-current@FreeBSD.ORG Thu Oct 28 06:31:48 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9322B16A4D2 for ; Thu, 28 Oct 2004 06:31:48 +0000 (GMT) Received: from mxsf25.cluster1.charter.net (mxsf25.cluster1.charter.net [209.225.28.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id D56B943D1F for ; Thu, 28 Oct 2004 06:31:47 +0000 (GMT) (envelope-from collin@kreklow.us) Received: from mxip07.cluster1.charter.net (mxip07a.cluster1.charter.net [209.225.28.137])i9S6Vkq7004521 for ; Thu, 28 Oct 2004 02:31:46 -0400 Received: from c68.185.189.50.mad.wi.charter.com (HELO charter.net) (68.185.189.50) by mxip07.cluster1.charter.net with SMTP; 28 Oct 2004 02:31:47 -0400 X-Ironport-AV: i="3.86,108,1096862400"; d="scan'208?atch'208"; a="378783125:sNHT18277556" Date: Thu, 28 Oct 2004 01:31:45 -0500 From: "Collin J. Kreklow" To: freebsd-current@freebsd.org Message-ID: <20041028063144.GA20869@jupiter.kreklow.us> References: <20041027173212.GA59754@xor.obsecurity.org> <20041027190416.GA70873@ei.bzerk.org> <20041027211531.GC59489@dragon.nuxi.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <20041027211531.GC59489@dragon.nuxi.com> User-Agent: Mutt/1.5.6i X-Mailman-Approved-At: Thu, 28 Oct 2004 12:07:37 +0000 cc: Zoltan Frombach cc: Ruben de Groot cc: Kris Kennaway Subject: Re: Portupgrade -af question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2004 06:31:48 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Oct 27, 2004 at 02:15:31PM -0700, David O'Brien wrote: > On Wed, Oct 27, 2004 at 12:34:51PM -0700, Zoltan Frombach wrote: > > >Yes. Wouldn't it be a nice feature for "portupgrade -P" to install the > > >port instead of the package if any non-defaults were defined in > > >pkgtools.conf? > > > > If you really want to add this to portupgrade, it should be optional, > > though. Because someone might have a broken compiler or something and just > > wants to install a binary package quickly. In that case it should be > > possible to force a binary package installation regardless of what's inside > > the pkgtools.conf file. Don't you agree? > > 'portupgrade -PP' can still be used for that. I believe that the attached patch will cause portupgrade to build a port when make options are specified either in pkgtools.conf or with the -m option, unless -PP/--use-packages-only is specified. I am by no means a Ruby expert, but this appears to do the correct thing for all the combinations of MAKE_ARGS, -m, -P and -PP I could come up with. Collin --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=portupgrade-patch --- /usr/ports/sysutils/portupgrade/work/pkgtools-20040701/bin/portupgrade Wed Jun 30 11:51:46 2004 +++ ./portupgrade Thu Oct 28 01:08:47 2004 @@ -943,35 +943,42 @@ newpkg = newpkgname = nil if (oldpkg < portpkg || $force) && $use_packages - progress_message "Checking for the latest package of '#{origin}'" + make_args = shellwords($make_args) - newpkg, pkgfile = find_pkg(origin) + if make_args.empty? || $use_packages_only + progress_message "Checking for the latest package of '#{origin}'" - if !newpkg || newpkg < oldpkg || newpkg < portpkg - if fetch_pkg(origin, logfile) - newpkg, pkgfile = find_pkg(origin) - end + newpkg, pkgfile = find_pkg(origin) + + if !newpkg || newpkg < oldpkg || newpkg < portpkg + if fetch_pkg(origin, logfile) + newpkg, pkgfile = find_pkg(origin) + end - if !newpkg - warning_message "Could not find the latest version (#{portpkg.version})" - else - progress_message "Located a package version #{newpkg.version} (#{pkgfile})" + if !newpkg + warning_message "Could not find the latest version (#{portpkg.version})" + else + progress_message "Located a package version #{newpkg.version} (#{pkgfile})" - if newpkg < oldpkg - warning_message "Ignoring the package, which is older than what is installed (#{oldpkg.version})" - newpkg = nil - elsif newpkg == oldpkg - warning_message "Ignoring the package, which is the same version as is installed (#{oldpkg.version})" - newpkg = nil - elsif newpkg < portpkg - if $use_packages_only - progress_message "Using it anyway although it is not the latest version (#{portpkg.version}), since -PP/--use-packages-only is specified" - else - warning_message "Ignoring the package which is not the latest version (#{portpkg.version})" + if newpkg < oldpkg + warning_message "Ignoring the package, which is older than what is installed (#{oldpkg.version})" + newpkg = nil + elsif newpkg == oldpkg + warning_message "Ignoring the package, which is the same version as is installed (#{oldpkg.version})" newpkg = nil + elsif newpkg < portpkg + if $use_packages_only + progress_message "Using it anyway although it is not the latest version (#{portpkg.version}), since -PP/--use-packages-only is specified" + else + warning_message "Ignoring the package which is not the latest version (#{portpkg.version})" + newpkg = nil + end end - end + end end + else + warning_message "Custom MAKE_ARGS or -m option, ignoring package" + newpkg = nil end if $fetch_only --BOKacYhQ+x31HxR3--