Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afbjorklund/debfile
dlocate query file cache
https://github.com/afbjorklund/debfile
debian dpkg
Last synced: about 2 months ago
JSON representation
dlocate query file cache
- Host: GitHub
- URL: https://github.com/afbjorklund/debfile
- Owner: afbjorklund
- License: gpl-2.0
- Created: 2024-03-21T21:55:40.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-06-03T10:01:04.000Z (8 months ago)
- Last Synced: 2024-10-14T17:44:57.632Z (3 months ago)
- Topics: debian, dpkg
- Language: Perl
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# debfile
Returns which deb package owns a particular file, and its version too.
Similar to `dpkg -S` and `dpkg-query -W`, but much faster (uses [dlocate](https://github.com/afbjorklund/dlocate)).
The deb equivalent of running `rpm -qf`.
Remember to run `sudo update-dlocatedb`.
## zstd
The default dlocatedb takes a lot of disk space, when not compressed...
But compressing it with gzip, makes dlocate run much slower (like 10x)
Use zstd instead, see: dlocate-zstd.diff
Still compresses 10x, but runs 10x faster
## grep
For reasons why dlocate is using text files and `grep`, instead of `locate`:
The debfile "database" maps from paths to packages, and packages to versions.
But since it doesn't use regular expressions, it can be converted into a dbm.
## text
For debugging purposes or other experiments, you can make it output text:
`DEBFILE_TEXT=1 ./convertdb.pl > debfiledb`
The format is actually YAML, and can be converted to e.g. JSON using `yq`.
Or one can use grep instead of gdbm, just like with the dlocate database.
## cron
The dlocatedb is normally updated from `/etc/cron.daily/dlocate`
You can update the debfile.db as well, from the same daily job.
Something like this: dlocate-debfile.diff
Or run `sudo /usr/share/dlocate/convertdb`.