The ${BUILDKERNELS:[2..-1]} appears to produce a non zero result for

a one word variable, which is quite unexpected from documentation.
So, to avoid double installation of a single kernel, protect the extra
kernels loop with ${BUILDKERNELS:[#]} > 1 conditional.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2015-09-02 15:42:14 +00:00
parent b0f99291de
commit 05f05f8bdc

View File

@ -1127,6 +1127,7 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
${CROSSENV} PATH=${TMPPATH} \ ${CROSSENV} PATH=${TMPPATH} \
${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
.if ${BUILDKERNELS:[#]} > 1
.for _kernel in ${BUILDKERNELS:[2..-1]} .for _kernel in ${BUILDKERNELS:[2..-1]}
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Installing kernel ${_kernel}" @echo ">>> Installing kernel ${_kernel}"
@ -1135,6 +1136,7 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel
${CROSSENV} PATH=${TMPPATH} \ ${CROSSENV} PATH=${TMPPATH} \
${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//}
.endfor .endfor
.endif
distributekernel distributekernel.debug: distributekernel distributekernel.debug:
.if empty(INSTALLKERNEL) .if empty(INSTALLKERNEL)
@ -1154,6 +1156,7 @@ distributekernel distributekernel.debug:
sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
${DESTDIR}/${DISTDIR}/kernel.meta ${DESTDIR}/${DISTDIR}/kernel.meta
.endif .endif
.if ${BUILDKERNELS:[#]} > 1
.for _kernel in ${BUILDKERNELS:[2..-1]} .for _kernel in ${BUILDKERNELS:[2..-1]}
.if defined(NO_ROOT) .if defined(NO_ROOT)
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
@ -1170,27 +1173,32 @@ distributekernel distributekernel.debug:
${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
.endif .endif
.endfor .endfor
.endif
packagekernel: packagekernel:
.if defined(NO_ROOT) .if defined(NO_ROOT)
cd ${DESTDIR}/${DISTDIR}/kernel; \ cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \ tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
.if ${BUILDKERNELS:[#]} > 1
.for _kernel in ${BUILDKERNELS:[2..-1]} .for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
.endfor .endfor
.endif
.else .else
cd ${DESTDIR}/${DISTDIR}/kernel; \ cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - . | \ tar cvf - . | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz
.if ${BUILDKERNELS:[#]} > 1
.for _kernel in ${BUILDKERNELS:[2..-1]} .for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - . | \ tar cvf - . | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz
.endfor .endfor
.endif .endif
.endif
# #
# doxygen # doxygen