PAR::Repository with static dependency resolution

tsee on 2009-02-04T18:50:14

My previous journal entry was about the PAR::Repository auto-upgrading feature. That, however, was just a precursor to the big news. Here's (approximately) what I posted to the PAR mailing list a few days ago:

Let me provide some context. Ever since I wrote PAR::Repository::*, people mistook it for a PAR-based PPM replacement. It was never intended to be a package manager/installer like PPM but instead as a sort of application server that could be comfortably and centrally managed, maintained, and upgraded. Even having separate staging and production repositories is quite simple as a PAR repository is just a directory on an ordinary web server or file system. Heck, you can even import one into git and switch branches as your heart desires. Since the clients simply fetch the most current packages for their specific needs, they are always be up to date when launching a new application from the repository.

After I gave a talk about PAR and the repository concept at YAPC::EU 2008 in Copenhagen, people again asked whether they could use a PAR repository in place of PPM. I said they couldn't and that the fundamental difference is that PAR::Repository finds dependencies dynamically, recursively, at run-time, whenever a module is required as opposed to PPM's static dependency information. But at the time, I already had a secret scheme for adding static dependency information to PAR repositories. Since the work on PAR is done purely in my not so copious spare time, I didn't spill the beans just yet in case I'd never get around to finish it. Seems I was lucky.

Since a couple of days ago, there are development releases of PAR, PAR::Dist, PAR::Repository, PAR::Indexer and PAR::Repository::Client[1] that sport support for static dependency extraction from .par files, storage thereof in the repository, and resolution and application of it in the client!

Getting to this point required a bit of Yak Shaving.

  • PAR::Dist's merge_par routine formerly simply copied the first package's META.yml. Now, it also merges the "provides" as well as the various requires-like sections.
  • The tests of both PAR::Repository and ::Client were in dire need of improvement because...
  • ... both modules needed some refactoring to make way for the rest of the changes.
  • The PAR::Repository aquired a new index file for dependencies.
  • The PAR file injection routines use the information from META.yml to fill it. The removal routines correctly remove the information again.
  • To make up for the extra bandwidth required for the dependency information, a checksum-scheme has been implemented to check for updates.
  • The client has a new option "static_dependencies" to enable recursive resolution of dependencies as found in the new dependencies index.
  • The "use PAR {...}" interface now has a "dependencies" option that enables the client's static dependency processing.

All involved modules have new releases on CPAN. They are mostly developer releases, since there must be serious bugs.

Thanks for reading!

Best regards,
Steffen

[1] To give the new releases a whirl, you can simply install PAR::Repository (for the server side) or PAR::Repository::Client (for the client, doh). No need to manually install all the distributions, they'll be picked up as dependencies.