Bug 267299 - ports-mgmt/pkg-provides: doesn't seem to work
Summary: ports-mgmt/pkg-provides: doesn't seem to work
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-23 22:24 UTC by Edward Tomasz Napierala
Modified: 2022-11-29 21:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Tomasz Napierala freebsd_committer freebsd_triage 2022-10-23 22:24:58 UTC
# pkg provides bin/firefox
usage: pkg provides [-uf] [-r repo] pattern

A plugin for querying which package provides a particular file

The same thing happens for every input I've tried ("pkg provides -u" etc).  This is pkg-provides 0.7.2 on FreeBSD 14.0/aarch64.
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2022-10-23 22:43:00 UTC
Did you added 'provides' pluggin to ${PREFIX}/etc/pkg.conf?

#PKG_ENABLE_PLUGINS = true;
PLUGINS [ provides ];
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2022-10-24 03:40:55 UTC
Over to maintainer.
Comment 3 Rodrigo Osorio freebsd_committer freebsd_triage 2022-10-24 08:16:29 UTC
Hi Edwared,

All the steps to enable pkg-provides are described in the pkg-message.

pkg info --pkg-message pkg-provides

In few words you need to register your plugin in /usr/local/etc/pkg.conf file by adding the following lines:

PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
PKG_ENABLE_PLUGINS = true;
PLUGINS [ provides ];

Then you can run 'pkg plugins' to see if the pkg-provides pluggin was detected.
The output will be:

NAME       DESC                                          VERSION   
provides   A plugin for querying which package provides a particular file 0.7.2

At this point you can start updating the database:

pkg provides -u

Let me know if you still having issues with pkg-provides :)
Comment 4 Rodrigo Osorio freebsd_committer freebsd_triage 2022-10-24 08:29:09 UTC
(In reply to Rodrigo Osorio from comment #3)

Edward, sorry for the typo.
Comment 5 Edward Tomasz Napierala freebsd_committer freebsd_triage 2022-10-25 15:04:11 UTC
I do have those lines in my config; and "pkg plugins" shows the expected output:

% pkg plugins
NAME       DESC                                          VERSION   
provides   A plugin for querying which package provides a particular file 0.7.2   

But it still doesn't work:

% pkg provides -u
usage: pkg provides [-uf] [-r repo] pattern

A plugin for querying which package provides a particular file
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-11-13 11:58:48 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5a1e5ee8580010803a466ee8eeeeb5451796dd22

commit 5a1e5ee8580010803a466ee8eeeeb5451796dd22
Author:     Rodrigo Osorio <rodrigo@FreeBSD.org>
AuthorDate: 2022-11-13 11:43:02 +0000
Commit:     Rodrigo Osorio <rodrigo@FreeBSD.org>
CommitDate: 2022-11-13 11:47:44 +0000

    ports-mgmt/pkg-provides: Update pkg-provides to 0.7.3

    Major changes:
        * Fix getopt() bad usage

    PR:             267299
    Reported by:    trasz

 ports-mgmt/pkg-provides/Makefile | 2 +-
 ports-mgmt/pkg-provides/distinfo | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 7 Rodrigo Osorio freebsd_committer freebsd_triage 2022-11-13 12:02:13 UTC
I was able to reproduce the issue using a FreeBSD 14 aarch64,
the same version on amd64 work as expected.

By the way, there was a real issue the way I handle getopt(),
so thanks for the heads-up.
Comment 8 Edward Tomasz Napierala freebsd_committer freebsd_triage 2022-11-29 21:41:51 UTC
Hello.  So...  It still appears to be broken?

trasz@v3:~/git/ports/ports-mgmt/pkg-provides % pkg info pkg-provides
pkg-provides-0.7.3
Name           : pkg-provides
Version        : 0.7.3

[..]

trasz@v3:~/git/ports/ports-mgmt/pkg-provides % doas pkg provides -u
usage: pkg provides [-uf] [-r repo] pattern

A plugin for querying which package provides a particular file

_But_:

trasz@v3:~/git/ports/ports-mgmt/pkg-provides % pkg plugins
NAME       DESC                                          VERSION   
provides   A plugin for querying which package provides a particular file 0.7.2 

Do I have something screwed up in my local setup, or did you forgot to bump the version in the source?  (Also, what do you think about shortening "A plugin for querying which package provides a particular file" to "Find package providing a particular file", so that "pkg plugins" output is aligned?

FWIW, I tested it on amd64, and it works perfectly :)  I wonder if it would be possible to provide a periodic script to run "pkg provides -u"?