simplify COPR handling to be more like side tags

we can predict the repo URL, so let's just...do that.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2024-05-02 10:44:44 -07:00
parent c6ba3226b6
commit 1df2cd8b38
5 changed files with 12 additions and 68 deletions

View File

@ -562,7 +562,7 @@ sub setup_repos {
my %args = (
# workarounds only
waonly => 0,
# release to get workarounds and setup COPR for
# release to get workarounds for
version => get_var("VERSION"),
# whether to write repo configs
configs => 1,
@ -571,20 +571,8 @@ sub setup_repos {
my $arch = get_var("ARCH");
my $tag = get_var("TAG");
my $copr = get_var("COPR");
# write the tag repo config if appropriate
assert_script_run 'printf "[openqa-testtag]\nname=openqa-testtag\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "$tag/latest/$arch" . '/\ncost=2000\nenabled=1\ngpgcheck=0\n" > /etc/yum.repos.d/openqa-testtag.repo' if ($tag && !$args{waonly});
# enable the COPR if appropriate
if ($copr) {
# use the target release version (for upgrade tests)
my $relver = get_var("VERSION");
$relver = "rawhide" if ($relver eq get_var("RAWREL"));
assert_script_run 'dnf -y install "dnf-command(copr)"', 180;
assert_script_run "dnf -y copr enable $copr fedora-${relver}-${arch}";
# set a high priority for the COPR repo in case any of its
# packages are behind the main repo
my $coprrepo = script_output "grep -l $copr /etc/yum.repos.d/_copr*";
assert_script_run 'echo "priority=1" >> ' . $coprrepo;
}
# write a side tag or COPR repo config if appropriate
assert_script_run 'printf "[openqa-testtag]\nname=openqa-testtag\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '/\ncost=2000\nenabled=1\ngpgcheck=0\n" > /etc/yum.repos.d/openqa-testtag.repo' if (($tag || $copr) && !$args{waonly});
my @was = get_workarounds($args{version});
# bail if there are no workarounds:
# * if we're in workarounds-only mode
@ -650,14 +638,10 @@ sub _repo_setup_updates {
my $tag = get_var("TAG");
my $copr = get_var("COPR");
# Check if we already ran, bail if so
if ($tag) {
if ($tag || $copr) {
# for TAG case, check for the repo file
return unless script_run "test -f /etc/yum.repos.d/openqa-testtag.repo";
}
elsif ($copr) {
# ditto, but the naming is awkward, this is easiest
return unless script_run "grep $copr /etc/yum.repos.d/_copr*";
}
else {
# otherwise, run unless both the update repo and the update
# package list are present already
@ -847,7 +831,6 @@ sub gnome_initial_setup {
@_
);
my $relnum = get_release_number;
my $advortask = get_var("ADVISORY_OR_TASK");
# note: when 'language' is "skipped", it's turned into a 'welcome'
# page, which has a "Start Setup" button, not a "Next" button

View File

@ -7,9 +7,6 @@ sub run {
my $self = shift;
my $version = get_var("VERSION");
my $advortask = get_var("ADVISORY_OR_TASK");
# sanitize a bit for COPR case
$advortask =~ s/\//_/;
$advortask =~ s/@//;
# we didn't use kiwi before F40, and I don't really want to write
# an imgfac test for a release that will be dead in 6 months
# FIXME drop when F39 is EOL
@ -60,8 +57,7 @@ sub run {
my $repos = 'config_opts[\'dnf.conf\'] += \"\"\"\n';
# add the update, tag or COPR repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag || $copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag);
$repos .= script_output 'cat /etc/yum.repos.d/_copr*.repo' if ($copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag || $copr);
# and the workaround repo
$repos .= '\n[workarounds]\nname=Workarounds repo\nbaseurl=file:///mnt/workarounds_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($workarounds);
# also the buildroot repo, for Rawhide
@ -92,13 +88,7 @@ sub run {
}
# now add the side repo or tag repo to the appropriate repo XML
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"advisory\" sourcetype=\"baseurl\">\n <source path=\"file:///mnt/update_repo\"/>\n </repository>\n</image>\n" > ' . $repoxml unless ($tag || $copr);
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"openqa-testtag\" sourcetype=\"baseurl\">\n <source path=\"https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($tag);
if ($copr) {
my $coprurl = script_output 'grep baseurl /etc/yum.repos.d/_copr*.repo | cut -c 9-';
$coprurl =~ s/\$releasever/$mockver/;
$coprurl =~ s/\$basearch/$arch/;
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"openqa-copr\" sourcetype=\"baseurl\">\n <source path=\"' . $coprurl . '\"/>\n </repository>\n</image>\n" > ' . $repoxml;
}
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"openqa-testtag\" sourcetype=\"baseurl\">\n <source path=\"' . get_var("UPDATE_OR_TAG_REPO") . '\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($tag || $copr);
# and the workarounds repo
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"workarounds\" sourcetype=\"baseurl\">\n <source path=\"file:///mnt/workarounds_repo\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($workarounds);
# and the buildroot repo, for Rawhide

View File

@ -10,11 +10,7 @@ sub run {
my $rawrel = get_var("RAWREL");
my $repo = $version eq $rawrel ? "fedora-rawhide.repo" : "fedora.repo";
my $advortask = get_var("ADVISORY_OR_TASK");
# sanitize a bit for COPR case
$advortask =~ s/\//_/;
$advortask =~ s/@//;
my $arch = get_var("ARCH");
my $copr = get_var("COPR");
my $packages = "lorax";
$packages .= " hfsplus-tools" if ($arch eq "ppc64le");
assert_script_run "dnf -y install $packages", 120;
@ -32,11 +28,7 @@ sub run {
$cmd .= " --repo=/etc/yum.repos.d/workarounds.repo" if (get_workarounds);
$cmd .= " --repo=/etc/yum.repos.d/koji-rawhide.repo" if ($version eq $rawrel);
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless (get_var("TAG") || get_var("COPR"));
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if (get_var("TAG"));
if ($copr) {
my $coprrepo = script_output "grep -l $copr /etc/yum.repos.d/_copr*";
$cmd .= " --repo=${coprrepo}";
}
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if (get_var("TAG") || get_var("COPR"));
$cmd .= " ./results";
assert_script_run $cmd, 2400;
# good to have the log around for checks

View File

@ -24,9 +24,6 @@ sub run {
$mockver = $version;
}
my $advortask = get_var("ADVISORY_OR_TASK");
# sanitize a bit for COPR case
$advortask =~ s/\//_/;
$advortask =~ s/@//;
my $arch = get_var("ARCH");
my $subv = get_var("SUBVARIANT");
my $lcsubv = lc($subv);
@ -55,8 +52,7 @@ sub run {
my $repos = 'config_opts[\'dnf.conf\'] += \"\"\"\n';
# add the update, tag or COPR repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag || $copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag);
$repos .= script_output 'cat /etc/yum.repos.d/_copr*.repo' if ($copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '/\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag || $copr);
# and the workaround repo
$repos .= '\n[workarounds]\nname=Workarounds repo\nbaseurl=file:///mnt/workarounds_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($workarounds);
# also the buildroot repo, for Rawhide
@ -75,13 +71,7 @@ sub run {
assert_script_run "git checkout ${branch}";
# now add the side, tag or COPR repo to the appropriate repo ks
assert_script_run 'echo "repo --name=advisory --baseurl=file:///mnt/update_repo" >> ' . $repoks unless ($tag || $copr);
assert_script_run 'echo "repo --name=openqa-testtag --baseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '" >> ' . $repoks if ($tag);
if ($copr) {
my $coprurl = script_output 'grep baseurl /etc/yum.repos.d/_copr*.repo | cut -c 9-';
$coprurl =~ s/\$releasever/$mockver/;
$coprurl =~ s/\$basearch/$arch/;
assert_script_run 'echo "repo --name=openqa-copr --baseurl=' . ${coprurl} . '" >> ' . $repoks;
}
assert_script_run 'echo "repo --name=openqa-testtag --baseurl=' . get_var("UPDATE_OR_TAG_REPO") . '" >> ' . $repoks if ($tag || $copr);
# and the workarounds repo
assert_script_run 'echo "repo --name=workarounds --baseurl=file:///mnt/workarounds_repo" >> ' . $repoks if ($workarounds);
# and the buildroot repo, for Rawhide

View File

@ -17,9 +17,6 @@ sub run {
$branch = "f${version}";
}
my $advortask = get_var("ADVISORY_OR_TASK");
# sanitize a bit for COPR case
$advortask =~ s/\//_/;
$advortask =~ s/@//;
my $arch = get_var("ARCH");
my $subv = get_var("SUBVARIANT");
my $lcsubv = lc($subv);
@ -45,20 +42,13 @@ sub run {
assert_script_run 'cp /etc/yum.repos.d/workarounds.repo .' if ($workarounds);
assert_script_run 'cp /etc/yum.repos.d/koji-rawhide.repo .' if ($version eq $rawrel);
assert_script_run 'cp /etc/yum.repos.d/advisory.repo .' unless ($tag || $copr);
assert_script_run 'cp /etc/yum.repos.d/openqa-testtag.repo .' if ($tag);
assert_script_run 'cp /etc/yum.repos.d/_copr*.repo .' if ($copr);
assert_script_run 'cp /etc/yum.repos.d/openqa-testtag.repo .' if ($tag || $copr);
# and add them to the config file
my $repl = 'repos:';
$repl .= '\n - workarounds' if ($workarounds);
$repl .= '\n - koji-rawhide' if ($version eq $rawrel);
$repl .= '\n - advisory' unless ($tag || $copr);
$repl .= '\n - openqa-testtag' if ($tag);
if ($copr) {
# get the name of the repo out of the repo definition by
# taking the first line and stripping first and last chars
my $coprrepl = script_output 'head -1 /etc/yum.repos.d/_copr*.repo | sed -e "s/^.//" -e "s/.$//"';
$repl .= '\n - ' . $coprrepl;
}
$repl .= '\n - openqa-testtag' if ($tag || $copr);
# Up to Fedora 39, repo definitions are in the subvariant config...
assert_script_run 'sed -i -e "s,repos:,' . $repl . ',g" fedora-' . $lcsubv . '.yaml';
# From Fedora 40 onwards, they're in the common config. Let's just
@ -115,8 +105,7 @@ sub run {
$cmd .= " --repo=/etc/yum.repos.d/workarounds.repo" if ($workarounds);
$cmd .= " --repo=/etc/yum.repos.d/koji-rawhide.repo" if ($version eq $rawrel);
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless ($tag || $copr);
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if ($tag);
$cmd .= " --repo=/etc/yum.repos.d/_copr*.repo" if ($copr);
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if ($tag || $copr);
$cmd .= " ./results";
assert_script_run $cmd, 9000;
# good to have the log around for checks