drupal/drupal.spec

Sat, 27 Oct 2012 17:19:03 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 27 Oct 2012 17:19:03 +0200
changeset 748
7548d72a64e3
parent 734
6f237b68bce5
child 750
0e7016e69724
permissions
-rw-r--r--

Update version adjusting patch logic accordingly, correctly create
installation hierarchy, and introduce apache-php::with_xmlwriter
dependency required by rather important XML sitemap logic.

michael@529 1 ##
michael@529 2 ## drupal.spec -- OpenPKG RPM Package Specification
michael@529 3 ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@529 4 ##
michael@529 5 ## Permission to use, copy, modify, and distribute this software for
michael@529 6 ## any purpose with or without fee is hereby granted, provided that
michael@529 7 ## the above copyright notice and this permission notice appear in all
michael@529 8 ## copies.
michael@529 9 ##
michael@529 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@529 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@529 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@529 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@529 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@529 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@529 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@529 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@529 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@529 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@529 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@529 21 ## SUCH DAMAGE.
michael@529 22 ##
michael@529 23
michael@529 24 # package information
michael@529 25 Name: drupal
michael@529 26 Summary: Content Management Platform
michael@529 27 URL: http://www.drupal.org/
michael@529 28 Vendor: Dries Buytaert et al.
michael@529 29 Packager: OpenPKG Foundation e.V.
michael@529 30 Distribution: OpenPKG Community
michael@529 31 Class: PLUS
michael@529 32 Group: CMS
michael@529 33 License: GPL
michael@748 34 Version: 7.16
michael@530 35 Release: 20120800
michael@529 36
michael@529 37 # package options
michael@529 38 %option with_mysql yes
michael@529 39 %option with_pgsql no
michael@529 40 %option with_dcron no
michael@529 41
michael@529 42 # checking for option conflicts
michael@529 43 %if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no"
michael@530 44 %{error:one of the buildtime options 'with_mysql' or 'with_pgsql' have to be enabled}
michael@529 45 %endif
michael@529 46 %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
michael@530 47 %{error:only one of the buildtime options 'with_mysql' or 'with_pgsql' can be enabled at a time}
michael@529 48 %endif
michael@529 49
michael@529 50 # list of sources
michael@530 51 Source0: ftp://ftp.drupal.org/pub/drupal/files/projects/drupal-%{version}.tar.gz
michael@529 52 Source1: drupal-setup.sh
michael@529 53 Source2: drupal-cron.sh
michael@529 54 Source3: drupal-apache.conf
michael@529 55 Source4: rc.drupal
michael@529 56 Patch0: drupal.patch
michael@529 57
michael@529 58 # build information
michael@529 59 BuildPreReq: OpenPKG, openpkg >= 20100101, infozip
michael@529 60 PreReq: OpenPKG, openpkg >= 20100101
michael@529 61 PreReq: pcre, pcre::with_utf8
michael@529 62 PreReq: apache
michael@529 63 PreReq: apache::with_mod_deflate = yes
michael@529 64 PreReq: apache-php
michael@529 65 PreReq: apache-php::with_ctype = yes
michael@529 66 PreReq: apache-php::with_gd = yes
michael@529 67 PreReq: apache-php::with_mbstring = yes
michael@529 68 PreReq: apache-php::with_session = yes
michael@529 69 PreReq: apache-php::with_mm = yes
michael@529 70 PreReq: apache-php::with_xml = yes
michael@748 71 PreReq: apache-php::with_xmlwriter = yes
michael@529 72 PreReq: apache-php::with_xslt = yes
michael@529 73 PreReq: apache-php::with_sendmail = yes
michael@529 74 %if "%{with_mysql}" == "yes"
michael@529 75 PreReq: apache-php::with_mysql = yes
michael@529 76 %endif
michael@529 77 %if "%{with_pgsql}" == "yes"
michael@529 78 PreReq: apache-php::with_pgsql = yes
michael@529 79 %endif
michael@529 80 %if "%{with_dcron}" == "yes"
michael@529 81 PreReq: dcron
michael@529 82 %endif
michael@529 83 PreReq: MTA
michael@529 84
michael@529 85 %description
michael@529 86 Drupal is a dynamic web site platform which allows an individual
michael@529 87 or community of users to publish, manage and organize a
michael@530 88 variety of content. Drupal integrates many popular features of
michael@529 89 content management systems, weblogs, collaborative tools and
michael@530 90 discussion based community software into one easy to use package.
michael@529 91
michael@529 92 %track
michael@529 93 prog drupal = {
michael@529 94 version = %{version}
michael@529 95 url = http://ftp.drupal.org/files/projects/
michael@530 96 regex = drupal-(\d\.\d+)\.tar\.gz
michael@529 97 }
michael@529 98
michael@529 99 %prep
michael@529 100 # unpack core distribution
michael@529 101 %setup -q -n drupal-%{version}
michael@529 102
michael@529 103 # apply local patches
michael@529 104 %patch -p0
michael@529 105
michael@529 106 %build
michael@529 107
michael@529 108 %install
michael@529 109 # create installation hierarchy
michael@529 110 %{l_shtool} mkdir -f -p -m 755 \
michael@529 111 $RPM_BUILD_ROOT%{l_prefix}/sbin \
michael@529 112 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
michael@748 113 $RPM_BUILD_ROOT%{l_prefix}/etc/drupal \
michael@529 114 $RPM_BUILD_ROOT%{l_prefix}/share/drupal \
michael@529 115 $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \
michael@529 116 $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \
michael@529 117 $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \
michael@529 118 $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \
michael@529 119 $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db
michael@529 120
michael@529 121 # avoid copying unnecessary text files
michael@529 122 find . -name "*.orig" -print | xargs rm -f
michael@529 123 rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt
michael@529 124 rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt
michael@529 125
michael@529 126 # install all files (and strip down installation afterwards)
michael@529 127 cp -rp * .htaccess \
michael@529 128 $RPM_BUILD_ROOT%{l_prefix}/share/drupal/
michael@529 129
michael@529 130 # set data location
michael@529 131 ln -s ../../../../var/drupal/files \
michael@529 132 $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files
michael@529 133
michael@530 134 # install runcommand script
michael@529 135 %if "%{with_dcron}" == "yes"
michael@529 136 l_drupal_cron="no"
michael@529 137 %else
michael@529 138 l_drupal_cron="yes"
michael@529 139 %endif
michael@529 140 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@529 141 -e "s;@l_drupal_cron@;$l_drupal_cron;g" \
michael@529 142 %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@529 143
michael@529 144 # install database setup script
michael@529 145 %if "%{with_mysql}" == "yes"
michael@529 146 l_dbtype="mysql"
michael@529 147 %endif
michael@529 148 %if "%{with_pgsql}" == "yes"
michael@529 149 l_dbtype="pgsql"
michael@529 150 %endif
michael@529 151 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@529 152 -e "s;@l_dbtype@;$l_dbtype;g" \
michael@529 153 -e "s;@l_bash@;%{l_bash};g" \
michael@529 154 %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup
michael@529 155
michael@529 156 # install crond(8) job script
michael@529 157 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@529 158 %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron
michael@529 159 %if "%{with_dcron}" == "yes"
michael@529 160 %{l_shtool} mkdir -f -p -m 755 \
michael@529 161 $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs
michael@529 162 echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \
michael@529 163 >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal
michael@529 164 %endif
michael@529 165
michael@529 166 # install custom Apache configuration
michael@529 167 l_hostname=`%{l_shtool} echo -e %h`
michael@529 168 l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
michael@529 169 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@529 170 -e "s;@l_hostname@;$l_hostname;g" \
michael@529 171 -e "s;@l_domainname@;$l_domainname;g" \
michael@529 172 %{SOURCE drupal-apache.conf} \
michael@529 173 $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/
michael@529 174
michael@529 175 # determine installation files
michael@529 176 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@529 177 %{l_files_std} \
michael@529 178 '%config %{l_prefix}/etc/drupal' \
michael@529 179 %if "%{with_dcron}" == "yes"
michael@529 180 '%not %dir %{l_prefix}/etc/dcron' \
michael@529 181 '%not %dir %{l_prefix}/etc/dcron/crontabs' \
michael@529 182 '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \
michael@529 183 %endif
michael@529 184 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \
michael@529 185 '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \
michael@529 186 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal'
michael@529 187
michael@529 188 %files -f files
michael@529 189
michael@529 190 %clean
michael@529 191
michael@529 192 %post
michael@529 193 if [ $1 -eq 1 ]; then
michael@529 194 # display final hints on initial installation
michael@529 195 ( echo "1. To complete this installation of Drupal please start the RDBMS"
michael@529 196 echo " and initialize the Drupal database like this:"
michael@529 197 %if "%{with_mysql}" == "yes"
michael@529 198 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
michael@529 199 %endif
michael@529 200 %if "%{with_pgsql}" == "yes"
michael@529 201 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
michael@529 202 %endif
michael@529 203 echo " \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install"
michael@529 204 echo ""
michael@529 205 echo "2. Now start Drupal by running the command"
michael@529 206 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start"
michael@529 207 echo " and connect with a browser to the URL:"
michael@529 208 echo " http://127.0.0.1:8080/drupal/install.php"
michael@529 209 echo " Follow the instructions. On the page \"Database configuration\""
michael@529 210 %if "%{with_mysql}" == "yes"
michael@529 211 echo " use database type \"mysql\", database name \"drupal\", database"
michael@529 212 %endif
michael@529 213 %if "%{with_pgsql}" == "yes"
michael@529 214 echo " use database type \"pgsql\", database name \"drupal\", database"
michael@529 215 %endif
michael@529 216 echo " username \"drupal\" and database password \"drupal\". Also create"
michael@529 217 echo " an account and login. The first account will automatically become"
michael@529 218 echo " the main administrator account with total control over Drupal."
michael@529 219 echo ""
michael@529 220 echo "3. By default, Drupal runs its own Apache server on IPv4 address"
michael@529 221 echo " 127.0.0.1, TCP port 8080. Please change this by editing the"
michael@529 222 echo " \"Listen 127.0.0.1:8080\" directive in"
michael@529 223 echo " $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf"
michael@529 224 echo " Also do not forget to cp -p"
michael@529 225 echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php"
michael@529 226 echo " $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php"
michael@529 227 echo " and adjust the \$base_url variable."
michael@529 228 echo ""
michael@529 229 echo "4. Access Drupal via:"
michael@529 230 echo " http://127.0.0.1:8080/drupal/ (website view)"
michael@529 231 echo " http://127.0.0.1:8080/drupal/admin (website admin)"
michael@529 232 ) | %{l_rpmtool} msg -b -t notice
michael@529 233 fi
michael@529 234 if [ $1 -eq 2 ]; then
michael@529 235 # display final hints on update installation
michael@529 236 ( echo "Please perform a Drupal database upgrade by visiting the"
michael@529 237 echo " http://127.0.0.1:8080/drupal/update.php"
michael@529 238 echo "page on your Drupal website."
michael@529 239 ) | %{l_rpmtool} msg -b -t notice
michael@529 240
michael@529 241 # after upgrade, restart service
michael@529 242 eval `%{l_rc} drupal status 2>/dev/null`
michael@529 243 [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart
michael@529 244 fi
michael@529 245 exit 0
michael@529 246
michael@529 247 %preun
michael@529 248 if [ $1 -eq 0 ]; then
michael@529 249 # before erase, stop service and remove log files
michael@529 250 %{l_rc} drupal stop 2>/dev/null
michael@529 251 $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true
michael@529 252 rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true
michael@529 253 rm -f $RPM_INSTALL_PREFIX/var/drupal/log/* >/dev/null 2>&1 || true
michael@529 254 rm -f $RPM_INSTALL_PREFIX/var/drupal/run/* >/dev/null 2>&1 || true
michael@529 255 rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/* >/dev/null 2>&1 || true
michael@529 256 rm -f $RPM_INSTALL_PREFIX/var/drupal/db/* >/dev/null 2>&1 || true
michael@529 257 fi
michael@529 258 exit 0
michael@529 259

mercurial