1+ #! /bin/bash
2+ set -e
3+
4+ SLEEP_SEC=" "
5+ while [[ $# -gt 0 ]]; do
6+ case $1 in
7+ -s|--sleep)
8+ SLEEP_SEC=" $2 "
9+ shift 2
10+ ;;
11+ * )
12+ break
13+ ;;
14+ esac
15+ done
16+
17+ if [[ $# -lt 2 ]]; then
18+ echo " Usage: $0 [-s seconds] <base-commit> <tip-commit>"
19+ echo " Example: $0 origin/master b4/driver-types"
20+ exit 1
21+ fi
22+
23+ BASE_COMMIT=" $1 "
24+ TIP_COMMIT=" $2 "
25+
26+ # Fix commits to apply (hardcoded for now)
27+ # 780b05710047: rust_binder: Fix build failure if !CONFIG_COMPAT
28+ # c658b7542cb9: rust: bitops: fix missing _find_* functions on 32-bit ARM
29+ FIXES=" 780b05710047 c658b7542cb9"
30+
31+ # Prepare Fixes Branch
32+ echo " Preparing fixes branch based on $BASE_COMMIT ..."
33+ (
34+ cd linux
35+ # Create/Reset ci/base-fixes branch
36+ git checkout -B ci/base-fixes " $BASE_COMMIT " > /dev/null 2>&1
37+ for FIX in $FIXES ; do
38+ git cherry-pick " $FIX " > /dev/null
39+ done
40+ )
41+
42+ # Get list of commits to test (oldest to newest)
43+ echo " Generating list of commits between $BASE_COMMIT and $TIP_COMMIT ..."
44+ COMMITS=$( cd linux && git rev-list --reverse " ${BASE_COMMIT} ..${TIP_COMMIT} " )
45+
46+ if [[ -z " $COMMITS " ]]; then
47+ echo " No commits found in range."
48+ exit 0
49+ fi
50+
51+ echo " Found $( echo " $COMMITS " | wc -l) commits to test."
52+
53+ for COMMIT in $COMMITS ; do
54+ SHORT_COMMIT=$( echo " $COMMIT " | cut -c1-12)
55+ echo " ========================================"
56+ echo " Processing submodule commit $SHORT_COMMIT "
57+ echo " ========================================"
58+
59+ # 1. Prepare Submodule
60+ echo " Preparing submodule..."
61+ (
62+ cd linux
63+ git checkout --detach " $COMMIT " > /dev/null 2>&1
64+ # Merge fixes
65+ git merge --no-edit ci/base-fixes > /dev/null
66+ # Push to a stable ref for the submodule
67+ git push --force origin HEAD:refs/heads/ci/fixes
68+ )
69+
70+ # 2. Update Parent
71+ echo " Updating parent repository..."
72+ git add linux
73+ # Amend the previous commit to avoid creating a huge history in the parent if running repeatedly?
74+ # But we want to test each one.
75+ git commit -m " ci: Update submodule to $SHORT_COMMIT (testing)"
76+
77+ # 3. Push Parent
78+ echo " Pushing to CI..."
79+ git push --force origin ci/actions
80+
81+ # 4. Wait
82+ if [[ -n " $SLEEP_SEC " ]]; then
83+ echo " Sleeping for $SLEEP_SEC seconds..."
84+ sleep " $SLEEP_SEC "
85+ else
86+ echo " Check GitHub Actions: https://github.com/Darksonn/linux/actions"
87+ read -p " Press Enter when the CI job has started to proceed to the next commit..."
88+ fi
89+ done
90+
91+ echo " Done!"
0 commit comments