Skip to content

Commit a0ba49d

Browse files
authored
[Build] Fix some of the patches not applied issue (#15660)
Why I did it Fix some of the patches in .patches folder not applied issue. The command "quilt applied" only lists the applied patches, if some of the patches have issues, then the patches will not be applied when you run the build command again. Work item tracking Microsoft ADO (number only): 24410730 How I did it Run the command to apply the patches without any conditions. If failed, check if the failure reason is "series fully applied". How to verify it
1 parent 19638a4 commit a0ba49d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

slave.mk

+7-7
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ $(addprefix $(FILES_PATH)/, $(SONIC_MAKE_FILES)) : $(FILES_PATH)/% : .platform $
648648
# Remove target to force rebuild
649649
rm -f $(addprefix $(FILES_PATH)/, $*)
650650
# Apply series of patches if exist
651-
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
651+
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
652652
# Build project and take package
653653
make DEST=$(shell pwd)/$(FILES_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(FILES_PATH)/$* $(LOG)
654654
# Clean up
@@ -692,7 +692,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
692692
# Remove target to force rebuild
693693
rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS))
694694
# Apply series of patches if exist
695-
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
695+
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
696696
# Build project and take package
697697
$(SETUP_OVERLAYFS_FOR_DPKG_ADMINDIR)
698698
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC}" $(ANT_DEB_CONFIG) $(CROSS_COMPILE_FLAGS) make -j$(SONIC_CONFIG_MAKE_JOBS) DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG)
@@ -732,7 +732,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
732732
# Remove old build logs if they exist
733733
rm -f $($*_SRC_PATH)/debian/*.debhelper.log
734734
# Apply series of patches if exist
735-
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
735+
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
736736
# Build project
737737
pushd $($*_SRC_PATH) $(LOG_SIMPLE)
738738
if [ -f ./autogen.sh ]; then ./autogen.sh $(LOG); fi
@@ -846,7 +846,7 @@ $(addprefix $(PYTHON_DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(PYTHON_DEBS_PA
846846
if [ -z '$($*_CACHE_LOADED)' ] ; then
847847

848848
# Apply series of patches if exist
849-
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
849+
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi $(LOG)
850850
# Build project
851851
pushd $($*_SRC_PATH) $(LOG_SIMPLE)
852852
rm -rf deb_dist/* $(LOG)
@@ -886,7 +886,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA
886886

887887
pushd $($*_SRC_PATH) $(LOG_SIMPLE)
888888
# apply series of patches if exist
889-
if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt applied || QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi $(LOG)
889+
if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi $(LOG)
890890
ifneq ($(CROSS_BUILD_ENVIRON),y)
891891
# Use pip instead of later setup.py to install dependencies into user home, but uninstall self
892892
pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name`
@@ -952,7 +952,7 @@ docker-start :
952952
$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
953953
$(HEADER)
954954
# Apply series of patches if exist
955-
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG)
955+
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG)
956956
# Prepare docker build info
957957
SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \
958958
TRUSTED_GPG_URLS=$(TRUSTED_GPG_URLS) \
@@ -1050,7 +1050,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform
10501050
if [ -z '$($*.gz_CACHE_LOADED)' ] ; then
10511051

10521052
# Apply series of patches if exist
1053-
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt applied || QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG)
1053+
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi $(LOG)
10541054
mkdir -p $($*.gz_PATH)/debs $(LOG)
10551055
mkdir -p $($*.gz_PATH)/files $(LOG)
10561056
mkdir -p $($*.gz_PATH)/python-debs $(LOG)

0 commit comments

Comments
 (0)