Skip to content
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: list sources via find conditionally #5807

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danishprakash
Copy link
Contributor

Taken directly from podman's Makefile. The current list doesn't list vendor sources and therefore if you need to build and test your changes to vendor/ for testing a backport or anything else, it's required to modify the Makefile before attempting to do so.

/kind other

Signed-off-by: Danish Prakash contact@danishpraka.sh

@danishprakash
Copy link
Contributor Author

@nalind I noticed you've added certain sources over time, so if there's a reason to selectively list sources that I'm not aware of, I can also only add vendor/*, that should also be good enough.

@nalind
Copy link
Member

nalind commented Oct 31, 2024

I hadn't considered that modifying files under vendor was a common enough case that the Makefile needed to account for it. Trying to add everything under vendor into the current SOURCES list seems like something that the bot that keeps our dependencies up to date would trip over, so if this doesn't slow down make, then I guess the thing to do is remove the part of the smoke test that fails.

@danishprakash
Copy link
Contributor Author

I hadn't considered that modifying files under vendor was a common enough case that the Makefile needed to account for it.

I mean I use it quite often w/ podman when testing c/* changes and it's come in quite handy.


then I guess the thing to do is remove the part of the smoke test that fails.

We were validating the sources because we were listing them manually, I guess moving to a finder cmd, I don't see the need for a validation anymore, wdyt?

Do we have benchmarks to test if there's a performance degradation? I can think of vendor bumps as an additional trigger for rebuilds, can't think of anything major that should have an impact.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a go file changed we should rebuild, in vendor/ or not. Because if I do a dependency bump locally via gp.mod then make buildah currently doesn't rebuild so this is clearly broken. As such I think this here is the right idea.

I don't see any advantage of listing all the packages here so the find seems much better to me. Even if it would pick something up that does not need to trigger a rebuild all the time go rebuilds are fast anyway so I would not be concerned about speed.

Makefile Outdated Show resolved Hide resolved
@danishprakash danishprakash force-pushed the makefile-sources-all branch 2 times, most recently from b87b49a to 40612f1 Compare November 5, 2024 08:44
@rhatdan
Copy link
Member

rhatdan commented Nov 7, 2024

LGTM

@nalind
Copy link
Member

nalind commented Nov 7, 2024

/approve

Copy link
Contributor

openshift-ci bot commented Nov 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danishprakash, nalind

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Nov 7, 2024
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably also remove *.go files from some of the targets that use `$(SOURCES). For example:

bin/buildah: $(SOURCES) cmd/buildah/*.go internal/mkcw/embed/entrypoint_amd64.gz

Here cmd/buildah/*.go is becoming redundant.

The current list of sources doesn't list vendor sources and some other
.go files, requiring you to manually modify the Makefile to build the
binaries. This change uses `find` (from Podman's Makefile) to detect .go
files across the repositories.

Removes the validation script since we're no longer specifying sources
manually. And removes explicit *.go files as binary sources.

Signed-off-by: Danish Prakash <contact@danishpraka.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants