Kaynağa Gözat

fix(root-setup): version values from pinned commit, bake ReSukiSU sha/branch

Count/describe the pinned SHA instead of the branch tip, which may
have moved on. Also bake KSU_COMMIT_SHA (killing the -dirty append)
and KSU_BRANCH_NAME for ReSukiSU instead of leaving unknown.
TheWildJames 4 gün önce
ebeveyn
işleme
5c3c6a47ca
1 değiştirilmiş dosya ile 10 ekleme ve 3 silme
  1. 10 3
      .github/actions/root-setup/action.yml

+ 10 - 3
.github/actions/root-setup/action.yml

@@ -128,9 +128,11 @@ runs:
         git fetch origin "$repobranch":refs/remotes/origin/"$repobranch" --tags --unshallow 2>/dev/null || \
         git fetch origin "$repobranch":refs/remotes/origin/"$repobranch" --tags 2>/dev/null || true
         
-        # Extract and export KSU version info from the fetched tracking branch
-        KSU_GIT_VERSION=$(git rev-list --count "refs/remotes/origin/$repobranch" 2>/dev/null || echo "0")
-        KSU_GIT_TAG=$(git describe --tags --abbrev=0 "refs/remotes/origin/$repobranch" 2>/dev/null || echo "v0.0.1")
+        # Extract and export KSU version info for the PINNED commit, not the
+        # branch tip: the pin is what we build, and the tip may have moved on.
+        KSU_GIT_VERSION=$(git rev-list --count "$expected_commit" 2>/dev/null || echo "0")
+        KSU_GIT_TAG=$(git describe --tags --abbrev=0 "$expected_commit" 2>/dev/null || echo "v0.0.1")
+        KSU_SHORT=$(git rev-parse --short=8 "$expected_commit")
         KSU_VERSION=$((30000 + KSU_GIT_VERSION))
 
         cd kernel
@@ -143,6 +145,11 @@ runs:
           # ReSukiSU targets KSU_VERSION and KSU_TAG_NAME explicitly
           sed -i "s|^KSU_VERSION :=.*|KSU_VERSION := ${KSU_VERSION}|" Kbuild
           sed -i "s|^KSU_TAG_NAME.*:=.*|KSU_TAG_NAME := ${KSU_GIT_TAG}|" Kbuild
+          # Bake the short SHA too (both the probe and the -dirty append
+          # match, so both become the literal and the suffix is gone), plus
+          # the branch the pin was taken from.
+          sed -i "s|^KSU_COMMIT_SHA  :=.*|KSU_COMMIT_SHA  := ${KSU_SHORT}|" Kbuild
+          sed -i "s|^KSU_BRANCH_NAME :=.*|KSU_BRANCH_NAME := ${repobranch}|" Kbuild
         elif [ "$flavor" = "next" ]; then
           #KernelSU-Next uses fallback pattern
           sed -i "s/^KSU_VERSION_FALLBACK := 1$/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" Kbuild