Package: python-debian
Version: 0.1.9
Severity: low
Tags: patch

Currently, deb822 writes multivalued fields as 'checksum size filename', whereas
the official Release files use a specific width for the size:

The official release file:
 d8544bb5a8a8460c2f6c5576c073066a 22586597 main/binary-amd64/Packages
 ceda0c78baeec155fc6564737622d023       82 main/binary-amd64/Release

The same created by deb822:
 d8544bb5a8a8460c2f6c5576c073066a 22586597 main/binary-amd64/Packages
 ceda0c78baeec155fc6564737622d023 82 main/binary-amd64/Release

This makes the file a bit unreadable. To fix this, you just need to get the
len() of the str(size) of every file, take the longest one and write something
like "%8d" (if 8 is the longest size). This would produce more readable release
files.

One should also be able to specify int() values as size. Currently deb822 only
accepts strings, but a size is normally an integer value. The attached patch
also fixes that issue.

-- 
Julian Andres Klode, Fellow of the Free Software Foundation Europe
                     Debian Maintainer | Developer | Ubuntu Member

try Debian: http://www.debian.org/ | my site: http://jak-linux.org/
        jabber: [EMAIL PROTECTED] | IRC: juliank (FreeNode, OFTC)
            languages:     German  | English
--- deb822.py	2008-03-23 00:08:32.000000000 +0100
+++ deb822.py	2008-03-29 17:00:09.000000000 +0100
@@ -448,8 +448,11 @@
                     array = self[key]
 
                 order = self._multivalued_fields[keyl]
+
+                maxlen = sorted([len(str(item.get('size', '0'))) for item in array])[-1]
                 for item in array:
-                    fd.write(" " + " ".join([item[x] for x in order]))
+                    for x in order:
+                        fd.write((x == 'size' and " %" + str(maxlen) +"s" or " %s") % item[x])
                     fd.write("\n")
         if return_string:
             return fd.getvalue()

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to