Hi, On 17-07-2023 09:26, Paul Gevers wrote:
apt-cache showsrc gcc-12 | awk '/^Package-List:/ { show=1; next } (/^ / && show==1) { print $1; next } { show=0 }' |sort -u | tr '\n' ' '
This comes from lib/adt_testbed.py (around line 1305). I had a tiny discussion with julian on IRC, he suggests something else, which I agree sounds a lot better. Documenting here so it doesn't get lost.
Paul<elbrus> juliank: I'm quickly looking at #1041162; if I want to ingnore Extra-Source-Only entries, is there anything I can do when calling apt-cache or do I need to do all processing myself?
<juliank> need to process that yoursef <elbrus> ack<elbrus> you recommend me to replace the call to apt-cache with a perl script or process the output of apt-cache?
<elbrus> I recall apt and "Debian" has perl code that I could leverage<juliank> in apt >= 2.0 you could just use src: pins directly but I think there's places that still need 1.x support <juliank> Certainly you'd want to process the output of apt-cache, accessing the files directly via apt-helper cat-file makes less sense <juliank> apt's src: pinning queries the Source field of the binaries rather than going the other way around
<juliank> makes no sense to query Sources files imo <juliank> that can always be wrong<juliank> elbrus: so might as well use apt-cache dumpavail | awk -v needle=apt '/^Package:/ {src=pkg=$2; next} /^Source:/ {src=$2; next} /^$/ { if (src==needle) print pkg; pkg=src=""; next}' <juliank> This implements the Source based lookup with fallback to binary name (as by default, no Source field means binary package has same name as Source)
<juliank> elbrus: This one searches for src:apt fwiw<juliank> elbrus: The needle variable controls the source package we care about <juliank> elbrus: This also means you don't need deb-src entries to use src: pinning
OpenPGP_signature
Description: OpenPGP digital signature