[oe-commits] [openembedded-core] 33/33: testexport.bbclass: Create tarballs for easy release

git at git.openembedded.org git at git.openembedded.org
Fri Jun 3 12:49:54 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f8a0456e100b07a966cc24a78f197400c5a2ccab
Author: Mariano Lopez <mariano.lopez at linux.intel.com>
AuthorDate: Wed Jun 1 10:46:44 2016 +0000

    testexport.bbclass: Create tarballs for easy release
    
    This create tarballs in the testexport directory in order
    to make easier to distribute the test in another systems.
    
    There are three tarballs, one for the metadata that is not
    arch dependant, another for packages needed by the DUT
    (this depends of target MACHINE), and the last one for the
    SDK needed by the systems that perform the tests.
    
    [YOCTO #8481]
    
    Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/testexport.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index 40097c2..9313b14 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -126,6 +126,9 @@ def exportTests(d,tc):
         for f in files:
             shutil.copy2(os.path.join(root, f), os.path.join(exportpath, "oeqa/runtime/files"))
 
+    # Create tar file for common parts of testexport
+    create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True))
+
     # Copy packages needed for runtime testing
     export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages")
     test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True)
@@ -140,6 +143,9 @@ def exportTests(d,tc):
             dst_f = os.path.join(export_pkg_dir, root.replace(test_pkg_dir, "").lstrip("/"), f)
             shutil.copy2(src_f, dst_f)
 
+    # Create tar file for packages needed by the DUT
+    create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir)
+
     # Copy SDK
     if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1":
         sdk_deploy = d.getVar("SDK_DEPLOY", True)
@@ -150,6 +156,9 @@ def exportTests(d,tc):
         bb.utils.mkdirhier(export_sdk_dir)
         shutil.copy2(tarball_path, export_sdk_dir)
 
+    # Create tar file for the sdk
+    create_tarball(d, "testexport_sdk_%s.tar.gz" % d.getVar("SDK_ARCH", True), export_sdk_dir)
+
     bb.plain("Exported tests to: %s" % exportpath)
 
 def testexport_main(d):
@@ -181,6 +190,23 @@ def testexport_main(d):
     tc.extract_packages()
     exportTests(d,tc)
 
+def create_tarball(d, tar_name, src_dir):
+
+    import tarfile
+
+    tar_path = os.path.join(d.getVar("TEST_EXPORT_DIR", True), tar_name)
+    current_dir = os.getcwd()
+    src_dir = src_dir.rstrip('/')
+    dir_name = os.path.dirname(src_dir)
+    base_name = os.path.basename(src_dir)
+
+    os.chdir(dir_name)
+    tar = tarfile.open(tar_path, "w:gz")
+    tar.add(base_name)
+    tar.close()
+    os.chdir(current_dir)
+
+
 testexport_main[vardepsexclude] =+ "BB_ORIGENV"
 
 inherit testimage

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list