summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-09-08 11:39:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:52 +0100
commit3dd9fc39abdbccdbc313b577e7750974e3d6454e (patch)
treefb5458798559fa4c3def01120a1ae0c6b43c113e /meta/lib
parent0d0e50810a793f517b253e329339ba40d4bedd36 (diff)
downloadpoky-3dd9fc39abdbccdbc313b577e7750974e3d6454e.tar.gz
devtool: update-recipe: better 'auto' mode
Enhance the logic behind the 'auto' mode a bit by only updating the SRCREV if the changes are already found upstream. The logic is simple: update SRCREV only if the current local HEAD commit is found in the remote branch (i.e. 'origin/<branch_name>'). Otherwise resort to patching. This affects a couple of the oe-selftest tests so update those as well. [YOCTO #7907] (From OE-Core rev: 9b9733b7d74032aef4979bec553019421e77da14) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 255f2c3820..6e731d6777 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -547,8 +547,8 @@ class DevtoolTests(DevtoolBase):
547 result = runCmd('echo "A new file" > devtool-new-file', cwd=tempdir) 547 result = runCmd('echo "A new file" > devtool-new-file', cwd=tempdir)
548 result = runCmd('git add devtool-new-file', cwd=tempdir) 548 result = runCmd('git add devtool-new-file', cwd=tempdir)
549 result = runCmd('git commit -m "Add a new file"', cwd=tempdir) 549 result = runCmd('git commit -m "Add a new file"', cwd=tempdir)
550 self.add_command_to_tearDown('cd %s; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, os.path.basename(recipefile))) 550 self.add_command_to_tearDown('cd %s; rm -rf %s; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, testrecipe, os.path.basename(recipefile)))
551 result = runCmd('devtool update-recipe %s' % testrecipe) 551 result = runCmd('devtool update-recipe -m srcrev %s' % testrecipe)
552 result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) 552 result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile))
553 self.assertNotEqual(result.output.strip(), "", '%s recipe should be modified' % testrecipe) 553 self.assertNotEqual(result.output.strip(), "", '%s recipe should be modified' % testrecipe)
554 status = result.output.splitlines() 554 status = result.output.splitlines()
@@ -585,6 +585,26 @@ class DevtoolTests(DevtoolBase):
585 matched = True 585 matched = True
586 break 586 break
587 self.assertTrue(matched, 'Unexpected diff remove line: %s' % line) 587 self.assertTrue(matched, 'Unexpected diff remove line: %s' % line)
588 # Now try with auto mode
589 runCmd('cd %s; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, os.path.basename(recipefile)))
590 result = runCmd('devtool update-recipe %s' % testrecipe)
591 result = runCmd('git rev-parse --show-toplevel')
592 topleveldir = result.output.strip()
593 result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile))
594 status = result.output.splitlines()
595 relpatchpath = os.path.join(os.path.relpath(os.path.dirname(recipefile), topleveldir), testrecipe)
596 expectedstatus = [('M', os.path.relpath(recipefile, topleveldir)),
597 ('??', '%s/0001-Change-the-Makefile.patch' % relpatchpath),
598 ('??', '%s/0002-Add-a-new-file.patch' % relpatchpath)]
599 for line in status:
600 statusline = line.split(None, 1)
601 for fstatus, fn in expectedstatus:
602 if fn == statusline[1]:
603 if fstatus != statusline[0]:
604 self.fail('Unexpected status in line: %s' % line)
605 break
606 else:
607 self.fail('Unexpected modified file in line: %s' % line)
588 608
589 @testcase(1170) 609 @testcase(1170)
590 def test_devtool_update_recipe_append(self): 610 def test_devtool_update_recipe_append(self):
@@ -708,7 +728,7 @@ class DevtoolTests(DevtoolBase):
708 self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir) 728 self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir)
709 result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir) 729 result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir)
710 # Create the bbappend 730 # Create the bbappend
711 result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) 731 result = runCmd('devtool update-recipe -m srcrev %s -a %s' % (testrecipe, templayerdir))
712 self.assertNotIn('WARNING:', result.output) 732 self.assertNotIn('WARNING:', result.output)
713 # Check recipe is still clean 733 # Check recipe is still clean
714 result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) 734 result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile))
@@ -729,12 +749,12 @@ class DevtoolTests(DevtoolBase):
729 self.assertEqual(expectedlines, f.readlines()) 749 self.assertEqual(expectedlines, f.readlines())
730 750
731 # Check we can run it again and bbappend isn't modified 751 # Check we can run it again and bbappend isn't modified
732 result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) 752 result = runCmd('devtool update-recipe -m srcrev %s -a %s' % (testrecipe, templayerdir))
733 with open(bbappendfile, 'r') as f: 753 with open(bbappendfile, 'r') as f:
734 self.assertEqual(expectedlines, f.readlines()) 754 self.assertEqual(expectedlines, f.readlines())
735 # Drop new commit and check SRCREV changes 755 # Drop new commit and check SRCREV changes
736 result = runCmd('git reset HEAD^', cwd=tempsrcdir) 756 result = runCmd('git reset HEAD^', cwd=tempsrcdir)
737 result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) 757 result = runCmd('devtool update-recipe -m srcrev %s -a %s' % (testrecipe, templayerdir))
738 self.assertFalse(os.path.exists(os.path.join(appenddir, testrecipe)), 'Patch directory should not be created') 758 self.assertFalse(os.path.exists(os.path.join(appenddir, testrecipe)), 'Patch directory should not be created')
739 result = runCmd('git rev-parse HEAD', cwd=tempsrcdir) 759 result = runCmd('git rev-parse HEAD', cwd=tempsrcdir)
740 expectedlines = ['SRCREV = "%s"\n' % result.output, 760 expectedlines = ['SRCREV = "%s"\n' % result.output,
@@ -747,7 +767,7 @@ class DevtoolTests(DevtoolBase):
747 os.remove(bbappendfile) 767 os.remove(bbappendfile)
748 result = runCmd('git commit -a -m "Change the Makefile"', cwd=tempsrcdir) 768 result = runCmd('git commit -a -m "Change the Makefile"', cwd=tempsrcdir)
749 result = runCmd('bitbake-layers remove-layer %s' % templayerdir, cwd=self.builddir) 769 result = runCmd('bitbake-layers remove-layer %s' % templayerdir, cwd=self.builddir)
750 result = runCmd('devtool update-recipe %s -a %s' % (testrecipe, templayerdir)) 770 result = runCmd('devtool update-recipe -m srcrev %s -a %s' % (testrecipe, templayerdir))
751 self.assertIn('WARNING: Specified layer is not currently enabled in bblayers.conf', result.output) 771 self.assertIn('WARNING: Specified layer is not currently enabled in bblayers.conf', result.output)
752 self.assertFalse(os.path.exists(os.path.join(appenddir, testrecipe)), 'Patch directory should not be created') 772 self.assertFalse(os.path.exists(os.path.join(appenddir, testrecipe)), 'Patch directory should not be created')
753 result = runCmd('git rev-parse HEAD', cwd=tempsrcdir) 773 result = runCmd('git rev-parse HEAD', cwd=tempsrcdir)