From nobody@FreeBSD.org  Mon Mar 15 19:00:38 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC3BD106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Mar 2010 19:00:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id BFB9D8FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Mar 2010 19:00:37 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2FJ0bne097039
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Mar 2010 19:00:37 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o2FJ0bQO097038;
	Mon, 15 Mar 2010 19:00:37 GMT
	(envelope-from nobody)
Message-Id: <201003151900.o2FJ0bQO097038@www.freebsd.org>
Date: Mon, 15 Mar 2010 19:00:37 GMT
From: Jeremy Pyne <jeremy.pyne@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] Portupgrade should have a configuration option to specify that some packages should alwayse be build from source even when using -P.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144769
>Category:       ports
>Synopsis:       [PATCH] ports-mgmt/portupgrade should have a configuration option to specify that some packages should alwayse be build from source even when using -P.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    crees
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 15 19:10:03 UTC 2010
>Closed-Date:    Mon Apr 16 17:32:55 UTC 2012
>Last-Modified:  Mon Apr 16 17:33:18 UTC 2012
>Originator:     Jeremy Pyne
>Release:        8.0-RELEASE
>Organization:
>Environment:
FreeBSD freebsd.local 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #12: Wed Mar  3 18:12:00 UTC 2010     root@freebsd.local:/usr/obj/usr/src/sys/ZFSKERNEL  i386

>Description:
The problem is that when using the portupgrade tool with the -P option to upgrade from packages when possible, there is no way to flag specific packages to still build from source.  You can hold packages from updating at all and then manually update them but this is not opportune. 
>How-To-Repeat:

Install a package from source (php5 and php5-mysql for example as they often need custom build options). 
Now do a package update with portupgrade -P.

The process will check for a binary package for this port witch we manually build and will overwrite it with the generic version if there was an update.  The only ways to prevent the losing or out custom version are to completely disable the updating of this package and its dependencies, thus requiring manual intervention for each case, or to do all portupgrades completely from source.
>Fix:
This patch adds a USE_PORTS configuration option that you can set to flag specific ports to always update from source, if the have custom build options for example.  Any matching packages will not check for binary version on portupgrade -P but will just assume no package is available and build from source.  It makes for a much cleaner update process.

Patch attached with submission follows:

diff -Nura pkgtools-2.4.6/bin/portupgrade pkgtools-2.4.6-1/bin/portupgrade
--- pkgtools-2.4.6/bin/portupgrade	2010-03-05 15:26:41.622209524 +0000
+++ pkgtools-2.4.6-1/bin/portupgrade	2010-03-05 17:00:16.811494195 +0000
@@ -1221,6 +1221,16 @@
     end
   end
 
+  if $use_packages && origin && config_use_ports?(origin)
+    progress_message "Using the port for '#{origin}' instead of package becouse of user override"  
+    useport = true
+  elsif $use_packages && config_use_ports?(oldpkgname)
+    progress_message "Using the port for '#{oldpkgname}' instead of package becouse of user override"
+    useport = true
+  else
+    useport = false  
+  end
+
   if origin.nil?
     warning_message "No origin recorded: #{oldpkgname}"
     warning_message "Specify one with -o option, or run 'pkgdb -F' to interactively fix it."
@@ -1241,7 +1251,7 @@
   have_package = false
   newpkg = nil
 
