From 21ecfa8538780eef347535164f17010727735e66 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 11 May 2020 16:05:47 -0700 Subject: [PATCH] os_release: blow up on RC compose with prerelease fedora-release Signed-off-by: Adam Williamson --- tests/os_release.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/os_release.pm b/tests/os_release.pm index 3f5fcba5..ab1a7b3d 100644 --- a/tests/os_release.pm +++ b/tests/os_release.pm @@ -91,8 +91,17 @@ sub run { # If fedora-release-common release starts with a 0, we'll have # "Prerelease" in varstr my $reltag = script_output 'rpm -q fedora-release-common --qf "%{RELEASE}\n"'; - $varstr .= " Prerelease" if (index($reltag, "0.") == 0); - + if (index($reltag, "0.") == 0) { + $varstr .= " Prerelease"; + # ...however, we shouldn't just wave this through if we're + # an RC candidate or update compose, those should never be + # done with a 0.x fedora-release-common. so let's blow up + # here if so + my $label = get_var("LABEL"); + if ($label =~ /^(RC|Update)-/) { + die "RC candidate or update compose should not have 0.x versioned fedora-release!"; + } + } my $version = "$version_id ($varstr)"; # for canned variants, we need to form a different string here by using # the above created cannedtag. See earlier comment