Пример #1
0
    def test_force_task_1(self):
        # test 1 from bug 5875
        import uuid
        test_recipe = 'zlib'
        # Need to use uuid otherwise hash equivlance would change the workflow
        test_data = "Microsoft Made No Profit From Anyone's Zunes Yo %s" % uuid.uuid1(
        )
        bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe)
        image_dir = bb_vars['D']
        pkgsplit_dir = bb_vars['PKGDEST']
        man_dir = bb_vars['mandir']
        self.write_config("PACKAGE_CLASSES = \"package_rpm\"")

        bitbake('-c clean %s' % test_recipe)
        bitbake('-c package -f %s' % test_recipe)
        self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)

        man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3')
        ftools.append_file(man_file, test_data)
        bitbake('-c package -f %s' % test_recipe)

        man_split_file = os.path.join(pkgsplit_dir, 'zlib-doc' + man_dir,
                                      'man3/zlib.3')
        man_split_content = ftools.read_file(man_split_file)
        self.assertIn(test_data, man_split_content,
                      'The man file has not changed in packages-split.')

        ret = bitbake(test_recipe)
        self.assertIn('task do_package_write_rpm:', ret.output,
                      'Task do_package_write_rpm did not re-executed.')
Пример #2
0
    def test_force_task_1(self):
        # test 1 from bug 5875
        test_recipe = 'zlib'
        test_data = "Microsoft Made No Profit From Anyone's Zunes Yo"
        bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe)
        image_dir = bb_vars['D']
        pkgsplit_dir = bb_vars['PKGDEST']
        man_dir = bb_vars['mandir']

        bitbake('-c clean %s' % test_recipe)
        bitbake('-c package -f %s' % test_recipe)
        self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)

        man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3')
        ftools.append_file(man_file, test_data)
        bitbake('-c package -f %s' % test_recipe)

        man_split_file = os.path.join(pkgsplit_dir, 'zlib-doc' + man_dir,
                                      'man3/zlib.3')
        man_split_content = ftools.read_file(man_split_file)
        self.assertIn(test_data, man_split_content,
                      'The man file has not changed in packages-split.')

        ret = bitbake(test_recipe)
        self.assertIn('task do_package_write_rpm:', ret.output,
                      'Task do_package_write_rpm did not re-executed.')
Пример #3
0
    def append_config(self, data):
        self.log.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
        ftools.append_file(self.testinc_path, data)

        custommachine = os.getenv('CUSTOMMACHINE')
        if custommachine and 'MACHINE' in data:
            machine = get_bb_var('MACHINE')
            self.log.warning('MACHINE overridden: %s' % machine)
Пример #4
0
    def append_config(self, data):
        """Append to <builddir>/conf/selftest.inc"""
        self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
        ftools.append_file(self.testinc_path, data)

        if self.tc.custommachine and 'MACHINE' in data:
            machine = get_bb_var('MACHINE')
            self.logger.warning('MACHINE overridden: %s' % machine)
Пример #5
0
    def append_config(self, data):
        """Append to <builddir>/conf/selftest.inc"""
        self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
        ftools.append_file(self.testinc_path, data)

        if self.tc.custommachine and 'MACHINE' in data:
            machine = get_bb_var('MACHINE')
            self.logger.warning('MACHINE overridden: %s' % machine)
Пример #6
0
    def append_config(self, data):
        self.log.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
        ftools.append_file(self.testinc_path, data)

        custommachine = os.getenv('CUSTOMMACHINE')
        if custommachine and 'MACHINE' in data:
            machine = get_bb_var('MACHINE')
            self.log.warning('MACHINE overridden: %s' % machine)