-  if (oldpkg.version < portpkg.version || $force) && $use_packages
+  if (oldpkg.version < portpkg.version || $force) && $use_packages && !useport
     newpkg = catch(:newpkg) {
       make_args = get_make_args(origin)
 
diff -Nura pkgtools-2.4.6/etc/pkgtools.conf pkgtools-2.4.6-1/etc/pkgtools.conf
--- pkgtools-2.4.6/etc/pkgtools.conf	2007-02-23 16:46:44.000000000 +0000
+++ pkgtools-2.4.6-1/etc/pkgtools.conf	2010-03-05 17:05:52.132538350 +0000
@@ -312,6 +312,25 @@
   USE_PKGS_ONLY = [
   ]
 
+  # USE_PORTS: array
+  #
+  # This is a list of ports that you alwayse want to build from source.  
+  # This will casue the pacakge to be installed from the local port even
+  # if there is a package available and the -P option is passed.  It is
+  # primarily usedwhen you have a custom configuration for a package but
+  # still want to be able to to an automated updat from packages of the
+  # rest of the system.
+  #
+  # e.g.:
+  #  USE_PORTS = [
+  #    'php5', 
+  #    'php5-mysql',
+  #  ]
+ 
+
+  USE_PORTS = [
+  ]
+
   # ALT_PKGDEP: hash
   #
   # This is a hash to define alternative package dependencies.  For
diff -Nura pkgtools-2.4.6/lib/pkgtools.rb pkgtools-2.4.6-1/lib/pkgtools.rb
--- pkgtools-2.4.6/lib/pkgtools.rb	2010-03-05 15:26:41.638208764 +0000
+++ pkgtools-2.4.6-1/lib/pkgtools.rb	2010-03-05 16:19:18.417815111 +0000
@@ -28,7 +28,7 @@
 # $Id: pkgtools.rb,v 1.36 2008/07/11 10:39:19 sem_prg Exp $
 
 PREFIX = "/usr/local"
-Version = "2.4.6"
+Version = "2.4.6-1"
 
 begin
   require 'features/ruby18/file'
@@ -207,6 +207,10 @@
   config_include?(:USE_PKGS, p)
 end
 
+def config_use_ports?(p)
+  config_include?(:USE_PORTS, p)
+end
+
 def config_held?(p)
   config_include?(:HOLD_PKGS, p)
 end


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ruby 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Mar 18 04:31:15 UTC 2010 
Responsible-Changed-Why:  
Fix synopsis and assign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
Responsible-Changed-From-To: ruby->pgollucci 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Thu Sep 9 23:12:09 UTC 2010 
Responsible-Changed-Why:  
I will take it 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
Responsible-Changed-From-To: pgollucci->freebsd-ports-bugs 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Fri Sep 24 06:23:00 UTC 2010 
Responsible-Changed-Why:  
going to have enotime for the next 2 weeks, sorry 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
Responsible-Changed-From-To: freebsd-ports-bugs->ruby 
Responsible-Changed-By: steve 
Responsible-Changed-When: Mon Jan 3 17:25:27 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
State-Changed-From-To: open->suspended 
State-Changed-By: pgollucci 
State-Changed-When: Wed Feb 22 05:24:02 UTC 2012 
State-Changed-Why:  
Over to maintainer. 


Responsible-Changed-From-To: ruby->freebsd-ports-bugs 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Wed Feb 22 05:24:02 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
State-Changed-From-To: suspended->open 
State-Changed-By: crees 
State-Changed-When: Thu Apr 12 10:03:22 UTC 2012 
State-Changed-Why:  
This should not be suspended. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 

From: Bryan Drewery <bryan@shatow.net>
To: bug-followup@FreeBSD.org, jeremy.pyne@gmail.com
Cc: crees@FreeBSD.org
Subject: Re: ports/144769: [PATCH] ports-mgmt/portupgrade should have a configuration
 option to specify that some packages should alwayse be build from source
 even when using -P.
Date: Sun, 15 Apr 2012 20:52:57 -0500

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 This has been accepted and merged into the upstream. It is now available
 in the latest portupgrade-devel port and will be included in the next
 release.
 
 Thanks,
 Bryan Drewery
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iQIcBAEBAgAGBQJPi3t4AAoJEG54KsA8mwz5ibsQAIx4ok+FDvzGegGcC0j0H8Wz
 0yoJyk0pgT/cfACVMdscrW0P9K2tR17ab5YUbvHwU4tyxgGujb2eNSu7mKY994ye
 1wa3MXj+9r4LURi5uoyVdIKtHx+/32RZyfVJeV9+GzS9h7/snrqEWZpqZokWCh0+
 jSlpx+9VqCUeCDZiv3jfujhNcPc7YNo/L8iuGFtaNN+OC2m4DepKJD8auSYvwnZg
 Ohu0hs6dCkBU33oOiDmdRzV+u1OLlV9Kx+xIR8n6zUwcfNGqVOdwKfHqSFLb6mNB
 ojC1LIRc9PSEWCqX94yFjy+An3Gt8rZkdfDzjj4Bv/O5xMsUBhMEIbkKV4sb2Fhq
 C5XFq32+8VflksKWiOu10NzwzSpUcAWjUDwtZlKuXg2DH4rjZXli2gmZ3t6O8Oz1
 TdgvgtMWrjXvqntdQPouFe4X15NpDCWrwFK/IBHIImD3mluA50SpakgYbvGlQEmR
 vdWiGMfYI8WZjMzn8uFdXsTyLRU8Ky+l1lTz+WOptr/cSBLy3fDsAPiGVgYJpY/a
 bUyQnz2ngOb7hma3RNj/5vnftaecWQUbaE5aNlRkAg3dNCk6lDS8839qFzviOVOn
 be96+c2RkPrhzzT8A1vaS67sj7A87FGrl0jchT+ob7YC/4FkQP960p+o4pQamfTf
 dUYsCC+1F/aaJ3JVzuyU
 =71oY
 -----END PGP SIGNATURE-----
State-Changed-From-To: open->closed 
State-Changed-By: crees 
State-Changed-When: Mon Apr 16 17:32:54 UTC 2012 
State-Changed-Why:  
Fixed in upstream. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
Responsible-Changed-From-To: freebsd-ports-bugs->crees 
Responsible-Changed-By: crees 
Responsible-Changed-When: Mon Apr 16 17:33:16 UTC 2012 
Responsible-Changed-Why:  
Take responsibility 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144769 
>Unformatted:
