Add logic to rotate the package repository, keyed on PKG_VERSION,

and create a 'latest' symlink to the PKG_VERSION repository path.

Suggested by:	des
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
gjb 2016-02-09 19:27:38 +00:00
parent ee23b7758f
commit 99ec5cddaa
2 changed files with 17 additions and 6 deletions

View File

@ -128,7 +128,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
xdev-links native-xtools stageworld stagekernel stage-packages \
create-world-packages create-kernel-packages create-packages \
packages installconfig sign-packages
packages installconfig real-packages sign-packages
TGTS+= ${SUBDIR_TARGETS}

View File

@ -1374,7 +1374,10 @@ _pkgbootstrap:
@env ASSUME_ALWAYS_YES=YES pkg bootstrap
.endif
packages: stage-packages create-packages sign-packages
packages:
${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages
real-packages: stage-packages create-packages sign-packages
stage-packages:
@mkdir -p ${WSTAGEDIR} ${KSTAGEDIR}
@ -1413,7 +1416,7 @@ create-world-packages: _pkgbootstrap
create -M ${DESTDIR}/$${pkgname}.ucl \
-p ${DESTDIR}/$${pkgname}.plist \
-r ${DESTDIR} \
-o ${REPODIR}/$$(pkg -o ABI_FILE=${DESTDIR}/bin/sh config ABI)/latest ; \
-o ${REPODIR}/$$(pkg -o ABI_FILE=${DESTDIR}/bin/sh config ABI)/${PKG_VERSION} ; \
done
create-kernel-packages: _pkgbootstrap
@ -1441,7 +1444,7 @@ create-kernel-packages: _pkgbootstrap
create -M ${DESTDIR}/${DISTDIR}/kernel-${flavor}.ucl \
-p ${DESTDIR}/${DISTDIR}/kernel-${flavor}.plist \
-r ${DESTDIR}/${DISTDIR} \
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
.endfor
.endif
.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
@ -1470,14 +1473,22 @@ create-kernel-packages: _pkgbootstrap
create -M ${DESTDIR}/kernel.${_kernel}/kernel.${_kernel}-${flavor}.ucl \
-p ${DESTDIR}/kernel.${_kernel}/kernel.${_kernel}-${flavor}.plist \
-r ${DESTDIR}/kernel.${_kernel} \
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
.endfor
.endif
.endfor
.endif
sign-packages: _pkgbootstrap
@pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI) ${PKGSIGNKEY}
@[ -L "${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest" ] && \
unlink ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest ; \
env PKG_VERSION=${PKG_VERSION} pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
${PKGSIGNKEY} ; \
env PKG_VERSION=${PKG_VERSION} \
ln -s ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest
#
#