tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: checkflist extra prefixes and post-build hooks



    Date:        Thu, 10 Apr 2025 14:58:33 +0200
    From:        Christoph Badura <bad%bsd.de@localhost>
    Message-ID:  <20250410125833.GA24156%irregular-apocalypse.k.bsd.de@localhost>

  | Unless I specifically removed them, of course.

If you just removed files from $DESTDIR the make (build.sh) should just put
them back again, that's its job.   If you removed something from src, you
should also remove it (or obsolete it in most cases) from the sets lists.
If the sets say something should exist after a build is done, and it doesn't,
then something has gone wrong.   Always.

  | build.sh has no "-e" option.  At least I don't see it greping the source.

Ah, apologies, I think of it like that, but what my code actually does is:

if [ -e "${DEST}/dev/console" ]
then
        set -- "$@" -V CHECKFLIST_FLAGS=-e
fi

DEST is what will be passed (via -D "${DEST}") to build.sh to become DESTDIR.

So, it is a -e flag, it just is not used the way I implied, but
the functionality is still there (I've been using this for many years).

That code snippet comes just a bit before the build.sh invocation (below).

  | That doesn't get me access to the environemnt variables set up by build.sh
  | and exported by make.

I prefer to tell build.sh what they all are, rather than having it tell
me what they should be.   That is, my script does that for me, and since
it knows what they are, it can use them again after build.sh is finished
to go ahead and do more (and it does).

The actual invocation of build.sh is:

env -i \
                "PATH=/sbin:/bin:/usr/sbin:/usr/bin${PKGBIN}" \
                "USER=$USER" \
                "HOME=$EMPTY" \
                "LOGNAME=$LOGNAME" \
                "DISPLAY=$DISPLAY" \
                "MAKECONF=/dev/null" \
        /bin/sh build.sh $REPRO "$@" \
                        -m "${ARCH}"                    \
                        -D "${DEST}"                    \
                        -O "${OBJD}/${REL}/${ARCH}"     \
                        -R "${SNAP}"                    \
                        -T "${OBJD}/${REL}/tools"       \
                        -X "${R}${TARGET}/src/xsrc"     \
                -u                                      \
                        "${BUILDING}"

(Not sure if HOME and DISPLAY are needed any more, they were years
ago, $EMPTY is an empty directory in /tmp created for the purpose)

Doing it this way means I get exactly the default build, except for
things I override, junk in /etc/mk.conf is fine for when I go to
/usr/src/... and just "make" something, not for doing builds, for
those I always say explicitly (via scripts, I don't type it all every
time of course) what I want to happen.

PKGBIN is ":/usr/pkg/bin" when set (usually it is empty), it is
used only when I need to make the tools with MKMAINTAINERTOOLS=yes

OBJD is /usr/obj typically, ARCH is obvious, REL is 10 or 9 or ...
R is /readonly (usually) which is a ro null mount of the source
directoery (and I always keep xsrc in a subdir of src rather than as
a sibling dir -- but that's just me).

TARGET is where the relevant sources live, ie: the system that is to be
built (which is also "." when the script is run and has made it this far,
since build.sh lives in $TARGET)

BUILDING is "release" or "distribution" or "tools" (any of build.sh's
targets). REPRO is -P if I want a reproducible build, otherwise nothing.

All of that is set based upon earlier script code which works out some of
it for itself, and is told other parts.   Naturally anyone else's needs
are going to differ from mine (also for the desired src/dest layout).

I always use -u ... newfs is MUCH faster than make clean!
(Making that very explicit is why the indentation of that option is as it is.)

newfs can be applied to the objdir or the destdir as required, they're
all separate filesystems.   -U would be in "$@" if I am using that.

The positional params ("$@") is where I include all the optional
stuff I want sometimes and not others, like -j and setting MKDEBUG (etc)
That has the CHECKFLIST_FLAGS=-e added to it when appropriate (as above).

This script is very generic in what it can do, but it rarely gets invoked
by me directly, rather I have other scripts that run it with the
appropriate args for the kind of build I am doing at the time (at
times I do a lot, quickly, one after another - making life easy for
myself is a definite aim).  The one quoted from above handles all the
details of running build.sh in my environment (it knows where the
sources for the various versions can be found, and where the target
directories should be, etc) the "higher level" scripts manage the
build options that can be varied (like do I want -o to skip making
the object directories, which can speed thins up when doing a
succession of builds with almost nothing changing from one to the
next), whether I want to bother building xsrc (-x), and the MKDEBUG*
options, etc (and -j ... if I am looking for build breakage, I do a
succession of builds with -j decreasing in jumps until it finally
reaches 1, where the make output is much easier to follow) and make
all that happen without me needing to remember details.

Just as I didn't remember exactly how that -e thing worked, just
that it does!

kre



Home | Main Index | Thread Index | Old Index