NetBSD Problem Report #59998
From www@netbsd.org Fri Feb 13 03:22:12 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 007201A923C
for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 Feb 2026 03:22:11 +0000 (UTC)
Message-Id: <20260213032210.F0E291A923D@mollari.NetBSD.org>
Date: Fri, 13 Feb 2026 03:22:10 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: index packages by plists
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 59998
>Category: pkg
>Synopsis: index packages by plists
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Feb 13 03:25:00 +0000 2026
>Last-Modified: Fri Feb 13 07:10:01 +0000 2026
>Originator: Taylor R Campbell
>Release:
>Organization:
The IndexBSD Packaginc.
>Environment:
>Description:
pkgin can search packages by name. It would be nice if we
could also search packages by what files they install.
>How-To-Repeat:
Ask: What package do I install to get, say, /usr/pkg/bin/pdfjoin?
>Fix:
Quick hack to create a locate(1) database of package files from
my notes the other year:
# generate newline-separated list of $PATHNAME/$PKG
# (hope packages don't have any pathnames with newlines in them...)
# about 500 MB uncompressed for 2022Q4, 30 MB gzipped
# XXX handle long package names wider than 80 columns for progress output
(n=0; for x in *.tgz; do n=$((n + 1)); done; i=0; for x in *.tgz; do printf '\r%80s\r%s/%s %s' '' $i $n $x >&2; pkg_info -qL $x | sed -e 's,$,/'"$x"','; i=$((i + 1)); done | gzip -nc > /tmp/pkgindex.2022Q4.gz; printf '\r%80s\r\n' '' >&2)
# generate bigrams
BIGRAM=$(gunzip -c < /tmp/pkgindex.2022Q4.gz | /usr/libexec/locate.bigram)
# generate locate(1) database
# about 30 MB uncompressed for 2022Q4, 23 MB gzipped
/usr/libexec/locate.code "$BIGRAM" | gzip -nc >/tmp/pkglocate.2022Q4.gz
Part of this pipeline, of course, is embarrassingly
parallelizable.
TBD:
1. Integrate into pbulk or other infrastructure.
2. Decide how to publish this.
3. Ship tool (or pkgin patches) for automatically downloading,
caching, and querying the index.
>Audit-Trail:
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc:
Subject: Re: pkg/59998: index packages by plists
Date: Fri, 13 Feb 2026 03:27:08 +0000
Credit: This locate(1) method was inspired by a talk by Rodrigo Osorio
at FOSDEM a couple years ago about FreeBSD's pkg-provides. (I haven't
looked into how it works beyond that talk, nor into others like
Debian's apt-file search.)
From: Jonathan Perkin <jperkin@pkgsrc.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/59998: index packages by plists
Date: Fri, 13 Feb 2026 07:08:06 +0000
> Quick hack to create a locate(1) database of package files from
> my notes the other year:
FWIW my repositories have shipped pkg_files.* archives for nearly 10
years now, generated with this:
https://github.com/NetBSD/pkgsrc/commit/0b8a13aa9282c91030817692a2c38bea97599917
I have not yet gotten around to hooking them up to pkgin though, and I'm
not sure I'm still keen on this approach, but just FYI.
--
Jonathan Perkin pkgsrc.smartos.org
Open Source Complete Cloud www.tritondatacenter.com
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.