Пример #7
0
    def test_layer_appends(self):
        corebase = get_bb_var("COREBASE")

        for l in ["0", "1", "2"]:
            layer = os.path.join(corebase, "meta-layertest" + l)
            self.assertFalse(os.path.exists(layer))
            os.mkdir(layer)
            os.mkdir(layer + "/conf")
            with open(layer + "/conf/layer.conf", "w") as f:
                f.write(self.layerconf.replace("INT", l))
            os.mkdir(layer + "/recipes-test")
            if l == "0":
                with open(layer + "/recipes-test/layerappendtest.bb",
                          "w") as f:
                    f.write(self.recipe)
            elif l == "1":
                with open(layer + "/recipes-test/layerappendtest.bbappend",
                          "w") as f:
                    f.write(self.append)
                os.mkdir(layer + "/recipes-test/layerappendtest")
                with open(
                        layer + "/recipes-test/layerappendtest/appendtest.txt",
                        "w") as f:
                    f.write("Layer 1 test")
            elif l == "2":
                with open(layer + "/recipes-test/layerappendtest.bbappend",
                          "w") as f:
                    f.write(self.append2)
                os.mkdir(layer + "/recipes-test/layerappendtest")
                with open(
                        layer + "/recipes-test/layerappendtest/appendtest.txt",
                        "w") as f:
                    f.write("Layer 2 test")
            self.track_for_cleanup(layer)

        self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(
            corebase)
        ftools.append_file(self.builddir + "/conf/bblayers.conf",
                           self.layerappend)
        stagingdir = get_bb_var("SYSROOT_DESTDIR", "layerappendtest")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 2 test")
        os.remove(
            corebase +
            "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 1 test")
        with open(
                corebase +
                "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt",
                "w") as f:
            f.write("Layer 2 test")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 2 test")
Пример #8
0
 def test_non_gplv3(self):
     data = 'INCOMPATIBLE_LICENSE = "GPLv3"'
     conf = os.path.join(self.builddir, 'conf/local.conf')
     ftools.append_file(conf ,data)
     self.addCleanup(ftools.remove_from_file, conf ,data)
     result = bitbake('readline', ignore_status=True)
     self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output))
     self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3')))
     self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2')))
Пример #9
0
 def test_non_gplv3(self):
     data = 'INCOMPATIBLE_LICENSE = "GPLv3"'
     conf = os.path.join(self.builddir, 'conf/local.conf')
     ftools.append_file(conf ,data)
     result = bitbake('readline', ignore_status=True)
     self.assertEqual(result.status, 0)
     self.assertFalse(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv3')))
     self.assertTrue(os.path.isfile(os.path.join(self.builddir, 'tmp/deploy/licenses/readline/generic_GPLv2')))
     ftools.remove_from_file(conf ,data)
Пример #10
0
 def test_non_gplv3(self):
     data = 'INCOMPATIBLE_LICENSE = "GPLv3"'
     conf = os.path.join(self.builddir, 'conf/local.conf')
     ftools.append_file(conf ,data)
     self.addCleanup(ftools.remove_from_file, conf ,data)
     result = bitbake('readline', ignore_status=True)
     self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output))
     lic_dir = get_bb_var('LICENSE_DIRECTORY')
     self.assertFalse(os.path.isfile(os.path.join(lic_dir, 'readline/generic_GPLv3')))
     self.assertTrue(os.path.isfile(os.path.join(lic_dir, 'readline/generic_GPLv2')))
Пример #11
0
    def add_include(cls):
        if "#include added by oe-selftest" \
            not in ftools.read_file(os.path.join(cls.builddir, "conf/local.conf")):
                cls.logger.info("Adding: \"include selftest.inc\" in %s" % os.path.join(cls.builddir, "conf/local.conf"))
                ftools.append_file(os.path.join(cls.builddir, "conf/local.conf"), \
                        "\n#include added by oe-selftest\ninclude machine.inc\ninclude selftest.inc")

        if "#include added by oe-selftest" \
            not in ftools.read_file(os.path.join(cls.builddir, "conf/bblayers.conf")):
                cls.logger.info("Adding: \"include bblayers.inc\" in bblayers.conf")
                ftools.append_file(os.path.join(cls.builddir, "conf/bblayers.conf"), \
                        "\n#include added by oe-selftest\ninclude bblayers.inc")
