Gentoo Archives: gentoo-catalyst

From: Guy Martin <gmsoft@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 08/11] Fix and improve kernel build when kerncache is enabled.
Date: Wed, 05 Feb 2014 10:40:21
Message-Id: 1391596806-14955-9-git-send-email-gmsoft@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 00/11] Livecd updates for catalyst 3.0 by Guy Martin
1 This patch gets rid of setting ROOT for merging kernel sources. Instead, the
2 sources are moved manually to the kerncache directory. A new file is created
3 containing the kernel version and it is fed into package.provided to prevent
4 merging the kernel sources again.
5
6 ---
7 targets/support/kmerge.sh | 38 ++++++++++++++++++++++++++++++--------
8 1 file changed, 30 insertions(+), 8 deletions(-)
9
10 diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
11 index 7c7f8fe..ababc57 100755
12 --- a/targets/support/kmerge.sh
13 +++ b/targets/support/kmerge.sh
14 @@ -197,8 +197,17 @@ then
15
16 # Create the kerncache directory if it doesn't exists
17 mkdir -p /tmp/kerncache/${clst_kname}
18 - clst_root_path=/tmp/kerncache/${clst_kname} PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --nodeps --update --newuse" run_merge "${clst_ksource}" || exit 1
19 - KERNELVERSION=`portageq best_visible / "${clst_ksource}"`
20 +
21 +
22 + if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION ]
23 + then
24 + KERNELVERSION=$(</tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION)
25 + mkdir -p ${clst_port_conf}/profile
26 + echo "${KERNELVERSION}" > ${clst_port_conf}/profile/package.provided
27 + else
28 + rm -f ${clst_port_conf}/profile/package.provided
29 + fi
30 +
31 if [ ! -e ${clst_port_conf}/profile/package.provided ]
32 then
33 mkdir -p ${clst_port_conf}/profile
34 @@ -209,8 +218,26 @@ then
35 echo "${KERNELVERSION}" >> ${clst_port_conf}/profile/package.provided
36 fi
37 fi
38 +
39 [ -L /usr/src/linux ] && rm -f /usr/src/linux
40 - ln -s /tmp/kerncache/${clst_kname}/usr/src/linux /usr/src/linux
41 +
42 + PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --nodeps --update --newuse" run_merge "${clst_ksource}" || exit 1
43 +
44 + SOURCESDIR="/tmp/kerncache/${clst_kname}/sources"
45 + if [ -L /usr/src/linux ]
46 + then
47 +
48 + # A kernel was merged, move it to $SOURCESDIR
49 + [ -e ${SOURCESDIR} ] && rm -Rf ${SOURCESDIR}
50 +
51 + KERNELVERSION=`portageq best_visible / "${clst_ksource}"`
52 + echo "${KERNELVERSION}" > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION
53 +
54 + echo "Moving kernel sources to ${SOURCESDIR} ..."
55 + mv `readlink -f /usr/src/linux` ${SOURCESDIR}
56 +
57 + fi
58 + ln -sf ${SOURCESDIR} /usr/src/linux
59
60 # If catalyst has set to a empty string, extraversion wasn't specified so we
61 # skip this part
62 @@ -259,9 +286,4 @@ unset USE
63 if [ -n "${clst_KERNCACHE}" ]
64 then
65 echo ${clst_kernel_use} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE
66 -
67 - if [ -e ${clst_port_conf}/profile/package.provided ]
68 - then
69 - sed -i "/^$(echo "${KERNELVERSION}" | sed -e 's|/|\\/|g')\$/d" ${clst_port_conf}/profile/package.provided
70 - fi
71 fi
72 --
73 1.8.3.2