Quoting Dag-Erling Smørgrav <d...@freebsd.org> (from Wed, 8 Feb 2023 22:59:33 GMT):

The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=0dfaefa975477cee2ec3155c3e0689ba1fcdde9a

commit 0dfaefa975477cee2ec3155c3e0689ba1fcdde9a
Author:     Dag-Erling Smørgrav <d...@freebsd.org>
AuthorDate: 2023-02-08 22:58:51 +0000
Commit:     Dag-Erling Smørgrav <d...@freebsd.org>
CommitDate: 2023-02-08 22:59:13 +0000

    depend-cleanup.sh: Simplify the logic, and clean bootstrap tools.

* There's no need to check if the file exists before grepping it; if it does not exist, grep will fail, which is what we want. Just redirect the error message to /dev/null.

You change from "no fork+exec if the file doesn't exist" (due to "if" and "[" being shell-builtins) to "always fork+exec". On fast machines surely not an issue, on slow ones, it may make a difference (I have an old amd64 machine at an ISP which takes days to do a buildworld with -j2 due to not much memory, only 2 cores, old HDs, and other stuff going on in parallel).

While the .depend.* namespace is surely controlled by us, would it make sense to change the glob to ".{o,pico}" instead of ".*o" instead to prevent unexpected surprises in the future?

--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -28,18 +28,8 @@ fi
 # $3 source extension
 clean_dep()
 {
-       if [ -e "$OBJTOP"/$1/.depend.$2.pico ] && \
-           egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.pico; then \
-               echo "Removing stale dependencies and objects for $2.$3"; \
-               rm -f \
-                   "$OBJTOP"/$1/.depend.$2.* \
-                   "$OBJTOP"/$1/$2.*o \
-                   "$OBJTOP"/obj-lib32/$1/.depend.$2.* \
-                   "$OBJTOP"/obj-lib32/$1/$2.*o
-       fi
-       if [ -e "$OBJTOP"/$1/.depend.$2.o ] && \
-           egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.o; then \
-               echo "Removing stale dependencies and objects for $2.$3"; \
+       if egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.*o 2>/dev/null; then
+               echo "Removing stale dependencies and objects for $2.$3"
                rm -f \
                    "$OBJTOP"/$1/.depend.$2.* \
                    "$OBJTOP"/$1/$2.*o \

Bye,
Alexander.

--
http://www.Leidinger.net alexan...@leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netch...@freebsd.org  : PGP 0x8F31830F9F2772BF

Attachment: pgp_TeR5pCoJI.pgp
Description: Digitale PGP-Signatur

Reply via email to