On Sat, 6 Jul 2019 at 12:32, Steve Mynott steve.mynott@gmail.com wrote:
I did a simple "strace dpkg -S /usr/bin/411toppm|grep open" and looked at some of the paths and came up with
basename `grep -rl "^/usr/bin/411toppm$" /var/lib/dpkg/info` .list
Interesting, thanks. If I understand correctly this would only work on the live system (or at least a similar system with the same packages installed) but I could, at a push, look at the files in the var/lib/dpkg/info directory in the tarball. Whilst that would be slow if done for each file separately, I could just extract and parse all the .list files in that directory (of the tarball) up front which would be pretty workable.
I've tended to use rsync -n to compare directories of files and a scripting language (or go) is probably a better tool than shell.
I'm working with a python script that can directly parse the compressed tarball (I found a sample script which could calculate checksums of all files in a tarball pretty quickly which I'm using as a base, because "tar -jtv" doesn't give enough information to detect if a file has changed), so my intention is to build on that. Parsing the .list files on the fly should be an easy add.
And in fact, I can compare just the list of .list files in that directory to get a diff of installed packages, so that's a good start. (But I do need to then exclude the files from each package from further comparisons, so I'd still need to parse them.)
[Actually on a quick dig, the .md5sums files are probably more useful than the .list files for my purposes.]
Thanks for that starting point.