Creating a patch-testbed with DAST step-by-step

Events happening in the community are now at Drupal community events on www.drupal.org.
allisterbeharry's picture

The dast-patch build script automates the process of creating and patching a fresh Drupal site fetched from CVS. This is a step-by-step guide on using the build script to:
0. Clean the existing directory and database location you want to run the test site from;
1. Fetch core HEAD from CVS;
2. Drop and recreate a MySQL database and user for the site;
3. Fetch a patch file from a URL and apply it to the Drupal site code-tree

Step 1: Install DAST. Download the d.o release packageat http://ftp.drupal.org/files/projects/DAST-5.x-1.1.tar.gz. Download the dependencies package from http://www.abeharry.info/stuff/dast-deps.tar.gz or http://www.abeharry.info/stuff/dast-deps.zip. and unpack them to the same dir - /usr/share/DAST for example. There are no additional dependencies besides PHP 5.2.x, cvs, wget, and patch.

Step 2: Set your properties. Each build script comes with one example properties file, in both a *nix and Windows flavour. The *nix sample properties file for dast-patch is dast-patch-nix-sample.properties and for Windows dast-patch-windows-sample.properties. Copy this to dast-patch.properties and edit this file to configure the build with the following properties (comments delimited with #):

patch.method = HTTP #Set to HTTP to fetch the patch from a HTTP URL, dfile to fetch the patch from a local directory

patch.file = #The name of the patch file that will be applied, e.g. update-core-94154-108.patch

patch.Url = #The full absolute Url to the patch file e.g. http://drupal.org/files/issues/update-core-94154-108.patch

drupal.dir = #The directory which will contain the fresh Drupal site, e.g /var/www/drupal6

drupal.database.CreateUrl = #The Url to connect to when creating the Drupal user and db, e.g. mysql://root:root@localhost/mysql
#The account specified must have rights to create and drop the Drupal user and database. Currently only mysql supported

#The script to run to (re)create the Drupal database and user and privileges. The user specified in the drupal.database.Createurl must have sufficient privileges to perform this task. Leave this as is unless you have your own script you want to run.
drupal.database.CreateScript = ${dast.home}/ext/MYSQL5-CREATE-DRUPAL-DB.sql

#The database connection url in the format driver://user:pass@host/dbname of the database created in the previous step. Leave this as is if using ext/MYSQL5-CREATE-DRUPAL-DB.sql
drupal.database.url = mysql://joe:cool@localhost/DRUPAL6

drupal.core.method = CVS #Set this to directory if instead you want to fetch the core from a local dir

#The ABSOLUTE path to the directory containing the local Drupal 6 core code tree to be fetched;
#this will be used if drupal.core.method = directory, e.g /usr/share/src/drupal/HEAD:
drupal.core.sourcedir = /usr/share/src/drupal/HEAD

#drupal,core,Cvs.command, drupal.core.CvsRoot...All the drupal.core.Cvs.* defaults should be ok but modify these properties if you need something different.

#File to write core CVS operations output to, == stdout. Currently this file path CANNOT CONTAIN SPACES
#on *nix or Windows.
drupal.core.Cvs.Output = /var/log/dast-patch-cvs-core-output.log

#File to write core CVS operations error to == stderror. Currently this file path, CANNOT CONTAIN SPACES
#on *nix or Windows.
drupal.core.Cvs.Error = var/log/dast-patch-cvs-core-error.log

#If this is yes, then a default-settings template will be modified to set $db_url = drupal.database.url and saved as sites/drupal/settings.php
drupal.settings.addDbUrl = yes

#The path to the settings file to use as a template, relative to drupal.dir. Leave this as is unless you want to use a different default-settings
drupal.settings.source = sites${php.directory_separator}default${php.directory_separator}default.settings.php

#The path to place the newly configures settings.php file relative to drupal.dir. Leave this as is unless you want to place the settings somewhere else
drupal.settings.location = sites${php.directory_separator}default${php.directory_separator}settings.php

Step 3: Test the build script From the root directory where you uncompressed the dast package:

./bin/dast -f dast-patch.xml  configure
This will run the configure task which will verify that Phing can be bootstrapped and that all required properties for the dast-patch build are present. (This isn't like autoconf configure - nothing is written to disk.)

Step 4: Run the build script From the root DAST directory:
./bin/dast -f dast-patch.xml

If all goes well you should have a fresh Drupal site patched and ready for testing.
All properties defined in a file can be overridden using the -D switch at the command-line, e.g.

./bin/dast -f dast-patch.xml -D"patch.method=skip"

To use a local patch file at patch.file.path You can also specify a logfile to store all output using the switch -f
You can also call most tasks individually -e.g ./bin/dast -f dast-patch.xml  clean

For all the properties and tasks you can use to tailor the build see the - *-sample.properties and check README.txt for usage and any general questions.

SoC 2007

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: