Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build/frr] Properly reset sonic-frr/frr branch after build #20868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions src/sonic-frr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,31 @@ export DEBEMAIL := sonicproject@googlegroups.com
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Build the package
pushd ./frr
git checkout -b $(FRR_BRANCH) origin/$(FRR_BRANCH) || git checkout $(FRR_BRANCH)
ifeq ($(CROSS_BUILD_ENVIRON), y)
git reset --hard
endif
stg branch --create $(STG_BRANCH) $(FRR_TAG)
git fetch --all

oldbranch=$$(git describe --always)
if ! git checkout $(FRR_BRANCH)-sonic; then
git checkout -b $(FRR_BRANCH)-sonic origin/$(FRR_BRANCH)
fi
git clean -xdf
git reset --hard origin/$(FRR_BRANCH)
git branch --list 'stg_temp.*' | sed -e '/^[*] /d' | xargs --no-run-if-empty git branch -D

stg branch --create $(STG_BRANCH)-sonic $(FRR_TAG)
stg import -s ../patch/series
gbp dch --ignore-branch --new-version=$(FRR_VERSION)-sonic-$(FRR_SUBVERSION) --dch-opt="--force-bad-version" --commit --git-author

cp ../$(DPLANE_FPM_SONIC_MODULE) zebra/
git add -A zebra
git commit -m 'Add dplan netlink module'

gbp dch --ignore-branch --new-version=$(FRR_VERSION)-sonic-$(FRR_SUBVERSION) --dch-opt="--force-bad-version" --commit --git-author

ifeq ($(CROSS_BUILD_ENVIRON), y)
CFLAGS="-I $$CROSS_PERL_CORE_PATH" dpkg-buildpackage -rfakeroot -b -d -us -uc -Ppkg.frr.nortrlib -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
else
dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
endif
stg undo || true
git clean -xfdf
git checkout $(FRR_BRANCH)
stg branch --delete --force $(STG_BRANCH)
git rev-parse --short HEAD | xargs git checkout
ifeq ($(CROSS_BUILD_ENVIRON), y)
git reset --hard
endif
git checkout master
git branch -D $(FRR_BRANCH)
git checkout "$$oldbranch"
popd
mv $(DERIVED_TARGET) $* $(DEST)/

Expand Down
Loading