svn commit: r455294 - in head/ports-mgmt/pkg: . files
Baptiste Daroussin
bapt at FreeBSD.org
Fri Dec 1 14:10:55 UTC 2017
Author: bapt
Date: Fri Dec 1 14:10:54 2017
New Revision: 455294
URL: https://svnweb.freebsd.org/changeset/ports/455294
Log:
Add patches from git to handle pkg version with newly flavoured ports tree
Added:
head/ports-mgmt/pkg/files/0001-Do-not-use-the-origin-at-all-anymore-when-looking-fo.patch (contents, props changed)
head/ports-mgmt/pkg/files/0002-Fix-finding-ports-updates-with-flavors.patch (contents, props changed)
Modified:
head/ports-mgmt/pkg/Makefile
Modified: head/ports-mgmt/pkg/Makefile
==============================================================================
--- head/ports-mgmt/pkg/Makefile Fri Dec 1 13:59:16 2017 (r455293)
+++ head/ports-mgmt/pkg/Makefile Fri Dec 1 14:10:54 2017 (r455294)
@@ -2,6 +2,7 @@
PORTNAME= pkg
DISTVERSION= 1.10.2
+PORTREVISION= 1
_PKG_VERSION= ${DISTVERSION}
CATEGORIES= ports-mgmt
MASTER_SITES= \
@@ -30,6 +31,8 @@ CFLAGS+= -Wno-error
.if !exists(/usr/include/jail.h)
EXTRA_PATCHES= ${FILESDIR}/extra-patch-docs_pkg.8
.endif
+EXTRA_PATCHES+= ${FILESDIR}/0001-Do-not-use-the-origin-at-all-anymore-when-looking-fo.patch:-p1 \
+ ${FILESDIR}/0002-Fix-finding-ports-updates-with-flavors.patch:-p1
.include <bsd.port.pre.mk>
Added: head/ports-mgmt/pkg/files/0001-Do-not-use-the-origin-at-all-anymore-when-looking-fo.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/ports-mgmt/pkg/files/0001-Do-not-use-the-origin-at-all-anymore-when-looking-fo.patch Fri Dec 1 14:10:54 2017 (r455294)
@@ -0,0 +1,114 @@
+From 7242a137ae73ad0da08d57c09901219179b19b14 Mon Sep 17 00:00:00 2001
+From: Baptiste Daroussin <bapt at FreeBSD.org>
+Date: Fri, 1 Dec 2017 14:26:59 +0100
+Subject: [PATCH 1/2] Do not use the origin at all anymore when looking for new
+ version from the INDEX files, this makes finding new version of flavoured
+ ports working again
+
+---
+ src/version.c | 33 +++++++++++----------------------
+ 1 file changed, 11 insertions(+), 22 deletions(-)
+
+diff --git a/src/version.c b/src/version.c
+index ee955bef..75d9e922 100644
+--- a/src/version.c
++++ b/src/version.c
+@@ -56,7 +56,7 @@
+ extern char **environ;
+
+ struct index_entry {
+- char *origin;
++ char *name;
+ char *version;
+ };
+
+@@ -286,10 +286,10 @@ hash_indexfile(const char *indexfilename)
+ FILE *indexfile;
+ kh_index_t *index = NULL;
+ struct index_entry *entry;
+- char *version, *origin;
+- char *line = NULL, *l, *p;
++ char *version, *name;
++ char *line = NULL, *l;
+ size_t linecap = 0;
+- int dirs, ret;
++ int ret;
+ khint_t k;
+
+
+@@ -306,40 +306,30 @@ hash_indexfile(const char *indexfilename)
+ l = line;
+
+ version = strsep(&l, "|");
++ name = version;
+ version = strrchr(version, '-');
+ version[0] = '\0';
+ version++;
+
+- origin = strsep(&l, "|");
+- for (dirs = 0, p = l; p > origin; p--) {
+- if ( p[-1] == '/' ) {
+- dirs++;
+- if (dirs == 2) {
+- origin = p;
+- break;
+- }
+- }
+- }
+-
+ entry = malloc(sizeof(struct index_entry));
+ if (entry != NULL) {
++ entry->name = strdup(name);
+ entry->version = strdup(version);
+- entry->origin = strdup(origin);
+ }
+
+ if (entry == NULL || entry->version == NULL ||
+- entry->origin == NULL)
++ entry->name == NULL)
+ err(EX_SOFTWARE, "Out of memory while reading %s",
+ indexfilename);
+
+ if (index == NULL)
+ index = kh_init_index();
+- k = kh_put_index(index, entry->origin, &ret);
++ k = kh_put_index(index, entry->name, &ret);
+ if (ret != 0) {
+ kh_value(index, k) = entry;
+ } else {
+- free(entry->origin);
+ free(entry->version);
++ free(entry->name);
+ free(entry);
+ }
+ }
+@@ -381,8 +371,8 @@ free_index(kh_index_t *index)
+ return;
+
+ kh_foreach_value(index, entry, {
+- free(entry->origin);
+ free(entry->version);
++ free(entry->name);
+ free(entry);
+ });
+ kh_destroy_index(index);
+@@ -460,7 +450,7 @@ do_source_index(unsigned int opt, char limchar, char *pattern, match_t match,
+ strcmp(name, matchname) != 0)
+ continue;
+
+- k = kh_get_index(index, origin);
++ k = kh_get_index(index, name);
+ print_version(pkg, "index",
+ k != kh_end(index) ? (kh_value(index, k))->version : NULL, limchar, opt);
+ }
+@@ -751,7 +741,6 @@ do_source_ports(unsigned int opt, char limchar, char *pattern, match_t match,
+ return (EX_USAGE);
+ }
+
+-
+ if (chdir(portsdir) != 0)
+ err(EX_SOFTWARE, "Cannot chdir to %s\n", portsdir);
+
+--
+2.15.1
+
Added: head/ports-mgmt/pkg/files/0002-Fix-finding-ports-updates-with-flavors.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/ports-mgmt/pkg/files/0002-Fix-finding-ports-updates-with-flavors.patch Fri Dec 1 14:10:54 2017 (r455294)
@@ -0,0 +1,64 @@
+From ab5d49c07944d6a9f3a61de4c830a0130feccbd7 Mon Sep 17 00:00:00 2001
+From: Baptiste Daroussin <bapt at FreeBSD.org>
+Date: Fri, 1 Dec 2017 14:53:41 +0100
+Subject: [PATCH 2/2] Fix finding ports updates with flavors
+
+Use the new target from flavors to list all potential packages and we
+match against them
+---
+ src/version.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/src/version.c b/src/version.c
+index 75d9e922..f2a24186 100644
+--- a/src/version.c
++++ b/src/version.c
+@@ -696,9 +696,10 @@ validate_origin(const char *portsdir, const char *origin)
+ }
+
+ static const char *
+-port_version(UT_string *cmd, const char *portsdir, const char *origin)
++port_version(UT_string *cmd, const char *portsdir, const char *origin,
++ const char *pkgname)
+ {
+- char *output;
++ char *output, *walk, *name;
+ char *version = NULL;
+ char *argv[5];
+
+@@ -712,12 +713,21 @@ port_version(UT_string *cmd, const char *portsdir, const char *origin)
+ argv[0] = "make";
+ argv[1] = "-C";
+ argv[2] = utstring_body(cmd);
+- argv[3] = "-VPKGVERSION";
++ argv[3] = "flavors-package-names";
+ argv[4] = NULL;
+
+ if (exec_buf(cmd, argv) != 0) {
+ output = utstring_body(cmd);
+- version = strsep(&output, "\n");
++ while ((walk = strsep(&output, "\n")) != NULL) {
++ name = walk;
++ walk = strrchr(walk, '-');
++ walk[0] = '\0';
++ walk++;
++ if (strcmp(name, pkgname) == 0) {
++ version = walk;
++ break;
++ }
++ }
+ }
+ }
+
+@@ -772,7 +782,7 @@ do_source_ports(unsigned int opt, char limchar, char *pattern, match_t match,
+ strcmp(name, matchname) != 0)
+ continue;
+
+- version = port_version(cmd, portsdir, origin);
++ version = port_version(cmd, portsdir, origin, name);
+ print_version(pkg, "port", version, limchar, opt);
+ utstring_clear(cmd);
+ }
+--
+2.15.1
+
More information about the svn-ports-all
mailing list