Пример #12
0
    def add_include(cls):
        if "#include added by oe-selftest" \
            not in ftools.read_file(os.path.join(cls.builddir, "conf/local.conf")):
            cls.logger.info("Adding: \"include selftest.inc\" in %s" %
                            os.path.join(cls.builddir, "conf/local.conf"))
            ftools.append_file(os.path.join(cls.builddir, "conf/local.conf"), \
                    "\n#include added by oe-selftest\ninclude machine.inc\ninclude selftest.inc")

        if "#include added by oe-selftest" \
            not in ftools.read_file(os.path.join(cls.builddir, "conf/bblayers.conf")):
            cls.logger.info(
                "Adding: \"include bblayers.inc\" in bblayers.conf")
            ftools.append_file(os.path.join(cls.builddir, "conf/bblayers.conf"), \
                    "\n#include added by oe-selftest\ninclude bblayers.inc")
Пример #13
0
 def configure_builddir(self, builddir):
     os.mkdir(builddir)
     self.track_for_cleanup(builddir)
     os.mkdir(os.path.join(builddir, 'conf'))
     shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'), os.path.join(builddir, 'conf/local.conf'))
     config = {}
     config['default_sstate_dir'] = "SSTATE_DIR ?= \"${TOPDIR}/sstate-cache\""
     config['null_sstate_mirrors'] = "SSTATE_MIRRORS = \"\""
     config['default_tmp_dir'] = "TMPDIR = \"${TOPDIR}/tmp\""
     for key in config:
         ftools.append_file(os.path.join(builddir, 'conf/selftest.inc'), config[key])
     shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/bblayers.conf'), os.path.join(builddir, 'conf/bblayers.conf'))
     try:
         shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/auto.conf'), os.path.join(builddir, 'conf/auto.conf'))
     except:
         pass
Пример #14
0
    def test_layer_appends(self):
        corebase = get_bb_var("COREBASE")

        for l in ["0", "1", "2"]:
            layer = os.path.join(corebase, "meta-layertest" + l)
            self.assertFalse(os.path.exists(layer))
            os.mkdir(layer)
            os.mkdir(layer + "/conf")
            with open(layer + "/conf/layer.conf", "w") as f:
                f.write(self.layerconf.replace("INT", l))
            os.mkdir(layer + "/recipes-test")
            if l == "0":
                with open(layer + "/recipes-test/layerappendtest.bb", "w") as f:
                    f.write(self.recipe)
            elif l == "1":
                with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
                    f.write(self.append)
                os.mkdir(layer + "/recipes-test/layerappendtest")
                with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
                    f.write("Layer 1 test")
            elif l == "2":
                with open(layer + "/recipes-test/layerappendtest.bbappend", "w") as f:
                    f.write(self.append2)
                os.mkdir(layer + "/recipes-test/layerappendtest")
                with open(layer + "/recipes-test/layerappendtest/appendtest.txt", "w") as f:
                    f.write("Layer 2 test")
            self.track_for_cleanup(layer)

        self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase)
        ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend)
        stagingdir = get_bb_var("SYSROOT_DESTDIR", "layerappendtest")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 2 test")
        os.remove(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 1 test")
        with open(corebase + "/meta-layertest2/recipes-test/layerappendtest/appendtest.txt", "w") as f:
            f.write("Layer 2 test")
        bitbake("layerappendtest")
        data = ftools.read_file(stagingdir + "/appendtest.txt")
        self.assertEqual(data, "Layer 2 test")
Пример #15
0
    def test_force_task_1(self):
        # test 1 from bug 5875
        test_recipe = 'zlib'
        test_data = "Microsoft Made No Profit From Anyone's Zunes Yo"
        image_dir = get_bb_var('D', test_recipe)
        pkgsplit_dir = get_bb_var('PKGDEST', test_recipe)
        man_dir = get_bb_var('mandir', test_recipe)

        bitbake('-c cleansstate %s' % test_recipe)
        bitbake(test_recipe)
        self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)

        man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3')
        ftools.append_file(man_file, test_data)
        bitbake('-c package -f %s' % test_recipe)

        man_split_file = os.path.join(pkgsplit_dir, 'zlib-doc' + man_dir, 'man3/zlib.3')
        man_split_content = ftools.read_file(man_split_file)
        self.assertIn(test_data, man_split_content, 'The man file has not changed in packages-split.')

        ret = bitbake(test_recipe)
        self.assertIn('task do_package_write_rpm:', ret.output, 'Task do_package_write_rpm did not re-executed.')
 def configure_builddir(self, builddir):
     os.mkdir(builddir)
     self.track_for_cleanup(builddir)
     os.mkdir(os.path.join(builddir, 'conf'))
     shutil.copyfile(
         os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'),
         os.path.join(builddir, 'conf/local.conf'))
     config = {}
     config[
         'default_sstate_dir'] = "SSTATE_DIR ?= \"${TOPDIR}/sstate-cache\""
     config['null_sstate_mirrors'] = "SSTATE_MIRRORS = \"\""
     config['default_tmp_dir'] = "TMPDIR = \"${TOPDIR}/tmp\""
     for key in config:
         ftools.append_file(os.path.join(builddir, 'conf/selftest.inc'),
                            config[key])
     shutil.copyfile(
         os.path.join(os.environ.get('BUILDDIR'), 'conf/bblayers.conf'),
         os.path.join(builddir, 'conf/bblayers.conf'))
     try:
         shutil.copyfile(
             os.path.join(os.environ.get('BUILDDIR'), 'conf/auto.conf'),
             os.path.join(builddir, 'conf/auto.conf'))
     except:
         pass
