aboutsummaryrefslogtreecommitdiff
path: root/release/Makefile.mirrors
blob: 7f0fcec09479f069d29a2e2a6f3b752ba98d09d9 (plain) (blame)
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
#
# 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.
#
# $FreeBSD$
#

.include "${.CURDIR}/Makefile"

FTPDIR?=		/ftp
RELEASEDIR?=		/R
STAGE_TARGETS?=		iso-images-stage

# snapshot
.if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT"
SNAPSHOT=		1
TLD?=			${FTPDIR}/snapshots
BUILDDATE!=		date -j -f '%s' $$(stat -f "%c" ${.OBJDIR}/dist/base/bin/sh) +%Y%m%d
. if ${TARGET} == "arm" && ${TARGET_ARCH} == "armv6"
.  if !defined(BOARDNAME) || empty(BOARDNAME)
BOARDNAME=		${KERNCONF}
.  endif
_SNAP_SUFFIX:=		-${BOARDNAME}-${BUILDDATE}
. else		# not arm/armv6
_SNAP_SUFFIX:=		-${BUILDDATE}
. endif
. for _D in /usr/bin /usr/local/bin
.  for _S in svnversion svnliteversion
.   if exists(${_D}/${_S})
SVNVERSION?=		${_D}/${_S}
.   endif
.  endfor
. endfor
. if exists(${SVNVERSION}) && !empty(SVNVERSION)
SVNREVISION!=		${SVNVERSION} ${WORLDDIR}/Makefile
_SNAP_SUFFIX:=		${_SNAP_SUFFIX}-r${SVNREVISION}
. endif
.else
# release
SNAPSHOT=
TLD?=			${FTPDIR}/releases
.endif

.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
STAGE_TARGETS+=		vm-images-stage
VM_DIR=			${TLD}/VM-IMAGES/${REVISION}-${BRANCH}/${TARGET_ARCH}
.endif

CLEANFILES+=		${STAGE_TARGETS}
CHECKSUM_FILES?=	SHA256 MD5
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 exists(${RELEASEDIR})
	@# Assume we have images to copy.
. for IMAGE in ${IMAGES}
	cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE} \
		${ISO_DIR}/${OSRELEASE}-${IMAGE}
.  if exists(${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz)
	cp -p ${RELEASEDIR}/${OSRELEASE}-${IMAGE}.xz \
		${ISO_DIR}/${OSRELEASE}-${IMAGE}.xz
.  endif
.  if exists(${RELEASEDIR}/CHECKSUM.${CHECKSUM})
	cp -p ${RELEASEDIR}/CHECKSUM.${CHECKSUM} \
		${ISO_DIR}/CHECKSUM.${CHECKSUM}
.  endif
. endfor
.endif

.if defined(SNAPSHOT) && !empty(SNAPSHOT)
. for IMAGE in ${IMAGES}
	cd ${ISO_DIR} && mv ${OSRELEASE}-${IMAGE} \
		${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
	cd ${TLD}/ISO-IMAGES/${REVISION} && \
		ln -s \
		../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${SNAP_SUFFIX}-${IMAGE}
. endfor
. for CHECKSUM in ${CHECKSUM_FILES}
.  if exists(${ISO_DIR}/CHECKSUM.${CHECKSUM})
	rm -f ${ISO_DIR}/CHECKSUM.${CHECKSUM}
.  endif
	cd ${ISO_DIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
		CHECKSUM.${CHECKSUM}-${REVISION}-${BRANCH}-${SNAP_SUFFIX}
	cd ${TLD}/ISO-IMAGES/${REVISION} && \
		ln -s \
		../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/CHECKSUM.${CHECKSUM}-${REVISION}-${BRANCH}-${SNAP_SUFFIX}
. endfor
.else	# !snapshot
	cd ${TLD}/ISO-IMAGES/${REVISION} && ln -s \
		../../${TARGET}/${TARGET_ARCH}/ISO-IMAGES/${REVISION}/${OSRELEASE}-${IMAGE} .
	cd ${ISO_DIR} && ${CHECKSUM:tl} ${OSRELEASE}* > \
		CHECKSUM.${CHECKSUM}-${REVISION}-${BRANCH}-${SNAP_SUFFIX}
.endif
.if exists(${RELEASEDIR}/ftp)
	mkdir -p ${FTP_DIR}
	cp ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR}
	cd ${TLD}/${TARGET} && \
		ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \
			${REVISION}-${BRANCH}
.endif

vm-images-stage:
	@true
#	mkdir -p ${VM_DIR}
#.if defined(SNAPSHOT) && !empty(SNAPSHOT)
#	mkdir -p ${VM_DIR}/${BUILDDATE}
#. if exists(${VM_DIR}/Latest)
#	unlink ${VM_DIR}/Latest
#	cd ${VM_DIR} && ln -s ${BUILDDATE} Latest
#. endif
#. for VMIMAGE in ${VMIMAGES}
#	cd /R/vmimages && cp -p ${VMIMAGE}.xz \
#		${VM_DIR}/${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}-${VMIMAGE}.xz
#	cd ${VM_DIR}/Latest && ln -s \
#		../${BUILDDATE}/${OSRELEASE}-${SNAP_SUFFIX}-${VMIMAGE}.xz \
#		${OSRELEASE}-${VMIMAGE}.xz
#. endfor
#. for CHECKSUM in ${CHECKSUM_FILES}
#.  if exists(${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM})
#	rm -f ${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}
#.  endif
#	cd ${VM_DIR}/${BUILDDATE} && ${CHECKSUM:tl} ${OSRELEASE}* > \
#		CHECKSUM.${CHECKSUM}-${REVISION}-${BRANCH}-${SNAP_SUFFIX}
#	cd ${VM_DIR}/Latest && ln -s \
#		${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX} \
#		CHECKSUM.${CHECKSUM}
#. endfor
#.else	# !snapshot
#. for CHECKSUM in ${CHECKSUM_FILES}
#	cd /R/vmimages && cp -p CHECKSUM.${CHECKSUM}* \
#		${VM_DIR}/${BUILDDATE}/CHECKSUM.${CHECKSUM}-${SNAP_SUFFIX}
#.endif

ftp-stage:	remove-old-bits ${STAGE_TARGETS}