diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-01-05 15:14:35 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-01-06 22:32:22 +0000 |
commit | 3ab6e17ffeabc7c82d35ab2c01a85b6286ddfa34 (patch) | |
tree | 5e0d3a2ed397a9429fd70c5447c5c2f53b3a0758 /meta/lib | |
parent | ccdc770fcbc619f08875fb110f6f41eecbff0e1b (diff) | |
download | poky-3ab6e17ffeabc7c82d35ab2c01a85b6286ddfa34.tar.gz |
bitbake.conf: Set AUTOREV to have a vardepvalue
If you have a recipe which does not include SRCPV in PV but does set
SRCREV = "${AUTOREV}" and you run do_fetch, then change the repo to a
new commit then run do_unpack, do_unpack will fail since the new commit
doesn't exist in the repo that was fetched.
The problem is the revision chosen is not represented in the do_fetch
task hash. It if were, the fetch would rerun first and the commit would be
present. It works when PV includes SRCPV since that does contain the chosen
commit from the AUTOREV.
The solution is to include the SRCPV value into the representation of AUTOREV
used for checksum calculation purposes.
Add a selftest for this issue.
(From OE-Core rev: 7b8ee9285a197784d51e339f1603240f49435846)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/sstatetests.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 47900886a3..6735694263 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py | |||
@@ -2,15 +2,51 @@ import os | |||
2 | import shutil | 2 | import shutil |
3 | import glob | 3 | import glob |
4 | import subprocess | 4 | import subprocess |
5 | import tempfile | ||
5 | 6 | ||
6 | from oeqa.selftest.case import OESelftestTestCase | 7 | from oeqa.selftest.case import OESelftestTestCase |
7 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer | 8 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer, create_temp_layer |
8 | from oeqa.selftest.cases.sstate import SStateBase | 9 | from oeqa.selftest.cases.sstate import SStateBase |
9 | from oeqa.core.decorator.oeid import OETestID | 10 | from oeqa.core.decorator.oeid import OETestID |
10 | 11 | ||
11 | import bb.siggen | 12 | import bb.siggen |
12 | 13 | ||
13 | class SStateTests(SStateBase): | 14 | class SStateTests(SStateBase): |
15 | def test_autorev_sstate_works(self): | ||
16 | # Test that a git repository which changes is correctly handled by SRCREV = ${AUTOREV} | ||
17 | # when PV does not contain SRCPV | ||
18 | |||
19 | tempdir = tempfile.mkdtemp(prefix='oeqa') | ||
20 | self.track_for_cleanup(tempdir) | ||
21 | create_temp_layer(tempdir, 'selftestrecipetool') | ||
22 | self.add_command_to_tearDown('bitbake-layers remove-layer %s' % tempdir) | ||
23 | runCmd('bitbake-layers add-layer %s' % tempdir) | ||
24 | |||
25 | # Use dbus-wait as a local git repo we can add a commit between two builds in | ||
26 | pn = 'dbus-wait' | ||
27 | srcrev = '6cc6077a36fe2648a5f993fe7c16c9632f946517' | ||
28 | url = 'git://git.yoctoproject.org/dbus-wait' | ||
29 | result = runCmd('git clone %s noname' % url, cwd=tempdir) | ||
30 | srcdir = os.path.join(tempdir, 'noname') | ||
31 | result = runCmd('git reset --hard %s' % srcrev, cwd=srcdir) | ||
32 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure.ac')), 'Unable to find configure script in source directory') | ||
33 | |||
34 | recipefile = os.path.join(tempdir, "recipes-test", "dbus-wait-test", 'dbus-wait-test_git.bb') | ||
35 | os.makedirs(os.path.dirname(recipefile)) | ||
36 | srcuri = 'git://' + srcdir + ';protocol=file' | ||
37 | result = runCmd(['recipetool', 'create', '-o', recipefile, srcuri]) | ||
38 | self.assertTrue(os.path.isfile(recipefile), 'recipetool did not create recipe file; output:\n%s' % result.output) | ||
39 | |||
40 | with open(recipefile, 'a') as f: | ||
41 | f.write('SRCREV = "${AUTOREV}"\n') | ||
42 | f.write('PV = "1.0"\n') | ||
43 | |||
44 | bitbake("dbus-wait-test -c fetch") | ||
45 | with open(os.path.join(srcdir, "bar.txt"), "w") as f: | ||
46 | f.write("foo") | ||
47 | result = runCmd('git add bar.txt; git commit -asm "add bar"', cwd=srcdir) | ||
48 | bitbake("dbus-wait-test -c unpack") | ||
49 | |||
14 | 50 | ||
15 | # Test sstate files creation and their location | 51 | # Test sstate files creation and their location |
16 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): | 52 | def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): |