Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

[SOLVED] dry-run pre-condition checks for installed apps!

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
13 posts • Page 1 of 1
Author
Message
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

[SOLVED] dry-run pre-condition checks for installed apps!

  • Quote

Post by VinzC » Wed Sep 09, 2020 1:05 pm

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.
Last edited by VinzC on Thu Oct 08, 2020 8:54 pm, edited 1 time in total.
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Princess Nell
l33t
l33t
User avatar
Posts: 947
Joined: Fri Apr 15, 2005 1:00 pm

  • Quote

Post by Princess Nell » Tue Oct 06, 2020 10:34 pm

https://devmanual.gentoo.org/eclass-ref ... fo.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.
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Wed Oct 07, 2020 12:19 am

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.
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Thu Oct 08, 2020 9:05 am

Thanks for the hint, Princess Nell. I've managed to have an idea of what would need my attention:

Code: Select all

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!
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Thu Oct 08, 2020 9:25 am

https://bugs.gentoo.org/532674
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Thu Oct 08, 2020 10:48 am

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: [bug=532674#c4]I better swallow that[/bug]... Sorry for the noise and thanks Michał Górny.
Last edited by VinzC on Thu Oct 08, 2020 9:06 pm, edited 2 times in total.
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Thu Oct 08, 2020 11:04 am

VinzC wrote:Thanks for the hint, Princess Nell. I've managed to have an idea of what would need my attention:

Code: Select all

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 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 08, 2020 4:01 pm

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 --.
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Thu Oct 08, 2020 7:55 pm

Anon-E-moose wrote:grep -r CONFIG_CHECK /var/db/pkg
Just that the number of not-an-ebuild files is hugely bigger:

Code: Select all

42171

Code: Select all

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!
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 08, 2020 8:21 pm

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.
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Thu Oct 08, 2020 8:24 pm

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 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
VinzC
Watchman
Watchman
User avatar
Posts: 5100
Joined: Sat Apr 17, 2004 1:51 pm
Location: Dark side of the mood

  • Quote

Post by VinzC » Thu Oct 08, 2020 8:46 pm

Thanks a lot for your highlights, Hu 8) . Guys, I think I've got it (as root):

Code: Select all

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: Select all

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!
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Oct 08, 2020 11:14 pm

Code: Select all

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.
Top
Post Reply

13 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy