10 if [ ! -f "$confdir/releaser.conf" ]; then
12 echo "Missing configuration file. Please copy $confdir/releaser.conf.txt to $confdir/releaser.conf and edit it."
15 source "$confdir/releaser.conf"
17 if [ -z "$start_point" -o -z "$version" -o -z "$first_act" ]; then
20 echo " $0 <start_point> <version> --build"
21 echo " $0 <start_point> <version> --publish"
22 echo " $0 <start_point> <version> --update"
23 echo " $0 <start_point> <version> --clean"
24 echo " $0 <start_point> <version> --build --publish --update --clean [[ORDER SIGNIFICANT]]"
26 echo " <start_point> is a branch name (e.g. \"master\")"
27 echo " <version> is Civi release (e.g. \"4.3.beta2\"); it will become a tag name"
31 if [ "`echo -n $version | tr -d 0-9.`" = '' ]; then
37 #################################################
39 function do_git_config
() {
40 git config
--global user.name
"$git_author_name"
41 git config
--global user.email
"$git_author_email"
44 #################################################
45 ## Create build directories; checkout repos
46 function do_mk_project
() {
50 "$workdir/$version/export" \
51 "$workdir/$version/gen" \
52 "$workdir/$version/tarballs" \
53 "$workdir/$version/tmp"
55 if [ ! -d "$dir" ]; then
60 $cmd_gitify all
"$git_base_url" "$workdir/$version/export" --l10n
63 #################################################
65 function do_git_tag
() {
67 for dir
in export export
/joomla export
/WordPress export
/packages
; do
69 git checkout
"$start_point"
74 for drupal_ver
in 6.x
7.x
; do
76 git checkout
"${drupal_ver}-${start_point}"
77 git tag
"${drupal_ver}-${version}"
82 #################################################
83 ## Publish tags via git
84 function do_git_tag_push
() {
86 for dir
in export export
/joomla export
/WordPress export
/packages
; do
88 git push
-f origin
"$version"
92 for drupal_ver
in 6.x
7.x
; do
94 git push
-f origin
"${drupal_ver}-${version}"
99 #################################################
101 function do_distmaker
() {
104 ## Determine SCM revision of main codebase
106 rev=$
(git rev-parse HEAD |
head -c10)
109 # create the distmaker.conf file
111 DM_SOURCEDIR=$workdir/$version/export
112 DM_GENFILESDIR=$workdir/$version/gen
113 DM_TMPDIR=$workdir/$version/tmp
114 DM_TARGETDIR=$workdir/$version/tarballs
120 DM_REF_CORE=${start_point}
121 DM_REF_DRUPAL=7.x-${start_point}
122 DM_REF_DRUPAL6=6.x-${start_point}
123 DM_REF_JOOMLA=${start_point}
124 DM_REF_WORDPRESS=${start_point}
125 DM_REF_PACKAGES=${start_point}
126 " > $workdir/$version/export
/distmaker
/distmaker.conf
128 # create a minimal civicrm.settings.php file
129 mkdir
-p $workdir/$version/export
/default
130 echo "<?php define('CIVICRM_GETTEXT_RESOURCEDIR', '$workdir/$version/export/l10n/'); define('CIVICRM_UF', 'Drupal'); global \$civicrm_root; \$civicrm_root = '$workdir/$version/export'; ?>" > $workdir/$version/export
/default
/civicrm.settings.php
132 # create a minimal settings_location.php file
133 echo "<?php define('CIVICRM_CONFDIR', '$workdir/$version/export'); ?>" > $workdir/$version/export
/settings_location.php
135 # run the exported distmaker
136 cd $workdir/$version/export
/distmaker
137 .
/distmaker.sh
$distmaker_tgt > $workdir/$version/build.log
140 #################################################
142 function do_publish
() {
144 cd $workdir/$version/tarballs
146 $cmd_md5sum *.
tar.gz
*.tgz
*.
zip > civicrm-
$version.MD5SUMS
147 echo $gpg_pass |
$cmd_gpg --armor --batch --passphrase-fd 0 --sign civicrm-
$version.MD5SUMS
149 if [ "$is_stable" ]; then
150 echo mkdir
${publish_stable_dir}/$version |
$cmd_sftp ${publish_ssh}
151 $cmd_rsync -aP --exclude='*starterkit.tgz' *.
tar.gz
*.
zip *MD5SUMS
* ${publish_ssh}:${publish_stable_dir}/$version
153 echo mkdir
${publish_latest_dir}/$version |
$cmd_sftp ${publish_ssh}
154 $cmd_rsync -aP --exclude='*starterkit.tgz' *.
tar.gz
*.
zip *MD5SUMS
* ${publish_ssh}:${publish_latest_dir}/$version
157 mv *.
tar.gz
*.tgz
*.
zip *MD5SUMS
* $build_dest
159 # publish to latest.civicrm.org
160 # FIXME: isn't this racy when doing concurrent security releases
161 if [ "$is_stable" ]; then
162 echo $version > $latest/stable.txt
164 echo $version > $latest/latest.txt
167 #################################################
168 ## Update Version Info
169 function do_update
() {
170 echo "VERSION UPDATE: Enter the version that comes after $version (or enter nothing to abort)"
172 if [ -n "$new_ver" ]; then
173 cd $workdir/$version/export
174 # create sql upgrade file
175 tpl
="CRM/Upgrade/Incremental/sql/$new_ver.mysql.tpl"
176 if [ ! -f $tpl ]; then
177 echo "{* file to handle db changes in $new_ver during upgrade *}" > $tpl
179 # escape regex special chars
180 arg
=`echo "$version" | sed 's:[]\[\^\$\.\*\/]:\\\\&:g'`
181 for file in xml
/version.xml
sql
/civicrm_generated.mysql
; do
184 sed "s/$arg/$new_ver/" < $file > $file.tmp
188 # print the diff directly to the screen
190 echo "Push these changes? y/n"
192 if [ "$input" = "y" ]; then
194 git add xml
/version.xml
sql
/civicrm_generated.mysql
$tpl
195 git commit
-m "Update version to $new_ver"
196 git push origin
"$start_point"
202 echo "No version entered. Aborting version update."
206 #################################################
208 function do_cleanup
() {
210 rm -rf export gen tmp tarballs tmp
213 #################################################
216 ## Refactoring note: this used to be one monolithic script
246 echo "unrecognized: $ACT"