Collect missing dependencies for openid login
[phorkie.git] / build.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <project name="phorkie" default="zip" basedir=".">
3   <!--
4     phorkie phing build file.
5     This script should provide a one-stop tool for all administrative
6     tasks around phorkie, like creating a release version,
7     tagging a release
8   -->
9   <property file="build.properties" />
10
11   <property name="version-m"  value="0.4" />
12   <property name="version"    value="0.4.0" />
13   <property name="stability"  value="alpha" />
14   <property name="releasenotes" value="
15 Version 0.3.1 - 2012-09-27
16 --------------------------
17 * Check for OpenID package in SetupCheck
18 * Fix bug #24: setupcheck: verify geshi installation
19 * Fix bug #25: setupcheck: verify markdown
20
21 Version 0.3.0 - 2012-09-27
22 --------------------------
23
24 * Fix bug #10: error when nothing submitted [cweiske]
25 * Fix bug #11: do not index edit, delete and tool pages [cweiske]
26 * Fix bug #20: elasticsearch error on deletion [cweiske]
27 * Fix bug #22: Edited pastes not in 'recently created' [cweiske]
28 * Fix bug #23: 'work dir not found' on failed remote fork [cweiske]
29 * Implement request #5: Add OpenID authentication [jnovack]
30 * Implement request #9: autodetect file type [cweiske]
31 * Implement request #12: DOAP and rel='vcs-git' support [cweiske]
32 * Implement request #13: remote forking support [cweiske]
33 * Hide additional file fields by default, button to toggle their visibility
34   [cweiske]
35 * Markdown support [jnovack]
36 * Added nginx rewrite rules to README [skl]
37 " />
38   <property name="libdir"      value="${phing.dir}/lib"/>
39   <property name="zipfile"     value="${phing.project.name}-${version}.tar.bz2" />
40   <property name="pharfile"    value="${phing.dir}/dist/${phing.project.name}-${version}.phar" />
41   <property name="pkgfile"     value="${phing.project.name}-${version}.tgz" />
42   <property name="distfile"    value="dist/${zipfile}" />
43   <property name="distpkgfile" value="dist/pear/${pkgfile}" />
44   <property name="sfproject"   value="phorkie" />
45   <property name="sffilepath"  value="p/ph/phorkie/" />
46
47   <fileset id="fs.zip" dir=".">
48    <include name="data/**"/>
49    <include name="scripts/**"/>
50    <include name="src/**"/>
51    <include name="www/**"/>
52
53    <include name="ChangeLog"/>
54    <include name="LICENSE"/>
55    <include name="NEWS.rst"/>
56    <include name="README.rst"/>
57
58    <exclude name="**/.gitignore/"/>
59    <exclude name="data/config.php"/>
60   </fileset>
61
62   <fileset id="fs.phar" dir="${phing.dir}">
63    <include name="data/**"/>
64    <include name="lib/**"/>
65    <include name="scripts/**"/>
66    <include name="src/**"/>
67    <include name="www/**"/>
68
69    <include name="ChangeLog"/>
70    <include name="README.rst"/>
71
72    <exclude name="data/config.php"/>
73    <exclude name="**/.gitignore/"/>
74    <exclude name="**/.git/"/>
75   </fileset>
76
77   <fileset id="fs.doc" dir=".">
78    <include name="README.rst"/>
79    <include name="NEWS.rst"/>
80   </fileset>
81
82   <taskdef name="d51pearpkg2" classname="phing.tasks.ext.d51PearPkg2Task" />
83
84
85   <target name="phar" depends="preparedirs,collectdeps"
86           description="Create phar file for release"
87   >
88    <delete file="${pharfile}"/>
89    <exec command="php scripts/build-rewritemap.php" dir="${phing.dir}"/>
90    <pharpackage basedir="${phing.dir}"
91                 destfile="${pharfile}"
92                 stub="${phing.dir}/src/stub-phar.php"
93                 alias="phorkie.phar"
94    >
95     <fileset refid="fs.phar"/>
96    </pharpackage>
97
98    <exec executable="bzip2" dir="${phing.dir}/dist">
99     <arg value="-kf"/>
100     <arg file="${pharfile}"/>
101    </exec>
102   </target>
103
104
105   <target name="collectdeps" description="Copy package dependencies to lib/">
106    <delete dir="${libdir}"/>
107    <mkdir dir="${libdir}"/>
108
109    <!-- requires phing >= 2.8.0 -->
110    <copy todir="${libdir}">
111     <pearPackageFileset package="pear.php.net/Cache_Lite"/><!-- OpenID -->
112     <pearPackageFileset package="pear.php.net/Console_Getopt"/>
113     <pearPackageFileset package="pear.php.net/Crypt_DiffieHellman"/><!-- OpenID -->
114     <pearPackageFileset package="pear.php.net/Date_HumanDiff"/>
115     <pearPackageFileset package="pear.geshi.org/geshi">
116      <!-- remove files that are probably not needed to save space in the .phar -->
117      <exclude name="geshi/arm.php"/>
118      <exclude name="geshi/autoit.php"/>
119      <exclude name="geshi/thinbasic.php"/>
120     </pearPackageFileset>
121     <pearPackageFileset package="pear.php.net/HTTP2"/>
122     <pearPackageFileset package="pear.php.net/HTTP_Request2"/>
123     <pearPackageFileset package="pear.php.net/MIME_Type"/>
124     <pearPackageFileset package="zustellzentrum.cweiske.de/MIME_Type_PlainDetect"/>
125     <pearPackageFileset package="zustellzentrum.cweiske.de/MIME_Type_PlainDetect" role="data"/>
126     <pearPackageFileset package="pear.michelf.com/Markdown"/>
127     <pearPackageFileset package="pear.php.net/Net_URL2"/>
128     <pearPackageFileset package="pear.php.net/OpenID"/>
129     <pearPackageFileset package="pear.php.net/Pager"/>
130     <pearPackageFileset package="pear.php.net/PEAR">
131      <include name="PEAR/Exception.php"/>
132      <include name="PEAR.php"/>
133      <include name="PEAR5.php"/>
134      <include name="OS/Guess.php"/>
135      <include name="System.php"/>
136     </pearPackageFileset>
137     <pearPackageFileset package="pear.php.net/Services_Libravatar"/>
138     <pearPackageFileset package="pear2.php.net/PEAR2_Services_Linkback"/>
139     <pearPackageFileset package="pear.php.net/Services_Yadis"/>
140     <pearPackageFileset package="pear.php.net/System_Command"/>
141     <pearPackageFileset package="pear.twig-project.org/Twig"/>
142     <pearPackageFileset package="pear.php.net/Validate"/>
143     <pearPackageFileset package="pear.php.net/VersionControl_Git"/>
144    </copy>
145   </target>
146
147
148   <target name="zip" depends="preparedirs"
149    description="Create zip file for release"
150    >
151     <!--
152       The release file is for end users, so it is safe to
153       remove anything developer-related.
154
155       Test your zip with: unzip -l phorkie-0.1.0.zip
156     -->
157     <echo msg="Creating distribution zip for phorkie ${version}"/>
158     <delete file="${distfile}" failonerror="false"/>
159     <tar compression="bzip2" destfile="${distfile}"
160          prefix="${phing.project.name}-${version}/"
161     >
162      <fileset refid="fs.zip"/>
163     </tar>
164   </target>
165
166
167
168   <target name="package" depends="check"
169    description="Creates the pear package"
170   >
171    <d51pearpkg2 dir="." baseinstalldir="/">
172      <name>phorkie</name>
173      <summary>Self-hosted pastebin software</summary>
174      <description>
175       Self-hosted pastebin software written in PHP.
176       Pastes are editable, may have multiple files and are stored in git repositories.
177      </description>
178      <channel>phorkie.sourceforge.net</channel>
179
180      <lead user="cweiske" name="Christian Weiske" email="cweiske@cweiske.de" />
181      <license>AGPL</license>
182
183      <version   release="${version}"   api="${version}" />
184      <stability release="${stability}" api="${stability}" />
185
186      <notes>${releasenotes}</notes>
187
188      <dependencies>
189        <php minimum_version="5.3.0" />
190        <pear minimum_version="1.9.0" />
191
192        <package name="Date_HumanDiff"
193                 channel="pear.php.net"
194                 minimum_version="0.4.0"
195                 />
196        <package name="HTTP_Request2"
197                 channel="pear.php.net"
198                 minimum_version="2.1.0"
199                 />
200        <package name="OpenID"
201                 channel="pear.php.net"
202                 minimum_version="0.3.3"
203                 />
204        <package name="Pager"
205                 channel="pear.php.net"
206                 minimum_version="2.4.8"
207                 />
208        <package name="Services_Libravatar"
209                 channel="pear.php.net"
210                 minimum_version="0.2.2"
211                 />
212        <package name="VersionControl_Git"
213                 channel="pear.php.net"
214                 minimum_version="0.4.4"
215                 />
216
217        <package name="geshi"
218                 channel="pear.geshi.org/geshi"
219                 minimum_version="1.0.0"
220                 />
221        <package name="Markdown"
222                 channel="pear.michelf.com"
223                 minimum_version="0.0.2"
224                 />
225        <package name="MIME_Type_PlainDetect"
226                 channel="zustellzentrum.cweiske.de"
227                 minimum_version="0.0.2"
228                 />
229        <package name="Twig"
230                 channel="pear.twig-project.org"
231                 minimum_version="1.6.0"
232                 />
233
234      </dependencies>
235
236      <!-- map directory (key) to role -->
237      <dirroles key="data">data</dirroles>
238      <dirroles key="scripts">data</dirroles>
239      <dirroles key="src">php</dirroles>
240      <dirroles key="www">www</dirroles>
241
242      <!-- do not add the following files to the package.
243           copied from excludes above -->
244      <ignore>**/.gitignore</ignore>
245      <ignore>build*</ignore>
246      <ignore>data/config.php</ignore>
247      <ignore>dist/**</ignore>
248      <ignore>*.properties</ignore>
249      <ignore>*.tgz</ignore>
250
251      <replacement path="www/www-header.php"
252       type="pear-config" from="@data_dir@" to="data_dir"
253       />
254
255
256    </d51pearpkg2>
257
258    <!-- time to fix the package.xml file since the task does not
259         allow everything we need:
260         - strip the base directory names like src, data and www
261         - remove that dumb baseinstalldir from files
262         - md5sums are generated automatically when packaging
263    -->
264    <!-- yes, we need to generate a 2nd file and move it back -->
265    <copy file="package.xml" tofile="package2.xml" overwrite="true">
266     <filterchain>
267      <replaceregexp>
268       <!-- remove md5sums -->
269       <regexp
270        pattern="md5sum=&quot;[a-z0-9]{32}&quot; "
271        replace=""
272        />
273       <!-- remove baseinstalldir for files -->
274       <regexp
275        pattern="&lt;file baseinstalldir=&quot;/&quot;"
276        replace="&lt;file"
277        />
278       <!-- install-as for different directories -->
279       <regexp
280        pattern="(&lt;file name=&quot;data/(.+?)&quot;)"
281        replace="\1 install-as=&quot;\2&quot;"
282        />
283       <regexp
284        pattern="(&lt;file name=&quot;doc/(.+?)&quot;)"
285        replace="\1 install-as=&quot;\2&quot;"
286        />
287       <regexp
288        pattern="(&lt;file name=&quot;tests/(.+?)&quot;)"
289        replace="\1 install-as=&quot;\2&quot;"
290        />
291       <regexp
292        pattern="(&lt;file name=&quot;www/(.+?)&quot;)"
293        replace="\1 install-as=&quot;phorkie/\2&quot;"
294        />
295       <regexp
296        pattern="(&lt;file name=&quot;src/(.+?)&quot;)"
297        replace="\1 install-as=&quot;\2&quot;"
298        />
299      </replaceregexp>
300     </filterchain>
301    </copy>
302    <move file="package2.xml" tofile="package.xml" overwrite="true" />
303
304    <!-- package up -->
305    <exec command="pear package" passthru="true" />
306    <move file="${pkgfile}" todir="dist/pear/" />
307
308    <delete file="package.xml" failonerror="true" />
309   </target>
310
311
312   <target name="build-docs" description="render documentation">
313    <rST format="html" uptodate="true">
314     <fileset refid="fs.doc"/>
315     <mapper type="regexp" from="^(.+?).rst$" to="dist/docs/\1.html"/>
316    </rST>
317   </target>
318
319   <target name="clean-docs" description="delete rendered documentation files">
320    <delete dir="dist/docs" includeemptydirs="yes"/>
321   </target>
322
323
324   <target name="release" depends="check,zip,package,deploy-sf"
325    description="Release the version on sourceforge"
326    >
327    <!-- meta-target -->
328   </target>
329
330
331   <!--
332   /home/frs/project/p/ph/phorkie/phorkie/v0.1/
333   /home/frs/project/p/ph/phorkie/phorkie/v0.1/phorkie-v0.1.0.zip
334   /home/frs/project/p/ph/phorkie/phorkie/v0.1/phorkie-v0.1.1.zip
335   https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download
336   -->
337   <target name="deploy-sf" depends="check,zip"
338    description="Upload release to sourceforge"
339    >
340     <delete dir="dist/deploy-sf" /><!-- make empty -->
341     <mkdir dir="dist/deploy-sf" />
342     <mkdir dir="dist/deploy-sf/v${version-m}" />
343     <copy file="${distfile}" tofile="dist/deploy-sf/v${version-m}/${zipfile}"/>
344     <!-- test
345     <exec command="rsync -av dist/deploy-sf/ /tmp/test/" escape="false" />
346     -->
347     <exec
348      command="rsync -av -e ssh dist/deploy-sf/ ${sfuser},${sfproject}@frs.sourceforge.net:/home/frs/project/${sffilepath}/${sfproject}/"
349      escape="false" checkreturn="false"
350      />
351     <!-- rsync always returns code 23 on sourceforge releases, so we
352          can't check return values -->
353   </target>
354
355
356   <target name="preparedirs">
357     <mkdir dir="dist" />
358   </target>
359
360   <target name="check" depends="preparedirs"
361    description="Check variables"
362    >
363     <fail unless="version" message="Version not defined!" />
364     <fail unless="sfuser" message="Sourceforge username not defined!" />
365     <fail unless="sfproject" message="Sourceforge project name not defined!" />
366     <fail unless="sffilepath" message="Sourceforge project file path not defined!" />
367   </target>
368
369 </project>