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

Fix sonic frr makefile to handle multiple builds #3483

Closed
wants to merge 8 commits into from

Conversation

nikos-github
Copy link
Collaborator

@nikos-github nikos-github commented Sep 19, 2019

This fixes #3407.

The logic is to try a dry run on the patch and if that passes, apply the patch. If not, try a dry run removal. If it passes, the patch is already applied and the code hasn't changed significantly to affect it. If it doesn't pass, fail the build as the patch most probably needs to be reworked.

@lguohan @pavel-shirshov Please review.

FYI: @ben-gale @MichelMoriniaux @mslocrian @heidinet2007

@pavel-shirshov
Copy link
Contributor

Hi Nikos,

Thank you for the patch. Can we make a loop over an array?
for patch_file in patch_file1 patch_file2 patch_file3
do

done
Also we could make a list of patches from ls of the patches directory.

@ben-gale
Copy link
Collaborator

ben-gale commented Sep 24, 2019 via email

@lguohan
Copy link
Collaborator

lguohan commented Sep 24, 2019

#3480 is a much simpler way to fix this issue. but I do not know why stg init fails?

@nikos-github
Copy link
Collaborator Author

Hi Nikos,

Thank you for the patch. Can we make a loop over an array?
for patch_file in patch_file1 patch_file2 patch_file3
do

done

Will do.

Also we could make a list of patches from ls of the patches directory.

I'm really not keen on parsing screen output in the makefile. How strongly do you feel about this?

@nikos-github
Copy link
Collaborator Author

#3480 is a much simpler way to fix this issue. but I do not know why stg init fails?

@lguohan I don't think that's the right approach. Issuing git reset --hard will cause any user changes to be lost.

exit 1
fi
fi
if patch -sfp1 --dry-run < ../patch/$(patch5); then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
what does "if patch -sfp1 --dry-run < ../patch/$(patch5);" mean ? Also, I am adding a new patch6. For every new patch, should we change the sonic-frr/makefile.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with each patch the makefile would have to be changed. if patch -sfp1 --dry-run < ../patch/$(patch5) tries (without applying hence the dry-run) to see if the patch can apply.

@nikos-github
Copy link
Collaborator Author

retest this please

1 similar comment
@nikos-github
Copy link
Collaborator Author

retest this please

@@ -10,7 +10,7 @@ patch2 = 0002-Reduce-severity-of-Vty-connected-from-message.patch
patch3 = 0003-ignore-nexthop-attribute-when-NLRI-is-present.patch
patch4 = 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch
patch5 = 0005-Support-VRF.patch
patches = "$patch1 $patch2 $patch3 $patch4 $patch5"
patches = "$(patch1) $(patch2) $(patch3) $(patch4) $(patch5)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nikos,
I needed this patch for my broadcom image. I had taken your changes and made some additions since I needed it urgently for submitting my changes. The below script works for broadcom image.
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e

MAIN_TARGET = $(FRR)
DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) $(FRR_SNMP) $(FRR_SNMP_DBG)

patch1 = 0001-Add-support-of-bgp-tcp-DSCP-value.patch
patch2 = 0002-Reduce-severity-of-Vty-connected-from-message.patch
patch3 = 0003-ignore-nexthop-attribute-when-NLRI-is-present.patch
patch4 = 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch
patch5 = 0005-Support-VRF.patch

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Build the package
pushd ./frr
for frr_patch in $(patch1) $(patch2) $(patch3) $(patch4) $(patch5); do
echo "Patch $$frr_patch"
if patch -sfp1 --dry-run < ../patch/$$frr_patch; then
patch -sfp1 < ../patch/$$frr_patch
else
if ! patch -Rsfp1 --dry-run < ../patch/$$frr_patch; then
echo "Patch $$frr_patch failure"
exit 1
fi
fi
done
tools/tarsource.sh -V -e '-sonic'
dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS)
popd
mv $(DERIVED_TARGET) $* $(DEST)/

$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes my latest patch is somewhat similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to replace $(frr_patch) by $$frr_patch. This is because, for a loop variable, we should not let the makefile change the frr_patch content.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the correction.

Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for now

