Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: linux-info.eclass
Date: Sun, 29 Sep 2013 02:49:44
Message-Id: 20130929024941.0644D2004E@flycatcher.gentoo.org
1 vapier 13/09/29 02:49:40
2
3 Modified: linux-info.eclass
4 Log:
5 get_version: extract version info with getfilevar_noexec as it should always work, and is much faster than evaluating with make; reported by Doug Anderson from ChromiumOS
6
7 Revision Changes Path
8 1.102 eclass/linux-info.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?rev=1.102&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?rev=1.102&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?r1=1.101&r2=1.102
13
14 Index: linux-info.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v
17 retrieving revision 1.101
18 retrieving revision 1.102
19 diff -u -r1.101 -r1.102
20 --- linux-info.eclass 29 Sep 2013 02:36:17 -0000 1.101
21 +++ linux-info.eclass 29 Sep 2013 02:49:40 -0000 1.102
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2013 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.101 2013/09/29 02:36:17 vapier Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.102 2013/09/29 02:49:40 vapier Exp $
27
28 # @ECLASS: linux-info.eclass
29 # @MAINTAINER:
30 @@ -429,7 +429,7 @@
31 # KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the
32 # symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build).
33 get_version() {
34 - local mkfunc tmplocal
35 + local tmplocal
36
37 # no need to execute this twice assuming KV_FULL is populated.
38 # we can force by unsetting KV_FULL
39 @@ -493,21 +493,24 @@
40 # keep track of it
41 KERNEL_MAKEFILE="${KV_DIR}/Makefile"
42
43 - # Decide the function used to extract makefile variables.
44 - mkfunc="$(get_makefile_extract_function "${KERNEL_MAKEFILE}")"
45 -
46 - # And if we didn't pass it, we can take a nosey in the Makefile
47 if [[ -z ${OUTPUT_DIR} ]]; then
48 + # Decide the function used to extract makefile variables.
49 + local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
50 +
51 + # And if we didn't pass it, we can take a nosey in the Makefile.
52 OUTPUT_DIR=$(${mkfunc} KBUILD_OUTPUT "${KERNEL_MAKEFILE}")
53 fi
54
55 # And contrary to existing functions I feel we shouldn't trust the
56 # directory name to find version information as this seems insane.
57 - # so we parse ${KERNEL_MAKEFILE}
58 - KV_MAJOR="$(${mkfunc} VERSION ${KERNEL_MAKEFILE})"
59 - KV_MINOR="$(${mkfunc} PATCHLEVEL ${KERNEL_MAKEFILE})"
60 - KV_PATCH="$(${mkfunc} SUBLEVEL ${KERNEL_MAKEFILE})"
61 - KV_EXTRA="$(${mkfunc} EXTRAVERSION ${KERNEL_MAKEFILE})"
62 + # So we parse ${KERNEL_MAKEFILE}. We should be able to trust that
63 + # the Makefile is simple enough to use the noexec extract function.
64 + # This has been true for every release thus far, and it's faster
65 + # than using make to evaluate the Makefile every time.
66 + KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
67 + KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
68 + KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
69 + KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
70
71 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
72 then