forked from nuxeo/nuxeo-drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian.xml
287 lines (258 loc) · 12.3 KB
/
debian.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<project name="nuxeoDriveDebianPackage"
default="package"
xmlns:nx="urn:nuxeo-build"
xmlns:artifact="urn:nuxeo-artifact">
<taskdef resource="org/nuxeo/build/antlib.xml" uri="urn:nuxeo-build" />
<taskdef resource="org/nuxeo/build/artifact/antlib.xml"
uri="urn:nuxeo-artifact" />
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<property name="out.dir" value="${maven.project.build.directory}" />
<!-- remote host settings -->
<property name="apt.host" value="apt.nuxeo.org" />
<property name="apt.user" value="nuxeo" />
<property name="apt.pool" value="/var/www/apt.nuxeo.org/pool" />
<property name="apt.keyfile" value="${user.home}/.ssh/id_rsa" />
<property name="apt.passphrase" value="" />
<!-- Get variables from environment if set, use defaults otherwise -->
<target name="init-from-env">
<property environment="env" />
<!-- distribution settings -->
<condition property="nuxeo.version" value="${env.nuxeo.version}"
else="${maven.project.version}">
<isset property="env.nuxeo.version" />
</condition>
<!-- drive client settints -->
<loadproperties srcFile="${maven.basedir}/nuxeo-drive-client/nxdrive/__init__.py">
<filterchain>
<linecontains>
<contains value="__version__" />
</linecontains>
</filterchain>
</loadproperties>
<propertyregex property="client.defaultversion"
input="${__version__}"
regexp="'(.*)'"
select="\1" />
<condition property="client.version" value="${env.client.version}"
else="${client.defaultversion}">
<isset property="env.client.version" />
</condition>
<!-- partial package settings -->
<propertyregex property="nuxeo.shortversion"
input="${nuxeo.version}"
regexp="([0-9\.]+)(-.*)?"
select="\1" />
<condition property="package.name" value="${env.package.name}"
else="nuxeo-${nuxeo.shortversion}-drive-client">
<isset property="env.package.name" />
</condition>
<condition property="package.revision" value="${env.package.revision}"
else="01">
<isset property="env.package.revision" />
</condition>
</target>
<!-- pick deb version and destination pool from drive client version -->
<target name="init" depends="init-from-env">
<!-- Build timestamp -->
<tstamp>
<format property="build.timestamp" pattern="yyyyMMdd" />
</tstamp>
<!-- Check whether we have a snapshot -->
<if>
<not>
<isset property="package.type" />
</not>
<then>
<propertyregex property="package.snapshot.version"
input="${client.version}"
regexp="([0-9\.]+)-(SNAPSHOT|dev)"
select="\1-00+${build.timestamp}+${package.revision}" />
<if>
<isset property="package.snapshot.version" />
<then>
<property name="package.version" value="${package.snapshot.version}" />
<property name="package.type" value="snapshots" />
</then>
</if>
</then>
</if>
<!-- Check whether we have a date-based release -->
<if>
<not>
<isset property="package.type" />
</not>
<then>
<propertyregex property="package.datebased.version"
input="${client}"
regexp="([0-9\.]+)-I([0-9]{8})_(.*)"
select="\1-00+\2+\3+${package.revision}" />
<if>
<isset property="package.datebased.version" />
<then>
<property name="package.version" value="${package.datebased.version}" />
<property name="package.type" value="datebased" />
</then>
</if>
</then>
</if>
<!-- Check whether we have a release candidate -->
<if>
<not>
<isset property="package.type" />
</not>
<then>
<propertyregex property="package.rc.version"
input="${client.version}"
regexp="([0-9\.]+)-(RC[0-9]+)"
select="\1-00+${build.timestamp}+\2+${package.revision}" />
<if>
<isset property="package.rc.version" />
<then>
<property name="package.version" value="${package.rc.version}" />
<property name="package.type" value="datebased" />
</then>
</if>
</then>
</if>
<!-- Drive client release + fasttrack Nuxeo -->
<if>
<not>
<isset property="package.type" />
</not>
<then>
<!-- Check whether we have a fasttrack Nuxeo -->
<propertyregex property="package.fasttrack.version"
input="${nuxeo.version}"
regexp="([0-9]{1}\.[0-9]{1}\.[0-9]{1})"
select="\1" />
<if>
<isset property="package.fasttrack.version" />
<then>
<property name="package.version" value="${client.version}" />
<property name="package.type" value="fasttracks" />
</then>
</if>
</then>
</if>
<!-- None of the above? Drive client release + LTS Nuxeo -->
<if>
<not>
<isset property="package.type" />
</not>
<then>
<property name="package.version" value="${client.version}" />
<property name="package.type" value="releases" />
</then>
</if>
<!-- Versions in debian parlance -->
<propertyregex property="debian.version"
input="${package.version}"
regexp="([0-9\.]+)(-.*)?"
select="\1" />
<propertyregex property="debian.revision"
input="${package.version}"
regexp="([0-9\.]+)-(.*)"
select="\2"
defaultValue="${package.revision}" />
<property name="package.fullversion" value="${debian.version}-${debian.revision}" />
<!-- Lowercase name -->
<script language="javascript"><![CDATA[
var currentName = nuxeoDriveDebianPackage.getProperty("package.name");
nuxeoDriveDebianPackage.setProperty("package.name", currentName.toLowerCase());
]]></script>
<!-- Print results -->
<echo message="*** Version settings ***" />
<echo message="Nuxeo CAP version: ${nuxeo.version}" />
<echo message="Nuxeo Drive client version: ${client.version}" />
<echo message="Package name: ${package.name}" />
<echo message="Package version: ${package.version}" />
<echo message="Package type: ${package.type}" />
<echo message="Debian version: ${debian.version}" />
<echo message="Debian revision: ${debian.revision}" />
</target>
<!-- Prepare files for deb packaging -->
<target name="setup" depends="init">
<!-- Prepare structure for dpkg-buildpackage -->
<echo message="*** Prepare structure for dpkg-buildpackage ***" />
<filterset id="nxvars">
<filter token="package.name" value="${package.name}" />
<filter token="package.fullversion" value="${package.fullversion}" />
</filterset>
<copy todir="${out.dir}/${package.name}-${package.fullversion}/debian">
<fileset dir="${maven.basedir}/resources/debian">
<include name="**" />
</fileset>
<filterset refid="nxvars" />
</copy>
<move file="${out.dir}/${package.name}-${package.fullversion}/debian/nuxeo-drive-client.manpages"
tofile="${out.dir}/${package.name}-${package.fullversion}/debian/${package.name}.manpages" />
<move file="${out.dir}/${package.name}-${package.fullversion}/debian/nuxeo-drive-client.lintian-overrides"
tofile="${out.dir}/${package.name}-${package.fullversion}/debian/${package.name}.lintian-overrides" />
<!-- Add sources -->
<copy file="${maven.basedir}/setup.cfg" tofile="${out.dir}/${package.name}-${package.fullversion}/setup.cfg" />
<copy file="${maven.basedir}/setup.py" tofile="${out.dir}/${package.name}-${package.fullversion}/setup.py" />
<chmod file="${out.dir}/${package.name}-${package.fullversion}/setup.py" perm="0755" />
<copy file="${maven.basedir}/README.md" tofile="${out.dir}/${package.name}-${package.fullversion}/README.md" />
<!--<copy todir="${out.dir}/${package.name}-${package.fullversion}/nuxeo-drive-client">
<fileset dir="${maven.basedir}/nuxeo-drive-client">
<include name="**" />
</fileset>
</copy>-->
<symlink resource="${maven.basedir}/nuxeo-drive-client" link="${out.dir}/${package.name}-${package.fullversion}/nuxeo-drive-client" />
<symlink resource="${maven.basedir}/nx_cx_Freeze" link="${out.dir}/${package.name}-${package.fullversion}/nx_cx_Freeze" />
<symlink resource="${maven.basedir}/nx_esky" link="${out.dir}/${package.name}-${package.fullversion}/nx_esky" />
<symlink resource="${maven.basedir}/launcher.pyw" link="${out.dir}/${package.name}-${package.fullversion}/launcher.pyw" />
</target>
<!-- Build the package -->
<target name="binary-package" depends="setup">
<echo message="*** Build binary package ***" />
<exec dir="${out.dir}/${package.name}-${package.fullversion}"
executable="dpkg-buildpackage"
failonerror="true">
<arg value="-rfakeroot" />
<arg value="-A" />
<arg value="-uc" />
<env key="PATH" path="${maven.basedir}/bin:${env.PATH}" />
</exec>
</target>
<!-- Move resulting packages -->
<target name="move-packages" depends="binary-package">
<echo message="*** Move files to packages directory ***" />
<move file="${out.dir}/${package.name}_${package.fullversion}_all.deb" todir="${out.dir}/packages/${package.type}" />
</target>
<!-- Run lintian on the results -->
<target name="lintian" depends="move-packages">
<echo message="*** Running lintian on the binary package ***" />
<exec dir="${out.dir}/packages/${package.type}"
executable="lintian"
failonerror="true">
<arg value="-cEI" />
<arg value="${package.name}_${package.fullversion}_all.deb" />
</exec>
</target>
<!--Packaging target -->
<target name="package" depends="lintian">
</target>
<!-- deployment target -->
<!-- Note: For snapshots, this will fail if package happens before
midnight but deploy happens after midnight.
This is due to the build stamp being recalculated between executions.
-->
<target name="deploy" depends="init">
<!-- use exec tasks for scp/ssh as the ant tasks tends to hang -->
<echo message="*** Uploading binary package to apt pool ***" />
<exec dir="${out.dir}/packages/${package.type}"
executable="scp"
failonerror="true">
<arg value="${out.dir}/packages/${package.type}/${package.name}_${package.fullversion}_all.deb" />
<arg value="${apt.user}@${apt.host}:${apt.pool}/${package.type}/" />
</exec>
<!-- update script in nuxeo-packaging-debian -->
<echo message="*** Updating apt repository on apt host ***" />
<exec executable="ssh"
failonerror="true">
<arg value="${apt.user}@${apt.host}" />
<arg value="bin/update_debian_repository" />
</exec>
</target>
</project>