@nikos-github
Copy link
Collaborator Author

@lguohan Can we merge this?

@pavel-shirshov
Copy link
Contributor

@nikos-github Currently I'm working on #3480
Which makes the same but with stg. Guohan asked me to use stg for applying patches into sonic-frr

@nikos-github
Copy link
Collaborator Author

nikos-github commented Sep 28, 2019

@nikos-github Currently I'm working on #3480
Which makes the same but with stg. Guohan asked me to use stg for applying patches into sonic-frr

@pavel-shirshov Is your solution considering private changes? Can you explain how it will work if someone has modified frr code and wants to re-build?

The solution in this PR will work with private changes too if any of the patches are not affected.

@pavel-shirshov
Copy link
Contributor

Close in favor of #3480

mssonicbld added a commit that referenced this pull request Sep 4, 2024
…atically (#20122)

#### Why I did it
src/sonic-utilities
```
* d29b8241 - (HEAD -> master, origin/master, origin/HEAD) Revert "[wol] Implement wol command line utility" (#3515) (3 hours ago) [Wenda Chu]
* 9357c45f - [chassis][cli] Fix config chassis module startup/shutdown command for fabric module (#3483) (9 hours ago) [Marty Y. Lok]
* 4c7e54a9 - [qos reload] Fix "config qos reload" overriding entire CONFIG_DB (#3479) (18 hours ago) [Stepan Blyshchak]
* 544584ea - Add back the option f to the reboot script (#3492) (18 hours ago) [DavidZagury]
* dc955e80 - [Mellanox] Add CMIS Host Management Files to 'show techsupport' Dumps (#3501) (18 hours ago) [Tomer Shalvi]
```
#### How I did it
#### How to verify it
#### Description for the changelog
mssonicbld added a commit that referenced this pull request Sep 7, 2024
…atically (#20188)

#### Why I did it
src/sonic-utilities
```
* 3a0575c2 - (HEAD -> 202405, origin/202405) Add back the option f to the reboot script (#3492) (4 hours ago) [DavidZagury]
* 60c14df8 - Enable show interfacess counters on chassis supervisor (#3488) (4 hours ago) [Changrong Wu]
* cbbfe7b7 - [chassis][cli] Fix config chassis module startup/shutdown command for fabric module (#3483) (4 hours ago) [Marty Y. Lok]
* b6cbe6ed - Remove redundant mmuconfig file (#3446) (4 hours ago) [HP]
* fb6dd589 - [qos reload] Fix "config qos reload" overriding entire CONFIG_DB (#3479) (4 hours ago) [Stepan Blyshchak]
* 9da5db58 - Skip default lanes dup check (#3489) (4 hours ago) [Xincun Li]
* edde02ce - [Mellanox] Add CMIS Host Management Files to 'show techsupport' Dumps (#3501) (4 hours ago) [Tomer Shalvi]
```
#### How I did it
#### How to verify it
#### Description for the changelog
vvolam pushed a commit to vvolam/sonic-buildimage that referenced this pull request Sep 12, 2024
…atically (sonic-net#20122)

#### Why I did it
src/sonic-utilities
```
* d29b8241 - (HEAD -> master, origin/master, origin/HEAD) Revert "[wol] Implement wol command line utility" (sonic-net#3515) (3 hours ago) [Wenda Chu]
* 9357c45f - [chassis][cli] Fix config chassis module startup/shutdown command for fabric module (sonic-net#3483) (9 hours ago) [Marty Y. Lok]
* 4c7e54a9 - [qos reload] Fix "config qos reload" overriding entire CONFIG_DB (sonic-net#3479) (18 hours ago) [Stepan Blyshchak]
* 544584ea - Add back the option f to the reboot script (sonic-net#3492) (18 hours ago) [DavidZagury]
* dc955e80 - [Mellanox] Add CMIS Host Management Files to 'show techsupport' Dumps (sonic-net#3501) (18 hours ago) [Tomer Shalvi]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error rebuilding FRR after clean
6 participants