Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] dry-run pre-condition checks for installed apps!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Wed Sep 09, 2020 1:05 pm    Post subject: [SOLVED] dry-run pre-condition checks for installed apps! Reply with quote

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
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 927

PostPosted: Tue Oct 06, 2020 10:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Wed Oct 07, 2020 12:19 am    Post subject: Reply with quote

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
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Thu Oct 08, 2020 9:05 am    Post subject: Reply with quote

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
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1964
Location: 127.0.0.1

PostPosted: Thu Oct 08, 2020 9:25 am    Post subject: Reply with quote

https://bugs.gentoo.org/532674
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Thu Oct 08, 2020 10:48 am    Post subject: Reply with quote

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
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6220
Location: Dallas area

PostPosted: Thu Oct 08, 2020 11:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23085

PostPosted: Thu Oct 08, 2020 4:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Thu Oct 08, 2020 7:55 pm    Post subject: Reply with quote

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 :lol: . 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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23085

PostPosted: Thu Oct 08, 2020 8:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6220
Location: Dallas area

PostPosted: Thu Oct 08, 2020 8:24 pm    Post subject: Reply with quote

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 :lol: )
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Thu Oct 08, 2020 8:46 pm    Post subject: Reply with quote

Thanks a lot for your highlights, Hu 8) . 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 :lol:

That was not funny...


:wink:
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3999

PostPosted: Thu Oct 08, 2020 11:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum