fix(build): make %prep idempotent for hidden files#595
Open
traviswu-bigstack wants to merge 1 commit into
Open
fix(build): make %prep idempotent for hidden files#595traviswu-bigstack wants to merge 1 commit into
traviswu-bigstack wants to merge 1 commit into
Conversation
The committed code-indexer cache .understand-anything (5 files) is a dotfile dir,
so %prep's `rm -rf ./*` skipped it while the `find ... -name '*'` flatten matched
it -> it leaked into BUILD/, survived the next clean, and collided on the next mv
("Directory not empty").
- Make %prep idempotent: clear with `find . -mindepth 1 -maxdepth 1 -exec rm -rf {} +`
(dotfile-inclusive, matching the flatten), so any stray hidden file is handled.
- Remove the committed .understand-anything cache (local tooling state, not source)
and gitignore it so it can't be re-committed.
Refs bigstack-oss/cubecos#1005
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Travis Wu <travis.wu@bigstack.co>
ebb9ec8 to
59d48e4
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.
What this PR does / why we need it
Resolves a build failure where
rpmbuild %prepaborted withmv: cannot move '.../.understand-anything' ...: Directory not empty.Root cause: the repo had a committed code-indexer cache
.understand-anything/(5 files, ~46k lines).
%prepcleaned the build dir withrm -rf ./*(a shell glob,which skips dotfiles) but flattened the extracted source with
find ... -name '*'(which matches dotfiles). So
.understand-anythingwas flattened intoBUILD/,survived the next
rm -rf ./*, and collided on the nextmv. It only surfaced oncethe make-mtime always-rebuild bug (bigstack-oss/cubecos#1005) made
%prepre-runevery build.
Two complementary fixes:
%prep(defense-in-depth): clear withfind . -mindepth 1 -maxdepth 1 -exec rm -rf {} +— dotfile-inclusive, matching theflatten — so any stray hidden file is handled. POSIX
find(notshopt dotglob)because rpm runs
%prepunder/bin/sh..understand-anything/cache (localtooling state, not source — it rode into every
git clone --depth 1and the rpmsource tarball) and add it to
.gitignoreso it can't be re-committed.Linked issue
Refs bigstack-oss/cubecos#1005 (the build-incrementality bug that surfaced this).