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 <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2018-02-23 15:51:37 -08:00 committed by Mike McLean
parent 45a5d3f99b
commit 72204b4f7f

View file

@ -2832,25 +2832,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:
@ -2859,6 +2868,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]