[PATCH koji] kojid: Compress livecd volume ID (bug 1145264)

Cole Robinson crobinso at redhat.com
Thu Oct 30 17:59:34 UTC 2014


(Note, this patch is untested as I'm unsure how to test koji.)

Currently the livecd volume ID is just set to the isoname, shrunk to
32 characters long. With the new longer iso names containing server,
workstation, etc., the resulting volume ID cuts off the Fedora version
number.

Volume IDs are used by libosinfo for distro detection, and by extension
gnome-boxes and virt-manager. But this doesn't work without the actual
version number available.

Compress the volume ID using the same logic that pungi uses. For
workstation livecds this should change volume ID from

  Fedora-Live-Workstation-x86_64-2

to

  Fedora-Live-WS-x86_64-21...

https://bugzilla.redhat.com/show_bug.cgi?id=1145264
---
 builder/kojid | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/builder/kojid b/builder/kojid
index 8b1ea27..9f5758b 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -2673,6 +2673,26 @@ class LiveCDTask(ImageTask):
 
         return manifest
 
+    def _shortenVolID(self, name, version, release):
+        # Based on code from pungi
+        subsitutions = {
+            'Workstation': 'WS',
+            'Server': 'S',
+            'Cloud': 'C',
+            'Alpha': 'A',
+            'Beta': 'B',
+            'TC': 'T',
+        }
+
+        for k, v in subsitutions.iteritems():
+            if name.contains(k):
+                name.replace(k, v)
+            if version.contains(k):
+                version.replace(k, v)
+
+        volid = "%s-%s-%s" % (name, version, release)
+        return volid[:32]
+
     def handler(self, name, version, release, arch, target_info, build_tag, repo_info, ksfile, opts=None):
 
         if opts == None:
@@ -2689,10 +2709,8 @@ class LiveCDTask(ImageTask):
         livecd_log = '/tmp/livecd.log'
         cmd = ['/usr/bin/livecd-creator', '-c', kskoji, '-d', '-v',
                '--logfile', livecd_log, '--cache', cachedir]
-        # we set the fs label to the same as the isoname if it exists, 
-        # taking at most 32 characters
         isoname = '%s-%s-%s' % (name, version, release)
-        cmd.extend(['-f', isoname[:32]])
+        cmd.extend(['-f', self._shortenVolID(name, version, release)])
 
         # Run livecd-creator
         rv = broot.mock(['--cwd', '/tmp', '--chroot', '--'] + cmd)
-- 
2.1.0



More information about the buildsys mailing list