Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Aug 2022 16:17:49 +0900
From:      Tatsuki Makino <tatsuki_makino@hotmail.com>
To:        freebsd-ports@freebsd.org
Subject:   Re: ports-mgmt/pkg: pkg query -e %#r condition doesn't match properly <PSAPR03MB5639FB7587281A570DE507F9FA9C9@PSAPR03MB5639.apcprd03
Message-ID:  <PSAPR03MB5639AE5617E6DC8625509FAAFA9F9@PSAPR03MB5639.apcprd03.prod.outlook.com>
In-Reply-To: <PSAPR03MB56391BF9DDCAC869E85B64FCFA9C9@PSAPR03MB5639.apcprd03.prod.outlook.com>
References:  <202208031420.273EKIij052490@nuc.oldach.net> <PSAPR03MB56391BF9DDCAC869E85B64FCFA9C9@PSAPR03MB5639.apcprd03.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Looking at "pkg shell .dump | grep \ deps\ " results, it seems that origin without @flavor is not unique.
However, ports that use FLAVORS are modified to make the PKGNAME unique.

So, the following patch is applied and it seems to be working properly.
The commands used in the tests are as follows.

pkg query -e "%#r > 2" "%n:%#r" | sort -t : -k 2nr -k 1

If someone has already repaired it, forget it :)

Regards.

--- src/query.c.orig	2022-08-03 07:37:06 UTC
+++ src/query.c
@@ -557,7 +557,7 @@ format_sql_condition(const char *str, xstring *sqlcond
 							fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.package_id=p.id)", sqlop);
 							break;
 						case 'r':
-							fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.origin=p.origin)", sqlop);
+							fprintf(sqlcond->fp, "(SELECT %s FROM deps AS d WHERE d.name=p.name)", sqlop);
 							break;
 						case 'C':
 							fprintf(sqlcond->fp, "(SELECT %s FROM pkg_categories AS d WHERE d.package_id=p.id)", sqlop);




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