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