-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile: make bin/* real targets! #9210
Makefile: make bin/* real targets! #9210
Conversation
ece6fa0
to
c82207e
Compare
@containers/podman-maintainers I propose not merging this one without at least three lgtms. I've been careful, but this is a small change with deep ramifications; it warrants careful scrutiny. |
Makefile
Outdated
@@ -35,7 +35,7 @@ PKG_MANAGER ?= $(shell command -v dnf yum|head -n1) | |||
# ~/.local/bin is not in PATH on all systems | |||
PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit pre-commit | head -n1) | |||
|
|||
SOURCES = $(shell find . -path './.*' -prune -o -name "*.go") | |||
SOURCES = $(shell find . -path './.*' -prune -o -name "*.go" -print) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did something similar in CRI-O as well, but excluded test files:
GO_FILES := $(shell find . -type f -name '*.go' -not -name '*_test.go')
How to get the best out of both find
commands? 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, I like @saschagrunert's idea to exclude unit tests
LGTM with @saschagrunert change. |
Backstory: every time you run 'make podman' or even just 'make', you get a full recompile. This is sub-ideal. Cause: I don't really know. It looks complicated. containers#5017 introduced a .PHONY for bin/podman, for reasons not explained in the PR. Then, much later, containers#5880 well- intentionedly but improperly tweaked the 'find' command used in defining SOURCES, adding a -prune but without the corresponding and required -print. Let's just say, it was an unfortunate cascade of events. This PR fixes the SOURCES definition and removes the highly-undesired .PHONY from podman & podman-remote, making it so you can type 'make' and, oh joy, not build anything if it's current. The way 'make' is supposed to work. Why fix this now? Because my PR (containers#9209) was failing in CI, in the Validate step: Can't exec "./bin/podman": No such file or directory at hack/xref-helpmsgs-manpages line 223. It failed even on Re-run, and only passed once I force-pushed the PR (with no changes, just a new commit SHA). I have no idea why bin/podman wasn't built, and I have zero interest in pursuing that right now, but the proper solution is to add bin/podman as a Makefile dependency for that particular test. So done. While I'm at it, fix what is pretty clearly a typo in a .PHONY And, finally, fix a go-md2man warning introduced in containers#9189 [NO TESTS NEEDED] Signed-off-by: Ed Santiago <[email protected]>
c82207e
to
dfa9a34
Compare
Changed as follows (whitespace for readability): - find . -path './.*' -prune -o -name "*.go" -print
+ find . -path './.*' -prune -o \( -name '*.go' -a ! -name '*_test.go' \) -print Tested via: $ find (the old one) >/tmp/find.1
$ find (the new one) >/tmp/find.2
$ diff /tmp/find.[12] | egrep -v '^< .*_test\.go'
$ diff /tmp/find.[12] | less (quick eyeball sanity check) Thanks for the suggestion, @saschagrunert ! Since this got more complicated and fragile than I'd hoped, I added a comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Backstory: every time you run 'make podman' or even
just 'make', you get a full recompile. This is sub-ideal.
Cause: I don't really know. It looks complicated. #5017
introduced a .PHONY for bin/podman, for reasons not
explained in the PR. Then, much later, #5880 well-
intentionedly but improperly tweaked the 'find'
command used in defining SOURCES, adding a -prune
but without the corresponding and required -print.
Let's just say, it was an unfortunate cascade of events.
This PR fixes the SOURCES definition and removes the
highly-undesired .PHONY from podman & podman-remote,
making it so you can type 'make' and, oh joy, not
build anything if it's current. The way 'make' is
supposed to work.
Why fix this now? Because my PR (#9209) was failing in CI,
in the Validate step:
It failed even on Re-run, and only passed once I force-pushed
the PR (with no changes, just a new commit SHA). I have no idea
why bin/podman wasn't built, and I have zero interest in pursuing
that right now, but the proper solution is to add bin/podman as
a Makefile dependency for that particular test. So done.
While I'm at it, fix what is pretty clearly a typo in a .PHONY
And, finally, fix a go-md2man warning introduced in #9189
Signed-off-by: Ed Santiago [email protected]