Revision of Vendor Branches for Modules from Thu, 10/16/2008 - 11:56

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

Use Subversions "vendor branch" capabilities for managing Drupal module installation and updating.

Ross Burton's Vendor Branches in Subversion is a decent explanation of how vendor branching works.
CodeGobbler has an article on SVN repository structure for Drupal projects that includes using svn:externals for modules.

Adding a Vendor branch to your repo
Check out a copy of the entire repo from the very top level:

cd /tmp
svn checkout file:///var/svn/projectname projectname
cd projectname

Create a vendor folder in the top-level:

svn mkdir vendor

Within that folder, create folders for modules and themes:

svn mkdir vendor/modules
svn mkdir vendor/themes

Commit your changes back to the repository:

cd /tmp/projectname
svn commit -m "Adding top-level vendor folder."

Delete the checked-out copy:

cd /tmp
rm -rf projectname

Installing a module
Check out a temporary copy of your vendor folder:

cd /tmp
svn checkout file:///var/svn/projectname/vendor projectname
cd projectname/modules

For this example, we'll use the Content Construction Kit (CCK) module. Firstly, we'll create a folder that will hold anything related to that module:

svn mkdir cck

Within that folder, create a directorythat will hold the "current" version of the module:

svn mkdir cck/current

Commit the folder changes:

svn commit -m "CCK module structure added"

Download and untar copy of the module. For this example, we're going to download the outdated 5.x-1.6-1 version so that afterwards, we can demonstrate how to update a module.

cd /tmp
wget http://ftp.drupal.org/files/projects/cck-5.x-1.6-1.tar.gz

Normally, when you untar a Drupal module, the resulting directory name doesn't contain the version number. However, in our case we're going to want it to contain that detail:

tar zxf cck-5.x-1.6-1.tar.gz
mv cck cck-5.x-1.6-1
rm cck-5.x-1.6-1.tar.gz

Load the module into current:

svn_load_dirs.pl file:///var/svn/projectname/vendor/modules/cck current \
/tmp/cck-5.x-1.6-1 -t cck-5.x-1.6-1

Install the module to your site
Navigate to where you want to add the module (sites/all/modules or sites/sitename/modules). If the folder doesn't exist, create it. Eg:

cd /var/websites/projectname/htdocs/sites/all
svn mkdir modules

Copy the module to the checked out site:

cd /var/websites/projectname/htdocs/sites/all/modules
svn copy file:///var/svn/projectname/vendor/modules/cck/current \
file:///var/svn/projectname/trunk/htdocs/sites/all/modules/cck -m "Add CCK to site"

Upgrading the module
Download the new module version:

cd /tmp
wget http://ftp.drupal.org/files/projects/cck-5.x-1.9.tar.gz
tar zxf cck-5.x-1.9.tar.gz
mv cck cck-5.x-1.9
rm -f cck-5.x-1.9.tar.gz

Load the new version into current:

svn_load_dirs.pl file:///var/svn/projectname/vendor/modules/cck current \
/tmp/cck-5.x-1.9 -t cck-5.x-1.9

Merge the new current version of the module with your working copy in trunk. Using merge instead of copy in case you've made any changes to the version in trunk.

cd /var/websites/projectname/htdocs/sites/all/modules
svn merge file:///var/svn/projectname/vendor/modules/cck/cck-5.x-1.6-1 \
file:///var/svn/projectname/vendor/modules/cck/current \
cck

Commit the update into your repo:

svn commit -m "Merging CCK 5.x-1.9 into trunk"

Recent Updates

  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
    php 8.x
  • 2 years 3 weeks ago
    10.6.7
  • 2 years 4 weeks ago
    Drop Centos 5/6 stuff