From: Marc Espie Subject: Re: sqlports: show complete DistTuple To: Thomas Frohwein Cc: ports@openbsd.org Date: Sun, 30 Nov 2025 11:06:57 +0100 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. > > This is fixed with the attached diff. There are likely more correct or > more elegant ways of doing this, as my experience with sqlite and > sqlports internals is limited. > > Old Behaviour: > > $ sqlite3 /usr/local/share/sqlports "select * from DistTuple where \ > FullPkgPath = 'audio/furnace';" > 525|audio/furnace|github|superctr|adpcm|7736b178f4fb722d594c6ebdfc1ddf1af2ec81f7|extern/adpcm > > With Diff Applied: > > $ sqlite3 /usr/ports/pobj/sqlports-7.53/sqlports-7.53/sqlports \ > "select * from DistTuple where FullPkgPath = 'audio/furnace';" > 525|audio/furnace|github|tildearrow|furnace|v0.6.8.3|. > 525|audio/furnace|github|superctr|adpcm|7736b178f4fb722d594c6ebdfc1ddf1af2ec81f7|extern/adpcm > > (For more striking examples, look at lang/v, www/nginx, > games/recoil-rts.) > > Fixing this will likely help DIST_TUPLE in the future, as makes it > easier to look for and test for regressions. > > comments? ok? > Thanks for sleuthing it out, but this is not the right fix. You generally don't want noreplace, rather a more elaborate unique constraint like for the _categories table (specifically, in case you end up scanning the same fullpkgpath several times, you don't want to create duplicate entries) Also: it's OO, so tests against table names are bad. It has to be done subclassing an existing class. Patch as soon as I've run it through tests.