View previous topic :: View next topic |
Author |
Message |
costel78 Guru
Joined: 20 Apr 2007 Posts: 407
|
Posted: Fri Jul 12, 2024 4:01 pm Post subject: [Solved]Find installed packages where filter-lto was applied |
|
|
Hello,
I want to find out all packages installed on my system on which filter-lto was applied in ebuild. So far, came with this:
Code: | for f in `emerge -pe world | grep 'ebuild\|binary' | gawk '{print $4;}'` ; do
n=`emerge --info =$f | grep -E '\bCFLAGS' --count` ;
if [[ $n -gt 1 ]]; then
m=`emerge --info =$f | tail -n 5 | grep CFLAGS | grep lto --count`
if [[ $m -eq 0 ]]; then
printf '%-65s: %s\t%s\n' "$f" "$n" "$m"
fi
fi
done |
Instead of emerge -pe world | grep 'ebuild\|binary' | gawk '{print $4;} qlist -I could be use, but I needed exact version/slot.
Is there a better/faster way to archive this ?
Thank you! _________________ Sorry for my English. I'm still learning this language.
Last edited by costel78 on Fri Jul 12, 2024 5:06 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22618
|
Posted: Fri Jul 12, 2024 4:10 pm Post subject: |
|
|
What about grep --files-without-match -e lto /var/db/pkg/*/*/CFLAGS? The resulting path will have the version embedded in it. |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1909
|
Posted: Fri Jul 12, 2024 4:18 pm Post subject: |
|
|
costel78 wrote: | qlist -I could be use, but I needed exact version/slot. |
Not withstanding Hu's answer, FWIW, if you need a version from qlist, add -v as it means version and not verbose.
e.g. qlist -Iv or qlist -IvS (for slot and version) |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2175
|
Posted: Fri Jul 12, 2024 4:59 pm Post subject: |
|
|
Code: | grep -Rl filter-lto /var/db/pkg |
You get a spurious /var/db/pkg on the front, and foo.ebuild on the back, both of which can be trimmed in various ways (exercise left to the reader).
Strictly, it's a list of ebuilds containing filter-lto, and if it's applied conditionally, it will still count even if not actually in effect.
It's faster if you have ripgrep:
Code: | rg -g '*.ebuild' -l filter-lto /var/db/pkg |
_________________ Greybeard |
|
Back to top |
|
|
costel78 Guru
Joined: 20 Apr 2007 Posts: 407
|
Posted: Fri Jul 12, 2024 5:05 pm Post subject: |
|
|
Hu wrote: | What about grep --files-without-match -e lto /var/db/pkg/*/*/CFLAGS? The resulting path will have the version embedded in it. |
Using flto instead of just lto is the faster way.
Thank everyone for support! _________________ Sorry for my English. I'm still learning this language. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22618
|
Posted: Fri Jul 12, 2024 5:22 pm Post subject: |
|
|
Goverp wrote: | Code: | grep -Rl filter-lto /var/db/pkg | You get a spurious /var/db/pkg on the front, and foo.ebuild on the back, both of which can be trimmed in various ways (exercise left to the reader).
Strictly, it's a list of ebuilds containing filter-lto, and if it's applied conditionally, it will still count even if not actually in effect. | I think this will also miss packages where the filter-lto runs in an eclass. I see that the eclasses for meson, qt5-build, qt6-build, and toolchain all have the ability to filter-lto, without the corresponding ebuild containing that string. The meson one appears to be removing it as a side effect of telling Meson to enable LTO in some other way, so missing it is fine there. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2400
|
Posted: Fri Jul 12, 2024 6:54 pm Post subject: |
|
|
Hu wrote: | What about grep --files-without-match -e lto /var/db/pkg/*/*/CFLAGS? The resulting path will have the version embedded in it. |
man grep wrote: | -L, --files-without-match
Suppress normal output; instead print the name of each input file from which no output would normally have been printed.
|
This would rather match files that do not contain the search string. OP wants to find packages that contain it. Or am I misunderstanding both of you?
It matched all packages of my install and that's expected since I don't have anything related to lto.
Best Regards,
Georgi |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22618
|
Posted: Fri Jul 12, 2024 7:18 pm Post subject: |
|
|
OP wants to find installed packages which used filter-lto. I took it as unstated that he set CFLAGS="-flto" (and presumably other, not relevant here, options). Therefore, every package which uses filter-lto should fail to have -flto in CFLAGS, because it was filtered; and every package which does not use filter-lto will have -flto in CFLAGS (because OP put it in make.conf, and without a call to filter-lto, it will be passed through the environment). Printing every package which fails to match lto in CFLAGS should find exactly those that actively removed it, which is the set the OP requested. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2400
|
Posted: Sat Jul 13, 2024 7:43 pm Post subject: |
|
|
Hu wrote: | OP wants to find installed packages which used filter-lto. I took it as unstated that he set CFLAGS="-flto" (and presumably other, not relevant here, options). Therefore, every package which uses filter-lto should fail to have -flto in CFLAGS, because it was filtered; and every package which does not use filter-lto will have -flto in CFLAGS (because OP put it in make.conf, and without a call to filter-lto, it will be passed through the environment). Printing every package which fails to match lto in CFLAGS should find exactly those that actively removed it, which is the set the OP requested. |
Thanks for the explanation!
Best Regards,
Georgi |
|
Back to top |
|
|
|