From: Alexis Lothoré <alexis.loth...@bootlin.com> send_qa_email currently fails when dealing with release version starting a new major, for example 5.0. This has been observed for example when trying to generate 5.0_M1.rc1
This specific versioning makes previous tag computation method fall through last branch which currently expects that the current release tag indeed exists (5.0_M1), which is true when checking regression reports a posteriori, but not in an autobuilder run (tag is added only when the release has been "validated") Fix tag computation for this case by getting previous release tag with git ls-remote, instead of relying on git describe with a possibly non-existing tag. While doing so, add a few tests about this specific case. Signed-off-by: Alexis Lothoré <alexis.loth...@bootlin.com> --- scripts/send_qa_email.py | 9 +++++++-- scripts/test_send_qa_email.py | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py index 232f360621fe..8422e4937102 100755 --- a/scripts/send_qa_email.py +++ b/scripts/send_qa_email.py @@ -42,10 +42,15 @@ def get_previous_tag(targetrepodir, version): # Process first milestone or release if not first in major release elif compareversionminor > 0: previousversion = compareversion[:-1] + [compareversion[-1] - 1] - # Otherwise : format it as tag (which must exist) and search previous tag + # Otherwise : compare against last release on previous major. This can + # not be computed: we need to retrieve the exact tag from remote else: comparetagstring = utils.get_tag_from_version(compareversion, comparemilestone) - return subprocess.check_output(["git", "describe", "--abbrev=0", comparetagstring + "^"], cwd=targetrepodir).decode('utf-8').strip() + previous_major = compareversion[0] - 1 + tags_list = subprocess.check_output(["git", "ls-remote", "--refs", "-t", "origin", f"refs/tags/yocto-{previous_major}*"], cwd=targetrepodir).decode('utf-8').strip() + # Get last tag from list, pick only the tag part, and remove the + # "refs/tags/" part + return tags_list.splitlines()[-1].split()[1].split('/')[-1] return utils.get_tag_from_version(previousversion, previousmilestone) diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py index 2dd946f32bf1..415d8cbbbccd 100755 --- a/scripts/test_send_qa_email.py +++ b/scripts/test_send_qa_email.py @@ -30,7 +30,10 @@ class TestVersion(unittest.TestCase): {"input": {"version": "4.1_M3.rc4"}, "expected": "4.1_M2"}, {"input": {"version": "4.1_M1.rc1"}, "expected": "yocto-4.0"}, {"input": {"version": "4.1_M1.rc4"}, "expected": "yocto-4.0"}, - {"input": {"version": "4.1.rc4"}, "expected": "yocto-4.0"} + {"input": {"version": "4.1.rc4"}, "expected": "yocto-4.0"}, + {"input": {"version": "yocto-5.0_M1.rc1"}, "expected": "yocto-4.3(\.\d)?"}, + {"input": {"version": "yocto-5.0_M1.rc2"}, "expected": "yocto-4.3(\.\d)?"}, + {"input": {"version": "yocto-5.0_M2.rc1"}, "expected": "5.0_M1"}, ] test_data_is_release_version = [ -- 2.42.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#61946): https://lists.yoctoproject.org/g/yocto/message/61946 Mute This Topic: https://lists.yoctoproject.org/mt/103224521/21656 Group Owner: yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-