Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 478244 - dev-util/catalyst - kmerge.sh with options=kerncache uses package.provided which results in missing RDEPENDs
Summary: dev-util/catalyst - kmerge.sh with options=kerncache uses package.provided wh...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: Catalyst (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Catalyst Developers
URL: http://dev.gentoo.org/~mattst88/catal...
Whiteboard:
Keywords: PATCH
: 340307 479460 (view as bug list)
Depends on:
Blocks: 477976
  Show dependency tree
 
Reported: 2013-07-26 15:21 UTC by Tom Stellard
Modified: 2018-01-10 18:26 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Stellard 2013-07-26 15:21:12 UTC
I ran into this error while building a liveCD with catalyst.  I'm not sure if 3.11 is the first kernel to require bc or if it is needed for some of the recent stable kernels too.

Reproducible: Always




Portage 2.1.12.2 (unavailable, gcc-4.6.3, glibc-2.15-r3, 3.7.10 i686)
=================================================================
System uname: Linux-3.7.10-i686-with-gentoo-2.2
Timestamp of tree: Unknown
ld GNU ld (GNU Binutils) 2.23.1
dev-lang/python:          2.7.5::gentoo, 3.2.5-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.11.6::gentoo, 1.12.6::gentoo
sys-devel/binutils:       2.23.1::gentoo
sys-devel/libtool:        2.4-r1::gentoo
sys-kernel/linux-headers: 3.7::gentoo (virtual/os-headers)
Repositories: x-portage x11
ACCEPT_LICENSE="* -@EULA"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="bindist build"
Unset:  ACCEPT_KEYWORDS, EMERGE_DEFAULT_OPTS, PORTAGE_BUNZIP2_COMMAND
Comment 1 Ben Kohler gentoo-dev 2013-07-26 15:46:52 UTC
You should not be setting USE=build, that's reserved for boostrapping and causes the sys-devel/bc dependency to be dropped.
Comment 2 Ben Kohler gentoo-dev 2013-07-30 02:49:32 UTC
I did not realize that catalyst was setting this internally... this is wrong, I think.  Here is kernel-2.eclass's RDEPEND:

    RDEPEND="!build? ( >=sys-libs/ncurses-5.2
                       sys-devel/make 
                       dev-lang/perl
                       sys-devel/bc )"

Luckily get by (in our 'genkernel all' call) without ncurses and perl, we already have make, and we got by without bc until kernel 3.9... so it hasn't really been an issue yet.  USE=build obviously assumes that you will not build the kernel sources at all, which obviously won't work for catalyst livecd-stage2 target.

IMHO the USE=build setting should just be removed from kmerge.sh, but that will end up bringing some other deps that may need to be cleaned up later.  A quicker but dirtier fix would be to just make the sys-devel/bc dep non-conditional.
Comment 3 Matt Turner gentoo-dev 2013-07-30 02:55:32 UTC
I've asked Tom to check if http://dev.gentoo.org/~mattst88/catalyst/dont-set-build-for-kernel-merges.patch solves the problem.
Comment 4 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2013-07-30 02:58:01 UTC
So this is why live-cd build has been failing for a while. I did a quick grep looking for USE="build", but failed to find this.
Comment 5 Ben Kohler gentoo-dev 2013-07-30 03:19:08 UTC
Matt- I just tried your patch against catalyst-9999, running "catalyst -f installcd-stage2-minimal.spec", while allowing unstable gentoo-sources-3.10.1.  It went even better than I expected, the ONLY extra dep it pulls is sys-devel/bc, and the compile succeeds. 


...
emerge --quiet --usepkg --buildpkg --newuse gentoo-sources
>>> Verifying ebuild manifests
>>> Emerging (1 of 2) sys-devel/bc-1.06.95
>>> Installing (1 of 2) sys-devel/bc-1.06.95
>>> Emerging (2 of 2) sys-kernel/gentoo-sources-3.10.1
>>> Installing (2 of 2) sys-kernel/gentoo-sources-3.10.1
>>> Recording sys-kernel/gentoo-sources in "world" favorites file...
...
* Linux Kernel 3.10.1-gentoo for x86_64...
* .. with config file /var/tmp/gentoo.config
* WARNING: No mounted /boot partition detected!
*          Run mount /boot to mount it!

* kernel: Using config from /var/tmp/gentoo.config
* kernel: >> Running mrproper...
*         >> Running oldconfig...
* kernel: >> Cleaning...
*         >> Compiling 3.10.1-gentoo bzImage...
*         >> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)...
*         >> Compiling 3.10.1-gentoo modules...
*         >> Generating module dependency data...
* Copying config for successful build to /etc/kernels/kernel-config-x86_64-3.10.1-gentoo
Comment 6 Matt Turner gentoo-dev 2013-07-30 07:10:19 UTC
Thanks for testing, Ben.

(I was going to wait for Tom to test, but Zero_Chaos wanted it sooner.)
Comment 7 Ben Kohler gentoo-dev 2013-07-31 14:53:48 UTC
I think we have another problem here, technically a different bug in the code, but it will manifest itself in the exact same way.  On my above test, I had kerncache disabled in catalyst.conf, but if you enable kerncache then it passes --nodeps which again causes a failure due to missing bc.  Here's the relevant lines from kmerge.sh:

if [ -n "${clst_KERNCACHE}" ]
then
        mkdir -p /tmp/kerncache/${clst_kname}
        clst_root_path=/tmp/kerncache/${clst_kname} PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --nodeps --update --newuse" run_merge "${clst_ksource}" || exit 1


