Metal Toad has been building applications and cloud environments for some of the most well-known global brands for over a decade. Learn more > >

Automated CVS checkouts of Drupal Core + Contrib

If you've built out more than a few Drupal projects, you've probably gone through the same song & dance a number of times - find the most recent release of core, download, find the most recent release of Views, download, find the most recent release of CCK...

Around here, we've been doing CVS checkouts to simplify upgrades but, even if you have scripts like

#!/bin/bash
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-$1 -d $2  drupal

...there's still the process of going and tracking down the relevant CVS tags which is fairly time consuming. This got me thinking - if the Update module can go out and find what the newest version of a module, why can't I?

It turns out I can.

The Update module gets XML info on the modules from updates.drupal.org - once I parse the feed & figure out what the latest stable release (PHP's built-in version_compare tells you that 5.1.beta4 is newer than 5.0.99) it's pretty simple to actually go do the checkouts. Which is exactly what I've done.

Attached, you should find a copy of the script. Keep in mind this is a development tool & not really fit for "production" or "seeing the light of day" - there's not a whole lot of error checking. I can't guarantee that it'll run anywhere other than on my development machine. IOW - this code is provided as-is.

Filed under:

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready to get started?