| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!-- <![CDATA[
|
| 3 |
$Id: dast-patch.xml,v 1.4 2007/08/20 18:54:48 allisterbeharry Exp $ ]]>
|
| 4 |
-->
|
| 5 |
<project name="dast-patch" default="main" basedir="../">
|
| 6 |
<!-- ================================================ -->
|
| 7 |
<!-- Creates a testbed for testing Drupal patches -->
|
| 8 |
<!-- -->
|
| 9 |
<!-- ================================================ -->
|
| 10 |
|
| 11 |
<property name="dast.tmp" value="${dast.home}${php.directory_separator}tmp" />
|
| 12 |
<taskdef name="CreoleSQLExec" classname="phing.tasks.ext.CreoleSQLExecTask"/>
|
| 13 |
<taskdef name="CVS" classname="phing.tasks.system.CVSTask"/>
|
| 14 |
<taskdef name="warn" classname="phing.tasks.system.WarnTask"/>
|
| 15 |
<property name="build.modules.fetched.count" value="0" />
|
| 16 |
<property name="build.modules.skipped.count" value="0"/>
|
| 17 |
<property name="build.modules.fetched.list" value="" />
|
| 18 |
<property name="build.modules.skipped.list" value=""/>
|
| 19 |
|
| 20 |
<!-- =================================
|
| 21 |
target: clean
|
| 22 |
================================= -->
|
| 23 |
<target name="clean" depends="configure" description="--> Cleans the Drupal dir and database">
|
| 24 |
|
| 25 |
<!--(Re)create drupal.dir-->
|
| 26 |
<available file="${drupal.dir}" type="dir" property="drupal.dir.DirectoryExists"/>
|
| 27 |
<if><isset property="drupal.dir.DirectoryExists"/>
|
| 28 |
<then>
|
| 29 |
<delete dir="${drupal.dir}" includeemptydirs="true" verbose="false" failonerror="true"/>
|
| 30 |
<echo>${drupal.dir} deleted </echo>
|
| 31 |
</then>
|
| 32 |
</if>
|
| 33 |
<mkdir dir="${drupal.dir}"/>
|
| 34 |
<echo>${drupal.dir} created</echo>
|
| 35 |
|
| 36 |
|
| 37 |
<!--Recreate drupal db and user -->
|
| 38 |
<CreoleSQLExec Url="${drupal.database.CreateUrl}" Print="true" Showheaders="false">
|
| 39 |
--Revoke all privileges for the user
|
| 40 |
DELETE FROM `tables_priv` where `User` = '${drupal.database.user}' and 'Host' = '${drupal.database.user.host}';
|
| 41 |
DELETE FROM `columns_priv` where `User` = '${drupal.database.user}' and 'Host' = '${drupal.database.user.host}';
|
| 42 |
FLUSH PRIVILEGES;
|
| 43 |
SELECT "Deleted any existing privileges for user ${drupal.database.user}@${drupal.database.user.host}" as MSG;
|
| 44 |
|
| 45 |
--Drop the user if it exists
|
| 46 |
DELETE FROM `user` where `User`= '${drupal.database.user}' and `Host` = '${drupal.database.user.host}';
|
| 47 |
SELECT "Deleted (if existed) user ${drupal.database.user}@${drupal.database.user.host}..." as MSG;
|
| 48 |
|
| 49 |
--Drop database if it exists
|
| 50 |
DROP DATABASE IF EXISTS ${drupal.database.name};
|
| 51 |
SELECT "Deleted (if existed) database ${drupal.database.name}..." as MSG;
|
| 52 |
|
| 53 |
--Create database
|
| 54 |
CREATE DATABASE ${drupal.database.name};
|
| 55 |
SELECT "Created database ${drupal.database.name}..." as MSG;
|
| 56 |
|
| 57 |
--Grant privileges
|
| 58 |
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE
|
| 59 |
TEMPORARY TABLES, LOCK TABLES
|
| 60 |
ON ${drupal.database.name}.*
|
| 61 |
TO '${drupal.database.user}'@'${drupal.database.user.host}' IDENTIFIED BY '${drupal.database.user.pass}';
|
| 62 |
FLUSH PRIVILEGES;
|
| 63 |
SELECT "Granted privileges SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES to user ${drupal.database.user}@${drupal.database.user.host}.." as MSG;
|
| 64 |
</CreoleSQLExec>
|
| 65 |
<echo>Dropped and recreated database ${drupal.database.name} and user ${drupal.database.user}@${drupal.database.user.host}</echo>
|
| 66 |
|
| 67 |
<!--Check if database url is now valid-->
|
| 68 |
<echo>Checking connection to ${drupal.database.url}...</echo>
|
| 69 |
<CreoleSQLExec Url="${drupal.database.url}" Print="true" Showheaders="false">
|
| 70 |
SELECT "${drupal.database.url} is now available." as MSG;
|
| 71 |
</CreoleSQLExec>
|
| 72 |
</target>
|
| 73 |
|
| 74 |
<!-- =================================
|
| 75 |
target: main
|
| 76 |
================================= -->
|
| 77 |
<target name="main" depends="configure" description="--> Runs the clean, fetchCore, fetchModules, patch, install tasks in sequence.">
|
| 78 |
<if> <not><equals arg1="${build.run.clean}" arg2="no"/></not> <then>
|
| 79 |
<phingcall target="clean" /> </then>
|
| 80 |
</if>
|
| 81 |
<phingcall target="fetchCore" />
|
| 82 |
<phingcall target="fetchModules" />
|
| 83 |
<phingcall target="patch" />
|
| 84 |
<phingcall target="install" />
|
| 85 |
</target>
|
| 86 |
|
| 87 |
<!-- =================================
|
| 88 |
target: install
|
| 89 |
================================= -->
|
| 90 |
<target name="install" depends="configure" description="--> Runs the Drupal installer script - install.php">
|
| 91 |
<if><equals arg1="${drupal.install}" arg2="yes" /><then>
|
| 92 |
<if><not><isset property="drupal.Url"/></not>
|
| 93 |
<then>
|
| 94 |
<fail>drupal.Url property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 95 |
</then>
|
| 96 |
</if>
|
| 97 |
<if><not><isset property="drupal.locale"/></not>
|
| 98 |
<then>
|
| 99 |
<fail>drupal.locale property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 100 |
</then>
|
| 101 |
</if>
|
| 102 |
<if><not><isset property="drupal.profile"/></not>
|
| 103 |
<then>
|
| 104 |
<fail>drupal.install property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 105 |
</then>
|
| 106 |
</if>
|
| 107 |
<!--Run the installer -->
|
| 108 |
<echo>${drupal.Url}install.php?profile=${drupal.profile}^&locale=${drupal.locale}</echo>
|
| 109 |
<exec command="wget "${drupal.Url}install.php?profile=${drupal.profile}&locale=${drupal.locale}""
|
| 110 |
Output="${build.log.defaultdir}${php.directory_separator}dast-patch-install-output.log" Error="${build.log.defaultdir}${php.directory_separator}dast-patch-install-error.log"
|
| 111 |
dir="${dast.tmp}" escape="false" passthru="false" checkreturn="false"/>
|
| 112 |
</then>
|
| 113 |
<else>
|
| 114 |
<echo>Not running Drupal installer.</echo>
|
| 115 |
</else>
|
| 116 |
</if>
|
| 117 |
</target>
|
| 118 |
|
| 119 |
<!-- =================================
|
| 120 |
target: patch
|
| 121 |
================================= -->
|
| 122 |
<target name="patch" depends="configure" description="--> Patches a Drupal dir with a local or remote file">
|
| 123 |
<property name="dast.ext" value="${dast.home}${php.directory_separator}ext${php.directory_separator}" />
|
| 124 |
<property name="dast.ext.patch" value="${dast.home}${php.directory_separator}ext${php.directory_separator}patch${php.directory_separator}" />
|
| 125 |
<if><equals arg1="${patch.method}" arg2="skip" />
|
| 126 |
<then>
|
| 127 |
<echo>Skipping patch.</echo>
|
| 128 |
</then>
|
| 129 |
</if>
|
| 130 |
<echo>${patch.Url}</echo>
|
| 131 |
<echo>${dast.home}</echo>
|
| 132 |
<if><equals arg1="${patch.method}" arg2="HTTP" /> <!--Fetch patch file from URL-->
|
| 133 |
<then>
|
| 134 |
<if><not><isset property="patch.Url"/></not>
|
| 135 |
<then>
|
| 136 |
<fail>patch.Url not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 137 |
</then>
|
| 138 |
</if>
|
| 139 |
<echo>Downloading ${patch.file} from ${patch.Url}...</echo>
|
| 140 |
<exec command="wget "${patch.Url}"" dir="${dast.ext.patch}" checkreturn="true"/>
|
| 141 |
<echo> Applying ${patch.file} patch to ${drupal.dir}...</echo>
|
| 142 |
<exec command = "patch -d "${drupal.dir}" -p0 < "${dast.ext.patch}${patch.file}"
|
| 143 |
-b" dir = "${drupal.dir}"
|
| 144 |
checkreturn="false" passthru="true" Output="${build.log.defaultdir}${php.directory_separator}dast-patch-patch-output.log" Error="${build.log.defaultdir}${php.directory_separator}dast-patch-patch-error.log"/>
|
| 145 |
<echo>Patching completed, see ${dast.ext.patch} for patch output.</echo>
|
| 146 |
|
| 147 |
</then>
|
| 148 |
</if>
|
| 149 |
<if><equals arg1="${patch.method}" arg2="file" />
|
| 150 |
<then>
|
| 151 |
<!--Check the availability of the patch file -->
|
| 152 |
<available file="${patch.file.path}" property="patch.FileExists"/>
|
| 153 |
<if><not><isset property="patch.FileExists"/></not>
|
| 154 |
<then>
|
| 155 |
<fail>The file ${patch.file.path} could not be found. Stopping. </fail>
|
| 156 |
</then>
|
| 157 |
</if>
|
| 158 |
<echo> Applying ${patch.file} patch to ${drupal.dir}...</echo>
|
| 159 |
<exec command = "patch -d "${drupal.dir}" -p0 < "${patch.file.path}"
|
| 160 |
-b" dir = "${drupal.dir}"
|
| 161 |
checkreturn="false" passthru="true" Output="${build.log.defaultdir}${php.directory_separator}dast-patch-patch-output.log" Error="${build.log.defaultdir}${php.directory_separator}dast-patch-patch-error.log"/>
|
| 162 |
<echo>Patching completed, see ${dast.ext.patch} for patch output.</echo>
|
| 163 |
</then>
|
| 164 |
</if>
|
| 165 |
</target>
|
| 166 |
|
| 167 |
<!-- =================================
|
| 168 |
target: fetchCore
|
| 169 |
================================= -->
|
| 170 |
<target name="fetchCore" depends="configure" description="--> Fetches Drupal core from CVS or local directory.">
|
| 171 |
<!--Fetch core from CVS-->
|
| 172 |
<if><equals arg1="${drupal.core.method}" arg2="CVS" />
|
| 173 |
<then>
|
| 174 |
<!--Check for required CVS properties-->
|
| 175 |
<if><not><isset property="drupal.core.Cvs.CvsRoot"/></not>
|
| 176 |
<then>
|
| 177 |
<fail>drupal.core.Cvs.CvsRoot property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 178 |
</then>
|
| 179 |
</if>
|
| 180 |
<if><not><isset property="drupal.core.Cvs.Command"/></not>
|
| 181 |
<then>
|
| 182 |
<fail>drupal.core.Cvs.Command property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 183 |
</then>
|
| 184 |
</if>
|
| 185 |
<if><not><isset property="drupal.core.Cvs.Revision"/></not>
|
| 186 |
<then>
|
| 187 |
<fail>drupal.core.Cvs.Revision property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 188 |
</then>
|
| 189 |
</if>
|
| 190 |
|
| 191 |
<!--Set optional CVS properties with defaults if they aren't set-->
|
| 192 |
<if><not><isset property="drupal.core.Cvs.Port"/></not>
|
| 193 |
<then>
|
| 194 |
<property name="drupal.core.Cvs.Port" value="2401"/>
|
| 195 |
<echo>drupal.core.Cvs.Port property not set, using default value 2401.</echo>
|
| 196 |
</then>
|
| 197 |
</if>
|
| 198 |
<if><not><isset property="drupal.core.Cvs.CompressionLevel"/></not>
|
| 199 |
<then>
|
| 200 |
<property name="drupal.core.Cvs.CompressionLevel" value="6"/>
|
| 201 |
<echo>drupal.core.Cvs.CompressionLevel property not set, using default value 6.</echo>
|
| 202 |
</then>
|
| 203 |
</if>
|
| 204 |
<if><not><isset property="drupal.core.Cvs.Quiet"/></not>
|
| 205 |
<then>
|
| 206 |
<property name="drupal.core.Cvs.Quiet" value="false"/>
|
| 207 |
<echo>drupal.core.Cvs.Quiet property not set, using default value false.</echo>
|
| 208 |
</then>
|
| 209 |
</if>
|
| 210 |
<if><not><isset property="drupal.core.Cvs.FailOnError"/></not>
|
| 211 |
<then>
|
| 212 |
<property name="drupal.core.Cvs.FailOnError" value="true"/>
|
| 213 |
<echo>drupal.core.Cvs.FailOnError property not set, using default value true.</echo>
|
| 214 |
</then>
|
| 215 |
</if>
|
| 216 |
<if><not><isset property="drupal.core.Cvs.Output"/></not>
|
| 217 |
<then>
|
| 218 |
<property name="drupal.core.Cvs.Output" value="${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-core-output.log"/>
|
| 219 |
<echo>drupal.core.Cvs.Output property not set, using default value ${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-core-output.log .</echo>
|
| 220 |
</then>
|
| 221 |
</if>
|
| 222 |
<if><not><isset property="drupal.core.Cvs.Error"/></not>
|
| 223 |
<then>
|
| 224 |
<property name="drupal.core.Cvs.Error" value="${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-core-error.log"/>
|
| 225 |
<echo>drupal.core.Cvs.Error property not set, using default value ${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-core-error.log .</echo>
|
| 226 |
</then>
|
| 227 |
</if>
|
| 228 |
|
| 229 |
<!--Run CVS operation-->
|
| 230 |
<echo>Executing CVS command to fetch core...this may take a few minutes...see ${drupal.core.Cvs.Output} and ${drupal.core.Cvs.Error} for details when completed.</echo>
|
| 231 |
<CVS CvsRoot="${drupal.core.Cvs.CvsRoot}" Port="${drupal.core.Cvs.Port}" Command="${drupal.core.Cvs.Command}" CompressionLevel="${drupal.core.Cvs.CompressionLevel}"
|
| 232 |
Quiet="${drupal.core.Cvs.Quiet}" FailOnError="${drupal.core.Cvs.FailOnError}"
|
| 233 |
Module="drupal" Tag="${drupal.core.Cvs.Revision}" Dest="${drupal.dir}"
|
| 234 |
Output="${drupal.core.Cvs.Output}" Error="${drupal.core.Cvs.Error}"/>
|
| 235 |
<!--The files will be in a folder called drupal under drupal.dir so move them up one level -->
|
| 236 |
<echo>Moving contents of ${drupal.dir}${php.directory_separator}drupal to parent ${drupal.dir}</echo>
|
| 237 |
<move todir="${drupal.dir}" includeemptydirs="true">
|
| 238 |
<fileset dir="${drupal.dir}${php.directory_separator}drupal">
|
| 239 |
<include name="**" />
|
| 240 |
</fileset>
|
| 241 |
</move>
|
| 242 |
<!--Then delete the drupal subfolder-->
|
| 243 |
<delete dir="${drupal.dir}${php.directory_separator}drupal" includeemptydirs="true" verbose="false" failonerror="true" />
|
| 244 |
</then>
|
| 245 |
</if> <!-- if ${drupal.core.method} =="CVS" -->
|
| 246 |
|
| 247 |
<if><equals arg1="${drupal.core.method}" arg2="directory"/><!--Fetch core from local directory-->
|
| 248 |
<then>
|
| 249 |
<available file="${drupal.core.sourcedir}" property="drupal.core.sourcedirExists"/>
|
| 250 |
<if><not><isset property="drupal.core.sourcedirExists"/></not>
|
| 251 |
<then>
|
| 252 |
<fail>The directory ${drupal.core.sourcedir} could not be found. Stopping. </fail>
|
| 253 |
</then>
|
| 254 |
</if>
|
| 255 |
<available file="${drupal.core.sourcedir}${php.directory_separator}index.php" property="drupal.core.sourcedir.index_phpExists"/>
|
| 256 |
<if><not><isset property="drupal.core.sourcedir.index_phpExists"/></not>
|
| 257 |
<then>
|
| 258 |
<fail>Could not find index.php in ${drupal.core.sourcedir} - verify that this directory is the parent directory containing the Drupal 6 source. Stopping.</fail>
|
| 259 |
</then>
|
| 260 |
</if>
|
| 261 |
<echo>Preparing to copy core files from ${drupal.core.sourcedir}...this may take a few secs...</echo>
|
| 262 |
<copy todir="${drupal.dir}" includeemptydirs="true" overwrite="true">
|
| 263 |
<fileset dir="${drupal.core.sourcedir}/">
|
| 264 |
<include name="**" />
|
| 265 |
</fileset>
|
| 266 |
</copy>
|
| 267 |
</then>
|
| 268 |
</if> <!-- if ${drupal.core.method} == directory -->
|
| 269 |
|
| 270 |
<if><equals arg1="${drupal.settings.addDbUrl}" arg2="yes" />
|
| 271 |
<then> <!--Set db url in settings.php-->
|
| 272 |
<echo>Attempting to set db Url in settings.php...</echo>
|
| 273 |
<available file="${drupal.dir}${php.directory_separator}${drupal.settings.source}" property="drupal.settings.sourceExists"/>
|
| 274 |
<if><not><isset property="drupal.settings.sourceExists"/></not>
|
| 275 |
<then>
|
| 276 |
<warn>The file ${drupal.settings.source} could not be found. The settings file will be modified directly. </warn>
|
| 277 |
</then>
|
| 278 |
<else>
|
| 279 |
<!--Copy the settings source -->
|
| 280 |
<copy file="${drupal.dir}${php.directory_separator}${drupal.settings.source}" tofile="${drupal.dir}${php.directory_separator}${drupal.settings.location}" overwrite="true" />
|
| 281 |
</else>
|
| 282 |
</if>
|
| 283 |
|
| 284 |
<!--Check if database url is now valid-->
|
| 285 |
<echo>Checking connection to ${drupal.database.url}...</echo>
|
| 286 |
<CreoleSQLExec Url="${drupal.database.url}" Print="true" Showheaders="false">
|
| 287 |
SELECT "${drupal.database.url} is now available." as MSG;
|
| 288 |
</CreoleSQLExec>
|
| 289 |
|
| 290 |
<!--Now set the database url in settings.php -->
|
| 291 |
<reflexive file="${drupal.dir}${php.directory_separator}${drupal.settings.location}">
|
| 292 |
<filterchain><replaceregexp>
|
| 293 |
<regexp pattern = "\$db_url = 'mysql:\/\/username:password\@localhost\/databasename';" replace="\$db_url = '${drupal.database.url}';" ignoreCase="true"/>
|
| 294 |
</replaceregexp>
|
| 295 |
</filterchain>
|
| 296 |
</reflexive>
|
| 297 |
</then>
|
| 298 |
</if>
|
| 299 |
|
| 300 |
</target>
|
| 301 |
|
| 302 |
<!-- =================================
|
| 303 |
target: fetchModules
|
| 304 |
================================= -->
|
| 305 |
<target name="fetchModules" depends="configure" description="--> Fetches Drupal modules from CVS or local directory.">
|
| 306 |
<!--Fetch modules from CVS-->
|
| 307 |
<if><equals arg1="${drupal.modules.method}" arg2="CVS" />
|
| 308 |
<then>
|
| 309 |
<!--Check for required CVS properties-->
|
| 310 |
<if><not><isset property="drupal.modules.Cvs.CvsRoot"/></not>
|
| 311 |
<then>
|
| 312 |
<fail>drupal.modules.Cvs.CvsRoot property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 313 |
</then>
|
| 314 |
</if>
|
| 315 |
<if><not><isset property="drupal.modules.Cvs.Command"/></not>
|
| 316 |
<then>
|
| 317 |
<fail>drupal.modules.Cvs.Command property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 318 |
</then>
|
| 319 |
</if>
|
| 320 |
<if><not><isset property="drupal.modules.Cvs.Revision"/></not>
|
| 321 |
<then>
|
| 322 |
<fail>drupal.modules.Cvs.Revision property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 323 |
</then>
|
| 324 |
</if>
|
| 325 |
|
| 326 |
<!--Set optional CVS properties with defaults if they aren't set-->
|
| 327 |
<if><not><isset property="drupal.modules.Cvs.Port"/></not>
|
| 328 |
<then>
|
| 329 |
<property name="drupal.modules.Cvs.Port" value="2401"/>
|
| 330 |
<echo>drupal.modules.Cvs.Port property not set, using default value 2401.</echo>
|
| 331 |
</then>
|
| 332 |
</if>
|
| 333 |
<if><not><isset property="drupal.modules.Cvs.CompressionLevel"/></not>
|
| 334 |
<then>
|
| 335 |
<property name="drupal.modules.Cvs.CompressionLevel" value="6"/>
|
| 336 |
<echo>drupal.modules.Cvs.CompressionLevel property not set, using default value 6.</echo>
|
| 337 |
</then>
|
| 338 |
</if>
|
| 339 |
<if><not><isset property="drupal.modules.Cvs.Quiet"/></not>
|
| 340 |
<then>
|
| 341 |
<property name="drupal.modules.Cvs.Quiet" value="false"/>
|
| 342 |
<echo>drupal.modules.Cvs.Quiet property not set, using default value false.</echo>
|
| 343 |
</then>
|
| 344 |
</if>
|
| 345 |
<if><not><isset property="drupal.modules.Cvs.FailOnError"/></not>
|
| 346 |
<then>
|
| 347 |
<property name="drupal.modules.Cvs.FailOnError" value="true"/>
|
| 348 |
<echo>drupal.modules.Cvs.FailOnError property not set, using default value true.</echo>
|
| 349 |
</then>
|
| 350 |
</if>
|
| 351 |
<if><not><isset property="drupal.modules.Cvs.Output"/></not>
|
| 352 |
<then>
|
| 353 |
<property name="drupal.modules.Cvs.Output" value="${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-modules-output.log"/>
|
| 354 |
<echo>drupal.modules.Cvs.Output property not set, using default value ${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-modules-output.log .</echo>
|
| 355 |
</then>
|
| 356 |
</if>
|
| 357 |
<if><not><isset property="drupal.modules.Cvs.Error"/></not>
|
| 358 |
<then>
|
| 359 |
<property name="drupal.modules.Cvs.Error" value="${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-modules-error.log"/>
|
| 360 |
<echo>drupal.core.Cvs.Error property not set, using default value ${build.log.defaultdir}${php.directory_separator}dast-patch-cvs-modules-error.log .</echo>
|
| 361 |
</then>
|
| 362 |
</if>
|
| 363 |
|
| 364 |
<available file="${drupal.dir}${php.directory_separator}${drupal.modules.dir}" type="dir" property = "drupal.modules.dir.dirExists" />
|
| 365 |
<if><not><isset property="drupal.modules.dir.dirExists" /></not><then>
|
| 366 |
<!--attempt to create modules directory-->
|
| 367 |
<mkdir dir="${drupal.dir}${php.directory_separator}${drupal.modules.dir}" />
|
| 368 |
</then>
|
| 369 |
</if>
|
| 370 |
|
| 371 |
<!--Run CVS task on each module-->
|
| 372 |
<echo>Executing CVS commands to fetch modules...</echo>
|
| 373 |
<foreach list="${drupal.modules.list}" param="module.name" target="fetchModulefromCVS"/>
|
| 374 |
</then>
|
| 375 |
</if> <!-- if ${drupal.modules.method} =="CVS" -->
|
| 376 |
|
| 377 |
<!--Fetch modules from source dir-->
|
| 378 |
<if><equals arg1="${drupal.modules.method}" arg2="directory"/>
|
| 379 |
<then>
|
| 380 |
<available file="${drupal.modules.sourcedir}" property="drupal.modules.sourcedirExists"/>
|
| 381 |
<if> <not><isset property="drupal.modules.sourcedirExists"/></not> <!--Directory doesn't exist-->
|
| 382 |
<then>
|
| 383 |
<fail>The directory ${drupal.modules.sourcedir} could not be found. Stopping. </fail>
|
| 384 |
</then>
|
| 385 |
</if>
|
| 386 |
<foreach list="${drupal.modules.list}" param="module.name" target="fetchModulefromSourceDirectory"/>
|
| 387 |
</then>
|
| 388 |
</if>
|
| 389 |
</target>
|
| 390 |
|
| 391 |
<!-- - - - - - - - - - - - - - - - - -
|
| 392 |
target: fetchModulefromSourceDirectory
|
| 393 |
- - - - - - - - - - - - - - - - - -->
|
| 394 |
<target name="fetchModulefromSourceDirectory" description="--> Private task used internally to retrieve a module from a local source directory given the module name.">
|
| 395 |
<property name="module.sourcedir" value="${drupal.modules.sourcedir}${php.directory_separator}${module.name}" />
|
| 396 |
<available file="${module.sourcedir}" property="$modulesourcedirectoryExists"/>
|
| 397 |
<if><not><isset property="$modulesourcedirectoryExists"/></not>
|
| 398 |
<then>
|
| 399 |
<warn>Did not find ${module.sourcedir} directory, skipping...</warn>
|
| 400 |
</then>
|
| 401 |
<else>
|
| 402 |
<if><not><isset property="drupal.modules.sourcedir.overwrite"/></not>
|
| 403 |
<then>
|
| 404 |
<property name="drupal.modules.sourcedir.overwrite" value="false"/>
|
| 405 |
<echo>drupal.modules.sourcedir.overwrite property not set, using default value false.</echo>
|
| 406 |
</then>
|
| 407 |
</if>
|
| 408 |
<echo>Preparing to copy ${module.name} from ${module.sourcedir}...this may take a few secs...</echo>
|
| 409 |
<copy todir="${drupal.dir}${php.directory_separator}${drupal.modules.dir}" includeemptydirs="true" overwrite="${drupal.modules.sourcedir.overwrite}">
|
| 410 |
<fileset dir="${drupal.modules.sourcedir}">
|
| 411 |
<include name="**${module.name}"/>
|
| 412 |
</fileset>
|
| 413 |
</copy>
|
| 414 |
|
| 415 |
</else>
|
| 416 |
</if>
|
| 417 |
</target>
|
| 418 |
|
| 419 |
<!-- =================================
|
| 420 |
target: fetchModulefromCVS
|
| 421 |
================================= -->
|
| 422 |
<target name="fetchModulefromCVS" description="--> Private task used internally to retrieve a module from CVS given the module name">
|
| 423 |
<echo>Executing CVS command to fetch module ${module.name}...see ${drupal.modules.Cvs.Output} and ${drupal.modules.Cvs.Error} for details when completed.</echo>
|
| 424 |
<CVS CvsRoot="${drupal.modules.Cvs.CvsRoot}" Port="${drupal.modules.Cvs.Port}" Command="${drupal.modules.Cvs.Command}" CompressionLevel="${drupal.core.Cvs.CompressionLevel}"
|
| 425 |
Quiet="${drupal.modules.Cvs.Quiet}" FailOnError="${drupal.modules.Cvs.FailOnError}"
|
| 426 |
Module="${module.name}" ModulePath="${drupal.modules.Cvs.Path}" Tag="${drupal.modules.Cvs.Revision}" Dest="${drupal.dir}${php.directory_separator}${drupal.modules.dir}"
|
| 427 |
Output="${drupal.modules.Cvs.Output}" Error="${drupal.modules.Cvs.Error}"/>
|
| 428 |
</target>
|
| 429 |
|
| 430 |
<!-- =============================================================
|
| 431 |
target: configure
|
| 432 |
Configures the build with properties from the properties file
|
| 433 |
============================================================= -->
|
| 434 |
<target name="configure" description="--> Configures the build with properties from properties file.">
|
| 435 |
<if><isset property="basePropertiesFile"/><then>
|
| 436 |
<property name="build.basePropertiesFile" value="${dast.home}${php.directory_separator}${basePropertiesFile}" /> <!--Use properties from specified base properties file -->
|
| 437 |
<echo>Loading base properties from: ${build.propertiesFile}...</echo>
|
| 438 |
</then>
|
| 439 |
<else>
|
| 440 |
<property name="build.basePropertiesFile" value="${dast.home}${php.directory_separator}dast-patch-base.properties" /> <!--Use default properties file -->
|
| 441 |
<echo>No base properties file specified. Loading base properties from default: ${build.basePropertiesFile}...</echo>
|
| 442 |
</else>
|
| 443 |
</if>
|
| 444 |
|
| 445 |
<available file="${build.basePropertiesFile}" property="build.basePropertiesFileExists"/>
|
| 446 |
<if><not><isset property="build.basePropertiesFileExists"/></not><then>
|
| 447 |
<warn>The file ${build.basePropertiesFile} could not be found. Only user properties file can be loaded</warn>
|
| 448 |
</then>
|
| 449 |
<else>
|
| 450 |
<property file="${build.basePropertiesFile}" override="false"/>
|
| 451 |
<echo>Loaded base properties from ${build.basePropertiesFile}.</echo>
|
| 452 |
</else>
|
| 453 |
</if>
|
| 454 |
|
| 455 |
<if><isset property="propertiesFile"/><then>
|
| 456 |
<property name="build.propertiesFile" value="${dast.home}${php.directory_separator}${propertiesFile}" /> <!--Use user properties from specified file -->
|
| 457 |
</then>
|
| 458 |
<else>
|
| 459 |
<property name="build.propertiesFile" value="${dast.home}${php.directory_separator}dast-patch.properties" /> <!--Use default user properties file -->
|
| 460 |
<echo>No user properties file specified. Loading user properties from default: ${build.propertiesFile}...</echo>
|
| 461 |
</else>
|
| 462 |
</if>
|
| 463 |
|
| 464 |
<available file="${build.propertiesFile}" property="build.propertiesFileExists"/>
|
| 465 |
<if><not><isset property="build.propertiesFileExists"/></not><then>
|
| 466 |
<if><not><isset property="build.basePropertiesFileExists"/></not><then>
|
| 467 |
<fail>Neither the base properties ${build.basePropertiesFile} or the user properties file ${build.propertiesFile} could be found. Stopping.</fail>
|
| 468 |
</then>
|
| 469 |
<else>
|
| 470 |
<echo>User properties file not found. Only properties from base properties file are loaded.</echo>
|
| 471 |
</else>
|
| 472 |
</if>
|
| 473 |
</then>
|
| 474 |
<else>
|
| 475 |
<property file="${build.propertiesFile}" override="true"/>
|
| 476 |
<echo>Loaded user properties from ${build.propertiesFile}.</echo>
|
| 477 |
</else>
|
| 478 |
</if>
|
| 479 |
|
| 480 |
<if><not><isset property="build.log.defaultdir"/></not><then>
|
| 481 |
<fail>build.log.defaultdir property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 482 |
</then>
|
| 483 |
</if>
|
| 484 |
<available file="${build.log.defaultdir}" property="build.log.defaultdirExists"/>
|
| 485 |
<if><not><isset property="build.log.defaultdirExists"/></not><then>
|
| 486 |
<echo>${build.log.defaultdir} doesn't exist, attempting to create...</echo>
|
| 487 |
<mkdir dir="${build.log.defaultdir}"/>
|
| 488 |
</then>
|
| 489 |
</if>
|
| 490 |
|
| 491 |
<if>
|
| 492 |
<not><isset property="drupal.dir"/></not>
|
| 493 |
<then>
|
| 494 |
<fail>drupal.dir property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 495 |
</then>
|
| 496 |
</if>
|
| 497 |
<if>
|
| 498 |
<not><isset property="drupal.database.driver"/></not>
|
| 499 |
<then>
|
| 500 |
<fail>drupal.database.driver property not set, check the properties files for omissions or bad syntax</fail>
|
| 501 |
</then>
|
| 502 |
</if>
|
| 503 |
|
| 504 |
<if>
|
| 505 |
<not><isset property="drupal.database.host"/></not>
|
| 506 |
<then>
|
| 507 |
<fail>drupal.database.host property not set, check the properties files for omissions or bad syntax</fail>
|
| 508 |
</then>
|
| 509 |
</if>
|
| 510 |
|
| 511 |
<if>
|
| 512 |
<not><isset property="drupal.database.name"/></not>
|
| 513 |
<then>
|
| 514 |
<fail>drupal.database.name property not set, check the properties files for omissions or bad syntax</fail>
|
| 515 |
</then>
|
| 516 |
</if>
|
| 517 |
|
| 518 |
<if>
|
| 519 |
<not><isset property="drupal.database.user"/></not>
|
| 520 |
<then>
|
| 521 |
<fail>drupal.database.user property not set, check the properties files for omissions or bad syntax</fail>
|
| 522 |
</then>
|
| 523 |
</if>
|
| 524 |
|
| 525 |
<if>
|
| 526 |
<not><isset property="drupal.database.user.host"/></not>
|
| 527 |
<then>
|
| 528 |
<fail>drupal.database.user.host property not set, check the properties files for omissions or bad syntax</fail>
|
| 529 |
</then>
|
| 530 |
</if>
|
| 531 |
|
| 532 |
<if>
|
| 533 |
<not><isset property="drupal.database.user.pass"/></not>
|
| 534 |
<then>
|
| 535 |
<fail>drupal.database.user.pass property not set, check the properties files for omissions or bad syntax</fail>
|
| 536 |
</then>
|
| 537 |
</if>
|
| 538 |
|
| 539 |
<if>
|
| 540 |
<not><isset property="drupal.database.CreateScript.user"/></not>
|
| 541 |
<then>
|
| 542 |
<fail>drupal.database.CreateScript.user property not set, check the properties files for omissions or bad syntax</fail>
|
| 543 |
</then>
|
| 544 |
</if>
|
| 545 |
|
| 546 |
<if>
|
| 547 |
<not><isset property="drupal.database.CreateScript.user.pass"/></not>
|
| 548 |
<then>
|
| 549 |
<fail>drupal.database.CreateScript.user.pass property not set, check the properties files for omissions or bad syntax</fail>
|
| 550 |
</then>
|
| 551 |
</if>
|
| 552 |
|
| 553 |
<if>
|
| 554 |
<not><isset property="drupal.database.CreateScript.name"/></not>
|
| 555 |
<then>
|
| 556 |
<fail>drupal.database.CreateScript.name not set, check the properties files for omissions or bad syntax</fail>
|
| 557 |
</then>
|
| 558 |
</if>
|
| 559 |
|
| 560 |
<property name="drupal.database.url" value="${drupal.database.driver}://${drupal.database.user}:${drupal.database.user.pass}@${drupal.database.host}/${drupal.database.name}" />
|
| 561 |
<property name="drupal.database.Url" value="${drupal.database.driver}://${drupal.database.user}:${drupal.database.user.pass}@${drupal.database.host}/${drupal.database.name}" />
|
| 562 |
<property name="drupal.database.CreateUrl" value="${drupal.database.driver}://${drupal.database.CreateScript.user}:${drupal.database.CreateScript.user.pass}@${drupal.database.host}/${drupal.database.CreateScript.name}" />
|
| 563 |
|
| 564 |
<if>
|
| 565 |
<not><isset property="drupal.core.method"/></not>
|
| 566 |
<then>
|
| 567 |
<fail>drupal.core.method property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 568 |
</then>
|
| 569 |
</if>
|
| 570 |
<if>
|
| 571 |
<not><isset property="drupal.modules.method"/></not>
|
| 572 |
<then>
|
| 573 |
<fail>drupal.modules.method property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 574 |
</then>
|
| 575 |
</if>
|
| 576 |
<if>
|
| 577 |
<not><isset property="patch.file"/></not>
|
| 578 |
<then>
|
| 579 |
<fail>patch.file property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 580 |
</then>
|
| 581 |
</if>
|
| 582 |
<if><not><isset property="patch.method"/></not>
|
| 583 |
<then>
|
| 584 |
<fail>patch.method property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 585 |
</then>
|
| 586 |
</if>
|
| 587 |
<if><not><isset property="drupal.settings.addDbUrl"/></not>
|
| 588 |
<then>
|
| 589 |
<fail>drupal.settings.addDbUrl property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 590 |
</then>
|
| 591 |
</if>
|
| 592 |
<if><not><isset property="drupal.install"/></not>
|
| 593 |
<then>
|
| 594 |
<fail>drupal.install property not set, check the ${propertiesFile} file for omissions or bad syntax</fail>
|
| 595 |
</then>
|
| 596 |
</if>
|
| 597 |
|
| 598 |
</target>
|
| 599 |
|
| 600 |
</project>
|