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

Re: New XML-based package description file format?



On Tue, May 30, 2000 at 09:35:51PM +1000, Anthony Towns wrote:
> If all the old formats stay, why not just write the translator?

On reflection, that mail was probably a bit too negative. But the above
point still stands. Here's a first draft, fwiw:

perl -e '$in = undef; while(<>) { chomp; if (m/^\s+/) { print "\n"; print $_; next; } if ($match) { print "</$match>\n"; $match = undef; } if (m/^$/) { print "</$in>\n" if ($in); $in = 0; next } if (m/^([^:]+):\s*(.*)$/) { if (!$in) { print "<$1>\n"; $in=$1; } print "    <$1>$2"; $match=$1; $inlong = 0; } }; if ($match) { print "</$match>\n"; } if ($in) { print "</$in>\n"; }'

Gives output like:

<Package>
    <Package>webmagick</Package>
    <Version>1.46-4</Version>
    <Priority>optional</Priority>
    <Section>web</Section>
    <Maintainer>Ryuichi Arafune <arafune@debian.org></Maintainer>
    <Depends>perl5, imagemagick, perlmagick, gs</Depends>
    <Architecture>all</Architecture>
    <Filename>dists/testing/main/binary-i386/web/webmagick_1.46-4.deb</Filename>
    <Size>160720</Size>
    <MD5sum>5816bc267fc476daef5776ef1532e807</MD5sum>
    <Description>create gallery thumbnails for website
 WebMagick provides a means of easily putting image collections on the
 Web. It recurses through directory trees, building HTML pages and
 imagemap (GIF or JPEG) files to allow the user to navigate through
 collections of thumbnail images (somewhat similar to 'xv') and select
 the images to view with a mouse click.</Description>
    <installed-size>411</installed-size>
</Package>

It works for both Packages and Sources files, but calls the paragraphs in
both "Package" which is a little unfortunate.

Cheers,
aj

-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG encrypted mail preferred.

  ``We reject: kings, presidents, and voting.
                 We believe in: rough consensus and working code.''
                                      -- Dave Clark

Attachment: pgprNeLzjSfd3.pgp
Description: PGP signature


Reply to: