public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger (vapier)" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: linux-info.eclass
Date: Sun, 29 Sep 2013 02:49:40 +0000 (UTC)	[thread overview]
Message-ID: <20130929024941.0644D2004E@flycatcher.gentoo.org> (raw)

vapier      13/09/29 02:49:40

  Modified:             linux-info.eclass
  Log:
  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

Revision  Changes    Path
1.102                eclass/linux-info.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?rev=1.102&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?rev=1.102&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/linux-info.eclass?r1=1.101&r2=1.102

Index: linux-info.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- linux-info.eclass	29 Sep 2013 02:36:17 -0000	1.101
+++ linux-info.eclass	29 Sep 2013 02:49:40 -0000	1.102
@@ -1,6 +1,6 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.101 2013/09/29 02:36:17 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.102 2013/09/29 02:49:40 vapier Exp $
 
 # @ECLASS: linux-info.eclass
 # @MAINTAINER:
@@ -429,7 +429,7 @@
 # KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the
 # symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build).
 get_version() {
-	local mkfunc tmplocal
+	local tmplocal
 
 	# no need to execute this twice assuming KV_FULL is populated.
 	# we can force by unsetting KV_FULL
@@ -493,21 +493,24 @@
 	# keep track of it
 	KERNEL_MAKEFILE="${KV_DIR}/Makefile"
 
-	# Decide the function used to extract makefile variables.
-	mkfunc="$(get_makefile_extract_function "${KERNEL_MAKEFILE}")"
-
-	# And if we didn't pass it, we can take a nosey in the Makefile
 	if [[ -z ${OUTPUT_DIR} ]]; then
+		# Decide the function used to extract makefile variables.
+		local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
+
+		# And if we didn't pass it, we can take a nosey in the Makefile.
 		OUTPUT_DIR=$(${mkfunc} KBUILD_OUTPUT "${KERNEL_MAKEFILE}")
 	fi
 
 	# And contrary to existing functions I feel we shouldn't trust the
 	# directory name to find version information as this seems insane.
-	# so we parse ${KERNEL_MAKEFILE}
-	KV_MAJOR="$(${mkfunc} VERSION ${KERNEL_MAKEFILE})"
-	KV_MINOR="$(${mkfunc} PATCHLEVEL ${KERNEL_MAKEFILE})"
-	KV_PATCH="$(${mkfunc} SUBLEVEL ${KERNEL_MAKEFILE})"
-	KV_EXTRA="$(${mkfunc} EXTRAVERSION ${KERNEL_MAKEFILE})"
+	# So we parse ${KERNEL_MAKEFILE}.  We should be able to trust that
+	# the Makefile is simple enough to use the noexec extract function.
+	# This has been true for every release thus far, and it's faster
+	# than using make to evaluate the Makefile every time.
+	KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
+	KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
+	KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
+	KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
 
 	if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
 	then





             reply	other threads:[~2013-09-29  2:49 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-29  2:49 Mike Frysinger (vapier) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-02  7:39 [gentoo-commits] gentoo-x86 commit in eclass: linux-info.eclass Mike Frysinger (vapier)
2015-06-02  4:27 Mike Frysinger (vapier)
2015-05-09  8:03 Ulrich Mueller (ulm)
2014-06-28  7:54 Robin H. Johnson (robbat2)
2013-09-29  2:36 Mike Frysinger (vapier)
2013-02-10  7:53 Mike Frysinger (vapier)
2013-02-10  6:20 Mike Frysinger (vapier)
2013-02-10  6:18 Mike Frysinger (vapier)
2013-02-10  2:21 Mike Frysinger (vapier)
2013-01-24 20:47 Mike Frysinger (vapier)
2013-01-14 21:19 Mike Frysinger (vapier)
2011-03-29 19:57 Diego Petteno (flameeyes)
2011-01-04 17:53 Doug Goldstein (cardoe)
2010-08-05 21:57 Robin H. Johnson (robbat2)
2010-08-03  7:03 Robin H. Johnson (robbat2)
2010-06-17 23:46 Jonathan Callen (abcd)
2010-01-17 21:46 Robin H. Johnson (robbat2)
2010-01-17 21:34 Robin H. Johnson (robbat2)
2010-01-10  9:26 Robin H. Johnson (robbat2)
2010-01-10  9:25 Robin H. Johnson (robbat2)
2010-01-10  9:01 Robin H. Johnson (robbat2)
2010-01-10  8:47 Robin H. Johnson (robbat2)
2010-01-10  8:25 Robin H. Johnson (robbat2)
2009-12-11 21:33 Robin H. Johnson (robbat2)
2009-12-11 20:54 Robin H. Johnson (robbat2)
2009-12-11 20:42 Robin H. Johnson (robbat2)
2009-10-11 11:48 Markus Meier (maekke)
2009-09-13 20:44 Robin H. Johnson (robbat2)
2009-09-08 12:34 Robin H. Johnson (robbat2)
2009-09-06 23:41 Robin H. Johnson (robbat2)
2009-09-06 23:40 Robin H. Johnson (robbat2)
2009-09-06 23:36 Robin H. Johnson (robbat2)
2009-09-06 23:31 Robin H. Johnson (robbat2)
2009-09-06 23:24 Robin H. Johnson (robbat2)
2009-09-06 23:12 Robin H. Johnson (robbat2)
2009-09-06 23:04 Robin H. Johnson (robbat2)
2009-09-06 22:54 Robin H. Johnson (robbat2)
2009-08-30 22:37 Robin H. Johnson (robbat2)
2009-07-04 18:39 Robin H. Johnson (robbat2)
2009-03-27 20:13 Peter Alfredsen (loki_val)
2009-01-12 23:04 Markus Meier (maekke)
2008-12-03 18:11 Daniel Drake (dsd)
2008-10-31 22:01 Daniel Drake (dsd)
2008-03-21 11:11 Daniel Drake (dsd)
2008-01-23 20:58 Daniel Drake (dsd)

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=20130929024941.0644D2004E@flycatcher.gentoo.org \
    --to=vapier@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