Re: FYI: Why META_MODE rebuilds so much for building again after installworld (no source changes)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Fri, 24 Feb 2023 20:55:56 UTC
On Feb 23, 2023, at 23:33, Simon J. Gerraty <sjg@juniper.net> wrote:
> 
>> . . .
> 
> Yes, if the value of MAKEOBJDIRPREFIX isn't consistent that's going to
> cause problems (I'd call it a bug). If so don't use MAKEOBJDIRPREFIX
> directly, set some other variable and export that.
> Hmm src.sys.obj.mk plays games with MAKEOBJDIRPREFIX so that's
> probably not a good option.
> Perhaps:
> 
> diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk
> index 3b48fc3c5514..3c7e570dbdbd 100644
> --- a/share/mk/src.sys.obj.mk
> +++ b/share/mk/src.sys.obj.mk
> @@ -67,6 +67,9 @@ SB_OBJROOT?= ${SB}/obj/
> OBJROOT?= ${SB_OBJROOT}
> .endif
> OBJROOT?= ${_default_makeobjdirprefix}${SRCTOP}/
> +# save the value before we mess with it
> +_OBJROOT:= ${OBJROOT:tA}
> +.export _OBJROOT
> .if ${OBJROOT:M*/} != ""
> OBJROOT:= ${OBJROOT:H:tA}/
> .else
> 
> and then something like?
> 
> .MAKE.META.IGNORE_PATHS +=
> ${_OBJROOT}/${MACHINE}.${MACHINE_ARCH}/tmp/legacy/usr
> 
>> . . .
> 

Thanks.

That has allowed me to set up the disabling of
specific . . ./tmp/legacy/usr/sbin/* programs
from having their dates lead directly to rebuild
activity (tested via -dM use in the make commands).

For reference, I'm using the below block of text
for the .MAKE.META.IGNORE_PATHS adjustments now.

# _OBJROOT is an addition to share/mk/src.sys.obj.mk
# provided by Simon J. Gerraty for my experimentation
# with this avoidance of some unnecessary build
# activity in META MODE:
#
#  OBJROOT?=      ${_default_makeobjdirprefix}${SRCTOP}/
# +# save the value before we mess with it
# +_OBJROOT:= ${OBJROOT:tA}
# +.export _OBJROOT
#
# TARGET.TARGET_ARCH   for amd64 stays as  amd64.amd64 for obj-lib32 (correct for the purpose)
# MACHINE.MACHINE_ARCH for amd64 turns into i386.i386  for obj-lib32 (wrong   for the purpose)
#
IGNORELEGACY_NOSYMLINKPREFIX= ${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/legacy/usr
IGNOREOTHER_NOSYMLINKPREFIX=  ${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/usr/bin
#
.for ignore_legacy_tool in awk basename cap_mkdb cat chmod cmp cp crunchgen crunchide cut date dd dirname echo egrep env expr fgrep file2c find gencat grep gzip head hostname jot lex lb ln ls m4 make
mkcsmapper mkdir mktemp mtree mv nawk patch realpath rm sed sh sort touch tr truncate uudecode uuencode wc xargs
.MAKE.META.IGNORE_PATHS+= ${IGNORELEGACY_NOSYMLINKPREFIX}/sbin/${ignore_legacy_tool}
.endfor
#
.for ignore_other_tool in ctfconvert objcopy nm
.MAKE.META.IGNORE_PATHS+= ${IGNOREOTHER_NOSYMLINKPREFIX}/${ignore_other_tool}
.endfor
#
.MAKE.META.IGNORE_PATHS:= ${.MAKE.META.IGNORE_PATHS}

(It is in a file specified via env __MAKE_CONF= use.)

I've extended the experiment to span releng/13.0 ,
releng/13.1 , stable/13 as well, not just main
[so: 14]. And I've set up the aarch64 environment
as well for that range of system variations. (It also
builds for targeting armv7 which is also covered.)
We will see how it goes as I track system updates
periodically.

Thanks again.


For reference, the -dM "is newer than" notice counts
in the log for a buildworld buildkernel just after
a installworld installkernel now looks like:

1467 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/Scrt1.o' is newer than the target...
515 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/crti.o' is newer than the target...
236 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/crti.o' is newer than the target...
 70 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/libgcc_s.so' is newer than the target...
 69 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libgcc_s.so' is newer than the target...
 68 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/crt1.o' is newer than the target...
  3 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/include/aio.h' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libssl.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libcxxrt.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libctf.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libcrypto.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/libc.so.7' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib32/Scrt1.o' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/libssl.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/libcxxrt.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/libctf.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/lib/libcrypto.so' is newer than the target...
  1 file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/lib/libc.so.7' is newer than the target...

Doing another buildworld buildkernel just after and looking at
its log's counts looks very similar.

(No claim of what the likes of, say, a clang14 -> clang15 based
system update would be like overall: the above is for the
study-state of no source updates being involved.)

===
Mark Millard
marklmi at yahoo.com