-
Notifications
You must be signed in to change notification settings - Fork 4
/
rpm.xml
345 lines (326 loc) · 13.5 KB
/
rpm.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<project name="rpm" default="rpm" xmlns:antcontrib="antlib:net.sf.antcontrib" basedir=".">
<property name="redline.version" value="1.2.1-SNAPSHOT" />
<property name="redline.version" value="1.1.16" />
<target name="bootstrap_redline" description="backwards compatibility">
</target>
<macrodef name="rpm">
<attribute name="user" default="cfml" />
<attribute name="source.dir" default="${dist.dir}" />
<attribute name="source.excludes" default="" />
<attribute name="target.dir" default="/opt/${distro.name}" />
<attribute name="architecture" default="NOARCH" />
<attribute name="packager" default="cfdistro" />
<attribute name="vendor" default="cfmlprojects.org" />
<attribute name="group" default="cfdistro" />
<attribute name="name" default="${distro.name}" />
<attribute name="summary" default="@{name}" />
<attribute name="description" default="@{name}" />
<attribute name="version" default="1.0.0.0" />
<attribute name="release" default="1" />
<attribute name="url" default="http://cfmlprojects.org/cfdistro" />
<attribute name="repo" default="${cfdistro.basedir}/artifacts/RPMS/noarch" />
<attribute name="keyring" default="" />
<attribute name="key" default="" />
<attribute name="passphrase" default="" />
<attribute name="useV3Signature" default="false" />
<attribute name="verbose" default="false" />
<attribute name="failonerror" default="true" />
<element name="tarfilesets" implicit="true"/>
<sequential>
<taskdef-dependency name="redline" classname="org.redline_rpm.ant.RedlineTask" groupId="org.redline-rpm" artifactId="redline" version="${redline.version}" dest="${cfdistro.lib.dir}/redline">
<exclusions>
<exclusion groupId="org.tukaani" artifactId="xz"/>
<!-- <exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/> -->
<exclusion groupId="org.apache.ant" artifactId="ant"/>
</exclusions>
</taskdef-dependency>
<antcontrib:if>
<equals arg1="@{keyring}" arg2="" />
<then>
<redline destination="@{repo}" release="@{release}" architecture="@{architecture}"
group="@{group}" name="@{name}" version="@{version}"
summary="@{summary}" description="@{description}"
packager="@{packager}" url="@{url}" vendor="@{vendor}">
<depends name="java" version=""/>
<tarfilesets />
</redline>
</then>
<else>
<echo message="signing RPM with key: @{key}"/>
<fail-if-not-available file="@{keyring}" message="no keyring: @{keyring}" />
<redline destination="@{repo}" release="@{release}" architecture="@{architecture}"
group="@{group}" name="@{name}" version="@{version}"
summary="@{summary}" description="@{description}"
packager="@{packager}" url="@{url}" vendor="@{vendor}"
privateKeyRingFile="@{keyring}" privateKeyId="@{key}"
privateKeyPassphrase="@{passphrase}" useV3Signature="@{useV3Signature}">
<depends name="java" version=""/>
<tarfilesets />
</redline>
</else>
</antcontrib:if>
</sequential>
</macrodef>
<macrodef name="rpm-sign">
<attribute name="dir"/>
<attribute name="gpgname"/>
<attribute name="passphrase"/>
<sequential>
<antcontrib:if>
<equals arg1="@{gpgname}" arg2=""/>
<then><echo message="Not signing RPM files as no gpgname was specified"/></then>
<else><echo file="${temp.dir}/rpmsign.expect"><![CDATA[ #!/usr/bin/expect -f
### rpm-sign.exp -- Sign RPMs by sending the passphrase.
log_user 0
set gpgname [lindex $argv 0]
set passphrase [lindex $argv 1]
set rpmfiles [lindex $argv 2]
set files [glob $rpmfiles]
foreach file $files {
log_user 1
puts "signing $file"
log_user 0
if [catch "spawn -noecho rpm --resign -D \"_signature gpg\" -D \"_gpg_name $gpgname\" -D \"_tmppath ${temp.dir}\" $file" reason] {
puts "failed to spawn program: $reason\n"
exit 1
}
expect {
-exact "Enter pass phrase: " {
send -- "$passphrase\r"
expect {
"Pass phrase is good." {
}
"Pass phrase check failed" {
log_user 0
puts "Failed to sign, reaseon: $expect_out(buffer)"
exit 1
}
}
}
}
expect eof
}
## end of rpm-sign.exp]]></echo>
<echo message="Signing RPMS in @{dir} with @{gpgname}"/>
<exec executable="/usr/bin/expect" dir="../" errorproperty="rpm.sign.result">
<arg value="${temp.dir}/rpmsign.expect"/>
<arg value="@{gpgname}"/>
<arg value="@{passphrase}"/>
<arg value="@{dir}/*.rpm"/>
</exec>
<echo message="${rpm.sign.result}"/>
</else>
</antcontrib:if>
</sequential>
</macrodef>
<macrodef name="rpm-create">
<attribute name="rpm.user" default="cfml" />
<attribute name="rpm.source.dir" default="${dist.dir}" />
<attribute name="rpm.source.excludes" default="" />
<attribute name="rpm.target.dir" default="/opt/${distro.name}" />
<attribute name="rpm.packager" default="cfdistro" />
<attribute name="rpm.group" default="cfdistro" />
<attribute name="rpm.name" default="${distro.name}" />
<attribute name="rpm.summary" default="@{rpm.name}" />
<attribute name="rpm.description" default="@{rpm.name}" />
<attribute name="rpm.version" default="1.0.0.0" />
<attribute name="rpm.release" default="1" />
<attribute name="rpm.url" default="http://cfmlprojects.org/cfdistro" />
<attribute name="rpm.repo" default="${cfdistro.basedir}/artifacts/RPMS/noarch" />
<attribute name="rpm.reponame" default="rpmrepo" />
<attribute name="rpm.baseurl" default="http://127.0.0.1:8088/artifacts/RPMS/noarch" />
<attribute name="rpm.keyring" default="" />
<attribute name="rpm.key" default="" />
<attribute name="rpm.passphrase" default="" />
<attribute name="failonerror" default="true" />
<element name="tarfilesets" implicit="true"/>
<sequential>
<rpm repo="@{rpm.repo}" release="@{rpm.release}"
group="@{rpm.group}" name="@{rpm.name}" version="@{rpm.version}"
summary="@{rpm.summary}" description="@{rpm.description}"
packager="@{rpm.packager}"
url="@{rpm.url}"
keyring="@{rpm.keyring}" key="@{rpm.key}"
passphrase="@{rpm.passphrase}">
<depends name="java" version=""/>
<tarfilesets />
</rpm>
<rpm-repo name="@{rpm.reponame}" baseurl="@{rpm.baseurl}" dir="${rpm.repo}" failonerror="@{failonerror}"/>
</sequential>
</macrodef>
<macrodef name="rpm-repo">
<attribute name="name" default="" />
<attribute name="baseurl" default="" />
<attribute name="dir" default="/opt/repo/RPMS/noarch" />
<attribute name="failonerror" default="true" />
<sequential>
<exec executable="createrepo" failonerror="@{failonerror}" failifexecutionfails="@{failonerror}">
<arg value="-v"/>
<arg value="-d"/>
<arg value="@{dir}"/>
</exec>
<echo message="creating @{dir}/@{name}.repo [@{name}]" />
<echo file="@{dir}/@{name}.repo">[@{name}]
name=@{name} $releasever - $basearch
failovermethod=priority
baseurl=@{baseurl}
enabled=1
metadata_expire=7d
gpgcheck=1
</echo>
</sequential>
</macrodef>
<macrodef name="cfdistro-rpm">
<attribute name="rpm.user" default="cfml" />
<attribute name="rpm.source.dir" default="${dist.dir}" />
<attribute name="rpm.source.excludes" default="" />
<attribute name="rpm.target.dir" default="/opt/${distro.name}" />
<attribute name="rpm.packager" default="cfdistro" />
<attribute name="rpm.group" default="cfdistro" />
<attribute name="rpm.name" default="${distro.name}" />
<attribute name="rpm.version" default="1.0.0.0" />
<attribute name="rpm.url" default="http://cfmlprojects.org/cfdistro" />
<attribute name="rpm.repo" default="${basedir}/../RPMS/noarch" />
<sequential>
<mkdir dir="@{rpm.repo}" />
<!-- make RC rpm -->
<echo file="${temp.dir}/preinstall.sh">
<![CDATA[if [ -e /home/@{rpm.user} ]; then
echo "@{rpm.user} user exists, thus not trying to add again" >&2
else
mkdir -p /home/@{rpm.user}
useradd -d /home/@{rpm.user} @{rpm.user}
fi
]]></echo>
<!-- make core rpm -->
<rpm repo="@{rpm.repo}" release="1" url="@{rpm.url}"
group="@{rpm.group}" name="@{rpm.name}" version="@{rpm.version}"
preinstallscript="${temp.dir}/preinstall.sh" packager="@{rpm.packager}"
key="${cfmlprojects.sign.key.id}" passphrase="${cfmlprojects.sign.key.passphrase}"
keyring="${cfmlprojects.sign.keyring}">
<tarfileset prefix="@{rpm.target.dir}"
dir="@{rpm.source.dir}" excludes="@{rpm.source.excludes}"
filemode="644" username="@{rpm.user}" group="@{rpm.user}" />
</rpm>
</sequential>
</macrodef>
<target name="rpm">
<mkdir dir="rpms" />
<!-- make RC rpm -->
<property name="rpm.user" value="railo" />
<echo file="${temp.dir}/preinstall.sh"><![CDATA[if [ -e /home/${rpm.user} ]; then
echo "${rpm.user} user exists, thus not trying to add again" >&2
else
mkdir -p /home/${rpm.user}
useradd -d /home/${rpm.user} ${rpm.user}
fi
]]></echo>
<property name="rpm.railo.dir" value="/opt/railo/${railo.build.version.major}" />
<property name="rpm.packager" value="Railo" />
<!-- make libs rpm -->
<rpm repo="rpms" release="1"
group="org.getrailo" name="railo-libs" version="${railo.build.version.major}"
preinstallscript="${temp.dir}/preinstall.sh" packager="${rpm.packager}"
url="http://getrailo.org">
<tarfileset dir="${railo.lib.dir}" prefix="${rpm.railo.dir}/libs"
filemode="644" username="railo" group="railo" excludes=".classpath, .project" />
<link path="/opt/railo/libs" target="${rpm.railo.dir}/libs" />
</rpm>
<!-- make core rpm -->
<rpm repo="rpms"
provides="railo" release="1"
group="org.getrailo" name="railo-core" version="${railo.build.version.long}"
preinstallscript="${temp.dir}/preinstall.sh" packager="${rpm.packager}"
url="http://getrailo.org">
<tarfileset prefix="${rpm.railo.dir}/railo-server/patches"
file="${railobuild.dist.dir}/rc/${railo.build.version.long}.rc"
filemode="644" username="${rpm.user}" group="${rpm.user}" />
<depends name="railo-libs" version="${railo.build.version.major}"/>
<link path="/opt/railo/railo-server" target="${rpm.railo.dir}/railo-server"/>
</rpm>
<!-- make runner rpm -->
<echo file="${temp.dir}/postinstall.sh"><![CDATA[echo "java -jar runwar.jar" > ${rpm.railo.dir}/railo.sh]]>
</echo>
<antcontrib:var name="runwar.jar.location" value="${temp.dir}/runwar.jar" />
<antcontrib:runtarget target="runwar.jetty.jar" />
<rpm repo="rpms" release="1"
group="org.getrailo" name="railo-runner" version="${railo.build.version.long}"
postinstallscript="${temp.dir}/postinstall.sh" packager="${rpm.packager}"
url="http://getrailo.org">
<tarfileset file="${temp.dir}/runwar.jar" prefix="${rpm.railo.dir}/runner"
filemode="644" username="railo" group="railo" excludes=".classpath, .project" />
<tarfileset dir="${basedir}/resource/railo-war-template" prefix="${rpm.railo.dir}/webroot"
filemode="644" username="railo" group="railo"/>
<depends name="railo" version=""/>
</rpm>
</target>
<target name="cfdistro.rpm">
<property name="rpm.user" value="cfml" />
<property name="rpm.source.dir" value="${dist.dir}" />
<property name="rpm.target.dir" value="/opt/${distro.name}" />
<property name="rpm.packager" value="cfdistro" />
<property name="rpm.group" value="cfdistro" />
<property name="rpm.name" value="${distro.name}" />
<property name="rpm.version" value="1.0.0.0" />
<property name="rpm.url" value="http://cfmlprojects.org/cfdistro" />
<property name="rpm.repo" value="${basedir}/../RPMS/noarch" />
<cfdistro-rpm
rpm.summary="cfdistro"
rpm.description="ant-based build tool"
rpm.user="${rpm.user}"
rpm.source.dir="${rpm.source.dir}"
rpm.target.dir="${rpm.target.dir}"
rpm.packager="${rpm.packager}"
rpm.group="${rpm.group}"
rpm.name="${rpm.name}"
rpm.version="${rpm.version}"
rpm.url="${rpm.url}"
rpm.repo="${rpm.repo}"
/>
</target>
<target name="add.rpmrepo.cfmlprojects">
<echo file="/etc/yum.repos.d/cfmlprojects.repo" message="[cfmlprojects]
name=cfmlprojects
baseurl=http://cfmlprojects.org/artifacts/RPMS/noarch
enabled=1
gpgcheck=0" />
</target>
<target name="cfdistro.rpm.repo">
<property name="rpm.repo.dir" value="/opt/repo/RPMS/noarch" />
<copy todir="${rpm.repo.dir}" overwrite="true">
<fileset dir="${temp.dir}/rpmbuild/RPMS/noarch" />
</copy>
<rpm-repo dir="${rpm.repo.dir}" />
</target>
<!--
<target name="cfdistro.rpm" depends="startscripts.create">
<property name="distro.name" value="cfdistro" />
<property name="distro.version" value="3.33" />
<property name="rpm.user" value="cfml" />
<property name="rpm.prefix" value="/home/cfml" />
<delete dir="${temp.dir}/rpmbuild"/>
<mkdir dir="${temp.dir}/rpmbuild" />
<mkdir dir="${temp.dir}/rpmbuild/SOURCES/" />
<mkdir dir="${temp.dir}/rpmbuild/SPECS/" />
<mkdir dir="${temp.dir}/rpmbuild/SRPMS/" />
<mkdir dir="${temp.dir}/rpmbuild/BUILD/" />
<mkdir dir="${temp.dir}/rpmbuild/RPMS" />
<mkdir dir="${temp.dir}/rpmbuild/RPMS/noarch" />
<echo file="${dist.dir}/${distro.name}/postinst.sh" message='cd $(dirname $0);echo "fart" > fartrock.txt' />
<property name="rpm.post" value="sh /home/cfml/${distro.name}/postinst.sh" />
<tar destfile="${temp.dir}/rpmbuild/SOURCES/release.tar.gz" compression="gzip">
<tarfileset dir="${dist.dir}" excludes="${cfdistro.dist.excludes}" prefix="${distro.name}-${distro.version}" />
</tar>
<copy file="${cfdistro.basedir}/rpmbuild/cfdistro.spec" tofile="${temp.dir}/rpmbuild/SPECS/${distro.name}.spec" overwrite="true">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<rpm
specFile="${distro.name}.spec"
topDir="${temp.dir}/rpmbuild/"
cleanBuildDir="true"
failOnError="true"/>
</target>
-->
</project>