From nobody Wed Jul 12 05:22:17 2023 X-Original-To: dev-commits-ports-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 4R15hn31Fdz2tk8R; Wed, 12 Jul 2023 05:22:17 +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 4R15hn2bl3z3mdG; Wed, 12 Jul 2023 05:22:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689139337; 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=exLNaWg3gBGq5aEBPXrk+tuEmH8EdKk+Rne8/6dkOPs=; b=W9oCbXZyNEscexS75YzmL9zygmjpmpaC6kWAEuhzJPDJD41JUvttjbhL8f92g22XNGT/JG 8IUrWZgrByX8qRgAZExcbiOUFvTEEOodovxirTpcTvj0MSL05dN9+UO9usotLezK14qrtG II6y0XgrC546Qt2m6X8MlybYEGKLCORI8ocS1r03TFsebeYPong7D/mTxH5BpdW4ZU/NR3 xPRRbCPV//Z87qWs7z2QyU5JOPVIFXZE0TVRtCbNSNrvySyc76asuz3/HE75bZILDNwu5G Cn73YqZ1PTLLFFBZcfVfSKWORkKWJuLV1rIHWgKxh1ONJza8ov5pgleAqZEX4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689139337; 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=exLNaWg3gBGq5aEBPXrk+tuEmH8EdKk+Rne8/6dkOPs=; b=I0ZERis7guvgO2JfIZETmrLOurlPWSJTBPExBHgXBX+zXSJW7ZUZH7A+fY5W83lphc8E/V b8nmXSSPssh2OtAT5sNnSC9j6mHgjPR9osYfvPqQQqVkfOtgcH9kCUNQtX2pjBlSue9h3w ZtDI1cHZSGk5i1bCCx4vB0Rjmroh4ElUWQsj0TjBfa/eF0Qwr7/MdVFZOs/YB44oWBenPT S2Uwd2r2KC9WrGx+8tCvWTVO6bHqtXP/UltBAKLkTXg7iQ7lVjeucAFjX+UDbxoIgshjfX blTcY1VTaEDTg2XZ42/E2ufBYGoPKzeoQLRf8xPVPCvilQ7VEr74ZZsNitdszw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689139337; a=rsa-sha256; cv=none; b=En7H3UjATz8VTrsCtIzo/uaAeDEKNJ+3sFEadOTxK0JmWHw1hkMbKCAGiDO3oHTVjJY5oa wADmU5Yq2oVMUYH6nbFcKmvLskbTDwNntX0MHZh7BKZlsSgLJC4eO0MiDKCPCYM3nJnqjd IznqpCVzhD88/FkDKwlyAyQ4NfXmS153VzXrgDWYDvUdOOyrQZFgMNKuKjo1o4uD1YDtHO CkEW8VXl5KOw6TXGaT8lwai7x4v2HvP3fx2T9cBG7wcYiRt0FwHnhE69uBgbPjBt0CzVDd QuVNDIXwhYgKcPq6rfziU/HenU5GjRXZ7yA/dSJ+hcbffzMpdlzjCijmZSVyiw== 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 4R15hn1h6Tzx0b; Wed, 12 Jul 2023 05:22:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36C5MHgU031146; Wed, 12 Jul 2023 05:22:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36C5MHs9031145; Wed, 12 Jul 2023 05:22:17 GMT (envelope-from git) Date: Wed, 12 Jul 2023 05:22:17 GMT Message-Id: <202307120522.36C5MHs9031145@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 7e866ceb0ef5 - main - Tools/scripts: Add update-rust-port.sh script to simplify Rust port updates List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e866ceb0ef53a7aeaed442890ca2fb1bab4e1e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=7e866ceb0ef53a7aeaed442890ca2fb1bab4e1e6 commit 7e866ceb0ef53a7aeaed442890ca2fb1bab4e1e6 Author: Yuri Victorovich AuthorDate: 2023-07-12 05:18:21 +0000 Commit: Yuri Victorovich CommitDate: 2023-07-12 05:18:21 +0000 Tools/scripts: Add update-rust-port.sh script to simplify Rust port updates The command 'update-rust-port.sh ', when run in the Rust port directory, updates this port to the requested version. update-rust-port.sh should work in most cases. --- Tools/scripts/update-rust-port.sh | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/Tools/scripts/update-rust-port.sh b/Tools/scripts/update-rust-port.sh new file mode 100755 index 000000000000..7e479f87822a --- /dev/null +++ b/Tools/scripts/update-rust-port.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# MAINTAINER: yuri@FreeBSD.org + +## args + +VERSION="$1" + +## checks + +if [ -z "$VERSION" ]; then + echo "Usage: $0 " + exit 1 +fi +if ! [ -f Makefile ] || ! [ -f pkg-descr ] || ! grep -q "CARGO_CRATES=" Makefile; then + echo "$0 should be run in a Rust-based port directory" + exit 1 +fi + +## MAIN + +# copy Makefile +cp Makefile Makefile.new + +# substitute version +sed -i '' -E "s/(VERSION=[\t ]*)[0-9.]+/\1${VERSION}/" Makefile.new + +# replace CARGO_CRATES with a placeholder +/usr/bin/awk ' +BEGIN { + in_cargo_crates = 0 +} +/^CARGO_CRATES=.*/ { + in_cargo_crates = 1 + print "#@@@PLACEHOLDER@@@" +} +/^\t.*/ { + if (in_cargo_crates) { + // skip line + } else { + print $0 + } +} +!/^CARGO_CRATES=.*|^\t.*/ { + if (in_cargo_crates) { + in_cargo_crates = 0 + } + print $0 +}' < Makefile.new > Makefile.new1 && +/bin/mv Makefile.new1 Makefile.new + +# update distinfo +make -f Makefile.new makesum + +# replace the placeholder +while IFS= read -r line; do + if [ "$line" = "#@@@PLACEHOLDER@@@" ]; then + make -f Makefile.new cargo-crates | grep -v '^=' + else + echo "$line" + fi +done < Makefile.new > Makefile.new1 && +mv Makefile.new1 Makefile.new + +# move Makefile.new +mv Makefile.new Makefile + +# update distinfo +make clean makesum