Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2023 04:12:04 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 03e62670c33c - main - etcupdate: Consolidate nobuild cases and make more robust
Message-ID:  <202307270412.36R4C4f2097702@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=03e62670c33c5d68ea69c842c24fe86765e2639e

commit 03e62670c33c5d68ea69c842c24fe86765e2639e
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-27 04:10:48 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-07-27 04:10:48 +0000

    etcupdate: Consolidate nobuild cases and make more robust
    
    The distrib-dirs and distribution steps are shared between the two, the
    only difference is whether MAKEOBJDIRPREFIX is in the environment for
    the latter. Having in the environment for the former is currently not
    needed but does no harm and will be needed in future, so we can just
    export it up-front in the subshell. When we do distrib-dirs relative to
    _obj and everything also doesn't matter, so move it next to distribution
    where it makes more sense. Finally, to avoid complicated && chains, use
    "|| exit 1" everywhere to make the subshell fail, and add an extra one
    on to the cd $SRCDIR to handle that failing (otherwise we'd go on and
    try to build the current directory after cd prints its error, which is
    unhelpful).
    
    These changes will make it easier to bundle these steps up into new
    top-level targets to allow the build system to manage the steps rather
    than etcupdate, which will also handle BUILD_WITH_STRICT_TMPPATH, which
    currently does not work with etcupdate.
    
    Reviewed by:    jhb
    Differential Revision:  https://reviews.freebsd.org/D41204
---
 usr.sbin/etcupdate/etcupdate.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index d15d1498200f..ae75a6e36f03 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -214,15 +214,17 @@ build_tree()
 			mkdir -p $1/etc || return 1
 			cp -p $SRCDIR/$file $1/etc/$name || return 1
 		done
-	elif ! [ -n "$nobuild" ]; then
-		(cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs &&
-    MAKEOBJDIRPREFIX=$destdir/usr/obj $make _obj SUBDIR_OVERRIDE=etc &&
-    MAKEOBJDIRPREFIX=$destdir/usr/obj $make everything SUBDIR_OVERRIDE=etc &&
-    MAKEOBJDIRPREFIX=$destdir/usr/obj $make DESTDIR=$destdir distribution) || \
-		    return 1
 	else
-		(cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs &&
-		    $make DESTDIR=$destdir distribution) || return 1
+		(
+			cd $SRCDIR || exit 1;
+			if ! [ -n "$nobuild" ]; then
+				export MAKEOBJDIRPREFIX=$destdir/usr/obj;
+				$make _obj SUBDIR_OVERRIDE=etc || exit 1
+				$make everything SUBDIR_OVERRIDE=etc || exit 1
+			fi
+			$make DESTDIR=$destdir distrib-dirs || exit 1
+			$make DESTDIR=$destdir distribution || exit 1
+		) || return 1
 	fi
 	chflags -R noschg $1 || return 1
 	rm -rf $1/usr/obj || return 1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307270412.36R4C4f2097702>