ports/144769: [PATCH] Portupgrade should have a configuration option to specify that some packages should alwayse be build from source even when using -P.

Jeremy Pyne jeremy.pyne at gmail.com
Mon Mar 15 19:10:04 UTC 2010


>Number:         144769
>Category:       ports
>Synopsis:       [PATCH] 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:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 15 19:10:03 UTC 2010
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:



More information about the freebsd-ports-bugs mailing list