Fix build with -DNO_ROOT

The inclusion of 0a0f748641 broke the build with the -DNO_ROOT option.
Specifically, that commit adds some relative paths (with `..`) to METALOG
that make other tools using that log, fail afterwards (tar, makefs...).

It's been argued[1] if this is really something mtree(8) should handle more
graciously. In the meantime, fix the breakage but changing the order in which
the links are created: first in the parent directory, then in the
architecture-specific one.

We keep the architecture-specific directories an the links to the parent
directories. This is something that we might want to change in the future.

This commit is based on a concept patch by avg@.

[1] https://lists.freebsd.org/archives/dev-commits-src-all/2021-November/index.html

Reported by: bapt@, emaste@
Approved by: avg@
Fixes: 0a0f748641
Differential Revision: https://reviews.freebsd.org/D33126
This commit is contained in:
Fernando Apesteguía 2021-11-26 11:55:50 +01:00
parent 0906362646
commit df90aeac24
6 changed files with 40 additions and 27 deletions

View File

@ -4,13 +4,6 @@
MAN= \
armv8crypto.4 \
aw_gpio.4 \
aw_mmc.4 \
aw_rtc.4 \
aw_sid.4 \
aw_spi.4 \
aw_syscon.4 \
bcm283x_pwm.4 \
enetc.4 \
felix.4 \
rk_gpio.4 \
@ -18,11 +11,24 @@ MAN= \
rk_i2c.4 \
rk_pinctrl.4 \
# Link files to the parent directory
# Install manpages shared with arm only if not installing manpages
# for all architectures, otherwise arm takes care of installing them.
.if !empty(MAN_ARCH) && ${MAN_ARCH} != "all"
MAN+= \
aw_gpio.4 \
aw_mmc.4 \
aw_rtc.4 \
aw_sid.4 \
aw_spi.4 \
aw_syscon.4 \
bcm283x_pwm.4 \
.endif
# Link files to the architecture directory.
_ARCH_SUBDIR=aarch64
.for _manpage in ${MAN}
MLINKS+=${_manpage} ../${_manpage}
MLINKS+=${_manpage} ${_ARCH_SUBDIR}/${_manpage}
.endfor
MANSUBDIR=/aarch64
.include <bsd.prog.mk>

View File

@ -18,11 +18,13 @@ MAN= \
MLINKS= imx_wdog.4 imxwdt.4
MLINKS+= mge.4 if_mge.4
# Link files to the parent directory
# Link files to the architecture directory
_ARCH_SUBDIR=arm
.for _manpage _link in ${MLINKS}
MLINKS+=${_link} ${_ARCH_SUBDIR}/${_link}
.endfor
.for _manpage in ${MAN}
MLINKS+=${_manpage} ../${_manpage}
MLINKS+=${_manpage} ${_ARCH_SUBDIR}/${_manpage}
.endfor
MANSUBDIR=/arm
.include <bsd.prog.mk>

View File

@ -21,11 +21,13 @@ MLINKS= CPU_ELAN.4 CPU_SOEKRIS.4
MLINKS+=pae.4 PAE.4
MLINKS+=sbni.4 if_sbni.4
# Link files to the parent directory
# Link files to the architecture directory
_ARCH_SUBDIR=i386
.for _manpage _link in ${MLINKS}
MLINKS+=${_link} ${_ARCH_SUBDIR}/${_link}
.endfor
.for _manpage in ${MAN}
MLINKS+=${_manpage} ../${_manpage}
MLINKS+=${_manpage} ${_ARCH_SUBDIR}/${_manpage}
.endfor
MANSUBDIR=/i386
.include <bsd.prog.mk>

View File

@ -15,11 +15,13 @@ MAN= adb.4 \
snd_davbus.4 \
tsec.4
# Link files to the parent directory
# Link files to the architecture directory
_ARCH_SUBDIR=powerpc
.for _manpage _link in ${MLINKS}
MLINKS+=${_link} ${_ARCH_SUBDIR}/${_link}
.endfor
.for _manpage in ${MAN}
MLINKS+=${_manpage} ../${_manpage}
MLINKS+=${_manpage} ${_ARCH_SUBDIR}/${_manpage}
.endfor
MANSUBDIR=/powerpc
.include <bsd.prog.mk>

View File

@ -2,11 +2,16 @@
# mptable: broken (not 64 bit clean)
# pnpinfo: crashes (not really useful anyway)
_ARCH_SUBDIR=amd64
.if ${MK_ACPI} != "no"
SUBDIR+= acpi
.endif
.if ${MK_APM} != "no"
SUBDIR+= apm
# Link files to the architecture directory
.for _manpage in ${:!/bin/sh -c "/bin/ls ${_ARCH_SUBDIR}/.8"!:E}
MLINKS+=${_manpage} ${_ARCH_SUBDIR}/${_manpage}
.endfor
.endif
.if ${MK_BHYVE} != "no"
SUBDIR+= bhyve

View File

@ -5,10 +5,6 @@ MAN= apm.8
MLINKS= apm.8 apmconf.8
MANSUBDIR= /${MACHINE_CPUARCH}
# Link files to the parent directory
MLINKS+= apm.8 ../apm.8
MLINKS+= apmconf.8 ../apmconf.8
PACKAGE=apm
.include <bsd.prog.mk>