Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Apr 2019 20:51:57 -0500
From:      "Matthew D. Fuller" <fullermd@over-yonder.net>
To:        freebsd-ports@freebsd.org
Subject:   portupgrade + FLAVORS
Message-ID:  <20190408015157.GE6019@over-yonder.net>

next in thread | raw e-mail | index | archive | help

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

For any portupgrade users still out there wishing for FLAVOR support,
I have patches to add it.  I've been running them here locally for a
few weeks without incident (apart from an extra upgrade or two
actually working without manual intervention/resort to portmaster,
that is).  Dropping the attached patch into
$PORTS/ports-mgmt/portupgrade/files/patch-flavors and rebuilding it is
a simple shortcut to getting it in place.

I haven't done any testing of using portupgrade with pre-built
packages (is there even any reason to post-pkg?), or using portinstall
(never saw the point), but it seems to handle the upgrading path just
fine.


Also sitting in a PR upstream at
https://github.com/freebsd/portupgrade/pull/72


-- 
Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-flavors

--- bin/portupgrade.orig	2018-03-09 18:59:29 UTC
+++ bin/portupgrade
@@ -1147,6 +1147,11 @@ def get_make_args(origin, pkgname = nil)
   else
     args = $make_args.split(' ')
   end
+
+  if flavor = origin[/@(.+)$/, 1]
+    args << 'FLAVOR=' + flavor
+  end
+
   quoted = 0
   n = 0
   is_quoted = false
--- lib/pkgtools/pkgdb.rb.orig	2018-03-09 18:59:29 UTC
+++ lib/pkgtools/pkgdb.rb
@@ -425,10 +425,20 @@ class PkgDB
       @installed_pkgs = []
       @installed_ports = []
       @db = {}
+
+      flavors = {}
+      pkg_flavors = xbackquote(PkgDB::command(:pkg), 'annotate', '-Sa',
+                               'flavor').split("\n")
+      pkg_flavors.each do |line|
+        pkg, flavor = line.sub(/: Tag: flavor Value: /, ':').split(':')
+        flavors[pkg] = flavor
+      end
+
       pkg_origins = xbackquote(PkgDB::command(:pkg), 'query', '%n-%v %o').split("\n")
       pkg_origins.each do |line|
         pkg, origin = line.split(' ')
         @installed_pkgs << pkg
+        origin << '@' + flavors[pkg] if flavors[pkg]
         add_origin(pkg, origin)
       end
       @installed_pkgs.freeze
--- lib/pkgtools/portsdb.rb.orig	2018-03-09 18:59:29 UTC
+++ lib/pkgtools/portsdb.rb
@@ -325,6 +325,7 @@ class PortsDB
   end
 
   def portdir(port)
+    port = port.sub(/@.*$/, '')
     File.join(ports_dir, port)
   end
 

--HlL+5n6rz5pIUxbD--



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