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

config: allow scriplets in subpackages with range replacements #1165

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

xnox
Copy link
Contributor

@xnox xnox commented Apr 23, 2024

This allows to create subpackages with dynamic scriplets, which take range key/value subsitutions just like other subapckage values.

Example fun usage shown in xnox/os@3a96413

    scriptlets:
      post-install: |
        #!/usr/bin/python${{range.key}}
        import glob, shutil
        for b in glob.glob("/usr/pybin/${{range.key}}/*"): shutil.copy2(b, "/usr/bin/")
bb6225aab2ee:/# head -n1 /usr/bin/pip
#!/usr/bin/python3.10

bb6225aab2ee:/# apk add py3.11-pip
(1/4) Installing python-3.11-base (3.11.9-r0)
(2/4) Installing py3.11-flit-core (3.9.0-r2)
(3/4) Installing py3.11-setuptools (69.5.1-r1)
(4/4) Installing py3.11-pip (24.0-r2)
Executing py3.11-pip-24.0-r2.post-install
OK: 140 MiB in 35 packages

bb6225aab2ee:/# head -n1 /usr/bin/pip
#!/usr/bin/python3.11

bb6225aab2ee:/# apk add py3.12-pip
(1/4) Installing python-3.12-base (3.12.3-r0)
(2/4) Installing py3.12-flit-core (3.9.0-r2)
(3/4) Installing py3.12-setuptools (69.5.1-r1)
(4/4) Installing py3.12-pip (24.0-r2)
Executing py3.12-pip-24.0-r2.post-install
OK: 199 MiB in 39 packages

bb6225aab2ee:/# head -n1 /usr/bin/pip
#!/usr/bin/python3.12

This is mostly for completness sake to be able to support full package schema, in the subpackages-range cases.

Melange Pull Request Template

Functional Changes

  • This change can build all of Wolfi without errors (describe results in notes)

Notes:

SCA Changes

  • Examining several representative APKs show no regression / the desired effect (details in notes)

Notes:

Linter

  • The new check is clean across Wolfi
  • The new check is opt-in or a warning

Notes:

This allows to create subpackages with dynamic scriplets, which take
range key/value subsitutions just like other subapckage values.

Example fun usage shown in
xnox/os@3a96413

This is mostly for completness sake to be able to support full package
schema, in the subpackages-range cases.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@chainguard.dev>
jonjohnsonjr
jonjohnsonjr previously approved these changes Apr 23, 2024
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@chainguard.dev>
@xnox xnox merged commit 0a50317 into chainguard-dev:main Apr 24, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants