[OE-core] [PATCH] lib/oeqa/selftest/buildoptions.py: added auto test for image build with GPL licenses for containing packages

Costin Constantin costin.c.constantin at intel.com
Tue Jun 9 11:34:58 UTC 2015


Signed-off-by: Costin Constantin <costin.c.constantin at intel.com>
---
 meta/lib/oeqa/selftest/buildoptions.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index a3297fd..cddfa48 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -156,3 +156,32 @@ class BuildImagesTest(oeSelfTest):
           self.prc.kill(9)
           self.log.error("It is possible that runquemu didn't start correctly. Add this line your_username  ALL=NOPASSWD:       ALL\nto your visudo")
           self.assertTrue(False, "Couldn't start qemu")
+
+class ArchiverTest(oeSelfTest):
+    @testcase(929)
+    def test_gpl_licenses(self):
+        """
+        Test for checking that correct GPL licenses are used when explicitly required.
+        """
+        self.add_command_to_tearDown('cleanup-workdir')
+        self.write_config("MACHINE = \"qemux86\"\nINHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nCOPYLEFT_LICENSE_INCLUDE = \"GPLv2* GPLv3*\"")
+        self.res = bitbake("core-image-minimal").status
+        self.remove_config("MACHINE = \"qemux86\"\nINHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nCOPYLEFT_LICENSE_INCLUDE = \"GPLv2* GPLv3*\"")
+        self.assertEqual(self.res, 0, "core-image-minimal didn't build. Please check logs for further details")
+        self.built_pkgs_list = os.listdir(self.builddir + "/tmp/deploy/sources/i586-poky-linux/")# the list containing built pkgs with ver.
+        self.pkg_name_split = [i.split("-") for i in self.built_pkgs_list]
+        self.pkgs = [] # this will contain the pkgs name as found in tmp/deploy/licenses
+        for i in self.pkg_name_split:
+          self.name = ""
+          for j in i:
+            if i.index(j) == 0:
+              self.name = j
+            elif j.isalpha() and i.index(j) != 0:
+              self.name = self.name + "-" + j
+            else:
+              self.pkgs.append(self.name)
+              break
+        self.license_dir = self.builddir + "/tmp/deploy/licenses/"
+        for i in self.pkgs:
+          if os.path.isdir(self.license_dir + i):
+            self.assertTrue(g.glob(self.license_dir + i + "/*GPL*"), "couldn't find GPL license in " + self.license_dir + i)
\ No newline at end of file
-- 
2.1.4




More information about the Openembedded-core mailing list