Guard lint.mk's submodule include so it doesn't break tarball builds - #37
Open
jnasbyupgrade wants to merge 1 commit into
Open
Guard lint.mk's submodule include so it doesn't break tarball builds#37jnasbyupgrade wants to merge 1 commit into
jnasbyupgrade wants to merge 1 commit into
Conversation
An unconditional `include .vendor/linter/lint.mk` (via the self-init rule
`git submodule update --init`) breaks EVERY make invocation -- not just
`make lint` -- when building from a source tarball. Make tries to satisfy
every `include` before doing anything else, for any target requested; a
real PGXN distribution tarball (git archive, make dist's own output) has no
.git and no submodule content, so `git submodule update` fails outright
("fatal: not a git repository"), and that failure aborted the whole build.
Confirmed by building a real `git archive` tarball into a clean directory
with no .git at all: a plain `make` failed immediately with
"fatal: not a git repository" before doing anything else, real exit code 2.
Fix: guard the self-init rule and include behind `ifneq ($(wildcard
.git),)`. Confirmed both directions: a real git checkout still runs `make
lint` successfully (submodule auto-inits as before) and a plain `make`
still succeeds there too; the same tarball now builds successfully with a
plain `make`, and `make lint` there fails with Make's own "no rule to make
target" instead of aborting every target.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
From `~/test-fixes.md` item #12 (found in `cat_tools`): an unconditional `include` of a submodule-vendored `.mk` file with a self-init rule breaks every `make` invocation, not just the feature it wires up, when building from a source tarball (`git archive`, PGXN's own `make dist` output) rather than a real git checkout.
test_factory has this exact pattern: `Makefile` does `include lint.mk`, and `lint.mk` does `include .vendor/linter/lint.mk` with a self-init rule (`git submodule update --init`). Make tries to satisfy every `include` before doing anything else, for any target requested. A real distribution tarball has no `.git` and no submodule content, so `git submodule update` fails immediately (`fatal: not a git repository`), and that failure aborted the entire build -- `make`, `make install`, everything, not just `make lint`.
Confirmed, not assumed
Built a real tarball (`git archive` of current `master`) into a clean directory with no `.git` at all:
Also confirmed the fix doesn't regress the normal case: from a real git checkout, both `make lint` (submodule auto-inits exactly as before) and a plain `make` still succeed.
Fix
Guard the self-init rule and the submodule `include` behind `ifneq ($(wildcard .git),)`. Outside a real git checkout, lint support is simply unavailable -- nothing else in the build needs it.
Test plan
🤖 Generated with Claude Code