From 82feb19ee1825c2dcdb9bf75c4b51408865e4f98 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 23 May 2024 10:50:10 +0200 Subject: [PATCH] make the chroot_to_dist method more generic this means we do not have to add entries for new versions, just for new distributions or families --- theforeman.org/pipelines/lib/copr.groovy | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/theforeman.org/pipelines/lib/copr.groovy b/theforeman.org/pipelines/lib/copr.groovy index 5bf38469..1c30c843 100644 --- a/theforeman.org/pipelines/lib/copr.groovy +++ b/theforeman.org/pipelines/lib/copr.groovy @@ -40,15 +40,11 @@ def copr_repos(package_name) { } def convert_to_dist(chroot) { - if(chroot == 'rhel-9-x86_64') { - return 'el9' - } else if(chroot == 'rhel-8-x86_64') { - return 'el8' - } else if(chroot == 'rhel-7-x86_64') { - return 'el7' - } else if(chroot == 'opensuse-leap-15.5-x86_64') { - return 'leap155' - } else { - return null - } + def family_map = ['rhel': 'el', 'centos-stream': 'el', 'opensuse-leap': 'leap'] + + chroot_parts = chroot.split('-') + os = chroot_parts[0..-3].join('-') + version = chroot_parts[-2].replace('.', '') + + return "${family_map[os]}${version}" }