SVN commit svn://test.kernel.org/autotest/tr...@270, git sha1 225d0581,
"Make installing kernels work properly" added code to apped "-autotest"
to the EXTRAVERSION field in the kernel version.  However, it does so by
modifying the Makefile which is not friendly when the source tree is
shared or several builds are performed using the same source tree.  In
the later case, -autotest ends up getting recursively appended to
EXTRAVERSION until the line become to long and the kernel no longer
compiles.

This patch changes the implementation of extraversion to append
-autotest to the LOCALVERSION field in .config.  This should be safer
because .config is a generated file.

Changes from v2:
- Fixed the correspondent unittest

Signed-off-by: Grant Likely <[email protected]>
---
 client/bin/kernel.py          |   14 ++++++++------
 client/bin/kernel_unittest.py |   12 ++++++++----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index f3f5a38..cb0ef99 100644
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
@@ -332,15 +332,17 @@ class kernel(BootableKernel):
             utils.extract_tarball_to_dir(tarball, self.build_dir)
 
 
-    def extraversion(self, tag, append=1):
+    def extraversion(self, tag, append=True):
         os.chdir(self.build_dir)
-        extraversion_sub = r's/^EXTRAVERSION =\s*\(.*\)/EXTRAVERSION = '
+        extraversion_sub = 
r's/^CONFIG_LOCALVERSION=\s*"\(.*\)"/CONFIG_LOCALVERSION='
+        cfg = self.build_dir + '/.config'
         if append:
-            p = extraversion_sub + '\\1-%s/' % tag
+            p = extraversion_sub + '"\\1-%s"/' % tag
         else:
-            p = extraversion_sub + '-%s/' % tag
-        utils.system('mv Makefile Makefile.old')
-        utils.system('sed "%s" < Makefile.old > Makefile' % p)
+            p = extraversion_sub + '"-%s"/' % tag
+        utils.system('mv %s %s.old' % (cfg, cfg))
+        utils.system("sed '%s' < %s.old > %s" % (p, cfg, cfg))
+        self.config(make='oldconfig')
 
 
     @log.record
diff --git a/client/bin/kernel_unittest.py b/client/bin/kernel_unittest.py
index 6761c05..4ed0d37 100755
--- a/client/bin/kernel_unittest.py
+++ b/client/bin/kernel_unittest.py
@@ -425,13 +425,17 @@ class TestKernel(unittest.TestCase):
     def test_extraversion(self):
         self.construct_kernel()
         tag = "tag"
+        # setup
+        self.god.stub_function(self.kernel, "config")
 
         # record
         os.chdir.expect_call(self.build_dir)
-        extraversion_sub = r's/^EXTRAVERSION =\s*\(.*\)/EXTRAVERSION = '
-        p = extraversion_sub + '\\1-%s/' % tag
-        utils.system.expect_call('mv Makefile Makefile.old')
-        utils.system.expect_call('sed "%s" < Makefile.old > Makefile' % p)
+        extraversion_sub = 
r's/^CONFIG_LOCALVERSION=\s*"\(.*\)"/CONFIG_LOCALVERSION='
+        cfg = self.build_dir + '/.config'
+        p = extraversion_sub + '"\\1-%s"/' % tag
+        utils.system.expect_call('mv %s %s.old' % (cfg, cfg))
+        utils.system.expect_call("sed '%s' < %s.old > %s" % (p, cfg, cfg))
+        self.kernel.config.expect_call(make='oldconfig')
 
         # run and check
         self.kernel.extraversion(tag)
-- 
1.7.2.3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to