The officially official Devuan Forum!

You are not logged in.

#1 2021-11-09 10:59:08

chomwitt
Member
Registered: 2019-09-24
Posts: 20  

Where does 'apt-cache search' searchs?

Initially i thought that is searches package names (by that i mean 'Package' field's value).
But it also searches Description field.
But as we can find by an example as :

$ apt-cache --names-only search "^ff.*"
ffado-dbus-server - FFADO D-Bus server
ffado-mixer-qt4 - FFADO D-Bus mixer applets
ffado-tools - FFADO debugging and firmware tools
....
sfftw-dev - library for computing Fast Fourier Transforms
sfftw2 - library for computing Fast Fourier Transforms
$ apt-cache show sfftw2
Package: sfftw2
Version: 2.1.5-4.2+b1
Installed-Size: 554
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Architecture: amd64
Provides: fftw2-single
....

it's obviously searches the 'Provide' field too.

$ man apt-cache
search regex...
           search performs a full text search on all available package lists for the POSIX regex pattern given, see regex(7). It searches the package names and the
           descriptions for an occurrence of the regular expression and prints out the package name and the short description, including virtual package names.

  --names-only, -n
           Only search on the package and provided package names, not the long descriptions. Configuration Item: APT::Cache::NamesOnly.

But

$ apt-cache show librust-pango-sys-dev
Package: librust-pango-sys-dev
Version: 0.9.0-2
Installed-Size: 158
Maintainer: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Architecture: amd64
Provides: librust-pango-sys+default-dev (= 0.9.0-2), librust-pango-sys+dox-dev (= 0.9.0-2), ......

and i think that i could search librust-pango-sys+default-dev  but:

$ apt-cache search 'librust-pango-sys+default-dev'

returns nothing

So if apt-cache search 'Provides:' why would that fail?

Offline

#2 2021-11-09 11:13:27

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 1,865  
Website

Re: Where does 'apt-cache search' searchs?

$ apt info librust-pango-sys+default-dev
Package: librust-pango-sys+default-dev
State: not a real package (virtual)
N: Can't select candidate version from package librust-pango-sys+default-dev as it has no candidate
N: Can't select versions from package 'librust-pango-sys+default-dev' as it is purely virtual
N: No packages found
$

EDIT: https://www.debian.org/doc/debian-polic … irtual-pkg

Last edited by Head_on_a_Stick (2021-11-09 11:19:55)


antifa ftw!

Offline

#3 2021-11-09 13:29:37

chomwitt
Member
Registered: 2019-09-24
Posts: 20  

Re: Where does 'apt-cache search' searchs?

https://www.debian.org/doc/debian-polic … s-provides
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=98695

So 'Provide' is related to declaring among other, virtual packages' so why apt-cache search would ignore certain entries?

Last edited by chomwitt (2021-11-09 15:44:47)

Offline

#4 2021-11-09 15:53:30

chomwitt
Member
Registered: 2019-09-24
Posts: 20  

Re: Where does 'apt-cache search' searchs?

Ok.i found it.

$ apt-cache search 'librust-pango-0\+dox-dev'
librust-pango+dox-dev - Rust bindings for the Pango library - feature "dox"

'+' must be escaped.

Offline

#5 2021-11-09 21:11:31

chomwitt
Member
Registered: 2019-09-24
Posts: 20  

Re: Where does 'apt-cache search' searchs?

Anyway reading the rationale for the 'Provide' search i wonder if it was the best way to do it.

'apt-cache --names-only search foo'  now means : search for packages with names that include 'foo'  OR packages who provide a virtual package with a name that contains 'foo'.
So you search for something that you didnt now you were searching for? Is that a good design?

Offline

Board footer