forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.mirrors
317 lines (303 loc) · 10.9 KB
/
Makefile.mirrors
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
#
# This Makefile helps create the directory structure on ftp-master,
# making staging builds a bit more sane.
#
# You probably do not want to use this. Really.
# You have been warned.
#
# Seriously.
#
# Don't use this unless you know why you're using it.
#
#
.include "${.CURDIR}/Makefile"
RELEASEDIR?= /R
FTPDIR?= ${RELEASEDIR}/ftp-stage
.if exists(${RELEASEDIR})
STAGE_TARGETS?= iso-images-stage
.endif
.if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD))
. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" || ${TARGET:Mriscv*} != ""
EMBEDDED= 1
. endif
.endif
# snapshot
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != ""
SNAPSHOT= 1
TLD?= ${FTPDIR}/snapshots
.if !defined(BUILDDATE) || empty(BUILDDATE)
BUILDDATE!= date +%Y%m%d
.endif
_SNAP_SUFFIX:= ${BUILDDATE}-${GITREV}-${GITCOUNT}
.else
# release
SNAPSHOT=
TLD?= ${FTPDIR}/releases
.endif
.if defined(EMBEDDED) && !empty(EMBEDDED)
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == "aarch64") || ${TARGET:Mriscv*} != ""
. if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != ""
SNAPSHOT= 1
. endif
IMAGES:= img
. endif # arm/armv6
.endif # embedded
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
STAGE_TARGETS+= vm-images-stage
VM_DIR= ${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
.endif
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE)
STAGE_TARGETS+= ci-images-stage
CI_DIR= ${TLD}/CI-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
.endif
CLEANFILES+= ${STAGE_TARGETS}
CHECKSUM_FILES?= SHA512 SHA256
SNAP_SUFFIX!= echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' '
ISO_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}
FTP_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/${REVISION}-${BRANCH}
remove-old-bits:
rm -rf ${FTPDIR}
iso-images-stage:
mkdir -p ${ISO_DIR}
mkdir -p ${TLD}/ISO-IMAGES/${REVISION}
.if defined(SNAPSHOT) && !empty(SNAPSHOT)
cd ${RELEASEDIR} && rm -f CHECKSUM.*
. for IMAGE in ${IMAGES}
. if defined(EMBEDDED) && !empty(EMBEDDED)
cd ${RELEASEDIR} && \
mv ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz \
${ISO_DIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
. endif # not embedded
. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE})
cd ${RELEASEDIR} && \
mv ${OSRELEASE}-${IMAGE} \
${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} \
${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
. endif
. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz)
cd ${RELEASEDIR} && \
mv ${OSRELEASE}-${IMAGE}.xz \
${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz \
${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz
. endif
. endfor # images loop
cd ${RELEASEDIR} && rm -f CHECKSUM.*
. for CHECKSUM in ${CHECKSUM_FILES}
. if defined(EMBEDDED) && !empty(EMBEDDED)
cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} \
${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}
. else # not embedded
cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} \
${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX}
. endif #
. endfor # checksum files
.else # not snapshot
. for IMAGE in ${IMAGES}
. if defined(EMBEDDED) && !empty(EMBEDDED)
cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
${ISO_DIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
. endif # not embedded
. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE})
cd ${RELEASEDIR} && \
cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE} \
${ISO_DIR}/${OSRELEASE}-${IMAGE}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}
. endif
. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz)
cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz \
${ISO_DIR}/${OSRELEASE}-${IMAGE}.xz
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}.xz
. endif
. endfor # images loop
cd ${RELEASEDIR} && rm -f CHECKSUM.*
. for CHECKSUM in ${CHECKSUM_FILES}
. if defined(EMBEDDED) && !empty(EMBEDDED)
cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} \
${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}
. else # not embedded
cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
CHECKSUM.${CHECKSUM}-${OSRELEASE}
cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} \
${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}
cd ${TLD}/ISO-IMAGES/${REVISION} && \
ln -s \
../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}
. endif
. endfor # checksum files
.endif # release
.if exists(${RELEASEDIR}/ftp)
mkdir -p ${FTP_DIR}
cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR}
echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE
echo ${GITBRANCH} > ${FTP_DIR}/GITBRANCH
echo ${GITREV} > ${FTP_DIR}/REVISION
cd ${TLD}/${TARGET} && \
ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \
${REVISION}-${BRANCH}
.endif
vm-images-stage:
mkdir -p ${VM_DIR}
.if defined(SNAPSHOT) && !empty(SNAPSHOT)
. if exists(${VM_DIR}/Latest)
rm -rf ${VM_DIR}/Latest
. endif
mkdir -p ${VM_DIR}/Latest
mkdir -p ${VM_DIR}/${BUILDDATE}
. for VMFORMAT in ${VMFORMATS}
. for FS in ${VMFSLIST}
cd ${RELEASEDIR}/vmimages && \
mv ${OSRELEASE}-${FS}.${VMFORMAT}.xz \
${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz
cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz
cd ${VM_DIR}/Latest && \
ln -s ../${BUILDDATE}/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz \
${OSRELEASE}-${FS}.${VMFORMAT}.xz
. endfor
. endfor
. if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE)
. for CW in ${CLOUDWARE}
. if ${CW} == BASIC-CLOUDINIT
. for VMFORMAT in ${${CW}_FORMAT}
. for FS in ${${CW}_FSLIST}
cd ${RELEASEDIR}/vmimages && \
mv ${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz \
${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
cd ${VM_DIR}/Latest && \
ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
. endfor
. endfor
. endif
. endfor
. endif
cd ${RELEASEDIR}/vmimages && rm -f CHECKSUM.*
. for CHECKSUM in ${CHECKSUM_FILES}
cd ${RELEASEDIR}/vmimages && \
${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
cd ${VM_DIR}/Latest && \
ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
CHECKSUM.${CHECKSUM}
. endfor
.else # not snapshot
. if exists(${VM_DIR}/Latest)
rm -rf ${VM_DIR}/Latest
. endif
mkdir -p ${VM_DIR}/Latest
. for VMFORMAT in ${VMFORMATS}
. for FS in ${VMFSLIST}
cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${FS}.${VMFORMAT}.xz \
${VM_DIR}/Latest/${OSRELEASE}-${FS}.${VMFORMAT}.xz
. endfor
. endfor
. if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE)
. for CW in ${CLOUDWARE}
. if ${CW} == BASIC-CLOUDINIT
. for VMFORMAT in ${${CW}_FORMAT}
. for FS in ${${CW}_FSLIST}
cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz \
${VM_DIR}/Latest/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
. endfor
. endfor
. endif
. endfor
. endif
. for CHECKSUM in ${CHECKSUM_FILES}
cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM} \
${VM_DIR}/Latest/CHECKSUM.${CHECKSUM}
. endfor
.endif
ci-images-stage:
mkdir -p ${CI_DIR}
.if defined(SNAPSHOT) && !empty(SNAPSHOT)
. if exists(${CI_DIR}/Latest)
rm -rf ${CI_DIR}/Latest
. endif
mkdir -p ${CI_DIR}/Latest
mkdir -p ${CI_DIR}/${BUILDDATE}
. for CW in ${CLOUDWARE}
. if ${CW} == BASIC-CI
. for VMFORMAT in ${${CW}_FORMAT}
. for FS in ${${CW}_FSLIST}
cd ${RELEASEDIR}/ciimages && \
mv ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \
${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
${CI_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz
cd ${CI_DIR}/Latest && \
ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}.${FS}.${VMFORMAT}.xz \
${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
. endfor
. endfor
. endif
. endfor
cd ${RELEASEDIR}/ciimages && rm -f CHECKSUM.*
. for CHECKSUM in ${CHECKSUM_FILES}
cd ${RELEASEDIR}/ciimages && \
${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
${CI_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
cd ${CI_DIR}/Latest && \
ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
CHECKSUM.${CHECKSUM}
. endfor
.else # not snapshot
. if exists(${CI_DIR}/Latest)
rm -rf ${CI_DIR}/Latest
. endif
mkdir -p ${CI_DIR}/Latest
. for CW in ${CLOUDWARE}
. if ${CW} == BASIC-CI
. for VMFORMAT in ${${CW}_FORMAT}
. for FS in ${${CW}_FSLIST}
cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \
${CI_DIR}/Latest/${OSRELEASE}-${CW}.${FS}.${VMFORMAT}.xz
. endfor
. endfor
. endif
. endfor
. for CHECKSUM in ${CHECKSUM_FILES}
cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM} \
${CI_DIR}/Latest/CHECKSUM.${CHECKSUM}
. endfor
.endif
ftp-stage: remove-old-bits ${STAGE_TARGETS}