Gentoolto: Is there a way to list packages based on what CFLAGS were used?

Created on 23 Jul 2019  路  3Comments  路  Source: InBetweenNames/gentooLTO

I managed to break X11 or something related when applying my own set of CFLAGS. I used:
emerge -av1 $(qlist -IC x11-apps) $(qlist -IC x11-base) $(qlist -IC x11-drivers) $(qlist -IC x11-libs) $(qlist -IC x11-misc) $(qlist -IC x11-themes)

To rebuild all Xorg packages, then rebuilt it with the default set of GentooLTO CFLAGS once I found out I introduced errors to the system. However it is still broken so I would like to see if I can rebuild more packages with sane(r) flags before I redo the system.

Most helpful comment

You can see the CFLAGS that were used to build each package in /var/db/pkg/*/*/CFLAGS. You can also see other portage flags in that directory. So for example, to find all packages built with -O2 you could run:
grep O2 -r --include="CFLAGS" /var/db/pkg/*

If you know the broken package was emerged recently or within a given time window, you can use eix to see them by the last emerge time, with someting like:
EIX_LIMIT=0 eix '-I*' --format '<installedversions:DATESORT>' | cut -f1,3 | sort -nr

All 3 comments

You can see the CFLAGS that were used to build each package in /var/db/pkg/*/*/CFLAGS. You can also see other portage flags in that directory. So for example, to find all packages built with -O2 you could run:
grep O2 -r --include="CFLAGS" /var/db/pkg/*

If you know the broken package was emerged recently or within a given time window, you can use eix to see them by the last emerge time, with someting like:
EIX_LIMIT=0 eix '-I*' --format '<installedversions:DATESORT>' | cut -f1,3 | sort -nr

@asaparov,

The scope of your answer is greatly appreciated. @InBetweenNames, I propose a wiki page dedicated to neat portage tricks including some of these above.

For anyone who has added an experimental flag globally and want to remove it, here's a shoddy way to grab all the packages and rebuild them (presumably without said flag, or just with different flags).

This will show you the list of packages:

grep '\-fno-plt' -r --include="CFLAGS" /var/db/pkg/* | cut -f1 -d":" | sed -e 's/\/var\/db\/pkg\//=/g' | sed -e 's/\/CFLAGS//g'

This will let you emerge the whole list:

emerge -1av $(grep '\-ftree-parallelize-loops' -r --include="CFLAGS" /var/db/pkg/* | cut -f1 -d":" | sed -e 's/\/var\/db\/pkg\//=/g' | sed -e 's/\/CFLAGS//g')

And this lets you pipe it into a file if you want to make it into a set:

grep '\-fno-common' -r --include="CFLAGS" /var/db/pkg/* | sed -e 's/\-[0-9].*//g' | cut -n -c 13- | sed -e 's/\/CFLAGS//g' >> fno-common-set

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javashin picture javashin  路  5Comments

imesg picture imesg  路  4Comments

ArniDagur picture ArniDagur  路  9Comments

mid-kid picture mid-kid  路  5Comments

pchome picture pchome  路  14Comments