[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#639663: [debian-policy] Please provide upgrading-checklist via web

Package: debian-policy
Severity: wishlist


It would be useful to have a copy of the HTML version of
upgrading-checklist somewhere on the web. This could, for example, be
linked from the PTS when some package's Standards-Version has to be

In #485085 the problem of the links from upgrading-checklist to the
policy has been discussed, but not solved. I've come up with a pair of
hacks that should do the trick (although they don't qualify as
"solution" at all). I'm attaching them in case you're interested.

You have to do something like that:

$ ./build_section_mapping.sh <
/usr/share/doc/debian-policy/policy-1.html > sect_map
$ ./patch_checklist.py <
/usr/share/doc/debian-policy/upgrading-checklist-1.html >

You'll probably want also want to change paths in patch_checklist.py.

Also, to usefully link upgrading-checklist from other services, it would
be helpful to have section anchors named with the relevant policy
version number instead of section number (otherwise some other hack like
build_section_mappings.sh should be used).

Thanks, Giovanni.
Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org

Attachment: build_section_mapping.sh
Description: Bourne shell script

# -*- coding: utf-8 -*-

import sys, re

POLICY_URL = 'file:///usr/share/doc/debian-policy/policy-1.html'
SECT_MAP_FILE = './sect_map'

dt_re = re.compile('^<dt>(.*)</dt>$')
dt_template = '<dt>%s</dt>\n'

sect_map = {}

def build_sect_map():
    with open(SECT_MAP_FILE) as sect_map_file:
        for line in sect_map_file:
            sect, anchor = line.strip().split(' ', 1)
            sect_map[sect] = anchor

def make_line(sect):
    if sect in sect_map:
        return '<a href="%s#%s">%s</a>' % (POLICY_URL, sect_map[sect], sect)
        return sect

def main():

    for line in sys.stdin:
        match = dt_re.match(line)
        if match is not None:
            line = dt_template % ', '.join([make_line(x.strip()) for x in match.group(1).split(',')])

if __name__ == '__main__':

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: