Skip to content

Commit efbddb9

Browse files
committed
[LTR] Infer kernel version from UPSTREAM_REF
Use the inferred kernel version to construct all of the other branch references in the script. This should allow an UPSTREAM_REF of stable_6.18.y to be passed and the script to work the same way it does today for 6.12
1 parent 9e802b4 commit efbddb9

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

lt_rebase.sh

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ if [ -z "$UPSTREAM_REF" ]; then
77
echo "UPSTREAM_REF not set, defaulting to $UPSTREAM_REF"
88
fi
99

10+
# Extract kernel version from UPSTREAM_REF (e.g., stable_6.12.y -> 6.12)
11+
KERNEL_VERSION=$(echo "$UPSTREAM_REF" | sed -E 's/.*_([0-9]+\.[0-9]+)\.y/\1/')
12+
if [ -z "$KERNEL_VERSION" ]; then
13+
echo "Failed to extract kernel version from UPSTREAM_REF: $UPSTREAM_REF"
14+
echo "Expected format: stable_X.Y.y (e.g., stable_6.12.y)"
15+
exit 1
16+
fi
17+
echo "Detected kernel version: $KERNEL_VERSION"
18+
1019
git fetch --all
1120
git show-ref --verify --quiet refs/remotes/origin/$UPSTREAM_REF
1221
if [ $? -ne 0 ]; then
@@ -20,36 +29,36 @@ if [ $? -ne 0 ]; then
2029
exit 1
2130
fi
2231

23-
git show-ref --verify --quiet refs/heads/ciq-6.12.y-next
24-
if [ $? -eq 0 ]; then
25-
echo "ciq-6.12.y-next branch already exists, please check status of remote and local branches"
32+
git show-ref --verify --quiet refs/heads/ciq-${KERNEL_VERSION}.y-next
33+
if [ $? -eq 0 ]; then
34+
echo "ciq-${KERNEL_VERSION}.y-next branch already exists, please check status of remote and local branches"
2635
exit 1
2736
fi
2837

29-
git show-ref --verify --quiet refs/heads/{automation_tmp}_ciq-6.12.y-next
30-
if [ $? -eq 0 ]; then
31-
echo "{automation_tmp}_ciq-6.12.y-next branch already exists, please check status of remote and local branches"
38+
git show-ref --verify --quiet refs/heads/{automation_tmp}_ciq-${KERNEL_VERSION}.y-next
39+
if [ $? -eq 0 ]; then
40+
echo "{automation_tmp}_ciq-${KERNEL_VERSION}.y-next branch already exists, please check status of remote and local branches"
3241
exit 1
3342
fi
3443

35-
git checkout -b ciq-6.12.y-next $UPSTREAM_REF
44+
git checkout -b ciq-${KERNEL_VERSION}.y-next $UPSTREAM_REF
3645
if [ $? -ne 0 ]; then
37-
echo "Failed to checkout ciq-6.12.y-next, please check status of remote and local branches"
46+
echo "Failed to checkout ciq-${KERNEL_VERSION}.y-next, please check status of remote and local branches"
3847
exit 1
3948
fi
40-
git checkout ciq-6.12.y
49+
git checkout ciq-${KERNEL_VERSION}.y
4150
if [ $? -ne 0 ]; then
42-
echo "Failed to checkout ciq-6.12.y, please check status of remote and local branches"
51+
echo "Failed to checkout ciq-${KERNEL_VERSION}.y, please check status of remote and local branches"
4352
exit 1
4453
fi
45-
git checkout -b {automation_tmp}_ciq-6.12.y-next
54+
git checkout -b {automation_tmp}_ciq-${KERNEL_VERSION}.y-next
4655
if [ $? -ne 0 ]; then
47-
echo "Failed to checkout {automation_tmp}_ciq-6.12.y-next, please check status of remote and local branches"
56+
echo "Failed to checkout {automation_tmp}_ciq-${KERNEL_VERSION}.y-next, please check status of remote and local branches"
4857
exit 1
4958
fi
50-
git rebase ciq-6.12.y-next
59+
git rebase ciq-${KERNEL_VERSION}.y-next
5160
if [ $? -ne 0 ]; then
52-
echo "Failed to rebase {automation_tmp}_ciq-6.12.y-next, please check status of remote and local branches"
61+
echo "Failed to rebase {automation_tmp}_ciq-${KERNEL_VERSION}.y-next, please check status of remote and local branches"
5362
exit 1
5463
fi
5564

0 commit comments

Comments
 (0)