Zepp-Hanzj opened a new pull request, #3585:
URL: https://github.com/apache/nuttx-apps/pull/3585

   ## Summary
   
   `Directory.mk`'s `distclean` target only traverses subdirectories that have 
`.built`, `.depend`, or `.kconfig` markers. When a build fails between the 
`context::` and `depend::` phases (e.g. during configure), none of these 
markers exist, so `distclean` silently skips the directory — leaving behind 
unpacked sources, downloaded archives, and generated config files.
   
   This PR fixes this by introducing a `.context` marker and separating the 
scopes of `clean` and `distclean`.
   
   ## Changes
   
   ### 1. `Directory.mk` — `DISTCLEANSUBDIRS`
   
   Introduce a new variable `DISTCLEANSUBDIRS`: a superset of `CLEANSUBDIRS` 
that also includes directories carrying `.context`:
   
   ```makefile
   DISTCLEANSUBDIRS := $(CLEANSUBDIRS)
   DISTCLEANSUBDIRS += $(dir $(wildcard */.context))
   DISTCLEANSUBDIRS := $(sort $(DISTCLEANSUBDIRS))
   ```
   
   - `clean::` keeps using `CLEANSUBDIRS` — only clean compiled artifacts
   - `distclean::` now uses `DISTCLEANSUBDIRS` — also undo `context::` work
   
   ### 2. `Application.mk` — clean `.context` on distclean
   
   Add `$(call DELFILE, .context)` to the `distclean::` target alongside 
`.built`, `.depend`, and `Make.dep`.
   
   ### 3. `interpreters/python/Makefile` — touch `.context`
   
   Touch `.context` at the end of the `context::` target, after unpacking 
CPython source. This ensures `distclean` can find the directory even if the 
build fails during configure.
   
   ### 4. `interpreters/python/.gitignore`
   
   Add `.context` to the gitignore.
   
   ## How it works
   
   | Scenario | `.built` | `.depend` | `.context` | `CLEANSUBDIRS` | 
`DISTCLEANSUBDIRS` | distclean cleans? |
   |---|---|---|---|---|---|---|
   | Successful build | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
   | Failed at configure | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ (new!) |
   | Never built | ❌ | ❌ | ❌ | ❌ | ❌ | N/A |
   
   ## Verification
   
   Simulated a partial build (context:: run, build fails at configure):
   1. Created `Python/`, `build/`, `install/`, `v3.13.0.zip`, `config.site`, 
`Setup.local`
   2. Created `.context` marker
   3. Confirmed `CLEANSUBDIRS` is empty (no `.built`/`.depend`/`.kconfig`)
   4. Confirmed `DISTCLEANSUBDIRS` includes `python/` (has `.context`)
   5. Ran distclean — all artifacts cleaned correctly
   
   ## Fixes
   
   Fixes #2895


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to