summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/devtool.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-04-23 17:11:42 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-01 07:43:32 +0100
commite9bae506e520a47e797c405a76f330d041289918 (patch)
treefb8bb6695d4083c31d35768999ca1591c0f627cb /meta/lib/oeqa/selftest/devtool.py
parenta74fa38365ab91d3143d8b7d6414c97cd3862794 (diff)
downloadpoky-e9bae506e520a47e797c405a76f330d041289918.tar.gz
devtool: better support for local source files
* extract: Copy all local source files (i.e. non-compressed/non-arcived SRC_URI files that have file:// URI prefix) - excluding patches - to the srctree repository. The files will be placed in a subdirectory called 'oe-local-files'. The oe-local-files directory is not committed to the Git repository, but, marked to be ignored by a .gitignore file. The developer can manually add and commit the files to Git if the changes to them need to be tracked. Before this patch, local source files (were copied (and committed) to the srctree repository only in some special cases (basically when S=WORKDIR) when doing devtool-extract. For most of the packages local files were not copied at all. * update-recipe: This patch causes the local files to be 'synced' from the srctree (i.e. from the 'oe-local-files' subdirectory) to the layer. Being 'synced' means that in addition to copying modified files over the original sources, devtool will also handle removing and adding local source files and updating the recipe accordingly. We don't want to create patches against the local source files but rather update them directly. Thus, 'oe-local-file' directory is ignored in patch generation when doing update-recipe, even if committed to Git. This functionality is only enabled if the 'oe-local-files' directory is present in srctree. [YOCTO #7602] (From OE-Core rev: a3bb5bd25b72bd1bcc156dabd0ffa2d9184bb160) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/devtool.py')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 92cd0e230d..baa56d6dc1 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -723,6 +723,77 @@ class DevtoolTests(DevtoolBase):
723 self.assertEqual(expectedlines, f.readlines()) 723 self.assertEqual(expectedlines, f.readlines())
724 # Deleting isn't expected to work under these circumstances 724 # Deleting isn't expected to work under these circumstances
725 725
726 @testcase(1173)
727 def test_devtool_update_recipe_local_files(self):
728 """Check that local source files are copied over instead of patched"""
729 testrecipe = 'makedevs'
730 recipefile = get_bb_var('FILE', testrecipe)
731 # Setup srctree for modifying the recipe
732 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
733 self.track_for_cleanup(tempdir)
734 self.track_for_cleanup(self.workspacedir)
735 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
736 # (don't bother with cleaning the recipe on teardown, we won't be
737 # building it)
738 result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
739 # Check git repo
740 self._check_src_repo(tempdir)
741 # Edit / commit local source
742 runCmd('echo "/* Foobar */" >> oe-local-files/makedevs.c', cwd=tempdir)
743 runCmd('echo "Foo" > oe-local-files/new-local', cwd=tempdir)
744 runCmd('echo "Bar" > new-file', cwd=tempdir)
745 runCmd('git add new-file', cwd=tempdir)
746 runCmd('git commit -m "Add new file"', cwd=tempdir)
747 self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' %
748 os.path.dirname(recipefile))
749 runCmd('devtool update-recipe %s' % testrecipe)
750 expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
751 (' M', '.*/makedevs/makedevs.c$'),
752 ('??', '.*/makedevs/new-local$'),
753 ('??', '.*/makedevs/0001-Add-new-file.patch$')]
754 self._check_repo_status(os.path.dirname(recipefile), expected_status)
755
756 @testcase(1174)
757 def test_devtool_update_recipe_local_files_2(self):
758 """Check local source files support when oe-local-files is in Git"""
759 testrecipe = 'lzo'
760 recipefile = get_bb_var('FILE', testrecipe)
761 # Setup srctree for modifying the recipe
762 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
763 self.track_for_cleanup(tempdir)
764 self.track_for_cleanup(self.workspacedir)
765 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
766 result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
767 # Check git repo
768 self._check_src_repo(tempdir)
769 # Add oe-local-files to Git
770 runCmd('rm oe-local-files/.gitignore', cwd=tempdir)
771 runCmd('git add oe-local-files', cwd=tempdir)
772 runCmd('git commit -m "Add local sources"', cwd=tempdir)
773 # Edit / commit local sources
774 runCmd('echo "# Foobar" >> oe-local-files/acinclude.m4', cwd=tempdir)
775 runCmd('git commit -am "Edit existing file"', cwd=tempdir)
776 runCmd('git rm oe-local-files/run-ptest', cwd=tempdir)
777 runCmd('git commit -m"Remove file"', cwd=tempdir)
778 runCmd('echo "Foo" > oe-local-files/new-local', cwd=tempdir)
779 runCmd('git add oe-local-files/new-local', cwd=tempdir)
780 runCmd('git commit -m "Add new local file"', cwd=tempdir)
781 runCmd('echo "Gar" > new-file', cwd=tempdir)
782 runCmd('git add new-file', cwd=tempdir)
783 runCmd('git commit -m "Add new file"', cwd=tempdir)
784 self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' %
785 os.path.dirname(recipefile))
786 # Checkout unmodified file to working copy -> devtool should still pick
787 # the modified version from HEAD
788 runCmd('git checkout HEAD^ -- oe-local-files/acinclude.m4', cwd=tempdir)
789 runCmd('devtool update-recipe %s' % testrecipe)
790 expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
791 (' M', '.*/acinclude.m4$'),
792 (' D', '.*/run-ptest$'),
793 ('??', '.*/new-local$'),
794 ('??', '.*/0001-Add-new-file.patch$')]
795 self._check_repo_status(os.path.dirname(recipefile), expected_status)
796
726 @testcase(1163) 797 @testcase(1163)
727 def test_devtool_extract(self): 798 def test_devtool_extract(self):
728 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 799 tempdir = tempfile.mkdtemp(prefix='devtoolqa')