Monday, March 1, 2010

The Software List as XML

When I wrote the new FreeDOS software list, one of the "targets" was to provide a method for the FDUPDATE program to get a list of packages that it needed to update. An easy way to do this is to query the database, and format the output in an XML file that the FDUPDATE program can read.

I've already shared this with Mateusz, but in case anyone else wants to write their own program to check FreeDOS program information via an XML file, here's how to export the software list as XML.

You start here:
www.freedos.org/cgi-bin/fdupdate.cgi

Without any parameters, the fdupdate.cgi program returns an unformatted list of "categories" (also called "disk sets") in the software list. When you installed your distribution of FreeDOS, you may only have installed the "Base" disk set. But others may have installed the "Full" distribution, and might have chosen to include things like "Devel" and "Edit". The FDUPDATE program knows what disk sets you installed, so it also knows what disk sets it needs to update. It does the right magic in the background to fetch the right category lists.

Let's say you wanted to get the data for just the "Base" category. You just give fdupdate.cgi the "cat=" parameter:
www.freedos.org/cgi-bin/fdupdate.cgi?cat=base

That will give you an XML list of all the packages (and their version numbers) in the "Base" category. The FDUPDATE program can easily parse this to figure out which programs need updating.

Since the software list was only recently converted to a database, obviously the FDUPDATE program doesn't support the new fdupdate.cgi method yet. That's probably a good thing for right now, since the database doesn't contain any information (yet) about the specific package zip file names. We haven't entered that into the database yet, but we will.

So this is sort of a "coming soon" feature of the software list. But I wanted to share this with you now, so you can see the flexibility that a database back-end gives us.

No comments:

Post a Comment