paketo-buildpacks / libpak

An opinionated extension to the libcnb Cloud Native Buildpack Library
Apache License 2.0
15 stars 17 forks source link

Have create-package use targets when generating included-files list #324

Open dmikusa opened 4 months ago

dmikusa commented 4 months ago

Describe the Enhancement

In this PR we added functionality such that create-package can generate a list of targets and add common included files, like README or LICENSE, to every architecture without needing them to be explicitly listed in the included files list.

It finds the targets by looking at the existing list of included files and looking for ones that start with linux/. If there are no targets then it falls back to the older format without linux/<arch>.

Possible Solution

We could not do this in 1.x because it requires buildpack API 0.10 support and libcnb 1.x will not get that. With v2.x libcnb will support buildpack API 0.10 and so it will have target information available. Instead of picking the targets based on the included files list, we can use the targets set in the buildpack.toml. This will make it more accurate and make it such that we can remove all the arch-specific info from included files.

If the targets list is not set in buildpack.toml, then we should fallback to the old behavior of not putting linux/<arch> on the front of things.

Motivation

Put fewer things in included files list. It's easier to maintain that way.

loewenstein commented 3 months ago

@dmikusa Should this be moved to whatever repo gets created as part of #259?

dmikusa commented 3 months ago

Probably. I think we have to decide as a team that we're going forward with externalizing the tools. I'd like to do #259, but I haven't heard from the other maintainers.