git: 4a1614a51de9 - main - devel/pkgconf: fix regression introduced by last minute patch

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Sat, 02 Sep 2023 17:52:06 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4a1614a51de9e7b4dcd58d102abefde1187c80a8

commit 4a1614a51de9e7b4dcd58d102abefde1187c80a8
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2023-09-02 17:49:35 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-09-02 17:51:53 +0000

    devel/pkgconf: fix regression introduced by last minute patch
    
    the last minute patch was intended to fix a bug in pkgconf which broke
    the expected behaviour of cabal (haskell)
    
    $ pkgconf --modversion atf-c atf-c++
    0.21
    0.21
    0.21
    
    due to bad pattern matching, the fix was a bit too harsh and broke the
    version comparison
    $ pkgconf --modversion "gtk+-2.0 >= 2.0.0"
    
    Reported by:    cmt
---
 devel/pkgconf/Makefile                          |  1 +
 devel/pkgconf/files/patch-modversion-comparison | 12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/devel/pkgconf/Makefile b/devel/pkgconf/Makefile
index e0b94fef0171..08e260c626e1 100644
--- a/devel/pkgconf/Makefile
+++ b/devel/pkgconf/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	pkgconf
 PORTVERSION=	2.0.2
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	devel
 MASTER_SITES=	https://distfiles.ariadne.space/${PORTNAME}/
diff --git a/devel/pkgconf/files/patch-modversion-comparison b/devel/pkgconf/files/patch-modversion-comparison
index a8d4c26e6c0a..dcab7c93146b 100644
--- a/devel/pkgconf/files/patch-modversion-comparison
+++ b/devel/pkgconf/files/patch-modversion-comparison
@@ -1,13 +1,19 @@
 diff --git cli/main.c cli/main.c
-index 25ff5ca..d75bbb7 100644
+index 25ff5ca..055b05a 100644
 --- cli/main.c
 +++ cli/main.c
-@@ -306,7 +306,7 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
+@@ -305,10 +305,13 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
+ 		{
  			pkgconf_dependency_t *dep = world_iter->data;
  			pkgconf_pkg_t *pkg = dep->match;
++			size_t len = strlen(pkg->id);
  
 -			if (strncmp(pkg->id, queue_node->package, strlen(pkg->id)))
-+			if (strcmp(pkg->id, queue_node->package))
++			if (strncmp(pkg->id, queue_node->package, len))
  				continue;
  
++			if (!isspace(queue_node->package[len]) && queue_node->package[len] != '\0')
++				continue;
  			if (pkg->version != NULL) {
+ 				if (verbosity)
+ 					printf("%s: ", pkg->id);