From nobody Fri Nov 11 20:40:43 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 4N89Zg3bnxz4g02x; Fri, 11 Nov 2022 20:40:43 +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 4N89Zg38D0z4Rvp; Fri, 11 Nov 2022 20:40:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668199243; 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=b8C/gHneDiDtQncRme2YddyyLU8S3aUfmJdKmtZygAo=; b=vH4mUsnZkvvF6l9uvy6BrUnburxuhYPH2yS1j1tlwbIRCSSMrHTwx9NhudFVsxeYWe38eG 9/KoJBE6wyeGSfrjEArsRYbLmc7xnNt4F1Pt7fwXRCSlUH08/4TB5QUxSa8j8sIU5Mg1+j 7C2EgjetOLzeb0yQRBwUIxiHG+xJu/19uQ2/e80nnuOa8TQHSfzmAHsVD30VcijNZB/5Gx +vGebO5tixixDjskGOnP6XC6C8BLiW8JkT/L3QXIF7RxOroFKwq4sFSiKEMyZtkjgb3qkS jSka8YYF+tUSRJP1qJ02DXAtEQse+lZtPFWTKa6ajFEksGMyTwMK5UexUHpQKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668199243; 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=b8C/gHneDiDtQncRme2YddyyLU8S3aUfmJdKmtZygAo=; b=SFw6Tfjhf/qAt4qqdoIQ/qSsjLELN+/NeORsVNXyLIuoTUT8TNKrCZonmUVxIn7mfBAc2Z lE9/5E+U7CugupWXocamRiTVZY36dc9TSBOW/ww30mW94iVrOeW8hxqxGgfFuXyZ1AQR9A GJSrN7FyOVE2cS18qTCiLAc5gqTgR07W8LAaZ09Jwsax7UlmRH9ejp9yGWFm6kYJwlT3k5 ulBkQkd78O23lutKJERRV/bp0IwzP5Oljpbz5L3MUKh7obT/cx/5nJSdvcfKxNa5IvIpMy DkOZUe7OoyLMb1YyOlJ2t71hTamk5EVxbcpxgV36EuKUeSzva6BYqFCqKTRVAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668199243; a=rsa-sha256; cv=none; b=VPQjRjjeAKETv0JJudNe3VnHk2yXRh/nBZ6w0AxG7V6DMqyRtgHWsDH1qxORx10WT6Zv3c x9yxInhx/pLR9nopQoQfovAkakqcho0s1UEy2VTjATHzeogGInTceEmn9CAP0bs37JhQhI jHacJHwzFzRxdz1OEVqbAZb3Zu9rIjgXT7eWm7X4JD0RS32mAODed4oDIxmCLUrntFfaGa uQRlM/MlMJIfFHxozaJ8gmKuwZ0z5jnCaoI4QShMNl95+H1ZBiVgjY8mgKZYMvK6Y7JGV+ upKjdDsW5vpSPqZVS2GclIQNQHPzzVlJqvOkEFX/Pm/uoj6CZl/n+diTmspewQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N89Zg2BxFzwwR; Fri, 11 Nov 2022 20:40:43 +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 2ABKehUL086159; Fri, 11 Nov 2022 20:40:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABKehIU086158; Fri, 11 Nov 2022 20:40:43 GMT (envelope-from git) Date: Fri, 11 Nov 2022 20:40:43 GMT Message-Id: <202211112040.2ABKehIU086158@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: 5ad46769a81f - main - framework: add git-hook to check PORTEPOCH validity 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: 5ad46769a81f77b8fd592a16f3367d359d34ecc4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tcberner: URL: https://cgit.FreeBSD.org/ports/commit/?id=5ad46769a81f77b8fd592a16f3367d359d34ecc4 commit 5ad46769a81f77b8fd592a16f3367d359d34ecc4 Author: Tobias C. Berner AuthorDate: 2022-11-11 20:37:54 +0000 Commit: Tobias C. Berner CommitDate: 2022-11-11 20:39:46 +0000 framework: add git-hook to check PORTEPOCH validity - checks dropping of PORTEPOCH: [pre-commit] dropped PORTEPOCH 1 in net/kf5-kdav/Makefile - checks it being non-decreasing: [pre-commit] PORTEPOCH decreasing from 2 to 1 in net-p2p/frost/Makefile Reviewed By: rene, bapt Differential Revision: https://reviews.freebsd.org/D35733 --- .hooks/pre-commit.d/check_portepoch | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.hooks/pre-commit.d/check_portepoch b/.hooks/pre-commit.d/check_portepoch new file mode 100755 index 000000000000..1a59a39b5407 --- /dev/null +++ b/.hooks/pre-commit.d/check_portepoch @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Check that PORTEPOCH is not being dropped, and is non-decreasing +# + +check_epoch() { + local makefile="$1" + local old_epoch=$(git diff --cached -U0 "${makefile}" | grep '^\-PORTEPOCH' | grep -oE '[0-9]+') + local new_epoch=$(git diff --cached -U0 "${makefile}" | grep '^\+PORTEPOCH' | grep -oE '[0-9]+') + if [ -z "${new_epoch}" ] ; then + echo "[pre-commit] dropped PORTEPOCH ${old_epoch} in ${makefile}" + exit 1 + fi + if [ -n "${old_epoch}" ] ; then + if [ ${new_epoch} -lt ${old_epoch} ] ; then + echo "[pre-commit] PORTEPOCH decreasing from ${old_epoch} to ${new_epoch} in ${makefile}" + exit 2 + fi + fi +} + +modified_makefiles=$(git diff --name-only --cached --diff-filter=M -GPORTEPOCH | grep -E '^[^/]+/[^/]+/Makefile$') +if [ $? -eq 0 ] ; then + for modified_makefile in ${modified_makefiles} ; do + check_epoch ${modified_makefile} + done +fi