public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Matt Jolly" <kangie@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/chromium-tools:master commit in: /
Date: Thu, 10 Oct 2024 10:03:38 +0000 (UTC)	[thread overview]
Message-ID: <1728554514.97423cbcc271276d24899f528c879ab011f28d1b.kangie@gentoo> (raw)

commit:     97423cbcc271276d24899f528c879ab011f28d1b
Author:     Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 10 10:01:54 2024 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Thu Oct 10 10:01:54 2024 +0000
URL:        https://gitweb.gentoo.org/proj/chromium-tools.git/commit/?id=97423cbc

New script: iterate-over-ebuild.sh

Iterates over a chromium ebuild provided as an argument and
updates `keeplibs` when the build fails.

Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 iterate-over-ebuild.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/iterate-over-ebuild.sh b/iterate-over-ebuild.sh
new file mode 100755
index 0000000..5013a45
--- /dev/null
+++ b/iterate-over-ebuild.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# spdx-license-identifier: GPL-2.0-or-later
+# Script to iterate over `ebuild foo-1.2.3.ebuild clean merge` and automatically add values to keeplibs.
+# Usage: ./iterate-over-ebuild.sh foo-1.2.3.ebuild
+# This script will run until the ebuild is merged, or until you interrupt it with Ctrl+C.
+# It will add the libraries to keeplibs in the ebuild as it goes.
+
+package="${1%.ebuild}"
+tmpfile=$(mktemp)
+iter=0
+added=()
+
+# Trap for Ctrl+C
+trap 'cleanup' INT
+
+cleanup() {
+  echo "[$(date)]: Script interrupted."
+  echo "$tmpfile" for this iteration\'s logs.
+  exit 1
+}
+
+while true; do
+  libs=()
+  echo "[$(date)]: Processing $package; iteration $((++iter))"
+  echo "So far, we've added:"
+  if [ ${#added[@]} -eq 0 ]; then
+    echo "  Nothing"
+  fi
+  for i in "${added[@]}"; do
+    echo "  $i"
+  done
+  ebuild "${1}" clean merge 2>&1 | tee "$tmpfile"
+
+  # Should only ever be one but whatever
+  mapfile -t libs < <(grep 'ninja: error:' "$tmpfile" | awk '{print $3}' | cut -c 8- | awk -F/ '{OFS="/"; NF--; print}')
+
+  if [ ${#libs[@]} -eq 0 ]; then
+    echo "[$(date)]: No new libraries to whitelist."
+  else
+    for lib in "${libs[@]}"; do
+      echo "[$(date)]: Whitelisting $lib"
+      if grep -q "$lib" "${1}"; then
+        # Something went wrong if we're here but whatever.
+        echo "[$(date)]: $lib already exists in keeplibs"
+      else
+        echo "[$(date)]: Adding $lib to keeplibs"
+        sed -i "/^\s*local keeplibs=/a \t\t$lib" "${1}"
+        added+=("$lib")
+      fi
+    done
+  fi
+
+  if grep -q "www-client/$package merged" "$tmpfile"; then
+    rm "$tmpfile"
+    break
+  fi
+  # Start with a clean slate for the next iteration
+  rm "$tmpfile"
+done


             reply	other threads:[~2024-10-10 10:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 10:03 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-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
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=1728554514.97423cbcc271276d24899f528c879ab011f28d1b.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