@@ -8,7 +8,7 @@ ROOT="$(pwd)/pf9-ovn"
88
99# Install dependencies
1010apt-get update
11- DEBIAN_FRONTEND=noninteractive apt-get install -y \
11+ DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
1212 fakeroot build-essential autoconf automake bzip2 debhelper devscripts dpkg-dev \
1313 debhelper-compat dh-exec dh-python dh-sequence-python3 dh-sequence-sphinxdoc \
1414 graphviz iproute2 libcap-ng-dev libnuma-dev libpcap-dev libssl-dev libtool \
@@ -26,6 +26,8 @@ if [ -f "$ROOT/Makefile" ]; then
2626fi
2727rm -rf " $ROOT /dist"
2828
29+ # ... [Previous setup and make distclean] ...
30+
2931UBUNTU_VERSION=$1
3032CURRENT_BRANCH=$( git -C " $ROOT " rev-parse --abbrev-ref HEAD)
3133
@@ -34,16 +36,19 @@ if [ "$UBUNTU_VERSION" = "u24" ]; then
3436 OVS_BASE=" 3.3.6"
3537 OVN_BASE=" 24.03.6"
3638
37- # Case 1: Already on a u24 branch
39+ # Case 1: Already on a u24 branch - No Switch/Fetch needed
3840 if echo " $CURRENT_BRANCH " | grep -q " u24" ; then
3941 echo " Current branch '$CURRENT_BRANCH ' is already a u24 branch. Keeping it."
4042
4143 # Case 2: On a u22 branch, try to swap 'u22' for 'u24'
4244 elif echo " $CURRENT_BRANCH " | grep -q " u22" ; then
43- # String substitution: replace 'u22' with 'u24'
4445 TARGET_BRANCH=" ${CURRENT_BRANCH/ u22/ u24} "
45- echo " Current branch '$CURRENT_BRANCH ' contains 'u22'. Attempting switch to ' $TARGET_BRANCH ' ."
46+ echo " Current branch '$CURRENT_BRANCH ' contains 'u22'. Fetching.. ."
4647
48+ # Fetch before switching
49+ git -C " $ROOT " fetch
50+
51+ echo " Attempting switch to '$TARGET_BRANCH '..."
4752 if git -C " $ROOT " checkout " $TARGET_BRANCH " ; then
4853 echo " Successfully switched to specific branch '$TARGET_BRANCH '."
4954 else
@@ -53,7 +58,8 @@ if [ "$UBUNTU_VERSION" = "u24" ]; then
5358
5459 # Case 3: Generic branch (no u22/u24 in name) -> Default to main-u24
5560 else
56- echo " Current branch '$CURRENT_BRANCH ' does not match u24 patterns. Defaulting to 'main-u24'."
61+ echo " Current branch '$CURRENT_BRANCH ' does not match u24 patterns. Fetching and defaulting to 'main-u24'."
62+ git -C " $ROOT " fetch
5763 git -C " $ROOT " checkout " main-u24"
5864 fi
5965
@@ -64,10 +70,13 @@ elif [ "$UBUNTU_VERSION" = "u22" ] || [ -z "$UBUNTU_VERSION" ]; then
6470
6571 # Case 1: On a u24 branch, try to swap 'u24' for 'u22'
6672 if echo " $CURRENT_BRANCH " | grep -q " u24" ; then
67- # String substitution: replace 'u24' with 'u22'
6873 TARGET_BRANCH=" ${CURRENT_BRANCH/ u24/ u22} "
69- echo " Current branch '$CURRENT_BRANCH ' contains 'u24'. Attempting switch to ' $TARGET_BRANCH ' ."
74+ echo " Current branch '$CURRENT_BRANCH ' contains 'u24'. Fetching.. ."
7075
76+ # Fetch before switching
77+ git -C " $ROOT " fetch
78+
79+ echo " Attempting switch to '$TARGET_BRANCH '..."
7180 if git -C " $ROOT " checkout " $TARGET_BRANCH " ; then
7281 echo " Successfully switched to specific branch '$TARGET_BRANCH '."
7382 else
@@ -76,7 +85,6 @@ elif [ "$UBUNTU_VERSION" = "u22" ] || [ -z "$UBUNTU_VERSION" ]; then
7685 fi
7786
7887 # Case 2: Already on u22 or generic branch -> Keep it.
79- # (We assume generic branches are intended for the default/u22 build)
8088 else
8189 echo " Current branch '$CURRENT_BRANCH ' is appropriate for u22. Keeping it."
8290 fi
8694 exit 1
8795fi
8896
97+ # ... [Submodule update and build logic below] ...
98+
8999# 2. Initialize and update submodules recursively
90100# Performed after branch switching to ensure correct submodules are pulled
91101git -C " $ROOT " submodule update --init --recursive
0 commit comments