From nobody Wed Apr 13 03:29:58 2022 X-Original-To: dev-commits-ports-main@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 BB08C1AF7E94; Wed, 13 Apr 2022 03:29: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KdSlB4tTJz3F0L; Wed, 13 Apr 2022 03:29:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649820598; 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=q2VF648ffmZ1skakwOOztKVNwxQh2m3E00jf/BABVBQ=; b=bXbbmNdhkuptgdL+YkITaQFSobamZ/ktgAbQCnFrpoc7S7NAJjzsDvP3eJ84Zn4EKYZfcc eMNUf6HVLw9c1yfcdH1zvKAsfIzCZodVoKvFUofbOBAJxmbmBIAEVZYsT0jFog/NiVQPr1 yBzCr2JvBJcncgXo8QZC0Ip5faaloOtkH+jjVROovSxY/VVFDX7P5gZlXbGp04Or8P/zkY Mhbkl+bKd2TRBKXNzsWisWWkb5ohATyyGa0RmZStq5uhC3aNlzLSUnkqcAdOeY8Vz0osiU sR9DtqQP2agKrZ4YncxQrdOWXpncAf1u9ZNQzJQdLgAsnkGPU0ItyZHK2Wghfg== 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 88F19240DA; Wed, 13 Apr 2022 03:29:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23D3TwRm081330; Wed, 13 Apr 2022 03:29:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23D3TwoA081329; Wed, 13 Apr 2022 03:29:58 GMT (envelope-from git) Date: Wed, 13 Apr 2022 03:29:58 GMT Message-Id: <202204130329.23D3TwoA081329@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Tobias C. Berner" Subject: git: ea589ebd6615 - main - framework: add hook to detect whether new ports are hooked into the tree List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tcberner X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea589ebd66157b2116e5c547d2af8ed94d10d715 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649820598; 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=q2VF648ffmZ1skakwOOztKVNwxQh2m3E00jf/BABVBQ=; b=xZfRTBocfg2jonjRgW1D5zJS0skSP0HutaY6AGT8RTHCSQXNdg8bjeKF4KemFDdJ7ydafP O1cZKxDoF6KKtO3pKMnCEevcg5w1ZWg9WrERZTsRkLlMhFgUa5F4/WYHFgMtVcIE+XzPNx 6bphzUc5HhtLi74vIfPRsRyz7xqkAs2WA2ag4XtvdpJ/bBNVHYESwIpnQpb/7fQjttMWXz AMboe/T58kmIPFqzkj1IrygX7WJNROiYHqsFLu3YJcJKDtbTmJ0Hqnm05koPa/Ht/+gzse 7qkPZoi472x1rzy5bnKBQ/PqxyRDjxZ3ub5UIXeSv62T1i+hSeMTdPiMj7x17w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649820598; a=rsa-sha256; cv=none; b=Xg/maL7wVhsMrMMKQ5H6UwMn3l0Nolwh1UvwQtx4/JXkEO4OA7gByps1X8m6DH9OdCJ1WP 1y40egeG4GdEC9SVmXxOS8fhdfPK40hYAjoMImrpb4uZ8oGpe9k+ieEhkXz/oLVvWcHi/L quWyNPDYU3C92f8rVPcuJwilF14EBc1Fn03Fgvmy25YqC91eDhy8Yjplr5OPZ8R2D50YMH MjpEnNXEFM2BDdu7W3aWgztEmmD3Zu3V62jDy3BlUvO1DlDqyglKLTBJI+OnzLOTEc2hzA U6FOFxmYYlC2XewoiDttiWa1ZPIWzprEc6hO9F8ka0f3+SEjLRXJlXyu0+UchQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tcberner: URL: https://cgit.FreeBSD.org/ports/commit/?id=ea589ebd66157b2116e5c547d2af8ed94d10d715 commit ea589ebd66157b2116e5c547d2af8ed94d10d715 Author: Tobias C. Berner AuthorDate: 2022-01-24 19:53:11 +0000 Commit: Tobias C. Berner CommitDate: 2022-04-13 03:29:33 +0000 framework: add hook to detect whether new ports are hooked into the tree This pre-commit hook looks for newly added files matching foo/bar/Makefile For these files, it is checking that a SUBDIR+=bar entry is present in foo/Makefile. Example run output: > mkdir -p graphics/test_port > touch graphics/test_port/Makefile > git add graphics/test_port/Makefile > git commit -m "graphics/test_port: not hooked into the build" [pre-commit] ERROR: Missing 'SUBDIR += test_port' in graphics/Makefile This should hopefully help reduce the number of index breakages. Differential Revision: https://reviews.freebsd.org/D34015 --- .hooks/pre-commit | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.hooks/pre-commit b/.hooks/pre-commit new file mode 100755 index 000000000000..fb43d4353256 --- /dev/null +++ b/.hooks/pre-commit @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Check that ports are hooked into the build +# + +newish_makefiles=$(git diff --name-only --cached --diff-filter=ACR | grep -E '^[^/]+/[^/]+/Makefile$') +if [ $? -eq 0 ] ; then + for newish_makefile in ${newish_makefiles} ; do + category=$(echo "${newish_makefile}" | awk -F '/' '{print $1}') + port=$(echo "${newish_makefile}" | awk -F '/' '{print $2}') + grep -q -E "^[[:space:]]+SUBDIR[[:space:]]\+=[[:space:]]*${port}\$" ${category}/Makefile + if [ $? -ne 0 ] ; then + echo "[pre-commit] ERROR: Missing 'SUBDIR += ${port}' in ${category}/Makefile" + exit 1 + fi + done +fi