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

Re: Output of dpkg-scanpackages as XML

On Wed, Jan 05, 2005 at 09:57:26PM +0100, Frank S. Thomas wrote:
> Hi,
> I want to publish on my homepage a list of packages, that are in my private 
> package repository. Therefore it would be useful, if I could convert the 
> output of 'dpkg-scanpackages' and 'dpkg-scansources' into XML, so that I only 
> have to write the appropriate XSLT stylesheets.
> Is there any tool, that can do this?

This is trivial with grep-dctrl and sed.  For example:

echo '<packages><entry>'
zcat /a/dists/latest/binary-i386/Packages.gz | \
  grep-dctrl -sPackage,Version . | \
  sed -r -e 's/([^:]+):(.+)/<\1>\2<\/\1>/' \
  -e 's/^$/<\/entry><entry>/' | head -n-1; 
echo '</entry></packages>'

If you want to include the short or long descriptions you'd have to
wrap those fields in CDATA tags, so you'd need an exta sed
expression to handle that.

XML is called "easy to use" because it's just text.

Reply to: