public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Matt Turner" <mattst88@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: targets/support/
Date: Tue, 20 Oct 2020 23:20:48 +0000 (UTC)	[thread overview]
Message-ID: <1603236041.4a713242d6af2e056b7e2c46e3d844257da3645c.mattst88@gentoo> (raw)

commit:     4a713242d6af2e056b7e2c46e3d844257da3645c
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 20 02:38:39 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Oct 20 23:20:41 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4a713242

targets: Rewrite kerncache support

I cannot see how the code added in the undermentioned commit could have
possibly worked.

Fixes: fed3b45b ("Fix and improve kernel build when kerncache is enabled.")
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 targets/support/kmerge.sh | 147 +++++++++++++++-------------------------------
 1 file changed, 47 insertions(+), 100 deletions(-)

diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 6a0137d7..972feb99 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -85,11 +85,6 @@ genkernel_compile() {
 	else
 		genkernel "${GK_ARGS[@]}" || exit 1
 	fi
-	if [ -n "${clst_KERNCACHE}" -a -e /var/tmp/${kname}.config ]
-	then
-		md5sum /var/tmp/${kname}.config | awk '{print $1}' > \
-			/tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG
-	fi
 }
 
 [ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
@@ -106,117 +101,69 @@ eval eval kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
 eval "ksource=\$clst_boot_kernel_${kname}_sources"
 [[ -z ${ksource} ]] && ksource="sys-kernel/gentoo-sources"
 
-# Check if we have a match in kerncach
-
-if [ -n "${clst_KERNCACHE}" ]
-then
-	USE_MATCH=0
-	if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE ]
-	then
-		STR1=$(for i in `cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
-		STR2=$(for i in ${kernel_use}; do echo $i; done|sort)
-		if [ "${STR1}" = "${STR2}" ]
-		then
-			USE_MATCH=1
-		else
-			[ -e /tmp/kerncache/${kname}/usr/src/linux/.config ] && \
-				rm /tmp/kerncache/${kname}/usr/src/linux/.config
-		fi
-	fi
-
-	EXTRAVERSION_MATCH=0
-	if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION ]
-	then
-		STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION`
-		STR2=${clst_kextraversion}
-		if [ "${STR1}" = "${STR2}" ]
-		then
-			EXTRAVERSION_MATCH=1
-		fi
-	fi
-
-	CONFIG_MATCH=0
-	if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG ]
-	then
-		if [ ! -e /var/tmp/${kname}.config ]
-		then
-			CONFIG_MATCH=1
-		else
-			STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG`
-			STR2=`md5sum /var/tmp/${kname}.config|awk '{print $1}'`
-			if [ "${STR1}" = "${STR2}" ]
-			then
-				CONFIG_MATCH=1
-			fi
-		fi
-	fi
+kernel_version=$(portageq best_visible / "${ksource}")
 
-	# install dependencies of kernel sources ahead of time in case
-	# package.provided generated below causes them not to be (re)installed
-	run_merge --onlydeps "${ksource}"
+if [[ -n ${clst_KERNCACHE} ]]; then
+	mkdir -p "/tmp/kerncache/${kname}"
+	pushd "/tmp/kerncache/${kname}" >/dev/null
 
-	# Create the kerncache directory if it doesn't exists
-	mkdir -p /tmp/kerncache/${kname}
+	echo "${kernel_use}" > /tmp/USE
+	echo "${kernel_version}" > /tmp/VERSION
+	echo "${clst_kextraversion}" > /tmp/EXTRAVERSION
 
-	if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION ]
-	then
-		KERNELVERSION=$(</tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION)
-		mkdir -p ${clst_port_conf}/profile
-		echo "${KERNELVERSION}" > ${clst_port_conf}/profile/package.provided
-	else
-		rm -f ${clst_port_conf}/profile/package.provided
+	if cmp -s {/tmp/,}USE && \
+	   cmp -s {/tmp/,}VERSION && \
+	   cmp -s {/tmp/,}EXTRAVERSION && \
+	   cmp -s /var/tmp/${kname}.config CONFIG; then
+		cached_kernel_found="true"
 	fi
 
-	# Don't use package.provided if there's a pending up/downgrade
-	if [[ "$(portageq best_visible / ${ksource})" == "${KERNELVERSION}" ]]; then
-		echo "No pending updates for ${ksource}"
-	else
-		echo "Pending updates for ${ksource}, removing package.provided"
-		rm -f ${clst_port_conf}/profile/package.provided
-	fi
+	rm -f /tmp/{USE,VERSION,EXTRAVERSION}
+	popd >/dev/null
+fi
 
+if [[ ! ${cached_kernel_found} ]]; then
 	USE=symlink run_merge --update "${ksource}"
+fi
 
+if [[ -n ${clst_KERNCACHE} ]]; then
 	SOURCESDIR="/tmp/kerncache/${kname}/sources"
-	if [ -L /usr/src/linux ]
-	then
-		# A kernel was merged, move it to $SOURCESDIR
-		[ -e ${SOURCESDIR} ] && rm -Rf ${SOURCESDIR}
-
-		KERNELVERSION=`portageq best_visible / "${ksource}"`
-		echo "${KERNELVERSION}" > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION
-
+	if [[ ! ${cached_kernel_found} ]]; then
 		echo "Moving kernel sources to ${SOURCESDIR} ..."
-		mv `readlink -f /usr/src/linux` ${SOURCESDIR}
-	fi
-	ln -sf ${SOURCESDIR} /usr/src/linux
 
-	# If catalyst has set to a empty string, extraversion wasn't specified so we
-	# skip this part
-	if [ "${EXTRAVERSION_MATCH}" = "0" ]
-	then
-		if [ ! "${clst_kextraversion}" = "" ]
-		then
-			echo "Setting extraversion to ${clst_kextraversion}"
-			sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
-			echo ${clst_kextraversion} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
-		else
-			touch /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
-		fi
+		rm -rf "${SOURCESDIR}"
+		mv $(readlink -f /usr/src/linux) "${SOURCESDIR}"
 	fi
-else
-	USE=symlink run_merge --update "${ksource}"
+	ln -snf "${SOURCESDIR}" /usr/src/linux
+fi
 
-	if [ ! "${clst_kextraversion}" = "" ]
-	then
-		echo "Setting extraversion to ${clst_kextraversion}"
-		sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
+if [[ -n ${clst_kextraversion} ]]; then
+	echo "Setting EXTRAVERSION to ${clst_kextraversion}"
+
+	if [[ -e /usr/src/linux/Makefile.bak ]]; then
+		cp /usr/src/linux/Makefile{.bak,}
+	else
+		cp /usr/src/linux/Makefile{,.bak}
 	fi
+	sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" \
+		/usr/src/linux/Makefile
 fi
 
 genkernel_compile
 
-if [ -n "${clst_KERNCACHE}" ]
-then
-	echo ${kernel_use} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE
+# Write out CONFIG, USE, VERSION, and EXTRAVERSION files
+if [[ -n ${clst_KERNCACHE} && ! ${cached_kernel_found} ]]; then
+	pushd "/tmp/kerncache/${kname}" >/dev/null
+
+	cp /var/tmp/${kname}.config CONFIG
+	echo "${kernel_use}" > USE
+	echo "${kernel_version}" > VERSION
+	echo "${clst_kextraversion}" > EXTRAVERSION
+
+	popd >/dev/null
+fi
+
+if [[ ! ${cached_kernel_found} ]]; then
+	run_merge -C "${ksource}"
+	rm /usr/src/linux
 fi


             reply	other threads:[~2020-10-20 23:20 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 23:20 Matt Turner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-19 19:56 [gentoo-commits] proj/catalyst:wip/mattst88 commit in: targets/support/ Matt Turner
2021-01-18 19:53 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-22 18:06 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-22 18:06 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-22 18:06 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-22 18:06 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-28 20:51 Matt Turner
2020-10-28 20:51 Matt Turner
2020-10-22 18:06 Matt Turner
2020-10-22 18:06 Matt Turner
2020-10-22 18:06 Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-21 17:58 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-20  8:30 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-20 23:20 Matt Turner
2020-10-20 23:20 Matt Turner
2020-10-20 23:20 Matt Turner
2020-10-20 19:59 Matt Turner
2020-10-20 19:59 Matt Turner
2020-10-20 19:59 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  8:30 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  4:31 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-10-20  2:50 Matt Turner
2020-05-21 20:25 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-20  3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-20  3:39 Matt Turner
2020-05-17  3:26 [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-16  6:54 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-16  6:54 Matt Turner
2020-05-03 22:58 Matt Turner
2020-05-03 22:58 Matt Turner
2020-05-03 22:58 Matt Turner
2020-05-03 22:04 Matt Turner
2020-05-03 22:04 Matt Turner
2020-05-03 22:04 Matt Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1603236041.4a713242d6af2e056b7e2c46e3d844257da3645c.mattst88@gentoo \
    --to=mattst88@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox