Tatsuhiko Miyagawa's Blog

Wanted: CPAN Changelog diff service

November 27, 2009

Something I’ve been thinking of implementing myself, but i have other exciting things to work on these days, so I just free up this idea to the lazyweb:

WANTED

We really need a web API service that gives you the changelog entry, given a distribution name and version(s). Say the service lives on changes.cpan.org: (of course it could be something else)

API: http://changes.cpan.org/changes.json?distribution=Plack&from=0.9010&to=0.9015 (“to” can be omitted, in which case the latest CPAN version is used)

Response: JSON with the following keys:

  • from, to, distribution: echo the request
  • changes: plain text of what’s new, extracted from Changes file

That’s it. Extracting the changes as a data structure, like identifying RT ticket numbers, would be neat but that could be built as a separate service or a module, so i’d rather want it just serve a plain text view.

HOW

Daisuke Murase actually created CPAN Recent Feed for this, but since his server died a couple of weeks ago, the service went down. (Alas, the source code also is temporary unavailable)

We could probably use search.cpan.org’s not-very-well-known Diff tool to extract changes, or manually download two tar-balls to peek at Changes file to diff. The other approach would be to parse Changes file to recognize versions. Not all dists use the same formats or filenames to log changes, so we may need some heuristics to recognize it. Some module authors use formats like YAML to log changes, in which case the parsing would be easier.

WHYIt would be obvious why this should be useful, but just in case: once we build this available as a web API, we could:

  • write a CPAN.pm (or CPANPLUS) plugin to display changes when you upgrade modules
  • write a command line tool to check the installed module version and display changes, so you can determine whether you should upgrade
  • CPAN realtime updates can now add changes as a comment to the module update entry
  • etc. etc..

So, who wants to write this? :)