Web lists-archives.com

Re: apt pinning: find out from which system version is a package

On Fri 03 May 2019 at 03:46:50 (+0200), Emanuel Berg wrote:
> David Wright wrote:
> > $ apt-cache dump | grep -A 2 '^Package:' | grep -B 2 '^ File:' | sed -e 'N;N;s/\n/ /g;s/ \+/ /g;N' | grep -v '^--' | sort >> "$Unique1"
> > $ dpkg-query -W -f '^Package: ${Package} \n' | grep --file=- "$Unique1" | sort
> That's some heavy parsing,

You wrote "no worries, I can make a zsh function and have them next to
each other" so I guess you're up to it …

> only I don't get it
> to work. I get "no such file or directory: "
> from the first, apt-cache-dump invocation.

… but I advise that you cut and paste.

> Maybe do a shell function of it (whatever shell
> you prefer)?

Don't think that I type this stuff into the command line itself.
This is just one part of a bash function that writes five files
to an archive, the output from dpkg -l, just the package names,
packages and versions, apt-show-versions, and the process above
which is named "origins".

These files can then be inspected, diffed etc, at leisure even
while the host concerned is not running.

> Also I don't understand where the argument
> goes? Where is ${Package} defined, even tho it
> didn't (for me) even get that far?

It's nothing to do with bash, as it's protected by '',
but see   man dpkg-query   just above 'EXIT STATUS'.