Re: git: 0dfaefa97547 - main - depend-cleanup.sh: Simplify the logic, and clean bootstrap tools.
Date: Thu, 09 Feb 2023 07:31:33 UTC
Quoting Dag-Erling Smørgrav <des@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 <des@FreeBSD.org>
> AuthorDate: 2023-02-08 22:58:51 +0000
> Commit: Dag-Erling Smørgrav <des@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 Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF