Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Mar 2010 16:25:18 -0500
From:      Jeremy Pyne <jeremy.pyne@gmail.com>
To:        ruby@FreeBSD.org
Subject:   pkgtools-2.4.6-1 Patch: Add a override for packages to always update from source.
Message-ID:  <2c0c01051003051325i8047c4fycb3ae31673b9614d@mail.gmail.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Sorry in advance as I haven't ever done patched for FreeBSD before So I'm
probably doing it wrong.  Anyway, here it goes:

This is a minor patch for portupgrade that adds the USE_PORTS user
variable.  Simply put any packages in this list will always update from
source regardless of -P/-PP  settings.  The problem with portupgrade was
that it would overwrite ports compiled with local configuration changes with
the default binary version.  (apache, php, virtualbox-ose-kmod) and so those
would have to me individually updated without -P.  Now the user can
configure witch packages should always come from source and then use
packages for the rest.

-- 
Jeremy Pyne

-- 
"Fear is the mind killer."  <Frank Herbert>

[-- Attachment #2 --]
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
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2c0c01051003051325i8047c4fycb3ae31673b9614d>