Пример #17
0
 def append_bblayers_config(self, data):
     self.log.debug("Appending to: %s\n%s\n" % (self.testinc_bblayers_path, data))
     ftools.append_file(self.testinc_bblayers_path, data)
Пример #18
0
 def append_recipeinc(self, recipe, data):
     """Append data to meta-selftest/recipes-test/<recipe>/test_recipe.inc"""
     inc_file = self.recipeinc(recipe)
     self.logger.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)
     return inc_file
Пример #19
0
 def append_bblayers_config(self, data):
     """Append to <builddir>/conf/bblayers.inc"""
     self.logger.debug("Appending to: %s\n%s\n" %
                       (self.testinc_bblayers_path, data))
     ftools.append_file(self.testinc_bblayers_path, data)
Пример #20
0
 def append_recipeinc(self, recipe, data):
     """Append data to meta-selftest/recipes-test/<recipe>/test_recipe.inc"""
     inc_file = self.recipeinc(recipe)
     self.logger.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)
     return inc_file
Пример #21
0
 def append_bblayers_config(self, data):
     """Append to <builddir>/conf/bblayers.inc"""
     self.logger.debug("Appending to: %s\n%s\n" % (self.testinc_bblayers_path, data))
     ftools.append_file(self.testinc_bblayers_path, data)
Пример #22
0
 def append_recipeinc(self, recipe, data):
     inc_file = os.path.join(self.testlayer_path, 'recipes-test', recipe, 'test_recipe.inc')
     self.log.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)
Пример #23
0
 def append_config(self, data):
     self.log.debug("Appending to: %s\n%s\n" % (self.testinc_path, data))
     ftools.append_file(self.testinc_path, data)
Пример #24
0
 def append_recipeinc(self, recipe, data):
     """Append data to meta-sefltest/recipes-test/<recipe>/test_recipe.inc"""
     inc_file = os.path.join(self.testlayer_path, 'recipes-test', recipe, 'test_recipe.inc')
     self.logger.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)
Пример #25
0
 def append_recipeinc(self, recipe, data):
     inc_file = os.path.join(self.testlayer_path, 'recipes-test', recipe, 'test_recipe.inc')
     self.log.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)
Пример #26
0
 def append_recipeinc(self, recipe, data):
     """Append data to meta-sefltest/recipes-test/<recipe>/test_recipe.inc"""
     inc_file = os.path.join(self.testlayer_path, 'recipes-test', recipe,
                             'test_recipe.inc')
     self.logger.debug("Appending to: %s\n%s\n" % (inc_file, data))
     ftools.append_file(inc_file, data)