From d2294841b2df66f4e684b5eed1cae955cea21cf8 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 28 Jun 2023 16:58:32 -0400
Subject: [PATCH] SL-18837: Get buildscripts_support_functions from
 sling-buildscripts

and use these variants for GitHub builds.
---
 .github/workflows/build.yaml   |  9 ++---
 buildscripts_support_functions | 60 ++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 7 deletions(-)
 create mode 100644 buildscripts_support_functions

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index dda5867a9f8..e7608657e32 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -41,7 +41,8 @@ jobs:
       build_log_dir: ${{ github.workspace }}/.logs
       build_viewer: true
       BUILDSCRIPTS_SHARED: ${{ github.workspace }}/.shared
-      BUILDSCRIPTS_SUPPORT_FUNCTIONS: ${{ github.workspace }}/.buildscripts/hg/bin/buildscripts_support_functions
+      # extracted and committed to viewer repo
+      BUILDSCRIPTS_SUPPORT_FUNCTIONS: ${{ github.workspace }}/buildscripts_support_functions
       git_hooks_checkout: ${{ github.workspace }}/.git-hooks
       GIT_REF: ${{ github.head_ref || github.ref }}
       LL_SKIP_REQUIRE_SYSROOT: 1
@@ -71,12 +72,6 @@ jobs:
           ref: viewer
           path: .build-variables
 
-      - name: Checkout buildscripts
-        uses: actions/checkout@v3
-        with:
-          repository: secondlife/sling-buildscripts
-          path: .buildscripts
-
       - name: Checkout git-hooks
         uses: actions/checkout@v3
         with:
diff --git a/buildscripts_support_functions b/buildscripts_support_functions
new file mode 100644
index 00000000000..557d2f80fbe
--- /dev/null
+++ b/buildscripts_support_functions
@@ -0,0 +1,60 @@
+# standalone functions from sling-buildscripts
+
+set_build_number_to_revision()
+{
+    record_event "buildNumber $revision"
+}
+
+record_event()
+{
+    echo "=== $@"
+}
+
+begin_section()
+{
+    record_event "START $*"
+    sections+=("$*")
+}
+
+end_section()
+{
+    # accommodate dumb Mac bash 3, which doesn't understand array[-1]
+    local last=$(( ${#sections[@]} - 1 ))
+    record_event "END ${*:-${sections[$last]}}"
+    unset "sections[$last]"
+}
+
+record_success()
+{
+    record_event "SUCCESS $*"
+}
+
+record_failure()
+{
+    record_event "FAILURE $*" >&2
+}
+
+fatal()
+{
+    record_failure "$@"
+    finalize false
+    exit 1
+}
+
+# redefined fail for backward compatibility
+alias fail=fatal
+
+pass()
+{
+  exit 0
+}
+
+export -f set_build_number_to_revision
+export -f record_event
+export -f begin_section
+export -f end_section
+export -f record_success
+export -f record_failure
+export -f fatal
+export -f pass
+export sections
-- 
GitLab