1 |
commit: 58a57b303efb9fb5ce60c0dc40c806e7d7b46db0 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Mar 28 20:04:21 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 28 20:04:21 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=58a57b30 |
7 |
|
8 |
get_KV(): refactoring how we determine KV |
9 |
|
10 |
- Fix handling O= builds (--kernel-outputdir): |
11 |
Patch (commit 8de731164496d09384d8be81a3f22316230deb65) from bug 238707 |
12 |
has probably never worked: |
13 |
|
14 |
There's no MAKEARGS in $KERNEL_DIR/Makefile... |
15 |
|
16 |
It is enough to read include/linux/version.h or include/linux/utsrelease.h |
17 |
from $KERNEL_OUTPUTDIR which is either set to $KERNEL_DIR or is a separate |
18 |
directory in which case there will be no files created in $KERNEL_DIR. |
19 |
|
20 |
- Set marker if KV will change to allow for user notification to avoid confusion. |
21 |
|
22 |
Bug: https://bugs.gentoo.org/521778 |
23 |
Bug: https://bugs.gentoo.org/352787 |
24 |
Bug: https://bugs.gentoo.org/263927 |
25 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
26 |
|
27 |
gen_determineargs.sh | 50 +++++++++++++++++++++++++++++--------------------- |
28 |
1 file changed, 29 insertions(+), 21 deletions(-) |
29 |
|
30 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
31 |
index c88bb4f..856d88e 100755 |
32 |
--- a/gen_determineargs.sh |
33 |
+++ b/gen_determineargs.sh |
34 |
@@ -2,6 +2,9 @@ |
35 |
# $Id$ |
36 |
|
37 |
get_KV() { |
38 |
+ local old_KV= |
39 |
+ [ -n "${KV}" ] && old_KV="${KV}" |
40 |
+ |
41 |
if ! isTrue "${KERNEL_SOURCES}" && [ -e "${KERNCACHE}" ] |
42 |
then |
43 |
/bin/tar -x -C ${TEMP} -f ${KERNCACHE} kerncache.config |
44 |
@@ -30,42 +33,47 @@ get_KV() { |
45 |
SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` |
46 |
EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'` |
47 |
|
48 |
- if [ -z "${SUB}" ] |
49 |
- then |
50 |
- # Handle O= build directories |
51 |
- KERNEL_SOURCE_DIR=`grep ^MAKEARGS\ \:\= ${KERNEL_DIR}/Makefile | awk '{ print $4 };'` |
52 |
- [ -z "${KERNEL_SOURCE_DIR}" ] && gen_die "Deriving \${KERNEL_SOURCE_DIR} failed" |
53 |
- SUB=`grep ^SUBLEVEL\ \= ${KERNEL_SOURCE_DIR}/Makefile | awk '{ print $3 };'` |
54 |
- EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_SOURCE_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'` |
55 |
- fi |
56 |
- |
57 |
- cd ${KERNEL_DIR} |
58 |
- #compile_generic prepare kernel > /dev/null 2>&1 |
59 |
- cd - > /dev/null 2>&1 |
60 |
- [ -f "${KERNEL_DIR}/include/linux/version.h" ] && \ |
61 |
- VERSION_SOURCE="${KERNEL_DIR}/include/linux/version.h" |
62 |
- [ -f "${KERNEL_DIR}/include/linux/utsrelease.h" ] && \ |
63 |
- VERSION_SOURCE="${KERNEL_DIR}/include/linux/utsrelease.h" |
64 |
+ # The files we are looking for are always in KERNEL_OUTPUTDIR |
65 |
+ # because in most cases, KERNEL_OUTPUTDIR == KERNEL_DIR. |
66 |
+ # If KERNEL_OUTPUTDIR != KERNEL_DIR, --kernel-outputdir is used, |
67 |
+ # in which case files will only be in KERNEL_OUTPUTDIR. |
68 |
+ [ -f "${KERNEL_OUTPUTDIR}/include/linux/version.h" ] && \ |
69 |
+ VERSION_SOURCE="${KERNEL_OUTPUTDIR}/include/linux/version.h" |
70 |
+ [ -f "${KERNEL_OUTPUTDIR}/include/linux/utsrelease.h" ] && \ |
71 |
+ VERSION_SOURCE="${KERNEL_OUTPUTDIR}/include/linux/utsrelease.h" |
72 |
# Handle new-style releases where version.h doesn't have UTS_RELEASE |
73 |
- if [ -f ${KERNEL_DIR}/include/config/kernel.release ] |
74 |
+ if [ -f ${KERNEL_OUTPUTDIR}/include/config/kernel.release ] |
75 |
then |
76 |
- UTS_RELEASE=`cat ${KERNEL_DIR}/include/config/kernel.release` |
77 |
+ print_info 3 "Using '${KERNEL_OUTPUTDIR}/include/config/kernel.release' to extract LOCALVERSION..." |
78 |
+ UTS_RELEASE=`cat ${KERNEL_OUTPUTDIR}/include/config/kernel.release` |
79 |
LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` |
80 |
KV=${VER}.${PAT}.${SUB}${EXV}${LOV} |
81 |
elif [ -n "${VERSION_SOURCE}" ] |
82 |
then |
83 |
+ print_info 3 "Using '${VERSION_SOURCE}' to extract LOCALVERSION..." |
84 |
UTS_RELEASE=`grep UTS_RELEASE ${VERSION_SOURCE} | sed -e 's/#define UTS_RELEASE "\(.*\)"/\1/'` |
85 |
LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` |
86 |
KV=${VER}.${PAT}.${SUB}${EXV}${LOV} |
87 |
else |
88 |
- determine_config_file |
89 |
- LCV=`grep ^CONFIG_LOCALVERSION= "${KERNEL_CONFIG}" | sed -r -e "s/.*=\"(.*)\"/\1/"` |
90 |
- KV=${VER}.${PAT}.${SUB}${EXV}${LCV} |
91 |
+ # We will be here only when currently selected kernel source |
92 |
+ # is untouched. I.e. after a new kernel sources version was installed |
93 |
+ # and genkernel was called for the first time. |
94 |
+ # However, we have no chance to get a LOCALVERSION, |
95 |
+ # so don't even try -- it would be useless at this stage. |
96 |
+ print_info 3 "Unable to determine LOCALVERSION -- maybe fresh sources?" |
97 |
+ KV=${VER}.${PAT}.${SUB}${EXV} |
98 |
fi |
99 |
fi |
100 |
|
101 |
KV_MAJOR=$(echo $KV | cut -f1 -d.) |
102 |
KV_MINOR=$(echo $KV | cut -f2 -d.) |
103 |
+ |
104 |
+ if [ -n "${old_KV}" -a "${KV}" != "${old_KV}" ] |
105 |
+ then |
106 |
+ print_info 3 "KV changed from '${old_KV}' to '${KV}'!" |
107 |
+ echo "${old_KV}" > "${TEMP}/.old_kv" || |
108 |
+ gen_die "failed to to store '${old_KV}' in '${TEMP}/.old_kv' marker" |
109 |
+ fi |
110 |
} |
111 |
|
112 |
determine_real_args() { |