1# 2# This Makefile helps create the directory structure on ftp-master, 3# making staging builds a bit more sane. 4# 5# You probably do not want to use this. Really. 6# You have been warned. 7# 8# Seriously. 9# 10# Don't use this unless you know why you're using it. 11# 12# 13 14.include "${.CURDIR}/Makefile" 15 16RELEASEDIR?= /R 17FTPDIR?= ${RELEASEDIR}/ftp-stage 18.if exists(${RELEASEDIR}) 19STAGE_TARGETS?= iso-images-stage 20.endif 21 22.if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD)) 23. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" || ${TARGET:Mriscv*} != "" 24EMBEDDED= 1 25. endif 26.endif 27 28# snapshot 29.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != "" 30SNAPSHOT= 1 31TLD?= ${FTPDIR}/snapshots 32.if !defined(BUILDDATE) || empty(BUILDDATE) 33BUILDDATE!= date +%Y%m%d 34.endif 35_SNAP_SUFFIX:= ${BUILDDATE}-${GITREV}-${GITCOUNT} 36.else 37# release 38SNAPSHOT= 39TLD?= ${FTPDIR}/releases 40.endif 41 42.if defined(EMBEDDED) && !empty(EMBEDDED) 43. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == "aarch64") || ${TARGET:Mriscv*} != "" 44. if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != "" 45SNAPSHOT= 1 46. endif 47IMAGES:= img 48. endif # arm/armv6 49.endif # embedded 50 51.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 52STAGE_TARGETS+= vm-images-stage 53VM_DIR= ${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH} 54.endif 55 56.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) 57STAGE_TARGETS+= ci-images-stage 58CI_DIR= ${TLD}/CI-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH} 59.endif 60 61.if defined(WITH_OCIIMAGES) && !empty(WITH_OCIIMAGES) 62STAGE_TARGETS+= oci-images-stage 63OCI_DIR= ${TLD}/OCI-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH} 64.endif 65 66CLEANFILES+= ${STAGE_TARGETS} 67CHECKSUM_FILES?= SHA512 SHA256 68SNAP_SUFFIX!= echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' ' 69ISO_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION} 70FTP_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/${REVISION}-${BRANCH} 71 72remove-old-bits: 73 rm -rf ${FTPDIR} 74 75iso-images-stage: 76 mkdir -p ${ISO_DIR} 77 mkdir -p ${TLD}/ISO-IMAGES/${REVISION} 78.if defined(SNAPSHOT) && !empty(SNAPSHOT) 79 cd ${RELEASEDIR} && rm -f CHECKSUM.* 80. for IMAGE in ${IMAGES} 81. if defined(EMBEDDED) && !empty(EMBEDDED) 82 cd ${RELEASEDIR} && \ 83 mv ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \ 84 ${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 85 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz \ 86 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 87 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 88 ln -s \ 89 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 90. endif # not embedded 91. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}) 92 cd ${RELEASEDIR} && \ 93 mv ${OSRELEASE}-${IMAGE} \ 94 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 95 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} \ 96 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 97 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 98 ln -s \ 99 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 100. endif 101. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz) 102 cd ${RELEASEDIR} && \ 103 mv ${OSRELEASE}-${IMAGE}.xz \ 104 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 105 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz \ 106 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 107 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 108 ln -s \ 109 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 110. endif 111. endfor # images loop 112 cd ${RELEASEDIR} && rm -f CHECKSUM.* 113. for CHECKSUM in ${CHECKSUM_FILES} 114. if defined(EMBEDDED) && !empty(EMBEDDED) 115 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 116 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 117 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} \ 118 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 119 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 120 ln -s \ 121 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 122. else # not embedded 123 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 124 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 125 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} \ 126 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 127 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 128 ln -s \ 129 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 130. endif # 131. endfor # checksum files 132.else # not snapshot 133. for IMAGE in ${IMAGES} 134. if defined(EMBEDDED) && !empty(EMBEDDED) 135 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \ 136 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz 137 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 138 ln -s \ 139 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz 140. endif # not embedded 141. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}) 142 cd ${RELEASEDIR} && \ 143 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE} \ 144 ${ISO_DIR}/${OSRELEASE}-${IMAGE} 145 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 146 ln -s \ 147 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE} 148. endif 149. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz) 150 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz \ 151 ${ISO_DIR}/${OSRELEASE}-${IMAGE}.xz 152 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 153 ln -s \ 154 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}.xz 155. endif 156. endfor # images loop 157 cd ${RELEASEDIR} && rm -f CHECKSUM.* 158. for CHECKSUM in ${CHECKSUM_FILES} 159. if defined(EMBEDDED) && !empty(EMBEDDED) 160 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 161 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 162 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} \ 163 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 164 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 165 ln -s \ 166 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 167. else # not embedded 168 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 169 CHECKSUM.${CHECKSUM}-${OSRELEASE} 170 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} \ 171 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} 172 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 173 ln -s \ 174 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE} 175. endif 176. endfor # checksum files 177.endif # release 178.if exists(${RELEASEDIR}/ftp) 179 mkdir -p ${FTP_DIR} 180 cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR} 181 echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE 182 echo ${GITBRANCH} > ${FTP_DIR}/GITBRANCH 183 echo ${GITREV} > ${FTP_DIR}/REVISION 184 cd ${TLD}/${TARGET} && \ 185 ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \ 186 ${REVISION}-${BRANCH} 187.endif 188 189vm-images-stage: 190 mkdir -p ${VM_DIR} 191.if defined(SNAPSHOT) && !empty(SNAPSHOT) 192. if exists(${VM_DIR}/Latest) 193 rm -rf ${VM_DIR}/Latest 194. endif 195 mkdir -p ${VM_DIR}/Latest 196 mkdir -p ${VM_DIR}/${BUILDDATE} 197. for VMFORMAT in ${VMFORMATS} 198. for FS in ${VMFSLIST} 199 cd ${RELEASEDIR}/vmimages && \ 200 mv ${OSRELEASE}-${FS}.${VMFORMAT}.xz \ 201 ${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz 202 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz \ 203 ${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz 204 cd ${VM_DIR}/Latest && \ 205 ln -s ../${BUILDDATE}/${OSRELEASE}-${FS}-${SNAP_SUFFIX}.${VMFORMAT}.xz \ 206 ${OSRELEASE}-${FS}.${VMFORMAT}.xz 207. endfor 208. endfor 209. if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) 210. for CW in ${CLOUDWARE} 211. if ${CW} == BASIC-CLOUDINIT 212. for VMFORMAT in ${${CW}_FORMAT} 213. for FS in ${${CW}_FSLIST} 214 cd ${RELEASEDIR}/vmimages && \ 215 mv ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \ 216 ${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz 217 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz \ 218 ${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz 219 cd ${VM_DIR}/Latest && \ 220 ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz \ 221 ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz 222. endfor 223. endfor 224. endif 225. endfor 226. endif 227 cd ${RELEASEDIR}/vmimages && rm -f CHECKSUM.* 228. for CHECKSUM in ${CHECKSUM_FILES} 229 cd ${RELEASEDIR}/vmimages && \ 230 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 231 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 232 ${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 233 cd ${VM_DIR}/Latest && \ 234 ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 235 CHECKSUM.${CHECKSUM} 236. endfor 237.else # not snapshot 238. if exists(${VM_DIR}/Latest) 239 rm -rf ${VM_DIR}/Latest 240. endif 241 mkdir -p ${VM_DIR}/Latest 242. for VMFORMAT in ${VMFORMATS} 243. for FS in ${VMFSLIST} 244 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${FS}.${VMFORMAT}.xz \ 245 ${VM_DIR}/Latest/${OSRELEASE}-${FS}.${VMFORMAT}.xz 246. endfor 247. endfor 248. if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) 249. for CW in ${CLOUDWARE} 250. if ${CW} == BASIC-CLOUDINIT 251. for VMFORMAT in ${${CW}_FORMAT} 252. for FS in ${${CW}_FSLIST} 253 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \ 254 ${VM_DIR}/Latest/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz 255. endfor 256. endfor 257. endif 258. endfor 259. endif 260. for CHECKSUM in ${CHECKSUM_FILES} 261 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM} \ 262 ${VM_DIR}/Latest/CHECKSUM.${CHECKSUM} 263. endfor 264.endif 265 266ci-images-stage: 267 mkdir -p ${CI_DIR} 268.if defined(SNAPSHOT) && !empty(SNAPSHOT) 269. if exists(${CI_DIR}/Latest) 270 rm -rf ${CI_DIR}/Latest 271. endif 272 mkdir -p ${CI_DIR}/Latest 273 mkdir -p ${CI_DIR}/${BUILDDATE} 274. for CW in ${CLOUDWARE} 275. if ${CW} == BASIC-CI 276. for VMFORMAT in ${${CW}_FORMAT} 277. for FS in ${${CW}_FSLIST} 278 cd ${RELEASEDIR}/ciimages && \ 279 mv ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \ 280 ${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz 281 cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz \ 282 ${CI_DIR}/${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz 283 cd ${CI_DIR}/Latest && \ 284 ln -s ../${BUILDDATE}/${OSRELEASE}-${CW}-${SNAP_SUFFIX}-${FS}.${VMFORMAT}.xz \ 285 ${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz 286. endfor 287. endfor 288. endif 289. endfor 290 cd ${RELEASEDIR}/ciimages && rm -f CHECKSUM.* 291. for CHECKSUM in ${CHECKSUM_FILES} 292 cd ${RELEASEDIR}/ciimages && \ 293 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 294 cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 295 ${CI_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 296 cd ${CI_DIR}/Latest && \ 297 ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 298 CHECKSUM.${CHECKSUM} 299. endfor 300.else # not snapshot 301. if exists(${CI_DIR}/Latest) 302 rm -rf ${CI_DIR}/Latest 303. endif 304 mkdir -p ${CI_DIR}/Latest 305. for CW in ${CLOUDWARE} 306. if ${CW} == BASIC-CI 307. for VMFORMAT in ${${CW}_FORMAT} 308. for FS in ${${CW}_FSLIST} 309 cp -p ${RELEASEDIR}/ciimages/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz \ 310 ${CI_DIR}/Latest/${OSRELEASE}-${CW}-${FS}.${VMFORMAT}.xz 311. endfor 312. endfor 313. endif 314. endfor 315. for CHECKSUM in ${CHECKSUM_FILES} 316 cp -p ${RELEASEDIR}/ciimages/CHECKSUM.${CHECKSUM} \ 317 ${CI_DIR}/Latest/CHECKSUM.${CHECKSUM} 318. endfor 319.endif 320 321oci-images-stage: 322 mkdir -p ${OCI_DIR} 323.if defined(SNAPSHOT) && !empty(SNAPSHOT) 324. if exists(${OCI_DIR}/Latest) 325 rm -rf ${OCI_DIR}/Latest 326. endif 327 mkdir -p ${OCI_DIR}/Latest 328 mkdir -p ${OCI_DIR}/${BUILDDATE} 329. for _IMG in ${OCI_IMAGES} 330 cd ${RELEASEDIR}/ociimages && \ 331 mv container-image-${_IMG}.txz \ 332 ${OSRELEASE}-container-image-${SNAP_SUFFIX}-${_IMG}.txz 333 cp ${RELEASEDIR}/ociimages/${OSRELEASE}-container-image-${SNAP_SUFFIX}-${_IMG}.txz \ 334 ${OCI_DIR}/${BUILDDATE}/${OSRELEASE}-container-image-${SNAP_SUFFIX}-${_IMG}.txz 335 cd ${OCI_DIR}/Latest && \ 336 ln -s ../${BUILDDATE}/${OSRELEASE}-container-image-${SNAP_SUFFIX}-${_IMG}.txz \ 337 ${OSRELEASE}-container-image-${_IMG}.txz 338. endfor 339 cd ${RELEASEDIR}/ociimages && rm -f CHECKSUM.* 340. for CHECKSUM in ${CHECKSUM_FILES} 341 cd ${RELEASEDIR}/ociimages && \ 342 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 343 cp -p ${RELEASEDIR}/ociimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 344 ${OCI_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 345 cd ${OCI_DIR}/Latest && \ 346 ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 347 CHECKSUM.${CHECKSUM} 348. endfor 349.else # not snapshot 350. if exists(${OCI_DIR}/Latest) 351 rm -rf ${OCI_DIR}/Latest 352. endif 353 mkdir -p ${OCI_DIR}/Latest 354. for _IMG in ${OCI_IMAGES} 355 cd ${RELEASEDIR}/ociimages && \ 356 mv container-image-${_IMG}.txz \ 357 ${OSRELEASE}-container-image-${_IMG}.txz 358 cp ${RELEASEDIR}/ociimages/${OSRELEASE}-container-image-${_IMG}.txz \ 359 ${OCI_DIR}/Latest/${OSRELEASE}-container-image-${_IMG}.txz 360. endfor 361. for CHECKSUM in ${CHECKSUM_FILES} 362 cd ${RELEASEDIR}/ociimages && \ 363 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM} 364 cp -p ${RELEASEDIR}/ociimages/CHECKSUM.${CHECKSUM} \ 365 ${OCI_DIR}/Latest/CHECKSUM.${CHECKSUM} 366. endfor 367.endif 368 369ftp-stage: remove-old-bits ${STAGE_TARGETS} 370 371