From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1080153-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8289B138334 for <garchives@archives.gentoo.org>; Thu, 28 Mar 2019 23:43:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A58F2E0AD6; Thu, 28 Mar 2019 23:43:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 64A29E0AD6 for <gentoo-commits@lists.gentoo.org>; Thu, 28 Mar 2019 23:43:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 04D71335D28 for <gentoo-commits@lists.gentoo.org>; Thu, 28 Mar 2019 23:43:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CEA8A588 for <gentoo-commits@lists.gentoo.org>; Thu, 28 Mar 2019 23:43:12 +0000 (UTC) From: "Thomas Deutschmann" <whissi@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" <whissi@gentoo.org> Message-ID: <1553803461.58a57b303efb9fb5ce60c0dc40c806e7d7b46db0.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_determineargs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 58a57b303efb9fb5ce60c0dc40c806e7d7b46db0 X-VCS-Branch: master Date: Thu, 28 Mar 2019 23:43:12 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d2386530-bf5f-434d-90fd-9baee090f399 X-Archives-Hash: b284777458710bb19e9801ac27643eb0 commit: 58a57b303efb9fb5ce60c0dc40c806e7d7b46db0 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> AuthorDate: Thu Mar 28 20:04:21 2019 +0000 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> CommitDate: Thu Mar 28 20:04:21 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=58a57b30 get_KV(): refactoring how we determine KV - Fix handling O= builds (--kernel-outputdir): Patch (commit 8de731164496d09384d8be81a3f22316230deb65) from bug 238707 has probably never worked: There's no MAKEARGS in $KERNEL_DIR/Makefile... It is enough to read include/linux/version.h or include/linux/utsrelease.h from $KERNEL_OUTPUTDIR which is either set to $KERNEL_DIR or is a separate directory in which case there will be no files created in $KERNEL_DIR. - Set marker if KV will change to allow for user notification to avoid confusion. Bug: https://bugs.gentoo.org/521778 Bug: https://bugs.gentoo.org/352787 Bug: https://bugs.gentoo.org/263927 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> gen_determineargs.sh | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/gen_determineargs.sh b/gen_determineargs.sh index c88bb4f..856d88e 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -2,6 +2,9 @@ # $Id$ get_KV() { + local old_KV= + [ -n "${KV}" ] && old_KV="${KV}" + if ! isTrue "${KERNEL_SOURCES}" && [ -e "${KERNCACHE}" ] then /bin/tar -x -C ${TEMP} -f ${KERNCACHE} kerncache.config @@ -30,42 +33,47 @@ get_KV() { SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'` - if [ -z "${SUB}" ] - then - # Handle O= build directories - KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'` - [ -z "${KERNEL_SOURCE_DIR}" ] && gen_die "Deriving \${KERNEL_SOURCE_DIR} failed" - SUB=`grep ^SUBLEVEL\ \= ${KERNEL_SOURCE_DIR}/Makefile | awk '{ print $3 };'` - EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_SOURCE_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'` - fi - - cd ${KERNEL_DIR} - #compile_generic prepare kernel > /dev/null 2>&1 - cd - > /dev/null 2>&1 - [ -f "${KERNEL_DIR}/include/linux/version.h" ] && \ - VERSION_SOURCE="${KERNEL_DIR}/include/linux/version.h" - [ -f "${KERNEL_DIR}/include/linux/utsrelease.h" ] && \ - VERSION_SOURCE="${KERNEL_DIR}/include/linux/utsrelease.h" + # The files we are looking for are always in KERNEL_OUTPUTDIR + # because in most cases, KERNEL_OUTPUTDIR == KERNEL_DIR. + # If KERNEL_OUTPUTDIR != KERNEL_DIR, --kernel-outputdir is used, + # in which case files will only be in KERNEL_OUTPUTDIR. + [ -f "${KERNEL_OUTPUTDIR}/include/linux/version.h" ] && \ + VERSION_SOURCE="${KERNEL_OUTPUTDIR}/include/linux/version.h" + [ -f "${KERNEL_OUTPUTDIR}/include/linux/utsrelease.h" ] && \ + VERSION_SOURCE="${KERNEL_OUTPUTDIR}/include/linux/utsrelease.h" # Handle new-style releases where version.h doesn't have UTS_RELEASE - if [ -f ${KERNEL_DIR}/include/config/kernel.release ] + if [ -f ${KERNEL_OUTPUTDIR}/include/config/kernel.release ] then - UTS_RELEASE=`cat ${KERNEL_DIR}/include/config/kernel.release` + print_info 3 "Using '${KERNEL_OUTPUTDIR}/include/config/kernel.release' to extract LOCALVERSION..." + UTS_RELEASE=`cat ${KERNEL_OUTPUTDIR}/include/config/kernel.release` LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` KV=${VER}.${PAT}.${SUB}${EXV}${LOV} elif [ -n "${VERSION_SOURCE}" ] then + print_info 3 "Using '${VERSION_SOURCE}' to extract LOCALVERSION..." UTS_RELEASE=`grep UTS_RELEASE ${VERSION_SOURCE} | sed -e 's/#define UTS_RELEASE "\(.*\)"/\1/'` LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` KV=${VER}.${PAT}.${SUB}${EXV}${LOV} else - determine_config_file - LCV=`grep ^CONFIG_LOCALVERSION= "${KERNEL_CONFIG}" | sed -r -e "s/.*=\"(.*)\"/\1/"` - KV=${VER}.${PAT}.${SUB}${EXV}${LCV} + # We will be here only when currently selected kernel source + # is untouched. I.e. after a new kernel sources version was installed + # and genkernel was called for the first time. + # However, we have no chance to get a LOCALVERSION, + # so don't even try -- it would be useless at this stage. + print_info 3 "Unable to determine LOCALVERSION -- maybe fresh sources?" + KV=${VER}.${PAT}.${SUB}${EXV} fi fi KV_MAJOR=$(echo $KV | cut -f1 -d.) KV_MINOR=$(echo $KV | cut -f2 -d.) + + if [ -n "${old_KV}" -a "${KV}" != "${old_KV}" ] + then + print_info 3 "KV changed from '${old_KV}' to '${KV}'!" + echo "${old_KV}" > "${TEMP}/.old_kv" || + gen_die "failed to to store '${old_KV}' in '${TEMP}/.old_kv' marker" + fi } determine_real_args() {