Improving the JSON cache created by ftp-admin install



(Please CC me when replying, as I am not subscribed to this list)

Last weekend, I decided to change the Perl script that is used to update the Cheese website:

http://git.gnome.org/browse/gnomeweb-wml/tree/projects.gnome.org/cheese/update.pl

Briefly, the script connects to the GNOME FTP server, queries the modification times (in effect, the release dates) of Cheese tarballs and updates the website with download links, checksums and links to announcement emails in the gnome-announce-list archives.

I discovered that a JSON cache of some useful metadata exists:

http://download.gnome.org/sources/cheese/cache.json

I changed the update script to use this metadata, and it simplified the process significantly. However, there are some relatively simple improvements that I would like to make to the cache.

Currently, the data is relatively unstructured, consisting of an array of one integer and three objects, with the objects all having the same name (the project name, in this case ‘cheese’). One object contains a list of versions, while the other contains the latest release for each major/minor series, and the other object contains detailed metadata about each version. Also, while a link to the checksum files is provided for each release, the checksums are not, which means that the script must fetch the checksum files and parse the checksum for a tarball out of each one. Finally, the release date is not included in the release metadata either, meaning another query to the FTP server to determine the modification time of each tarball.

I propose a more structured format, something similar to the following:

// Implied project name here.
{
  "releaseSeries" :
  [
    {
      "seriesVersion" : "3.2"
      "releases" :
      [
        {
          "releaseVersion" : "3.2.0",
          "releaseDate" : "2011-04-01 12:34",
          "tarballs" :
          [
            "tar.gz" :
            {
              "basename" : "cheese-3.2.0.tar.gz",
              "md5sum" : "abcdef",
              "sha256sum" : "123456abcdef"
            },
            "tar.bz2" :
            {
              // etc.
            }
          ],
          "sha256sumFile" : "cheese-3.2.0.sha256sum",
          "md5sumFile" : "cheese-3.2.0.md5sum",
          "newsFile" : "cheese-3.2.0.news",
          "changesFile" : "cheese-3.2.0.changes";
          "latestFile" : "LATEST-IS-3.0.2";
        },
        {
          "releaseVersion" : "3.2.1",
          // etc.
        }
      ]
    },
    {
      "seriesVersion" : "3.3",
      // etc.
    },
  ]
}

I am happy to implement the changes in the ftp-admin script:

http://git.gnome.org/browse/sysadmin-bin/tree/ftpadmin

and welcome any comments, especially from anyone who uses the current data, or who might otherwise find more detailed metadata useful. This is my first experience with Perl and JSON, so please go easy on the newbie!

--
http://amigadave.com/


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