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# $FreeBSD$ 13# 14 15.include "${.CURDIR}/Makefile" 16 17RELEASEDIR?= /R 18FTPDIR?= ${RELEASEDIR}/ftp-stage 19.if exists(${RELEASEDIR}) 20STAGE_TARGETS?= iso-images-stage 21.endif 22SRCBRANCH!= ${SVN_CMD} info --show-item relative-url ${WORLDDIR} 23 24.if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD)) 25. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" 26EMBEDDED= 1 27. endif 28.endif 29 30# snapshot 31.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != "" 32SNAPSHOT= 1 33TLD?= ${FTPDIR}/snapshots 34. if !defined(SVNREVISION) || empty(SVNREVISION) 35. for _D in /usr/bin /usr/local/bin 36. for _S in svnversion svnliteversion 37. if exists(${_D}/${_S}) 38SVNVERSION?= ${_D}/${_S} 39. endif 40. endfor 41. endfor 42. if exists(${SVNVERSION}) && !empty(SVNVERSION) 43SVNREVISION!= ${SVNVERSION} ${WORLDDIR}/Makefile 44. endif 45. endif # !defined(SVNREVISION) 46. if !defined(BUILDDATE) || empty(BUILDDATE) 47. if exists(${.CURDIR}/${.OBJDIR}/dist/base/bin/sh) 48BUILDDATE!= cd ${.CURDIR} && date -j -f '%s' $$(stat -f "%c" ${.OBJDIR}/dist/base/bin/sh) +%Y%m%d 49. else 50BUILDDATE!= date +%Y%m%d 51. endif 52. endif 53_SNAP_SUFFIX:= ${BUILDDATE}-r${SVNREVISION} 54.else 55# release 56SNAPSHOT= 57TLD?= ${FTPDIR}/releases 58.endif 59 60.if defined(EMBEDDED) && !empty(EMBEDDED) 61. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == "aarch64") 62. if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != "" 63SNAPSHOT= 1 64. endif 65IMAGES:= img 66. endif # arm/armv6 67.endif # embedded 68 69.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) 70STAGE_TARGETS+= vm-images-stage 71VM_DIR= ${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH} 72.endif 73 74CLEANFILES+= ${STAGE_TARGETS} 75CHECKSUM_FILES?= SHA512 SHA256 76SNAP_SUFFIX!= echo ${_SNAP_SUFFIX:S,^-,,1} | tr -d ' ' 77ISO_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION} 78FTP_DIR= ${TLD}/${TARGET}/${TARGET_ARCH}/${REVISION}-${BRANCH} 79 80remove-old-bits: 81 rm -rf ${FTPDIR} 82 83iso-images-stage: 84 mkdir -p ${ISO_DIR} 85 mkdir -p ${TLD}/ISO-IMAGES/${REVISION} 86.if defined(SNAPSHOT) && !empty(SNAPSHOT) 87 cd ${RELEASEDIR} && rm -f CHECKSUM.* 88. for IMAGE in ${IMAGES} 89. if defined(EMBEDDED) && !empty(EMBEDDED) 90 cd ${RELEASEDIR} && \ 91 mv ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \ 92 ${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 93 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz \ 94 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 95 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 96 ln -s \ 97 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz 98. endif # not embedded 99. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}) 100 cd ${RELEASEDIR} && \ 101 mv ${OSRELEASE}-${IMAGE} \ 102 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 103 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} \ 104 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 105 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 106 ln -s \ 107 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE} 108. endif 109. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz) 110 cd ${RELEASEDIR} && \ 111 mv ${OSRELEASE}-${IMAGE}.xz \ 112 ${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 113 cp -p ${RELEASEDIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz \ 114 ${ISO_DIR}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 115 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 116 ln -s \ 117 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}.xz 118. endif 119. endfor # images loop 120 cd ${RELEASEDIR} && rm -f CHECKSUM.* 121. for CHECKSUM in ${CHECKSUM_FILES} 122. if defined(EMBEDDED) && !empty(EMBEDDED) 123 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 124 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 125 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} \ 126 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 127 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 128 ln -s \ 129 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX} 130. else # not embedded 131 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 132 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 133 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} \ 134 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 135 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 136 ln -s \ 137 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${SNAP_SUFFIX} 138. endif # 139. endfor # checksum files 140.else # not snapshot 141. for IMAGE in ${IMAGES} 142. if defined(EMBEDDED) && !empty(EMBEDDED) 143 cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \ 144 ${ISO_DIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz 145 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 146 ln -s \ 147 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz 148. endif # not embedded 149. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}) 150 cd ${RELEASEDIR} && \ 151 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE} \ 152 ${ISO_DIR}/${OSRELEASE}-${IMAGE} 153 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 154 ln -s \ 155 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE} 156. endif 157. if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz) 158 cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz \ 159 ${ISO_DIR}/${OSRELEASE}-${IMAGE}.xz 160 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 161 ln -s \ 162 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE}.xz 163. endif 164. endfor # images loop 165 cd ${RELEASEDIR} && rm -f CHECKSUM.* 166. for CHECKSUM in ${CHECKSUM_FILES} 167. if defined(EMBEDDED) && !empty(EMBEDDED) 168 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 169 CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 170 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} \ 171 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 172 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 173 ln -s \ 174 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE}-${BOARDNAME} 175. else # not embedded 176 cd ${RELEASEDIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \ 177 CHECKSUM.${CHECKSUM}-${OSRELEASE} 178 cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} \ 179 ${ISO_DIR}/CHECKSUM.${CHECKSUM}-${OSRELEASE} 180 cd ${TLD}/ISO-IMAGES/${REVISION} && \ 181 ln -s \ 182 ../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${OSRELEASE} 183. endif 184. endfor # checksum files 185.endif # release 186.if exists(${RELEASEDIR}/ftp) 187 mkdir -p ${FTP_DIR} 188 cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR} 189 echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE 190 echo ${SRCBRANCH} > ${FTP_DIR}/SRCBRANCH 191 echo r${SVNREVISION} > ${FTP_DIR}/REVISION 192 cd ${TLD}/${TARGET} && \ 193 ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \ 194 ${REVISION}-${BRANCH} 195.endif 196 197vm-images-stage: 198 mkdir -p ${VM_DIR} 199.if defined(SNAPSHOT) && !empty(SNAPSHOT) 200. if exists(${VM_DIR}/Latest) 201 rm -rf ${VM_DIR}/Latest 202. endif 203 mkdir -p ${VM_DIR}/Latest 204 mkdir -p ${VM_DIR}/${BUILDDATE} 205. for VMFORMAT in ${VMFORMATS} 206 cd ${RELEASEDIR}/vmimages && \ 207 mv ${OSRELEASE}.${VMFORMAT}.xz \ 208 ${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz 209 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz \ 210 ${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz 211 cd ${VM_DIR}/Latest && \ 212 ln -s ../${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}.${VMFORMAT}.xz \ 213 ${OSRELEASE}.${VMFORMAT}.xz 214. endfor 215 cd ${RELEASEDIR}/vmimages && rm -f CHECKSUM.* 216. for CHECKSUM in ${CHECKSUM_FILES} 217 cd ${RELEASEDIR}/vmimages && \ 218 ${CHECKSUM:tl} ${OSRELEASE}* > CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 219 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 220 ${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} 221 cd ${VM_DIR}/Latest && \ 222 ln -s ../${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \ 223 CHECKSUM.${CHECKSUM} 224. endfor 225.else # not snapshot 226. if exists(${VM_DIR}/Latest) 227 rm -rf ${VM_DIR}/Latest 228. endif 229 mkdir -p ${VM_DIR}/Latest 230. for VMFORMAT in ${VMFORMATS} 231 cp -p ${RELEASEDIR}/vmimages/${OSRELEASE}.${VMFORMAT}.xz \ 232 ${VM_DIR}/Latest/${OSRELEASE}.${VMFORMAT}.xz 233. endfor 234. for CHECKSUM in ${CHECKSUM_FILES} 235 cp -p ${RELEASEDIR}/vmimages/CHECKSUM.${CHECKSUM} \ 236 ${VM_DIR}/Latest/CHECKSUM.${CHECKSUM} 237. endfor 238.endif 239 240ftp-stage: remove-old-bits ${STAGE_TARGETS} 241 242