Index | Thread | Search

From:
Marc Espie <marc.espie.openbsd@gmail.com>
Subject:
Re: sqlports: show complete DistTuple
To:
Thomas Frohwein <tfrohwein@fastmail.com>
Cc:
ports@openbsd.org
Date:
Sun, 30 Nov 2025 11:39:30 +0100

Download raw body.

Thread
On Fri, Nov 28, 2025 at 11:50:41AM -0800, Thomas Frohwein wrote:
> Marc, ports@,
> 
> It's been irking me for a while that sqlports' DistTuple shows only the
> last tuple (set of 5 components) for a package, rather than all of
> them. I figured out that the UNIQUE constraint on FullPkgPath for
> _DistTuple and the `INSERT OR REPLACE` logic replace rather than add
> multiple DIST_TUPLE sets to a package entry.


Here is a proper patch.

Basically, I included ->noreplace for completeness, but I never use it.

The proper way, like for _categories, is to actually include the right
columns in ->constraint, which spews out the correct
unique(...) list in the table definition.

Index: Makefile
===================================================================
RCS file: /build/data/openbsd/cvs/ports/databases/sqlports/Makefile,v
diff -u -p -r1.152 Makefile
--- Makefile	3 Nov 2025 14:46:04 -0000	1.152
+++ Makefile	30 Nov 2025 10:38:36 -0000
@@ -1,5 +1,5 @@
 CATEGORIES =		databases
-V =			7.53
+V =			7.54
 DISTNAME =		sqlports-$V
 DISTFILES =
 COMMENT-main =		sqlite database of ports
Index: files/Var.pm
===================================================================
RCS file: /build/data/openbsd/cvs/ports/databases/sqlports/files/Var.pm,v
diff -u -p -r1.76 Var.pm
--- files/Var.pm	3 Nov 2025 14:46:04 -0000	1.76
+++ files/Var.pm	30 Nov 2025 10:37:14 -0000
@@ -1233,10 +1233,10 @@ sub create_tables($self, $inserter)
 {
 	$self->create_table(
 	    $self->fullpkgpath,
-	    Sql::Column::Text->new("Type"),
-	    Sql::Column::Text->new("Account"),
-	    Sql::Column::Text->new("Project"),
-	    Sql::Column::Text->new("Id"),
+	    Sql::Column::Text->new("Type")->constraint,
+	    Sql::Column::Text->new("Account")->constraint,
+	    Sql::Column::Text->new("Project")->constraint,
+	    Sql::Column::Text->new("Id")->constraint,
 	    Sql::Column::Text->new("Mv"));
 	$self->create_view(
 	    $self->pathref,