View previous topic :: View next topic |
Author |
Message |
VinzC Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/92679028148bc3f0ff1e99.jpg)
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Wed Sep 09, 2020 1:05 pm Post subject: [SOLVED] dry-run pre-condition checks for installed apps! |
|
|
Hi all.
I'd like to check application requirements for a kernel I'm about to configure. Is it possible to check the kernel prerequisites for installed applications but without reinstalling everything?
Thanks in advance for any hint/suggestion. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Last edited by VinzC on Thu Oct 08, 2020 8:54 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Princess Nell l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/17556244943a013587581f.jpg)
Joined: 15 Apr 2005 Posts: 927
|
Posted: Tue Oct 06, 2020 10:34 pm Post subject: |
|
|
https://devmanual.gentoo.org/eclass-reference/linux-info.eclass/
You know which ebuilds are installed, it would then be a matter of finding the actual .ebuild files associated with them, which is probably the hardest part, and parsing them for presence of linux-info and CHECK_CONFIG. I didn't spot anything in gentoolkit that operates at that level. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
CaptainBlood Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/1795298829674c652a4ed66.gif)
Joined: 24 Jan 2010 Posts: 3999
|
Posted: Wed Oct 07, 2020 12:19 am Post subject: |
|
|
VinzC wrote: | I'd like to check application requirements for a kernel I'm about to configure. Is it possible to check the kernel prerequisites for installed applications but without reinstalling everything? | Yeah, +1
That would be a great feature.
Greping ebuild logs could be of some help when not deleted, as a poor workaround.
Thks 4 ur attention, interest & support. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
VinzC Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/92679028148bc3f0ff1e99.jpg)
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Thu Oct 08, 2020 9:05 am Post subject: |
|
|
Thanks for the hint, Princess Nell. I've managed to have an idea of what would need my attention:
Code: | find /var/db/pkg/ -name *.ebuild | xargs grep -H --color CONFIG_CHECK |
It sort of works except when the variable contents is split across several lines or begins on a line right below the quotation mark (e.g. libvirt-6.2.0-r2). That's a start anyway. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
netfab Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 03 Mar 2005 Posts: 1964 Location: 127.0.0.1
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
VinzC Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/92679028148bc3f0ff1e99.jpg)
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Thu Oct 08, 2020 10:48 am Post subject: |
|
|
netfab wrote: | https://bugs.gentoo.org/532674 |
Opened about six years ago... guess we'll have to find ways beforehand, be it to submit them to bugzilla.
EDIT: I better swallow that... Sorry for the noise and thanks Michał Górny. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Last edited by VinzC on Thu Oct 08, 2020 9:06 pm; edited 2 times in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Anon-E-moose Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/3064969284ad468b81342a.jpg)
Joined: 23 May 2008 Posts: 6220 Location: Dallas area
|
Posted: Thu Oct 08, 2020 11:04 am Post subject: |
|
|
VinzC wrote: | Thanks for the hint, Princess Nell. I've managed to have an idea of what would need my attention:
Code: | find /var/db/pkg/ -name *.ebuild | xargs grep -H --color CONFIG_CHECK |
It sort of works except when the variable contents is split across several lines or begins on a line right below the quotation mark (e.g. libvirt-6.2.0-r2). That's a start anyway. |
grep -r CONFIG_CHECK /var/db/pkg
then you can less or vi/view any ebuild that uses multiple lines. _________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23085
|
Posted: Thu Oct 08, 2020 4:01 pm Post subject: |
|
|
If you plan to visit every hit anyway, you could use: vim -q <( grep -rn CONFIG_CHECK /var/db/pkg/ --include='*.ebuild' ) (assumes Bash extension <( ... )). This searches only files ending in .ebuild, prints the line number of every hit, and tells Vim to use it as a quickfix list, so Vim visits each line in turn as you use :cnext.
For less, you can use the slightly more redundant: xargs -a <( grep -rl CONFIG_CHECK /var/db/pkg/ --include='*.ebuild' ) less +/CONFIG_CHECK --. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
VinzC Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/92679028148bc3f0ff1e99.jpg)
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Thu Oct 08, 2020 7:55 pm Post subject: |
|
|
Anon-E-moose wrote: | grep -r CONFIG_CHECK /var/db/pkg |
Just that the number of not-an-ebuild files is hugely bigger:
find /var/db/pkg/ -type f | wc -l: | 42171 |
find /var/db/pkg/ -name *.ebuild | wc -l: | 1388 |
i.e. 30 times more "junk". I tried, took ages before I got a response .
Hu wrote: | For less, you can use the slightly more redundant: xargs -a <( grep -rl CONFIG_CHECK /var/db/pkg/ --include='*.ebuild' ) less +/CONFIG_CHECK --. |
Woah! That's just voodoo magick to me . Sure'd never had come up with that kind of one liner, as I don't quite understand it (not talking about the bashism, that said). Thanks for sharing. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23085
|
Posted: Thu Oct 08, 2020 8:21 pm Post subject: |
|
|
Hu wrote: | xargs -a <( grep -rl CONFIG_CHECK /var/db/pkg/ --include='*.ebuild' ) less +/CONFIG_CHECK -- |
- xargs - standard
- -a <filename or file-like object> - read list of tokens from the named file, instead of stdin. This leaves stdin free to become the stdin of the child process later.
- <( ... ) - bash-ism to run ... as a subprocess, and expose its output as the contents of the file-like name (usually, a pipe or similar) that bash will place in the outer argument. Use ls -l <( echo a ) to see how it is replaced.
- grep - standard
- -r - recursive
- -l - filenames only; showing the contents would confuse less
- CONFIG_CHECK - expression to seek
- /var/db/pkg/ - directory to scan
- --include='*.ebuild' - restrict -r to only search files matching this pattern. This gets you the speed boost, as it prevents grep scanning files we don't want to see, like the environment, the USE flags, etc.
- less - command for xargs to run
- +/CONFIG_CHECK - argument to less, tells it to search for CONFIG_CHECK on startup. This gets us to the first matching line of the file, rather than starting at the top of the file
- -- explicitly stop the argument list, so that any later files are treated as filenames, not arguments. Not needed here since grep shouldn't print anything that looks like an argument, unless you have a very strange ebuild installed.
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Anon-E-moose Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/3064969284ad468b81342a.jpg)
Joined: 23 May 2008 Posts: 6220 Location: Dallas area
|
Posted: Thu Oct 08, 2020 8:24 pm Post subject: |
|
|
VinzC wrote: | Anon-E-moose wrote: | grep -r CONFIG_CHECK /var/db/pkg |
Just that the number of not-an-ebuild files is hugely bigger: |
You should ONLY find CONFIG_CHECK in the ebuilds, and it's pretty fast (ETA: I do sometimes forget I'm on an nvme ) _________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
VinzC Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/92679028148bc3f0ff1e99.jpg)
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Thu Oct 08, 2020 8:46 pm Post subject: |
|
|
Thanks a lot for your highlights, Hu . Guys, I think I've got it (as root):
Code: | grep -rl CONFIG_CHECK /var/db/pkg/ --include='*.ebuild' | \
while read PKG; do
PKG=${PKG#/var/db/pkg/} # Keep category/package
PKG=$(equery w ${PKG%/*.ebuild}) # Rid the trailing ebuild file and extension
echo "Checking $PKG..." && ebuild $PKG pretend && ebuild $PKG clean
done |
The "pretend" feature was there all this time!
Code: | Checking /portage.d/portage/media-tv/kodi/kodi-18.4-r1.ebuild...
Checking /portage.d/portage/app-admin/conky/conky-1.10.8-r4.ebuild...
Checking /portage.d/portage/x11-drivers/nvidia-drivers/nvidia-drivers-390.132-r1.ebuild...
* Determining the location of the kernel source code
* Found kernel source directory:
* /usr/src/linux
* Found sources for kernel version:
* 4.19.97-gentoo-nvidia-hardened
* Checking for suitable kernel configuration options... [ ok ]
Checking /portage.d/portage/x11-drivers/xf86-input-evdev/xf86-input-evdev-2.10.6.ebuild...
* Determining the location of the kernel source code
* Found kernel source directory:
* /usr/src/linux
* Found sources for kernel version:
* 4.19.97-gentoo-nvidia-hardened
* Checking for suitable kernel configuration options... [ ok ]
... |
Anon-E-moose wrote: | I do sometimes forget I'm on an nvme ![Laughing :lol:](images/smiles/icon_lol.gif) |
That was not funny...
![Wink :wink:](images/smiles/icon_wink.gif) _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
CaptainBlood Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/1795298829674c652a4ed66.gif)
Joined: 24 Jan 2010 Posts: 3999
|
Posted: Thu Oct 08, 2020 11:14 pm Post subject: |
|
|
Code: | echo ---------------------------;grep -rl CONFIG_CHECK /var/db/pkg/ --include='*.ebuild'|
> while read PKG_FILE; do
> # echo Checking file $PKG_FILE
> PKG_FILE=${PKG_FILE#/var/db/pkg/} # Keep category/package
> # echo Checking file $PKG_FILE
> PKG_NAME_AND_REPO=$(dirname $PKG_FILE)
> # echo Checking repo $PKG_NAME_AND_REPO
> PKG_FILE=$(equery w ${PKG_FILE%/*.ebuild}) 2>null # Rid the trailing ebuild file and extension
> # echo Checking file $PKG_FILE
> PKG_NAME_AND_REPO+="::"$(basename $(dirname $(dirname $(dirname $PKG_FILE))))
> echo Checking $PKG_NAME_AND_REPO... && ebuild $PKG_FILE pretend 2>null && ebuild $PKG_FILE clean 2>null
> done
---------------------------
Checking media-libs/libv4l-1.16.6::gentoo...
Checking media-libs/mesa-20.2.0::gentoo...
* Ignoring USE=vaapi since VIDEO_CARDS does not contain r600, radeonsi, or nouveau
* Ignoring USE=vdpau since VIDEO_CARDS does not contain r300, r600, radeonsi, or nouveau
* Ignoring USE=xa since VIDEO_CARDS does not contain freedreno, nouveau, or vmware
* Ignoring USE=xvmc since VIDEO_CARDS does not contain r600 or nouveau
Checking app-emulation/libvirt-6.7.0::gentoo...
Checking app-emulation/qemu-5.1.0-r1::gentoo...
* Determining the location of the kernel source code
* Found kernel source directory:
* /usr/src/linux
* Found sources for kernel version:
* 5.4.70-gentoo-classic
* Checking for suitable kernel configuration options...
* You must enable KVM in your kernel to continue
* If you have an Intel CPU, you must enable KVM_INTEL in your kernel configuration.
* debugFS support required for kvm_stat
* Please check to make sure these options are set correctly.
* Failure to do so may cause unexpected problems.
Checking net-misc/networkmanager-1.26.0-r1::gentoo...
* Determining the location of the kernel source code
* Found kernel source directory:
* /usr/src/linux
* Found sources for kernel version:
* 5.4.70-gentoo-classic
* Checking for SYSFS_DEPRECATED support ... [ ok ]
Checking net-misc/bridge-utils-1.6::gentoo... | Thks 4 ur attention, interest & support. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|