mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
package.bbclass: hash equivalency and pr service
When the PR service is enabled a number of small changes may happen to variables. In the do_package step a call to package_get_auto_pr will end up setting PRAUTO and modifying PKGV (if AUTOINC is there). PRAUTO is then used by EXTENDPRAUTO, which is then used to generate PKGR. Since this behavior typically happens BEFORE the BB_UNIHASH is calculated for do_package, we need a way to defer the expansion until after we have the unihash value. Writing out the pkgdata files w/o AUTOPR and PKGV (AUTOINC) expanded to placeholder values is the easiest way to deal with this. All other variables are expanded as expected. In the next task, typically do_packagedata, we will then use the UNIHASH from the do_package to get the PR (AUTOPR) as well as generate the AUTOINC replacement value (now PRSERV_PV_AUTOINC). The do_packagedata then translates the placeholders to the final values when copying the data from pkgdata to pkgdata-pdata-input. Also update the prservice test case. With unihash, just changing the do_package (via a _append) will not change the PR. So write the date to a specific file that is incorporated into the unihash to ensure it is always different for the test. Various assert messages were also updated to make it easier to figure out where/why a problem occured. (From OE-Core rev: 2e32f37b0e4abc438c8f60e673cd18a5cc110768) Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9189aaedc7
commit
39c1accf90
@@ -23,7 +23,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name)
|
||||
package_data = ftools.read_file(package_data_file)
|
||||
find_pr = re.search(r"PKGR: r[0-9]+\.([0-9]+)", package_data)
|
||||
self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file)
|
||||
self.assertTrue(find_pr, "No PKG revision found via regex 'PKGR: r[0-9]+\.([0-9]+)' in %s" % package_data_file)
|
||||
return int(find_pr.group(1))
|
||||
|
||||
def get_task_stamp(self, package_name, recipe_task):
|
||||
@@ -40,7 +40,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
return str(stamps[0])
|
||||
|
||||
def increment_package_pr(self, package_name):
|
||||
inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\"\n}" % datetime.datetime.now()
|
||||
inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\" > ${PKGDESTWORK}/${PN}.datestamp\n}" % datetime.datetime.now()
|
||||
self.write_recipeinc(package_name, inc_data)
|
||||
res = bitbake(package_name, ignore_status=True)
|
||||
self.delete_recipeinc(package_name)
|
||||
@@ -63,7 +63,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
pr_2 = self.get_pr_version(package_name)
|
||||
stamp_2 = self.get_task_stamp(package_name, track_task)
|
||||
|
||||
self.assertTrue(pr_2 - pr_1 == 1, "Step between pkg revisions is not 1 (was %s - %s)" % (pr_2, pr_1))
|
||||
self.assertTrue(pr_2 - pr_1 == 1, "New PR %s did not increment as expected (from %s), difference should be 1" % (pr_2, pr_1))
|
||||
self.assertTrue(stamp_1 != stamp_2, "Different pkg rev. but same stamp: %s" % stamp_1)
|
||||
|
||||
def run_test_pr_export_import(self, package_name, replace_current_db=True):
|
||||
@@ -89,7 +89,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
self.increment_package_pr(package_name)
|
||||
pr_2 = self.get_pr_version(package_name)
|
||||
|
||||
self.assertTrue(pr_2 - pr_1 == 1, "Step between pkg revisions is not 1 (was %s - %s)" % (pr_2, pr_1))
|
||||
self.assertTrue(pr_2 - pr_1 == 1, "New PR %s did not increment as expected (from %s), difference should be 1" % (pr_2, pr_1))
|
||||
|
||||
def test_import_export_replace_db(self):
|
||||
self.run_test_pr_export_import('m4')
|
||||
|
||||
Reference in New Issue
Block a user