With this patch you can use equery to know which version of gcc has been used to compile a package. Example: # equery gcc glibc-2.3.6 [ Searching for packages matching glibc-2.3.6-r1 ... ] * gcc version used for sys-libs/glibc-2.3.6-r1 version: 4.0.2 slot: 4.0 You can also query all /var/db/pkg and have a summary so you can know all the packages that have been compiled with an old version of gcc. It is usefull if you use gcc 4, but you have some packages compiled with gcc 3.3 and you don't want to recompiled your entire system to have a full gcc 4 system. Example: #equery gcc --all [ Searching for gcc used for all packages... ] Last installed gcc slot: 4.0 Packages installed: 353 Packages compiled with a gcc of an old slot: 1 [SLOT] [VERSION] [3.3] [3.3.6] sys-process/dcron-2.9-r4 Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 74507 [details, diff] equery gcc patch
ROOTPATH is not PATH, nor does the patch take into account custom CC/CXX settings
This should be taken a step further and poke directly into the ELF and display the .comment section. Simply knowing the gcc used to compile a pkg is not enough. You need to know what all the linked in objects a given executable were using. Adding marienz to the CC: as he has a python script to pinpoint exactly what I'm talking about.
Created attachment 74513 [details, diff] equery gcc patch - Corrected ROOTPATH with PATH. - Added chost, c flags, cxx flags
This is an example of the output: # equery gcc glibc [ Searching for packages matching glibc ... ] * gcc version used for sys-libs/glibc-2.3.6-r1 host: i686-pc-linux-gnu C compiler: i686-pc-linux-gnu-gcc C++ compiler: version: 4.0.2 slot: 4.0 C flags: -march=i686 -pipe -O2 C++ flags: -march=i686 -pipe -O2
Ok, I've added the info about CC/CXX settings as requested by SpanKY. Do you think this patch could be useful?
Created attachment 75204 [details, diff] equery gcc patch Fixed a stupid error on array manipulation, now the option --all works perfectly
Any chance that this new feature will ever be added to the official equery tool ?
Created attachment 110530 [details, diff] New patch for gentoolkit-0.2.3 The patch has been rewritten to make the code cleaner, simpler and a little faster. Now it is compatible with gentoolkit-0.2.3_pre3, but not with older versions (surely not with 0.2.2, maybe with 0.2.3_pre{1,2}, but I did't check). This patch searches for CC, CXX, CFLAGS, CXXFLAGS and CHOST in the vbd tree of a package and, if it finds these files, shows the contents. The purpose is to show Portage options related to the compiler at the time of the installation of a package, not to show the flags and compiler version grabbed from the generated binary. To apply the patch, it is sufficient to add this functions to the ebuild: src_unpack() { unpack ${P}.tar.gz cd "${WORKDIR}/${P}" epatch "${FILESDIR}/${P%_*}-equery-gcc.patch" } The sostitution in the epatch line removes the _{pre,rc,whatever}* trailing portion from the ebuild version, hoping the patch will apply to the final 0.2.3 release without change.
(In reply to Stefano Varesi from comment #9) > Created attachment 110530 [details, diff] [details, diff] > New patch for gentoolkit-0.2.3 > > The patch has been rewritten to make the code cleaner, simpler and a little > faster. > Now it is compatible with gentoolkit-0.2.3_pre3, but not with older versions > (surely not with 0.2.2, maybe with 0.2.3_pre{1,2}, but I did't check). > This patch searches for CC, CXX, CFLAGS, CXXFLAGS and CHOST in the vbd tree > of a package and, if it finds these files, shows the contents. > The purpose is to show Portage options related to the compiler at the time > of the installation of a package, not to show the flags and compiler version > grabbed from the generated binary. > To apply the patch, it is sufficient to add this functions to the ebuild: > src_unpack() { > unpack ${P}.tar.gz > cd "${WORKDIR}/${P}" > epatch "${FILESDIR}/${P%_*}-equery-gcc.patch" > } > The sostitution in the epatch line removes the _{pre,rc,whatever}* trailing > portion from the ebuild version, hoping the patch will apply to the final > 0.2.3 release without change. I have not tested this patch, but it appears that it cannot work any more since PATH is not in environment.bz2. It further appears that there is no information that can be used to find the gcc version either in the vdb or in the binary itself. It is possible to scan the debug files, however this is no longer Portage-specific. Furthermore, the other functions listed have been added to emerge --info sometime in the interim ("Package settings"). Therefore, I am closing this bug as WORKSFORME.