apps: fix distclean for partial builds and residual .kconfig files#3585
Open
Zepp-Hanzj wants to merge 1 commit into
Open
apps: fix distclean for partial builds and residual .kconfig files#3585Zepp-Hanzj wants to merge 1 commit into
Zepp-Hanzj wants to merge 1 commit into
Conversation
8d39253 to
d6d4f3f
Compare
d6d4f3f to
1f90ced
Compare
1f90ced to
d2d19d7
Compare
06e44e7 to
29ca83b
Compare
Contributor
Author
|
Hi, the CI failure on Linux (arm-02) appears to be a timeout issue rather than a build failure caused by this PR. Looking at the arm-02 logs:
Could someone re-run the CI? The timeout seems to be an infrastructure issue. Thank you! |
29ca83b to
1b8feed
Compare
| # like cargo). TOPDIR is passed so that sub-makes can include | ||
| # $(TOPDIR)/Make.defs and define SDIR_template for further recursion. | ||
|
|
||
| $(foreach SDIR, $(SUBDIRS), $(eval .PHONY: $(SDIR)_clean)) |
Contributor
There was a problem hiding this comment.
let extend SDIR_template instead duplicating the code
The current distclean implementation has two issues: 1. Application.mk does not remove .kconfig on distclean, so stale config fragments from earlier builds can pollute subsequent ones. 2. Several external-library Makefiles (lame, libshvc, libulut) run "make -C <subdir> distclean" without checking whether the subdirectory exists. When the library was never downloaded (common in CI partial-build environments), distclean fails with "No such file or directory". Fix: - Application.mk: add $(call DELFILE, .kconfig) to the distclean target so that .kconfig is cleaned along with .built, .depend, etc. - audioutils/lame/Makefile: guard the distclean recipe with "if [ -d $(DST_PATH) ]; then ...; fi" and use $(MAKE) instead of bare make. - netutils/libshvc/Makefile, netutils/libulut/Makefile: same directory-existence guard for their distclean recipes. - crypto/wolfssl/Makefile: change "distclean:" to "distclean::" (double-colon) so it does not override the distclean:: rule inherited from Application.mk. Signed-off-by: hanzhijian <hanzhijian@zepp.com>
1b8feed to
1ba1b22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Directory.mk'sdistcleanonly traversesCLEANSUBDIRS— directories with.built,.depend, or.kconfigmarkers. When a build fails before these markers are written (e.g. Python configure succeeds but compilation fails),distcleanskips the directory entirely, leaving behindbuild/,config.site, and other artifacts.Fix: use
SUBDIRS(all directories with Makefiles) fordistclean. It is idempotent, so calling it on un-built directories is harmless.Changes
Directory.mkSUBDIRSinstead ofCLEANSUBDIRS; inline target definitions withTOPDIR;-prefix for error resilienceApplication.mk$(call DELFILE, .kconfig)audioutils/lame/Makefilecd $(DST_PATH)against already-deleted directorycrypto/wolfssl/Makefiledistclean:->distclean::(conflicted with Application.mk)Companion PR
Requires nuttx#19310 which passes
TOPDIRinSDIR_template/MAKE_template.Verification
The bug: when a build fails between
context::anddepend::phases,.builtand.dependmarkers are never written. The old distclean usesCLEANSUBDIRSwhich requires these markers, so it skips the directory and leaves artifacts behind.To reproduce, simulate a partial build by creating the residual files a failed Python configure would leave, without
.built/.dependmarkers:Run distclean through the NuttX build system (note:
appsis a symlink tonuttx-apps):Verify all residuals are cleaned:
Without this patch,
make distcleanproduces no output (CLEANSUBDIRS is empty, nothing is traversed) and all residuals remain.Fixes #2895