I don't believe --nodeps should be there at all.  Having kerncache on does not guarantee that you will not need to build a kernel.  

Shouldn't the logic here check for a *usable* kernel cache tarball, and then either skip the sources emerge entirely, or emerge it fully with deps, depending on the result?
Comment 8 Tom Stellard 2013-08-02 04:41:23 UTC
*** Bug 479460 has been marked as a duplicate of this bug. ***
Comment 9 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-02 04:53:49 UTC
This is a ten second fix, I agree with Ben.  We can safely just drop --nodeps.

Any other member of releng ack and I will do it, or consider this and ack and you do it.
Comment 10 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-02 05:37:24 UTC
This bug is about two bugs now, but the USE=build fix was wrong as well.  It accidentally dropped livecd-stage2 use flags as well which caused build failures for me (and nearly a sanity failure since my spec fail wasn't being respected).

I've fixed it in git, but the last release is bad.... we need to tag a .1 and pull the bad release, it's broken.
Comment 11 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-02 06:18:33 UTC
Matt acked me on irc, both of these are fixed.
Comment 12 Tom Stellard 2013-08-06 02:56:14 UTC
I'm still getting the 'bc: command not found' build error when enabling kerncache, even with the latest catalyst code from git.  It looks like bc is being installed to kerncache/default/livecd-stage2-i686-radeon.live/gentoo but not to the livecd-stage2 chroot.
Comment 13 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-06 17:17:24 UTC
Is this bug still blocking stabilization of 3.9 and later kernels?

From the last comment, I don't think so; maints: Please remove the blocker. :)
Comment 14 Ben Kohler gentoo-dev 2013-08-06 18:46:24 UTC
This is still broken for catalyst with 'kerncache' turned on.  I believe our x86/amd64 autobuild setups have this turned on, so it will be a major issue.
Comment 15 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2013-08-06 19:04:41 UTC
(In reply to Tom Wijsman (TomWij) from comment #13)
> Is this bug still blocking stabilization of 3.9 and later kernels?
> 
> From the last comment, I don't think so; maints: Please remove the blocker.
> :)

Tom,

it seems for now we're unable to build kernels for install-cd with 3.9 and later kernels (due to the bc dep).
I don't want us (releng) to block kernel stabilization, so if we can't get a patch for catalyst to make it work, we'll try adding bc to the stage1 deps to see if that fixes our build issues.
Comment 16 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-07 17:30:30 UTC
(In reply to Tom Stellard from comment #12)
> I'm still getting the 'bc: command not found' build error when enabling
> kerncache, even with the latest catalyst code from git.  It looks like bc is
> being installed to kerncache/default/livecd-stage2-i686-radeon.live/gentoo
> but not to the livecd-stage2 chroot.

you are using catalyst-9999, right?
Comment 17 Ben Kohler gentoo-dev 2013-08-07 17:37:23 UTC
This still affects catalyst-9999 for sure.  If a user turns on kerncache, all the kernel build deps (including bc) are built within a kerncache chroot, but genkernel is not run from this same chroot.  Seems to me like kerncache is quite broken.
Comment 18 Rick Farina (Zero_Chaos) gentoo-dev 2013-08-28 03:09:01 UTC
*** Bug 340307 has been marked as a duplicate of this bug. ***
Comment 19 Ben Kohler gentoo-dev 2017-10-11 15:45:11 UTC
I believe I have found the cause of this issue.  The patch below is a rough workaround but it explains the problem:



From 75f23450ab55bbb48aba5a962b42441272562ec9 Mon Sep 17 00:00:00 2001
From: Ben Kohler <bkohler@gmail.com>
Date: Wed, 11 Oct 2017 10:36:08 -0500
Subject: [PATCH] kmerge.sh: ensure bc is installed when kerncache is active

When options=kerncache is on, catalyst finds cached kernel sources and
generates a package.provided entry so these sources aren't reinstalled.
However, this causes all RDEPEND in *-sources to be ignored.  We at
least need sys-devel/bc to be installed, even if *-sources is in
package.provided.
---
 targets/support/kmerge.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index fc066cc..7f78a27 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -220,7 +220,7 @@ then

        [ -L /usr/src/linux ] && rm -f /usr/src/linux

-       PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update --newuse" run_merge "${clst_ksource}" || exit 1
+       PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update --newuse" run_merge "sys-devel/bc ${clst_ksource}" || exit 1

        SOURCESDIR="/tmp/kerncache/${clst_kname}/sources"
        if [ -L /usr/src/linux ]
-- 
2.13.6
Comment 20 Ben Kohler gentoo-dev 2017-10-11 15:51:49 UTC
Perhaps a cleaner fix would be to "emerge --onlydeps ${clst_ksource}" just before package.provided is generated.

Input welcome.
Comment 21 Ben Kohler gentoo-dev 2017-10-11 17:30:30 UTC
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index fc066cc..f29cd38 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -195,6 +195,10 @@ then
                fi
        fi

+       # install dependencies of kernel sources ahead of time in case
+       # package.provided generated below causes them not to be (re)installed
+       PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update --newuse --onlydeps" run_merge "${clst_ksource}" || exit 1
+
        # Create the kerncache directory if it doesn't exists
        mkdir -p /tmp/kerncache/${clst_kname}

-- 
2.13.6