From e83d437e97cf2b41830ef1dbcb0d4e5fb4c3d011 Mon Sep 17 00:00:00 2001 From: Sonic-builder OSSO Date: Wed, 20 Nov 2024 10:08:04 +0100 Subject: [PATCH] [#47/%20869] build: (minor) frr keeps changing after build --- src/sonic-frr/Makefile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index c7c43ccecc0e..69d62a2e7a82 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -13,12 +13,19 @@ 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 ifeq ($(CROSS_BUILD_ENVIRON), y) @@ -26,16 +33,7 @@ ifeq ($(CROSS_BUILD_ENVIRON), y) 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)/