From: "Matt Jolly" <kangie@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/chromium-tools:master commit in: /
Date: Wed, 20 Mar 2024 21:45:19 +0000 (UTC) [thread overview]
Message-ID: <1710971100.3b0f8cfc4a3d2e3344be2786a6ea9c255c43f8ee.kangie@gentoo> (raw)
commit: 3b0f8cfc4a3d2e3344be2786a6ea9c255c43f8ee
Author: Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 20 21:45:00 2024 +0000
Commit: Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Wed Mar 20 21:45:00 2024 +0000
URL: https://gitweb.gentoo.org/proj/chromium-tools.git/commit/?id=3b0f8cfc
New script: get_chromium_toolchain_strings.sh
Just does some awks and seds to enable the automated update
of google toolchain information within / from the specified
ebuild
Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>
get_chromium_toolchain_strings.sh | 70 +++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/get_chromium_toolchain_strings.sh b/get_chromium_toolchain_strings.sh
new file mode 100755
index 0000000..483d66f
--- /dev/null
+++ b/get_chromium_toolchain_strings.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+# This script extracts version information from Chromium sources by way of a Gentoo ebuild
+# then plugs the version information into the ebuild file. This is useful for updating the
+# toolchain versions in the ebuild file when a new (major) version of Chromium is released.
+
+# Usage: get_chromium_toolchain_strings.sh <ebuild_file>
+# <ebuild_file>: The path to the Chromium ebuild file
+
+# Extract the version string from an ebuild
+get_version() {
+ local filename="$1"
+ [[ -z "$filename" ]] && return 1 # Check for empty filename
+ local version_match="${filename##*-}"; # Extract everything after the last hyphen
+ version_match="${version_match%.*}" # Remove extension (.ebuild)
+ echo "$version_match"
+}
+
+# Display script usage
+usage() {
+ echo "Usage: get_chromium_toolchain_strings.sh <ebuild_file>"
+ echo " <ebuild_file>: The path to the Chromium ebuild file"
+}
+
+# Get the ebuild filename as the first argument
+ebuild_file="$1"
+
+# Check for missing argument
+if [[ -z "$ebuild_file" ]]; then
+ echo "Error: Please provide an ebuild filename as an argument."
+ usage
+ exit 1
+fi
+
+# Extract version from filename
+version="$(get_version "$ebuild_file")"
+
+# Check if version extraction failed (function return code)
+if [[ $? -ne 0 ]]; then
+ echo "Error: Could not extract version from filename."
+ exit 1
+fi
+
+# Construct S string based on version
+# Bad luck if you don't use /var/tmp/portage, I guess.
+S="/var/tmp/portage/www-client/chromium-${version}/work/chromium-${version}/"
+
+# Run ebuild with clean and unpack options
+ebuild "$ebuild_file" clean unpack
+
+# No secret sauce here - it's just simpler to set the field separator to a single quote
+# and then extract the final character from the sub-revision field.
+# This is a bit of a hack, but it works for now - I haven't see upstream go past the
+# 9th sub-revision yet!
+
+llvm_version=$(awk -F"'" '
+/CLANG_REVISION =/ { revision = $2 }
+/CLANG_SUB_REVISION =/ { printf("%s-%d\n", revision, substr($1, length($1), 1)) }
+' "${S}/tools/clang/scripts/update.py")
+
+rust_version=$(awk -F"'" '
+/RUST_REVISION =/ { revision = $2 }
+/RUST_SUB_REVISION =/ { printf("%s-%d\n", revision, substr($1, length($1), 1)) }
+' "${S}/tools/rust/update_rust.py")
+
+# Substitute versions into ebuild (assuming specific locations)
+sed -i "s/GOOGLE_CLANG_VER=.*/GOOGLE_CLANG_VER=${llvm_version}/" "$ebuild_file"
+sed -i "s/GOOGLE_RUST_VER=.*/GOOGLE_RUST_VER=${rust_version}/" "$ebuild_file"
+
+echo "Successfully substituted versions into $ebuild_file"
next reply other threads:[~2024-03-20 21:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 21:45 Matt Jolly [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-23 3:50 [gentoo-commits] proj/chromium-tools:master commit in: / Matt Jolly
2024-10-23 3:50 Matt Jolly
2024-10-10 21:52 Matt Jolly
2024-10-10 10:03 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-27 0:52 Matt Jolly
2024-09-26 7:25 Matt Jolly
2024-09-26 5:29 Matt Jolly
2024-09-26 5:21 Matt Jolly
2024-09-26 3:03 Matt Jolly
2024-09-26 2:39 Matt Jolly
2024-09-26 2:36 Matt Jolly
2024-08-30 3:39 Matt Jolly
2024-06-01 7:22 Matt Jolly
2024-05-31 23:02 Matt Jolly
2024-03-28 2:39 Matt Jolly
2024-03-20 21:45 Matt Jolly
2024-03-20 21:45 Matt Jolly
2024-03-20 21:45 Matt Jolly
2023-02-05 15:09 Stephan Hartmann
2022-09-01 19:33 Mike Gilbert
2022-09-01 19:24 Mike Gilbert
2022-05-06 9:55 Stephan Hartmann
2022-05-03 16:54 Mike Gilbert
2022-05-03 16:54 Mike Gilbert
2022-02-11 17:16 Stephan Hartmann
2022-02-05 16:29 Stephan Hartmann
2022-01-31 20:20 Stephan Hartmann
2020-11-21 19:34 Stephan Hartmann
2020-10-26 17:48 Mike Gilbert
2016-09-15 16:15 Mike Gilbert
2016-09-15 16:11 Mike Gilbert
2015-08-13 20:53 Mike Gilbert
2012-07-31 23:27 Mike Gilbert
2012-07-31 20:39 Mike Gilbert
2012-06-18 7:38 Paweł Hajdan
2011-10-25 16:36 Paweł Hajdan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1710971100.3b0f8cfc4a3d2e3344be2786a6ea9c255c43f8ee.kangie@gentoo \
--to=kangie@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox