From nobody Mon Dec 09 21:48:57 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y6b960jmcz5gqrm; Mon, 09 Dec 2024 21:48:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y6b9550k9z4HN5; Mon, 9 Dec 2024 21:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733780937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=neVJL3gttiLjc7OZdHVocLqyGVV9T99YXA9WmXyYy9s=; b=HO3LvX1ksJ3UgOEhIVSOJz2Pr86tNEfj0/jc+IWTpJT4qrIpsVc5B+jYf1I1ly7b7s8/D6 VedBu6Liohk63toxtBIuRd/uDy0MR3RAqSWrRpmY81wH4/9/h4BDB0ZFpBF1rUvlKPPFbr BQJz7joW/I2ke0VTncrLkHUQs3HFoMKzUhKTyE4muL909gazeMP9MNajIaG4ZtEsgjifgn 8knuUD8UNYZOKV0br2/kPsmVAPmxGadgaUzsYQyzRXuCwVwOi1FzqwxAsc/JIupnEdrMmW xCa10DkoqH9qWlPvQ/jXn5zm4nYX0ll8rWjxeg6VJC5jsuHtJjcFh9AcMg4B7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733780937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=neVJL3gttiLjc7OZdHVocLqyGVV9T99YXA9WmXyYy9s=; b=KnJ3tSGJeyI3Ytak+wQZAd8MNjy8Yc3LxqHJfRaBxIhzmbVz5Jn+stxwV8Oo+yTY8OtaUg sgR6NdQ+4xgffNaoRIdg3pw3JNsH3m7TdgzAsVeYRTH3jOERdWHli6QpyBcCnGFMhzKrlo jyGDm8rseVgK6SozxQXpA9tnNJ6mFsslfGfSBIHzc+9fw6rrwGAWYWgsKNndxws0lIl20s cc1JXonCBLGyorTfVeHDAtapKHo9RVq7QNngDYr0YBiiUwEZ2mR1+Btehkrx7GADNyNMCK FFk7rIf7HZGeHc3X4L/prOaGyrFqauM7yGd3AWXuBv+jtNDREYDiVNEFL0XxGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733780937; a=rsa-sha256; cv=none; b=rfTNb8ur3ngntDjSBDLu9rjLtmijIvKMXVknnrXB87mclAOKafdVbaxMqSv5gmDLnqeraG 1ULE9LAyoLn6nmT8hFn0ch1ogmORgaSwIofTMyZVOOpgCJUx+QIKeLwe3EZDM0uYrGtB8t RBNyJ7vwt7tpQV4ZzdLuRX5mxS9G+A3QixlyvApV1/mz+YVeZxdtMDDYMF6fcaWL2+8lgw JOUtsX4196m7CpMp4+KiLRTNVbcIKHrUbY5b1PAtEW6iPYU3enDUAEHIsepzMpgrM0WQAr M5UtBYFGCxdOw+tCBkdXu+x8I2WGAvGEE4qOSoB9VfOGpR/WwlyV0XqsymziJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y6b954cDJzvG8; Mon, 9 Dec 2024 21:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B9LmvSn033165; Mon, 9 Dec 2024 21:48:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B9Lmvcj033162; Mon, 9 Dec 2024 21:48:57 GMT (envelope-from git) Date: Mon, 9 Dec 2024 21:48:57 GMT Message-Id: <202412092148.4B9Lmvcj033162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 0f00a4c39b65 - stable/13 - depend-cleanup: Add verbose (-v) and pretend/dry-run (-n) flags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f00a4c39b65172f3e12bf7e12d31c1b4bc40e34 Auto-Submitted: auto-generated The branch stable/13 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=0f00a4c39b65172f3e12bf7e12d31c1b4bc40e34 commit 0f00a4c39b65172f3e12bf7e12d31c1b4bc40e34 Author: Jessica Clarke AuthorDate: 2023-07-11 00:53:04 +0000 Commit: Brooks Davis CommitDate: 2024-12-09 21:46:48 +0000 depend-cleanup: Add verbose (-v) and pretend/dry-run (-n) flags These are useful for testing new additions to the script. Whilst here, harden the script a little and improve error messages. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31007 (cherry picked from commit 1ec7cb1b5d1800b05c0682e0b673be0dece98779) Pull Request: https://github.com/freebsd/freebsd-src/pull/1543 --- tools/build/depend-cleanup.sh | 76 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 385df785b426..e88a765357a5 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -16,22 +16,72 @@ # anyone would try a NO_CLEAN build against an object tree from before the # related change. One year should be sufficient. +set -e +set -u + +warn() +{ + echo "$(basename "$0"):" "$@" >&2 +} + +err() +{ + warn "$@" + exit 1 +} + +usage() +{ + echo "usage: $(basename $0) [-v] [-n] objtop" >&2 +} + +VERBOSE= +PRETEND= +while getopts vn o; do + case "$o" in + v) + VERBOSE=1 + ;; + n) + PRETEND=1 + ;; + *) + usage + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + OBJTOP=$1 +shift if [ ! -d "$OBJTOP" ]; then - echo "usage: $(basename $0) objtop" >&2 - exit 1 + err "$OBJTOP: Not a directory" fi if [ -z "${MACHINE+set}" ]; then - echo "$(basename "$0"): MACHINE not set" >&2 - exit 1 + err "MACHINE not set" fi if [ -z "${MACHINE_ARCH+set}" ]; then - echo "$(basename "$0"): MACHINE_ARCH not set" >&2 - exit 1 + err "MACHINE_ARCH not set" fi +run() +{ + if [ "$VERBOSE" ]; then + echo "$@" + fi + if ! [ "$PRETEND" ]; then + "$@" + fi +} + # $1 directory # $2 source filename w/o extension # $3 source extension @@ -39,7 +89,7 @@ clean_dep() { 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 \ + run rm -f \ "$OBJTOP"/obj-lib32/$1/.depend.$2.* \ "$OBJTOP"/obj-lib32/$1/$2.*o fi @@ -56,14 +106,14 @@ if [ -e "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o ] && \ egrep -qw "cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c" \ "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o; then echo "Removing old ZFS tree" - rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl + run rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl fi # 20200916 WARNS bumped, need bootstrapped crunchgen stubs if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ ! grep -q 'crunched_stub_t' "$OBJTOP"/rescue/rescue/rescue.c; then echo "Removing old rescue(8) tree" - rm -rf "$OBJTOP"/rescue/rescue + run rm -rf "$OBJTOP"/rescue/rescue fi # 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c @@ -71,13 +121,13 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ egrep -qw "sys/netpfil/pf/pf_ruleset.c" \ "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o; then echo "Removing old pf_ruleset dependecy file" - rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o + run rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o fi # 20210108 821aa63a0940 non-widechar version of ncurses removed if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then echo "Removing stale ncurses objects" - rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses + run rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses fi # 20210608 f20893853e8e move from atomic.S to atomic.c @@ -89,14 +139,14 @@ clean_dep lib/libc pdfork S if stat "$OBJTOP"/tests/sys/kqueue/libkqueue/*kqtest* \ "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.kqtest* >/dev/null 2>&1; then echo "Removing old kqtest" - rm -f "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.* \ + run rm -f "$OBJTOP"/tests/sys/kqueue/libkqueue/.depend.* \ "$OBJTOP"/tests/sys/kqueue/libkqueue/* fi # 20230110 bc42155199b5 usr.sbin/zic/zic -> usr.sbin/zic if [ -d "$OBJTOP"/usr.sbin/zic/zic ] ; then echo "Removing old zic directory" - rm -rf "$OBJTOP"/usr.sbin/zic/zic + run rm -rf "$OBJTOP"/usr.sbin/zic/zic fi # 20241018 5deeebd8c6ca Merge llvm-project release/19.x llvmorg-19.1.2-0-g7ba7d8e2f7b6