From 68ae910dd6e79aa8e8d95650278fec1263fc3af1 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Feb 24 2018 00:12:05 +0000 Subject: Update the volume ID substitutions list and application Some newer subvariants / loadouts, and 'Rawhide' for some reason, were missing from the substitution list. This updates it, alphabetizes it, adjusts the indentation to match how it is in pungi-fedora for ease of comparison, and also tweaks the way the list is applied to match https://pagure.io/pungi/pull-request/857 , the correct way to ensure longer substitutions are applied before shorter ones. Note 'Alpha' and 'TC' are removed because we don't do Alphas or TCs any more. Signed-off-by: Adam Williamson --- diff --git a/builder/kojid b/builder/kojid index 26fbc6e..2d700c8 100755 --- a/builder/kojid +++ b/builder/kojid @@ -2828,25 +2828,34 @@ class ImageTask(BaseTaskHandler): return hdrlist def _shortenVolID(self, name, version, release): - # Based on code from pungi + # Duplicated with pungi-fedora fedora.conf substitutions = { - 'MATE_Compiz': 'MATE', - 'Security': 'Sec', - 'Electronic_Lab': 'Elec', - 'Robotics': 'Robo', - 'Scientific_KDE': 'SciK', - 'Design_suite': 'Dsgn', - 'Games': 'Game', - 'Jam_KDE': 'Jam', - 'Workstation': 'WS', - 'Server': 'S', - 'Cloud': 'C', - 'Alpha': 'A', - 'Beta': 'B', - 'TC': 'T', + 'Beta': 'B', + 'Rawhide': 'rawh', + 'Astronomy_KDE': 'AstK', + 'Atomic': 'AH', + 'Cinnamon': 'Cinn', + 'Cloud': 'C', + 'Design_suite': 'Dsgn', + 'Electronic_Lab': 'Elec', + 'Everything': 'E', + 'Games': 'Game', + 'Images': 'img', + 'Jam_KDE': 'Jam', + 'MATE_Compiz': 'MATE', + # Note https://pagure.io/pungi-fedora/issue/533 + 'Python-Classroom': 'Clss', + 'Python_Classroom': 'Clss', + 'Robotics': 'Robo', + 'Scientific_KDE': 'SciK', + 'Security': 'Sec', + 'Server': 'S', + 'Workstation': 'WS', + 'WorkstationOstree': 'WS', } - for k, v in substitutions.iteritems(): + # Duplicated with pungi/util.py _apply_substitutions + for k, v in sorted(substitutions.items(), key=lambda x: len(x[0]), reverse=True): if k in name: name = name.replace(k, v) if k in version: @@ -2855,6 +2864,8 @@ class ImageTask(BaseTaskHandler): release = release.replace(k, v) volid = "%s-%s-%s" % (name, version, release) + # Difference: pungi treats result more than 32 characters long as + # fatal and raises an error return volid[:32]