expose package metadata to mutate scripts
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
Hướng nghiên cứu
This is a design proposal, not a ready change. Read the description of the mutate script environment, where content is the only predeclared input, and the proposed PackageInfo fields (name, version, arch, control). Done means the maintainers settle whether a load()-based module is acceptable, given the closed #40 precedent for re.star. Do not start an implementation until that decision is made.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
low priority enhancement idea
context
a mutate script sometimes needs facts about the package it is slicing that are not in the rootfs as a file: its version or its architecture. today the only input a script has is content, so it has to recover those facts from file names.
concrete case, rabbitmq-server 4.3.2 on 26.10 (canonical/chisel-releases#1428). the debian wrapper at /usr/lib/rabbitmq/bin/rabbitmq-script-wrapper finds the plugins directory at run time with
RB_VERSION=$(dpkg-query -W rabbitmq-server | awk '{print $2}' | cut -d- -f1)
export RABBITMQ_PLUGINS_DIR=/usr/lib/rabbitmq/lib/rabbitmq_server-${RB_VERSION}/plugins
a chiselled rootfs has no dpkg database, so the slice patches the version in at cut time. to get the version the mutate lists /usr/lib/rabbitmq/lib/, strips the rabbitmq_server- prefix and the trailing slash and fails if there is not exactly one match:
prefix = "rabbitmq_server-"
dirs = content.list("/usr/lib/rabbitmq/lib/")
versions = [d[len(prefix):-1] for d in dirs if d.startswith(prefix)]
if len(versions) != 1:
fail("expected one rabbitmq_server directory, found %s" % versions)
proposal
let a mutate script ask for the package's metadata explicitly.
concrete proposal
use starlark's own module mechanism rather than more predeclared names:
load("deb.star", "deb")
content.write(wrapper, script.replace(dpkg_line, deb.version))
with deb a starlarkstruct.Module built from the slice's PackageInfo, e.g.
deb.name,deb.version,deb.arch: the strings chisel selected the package bydeb.control: the parsed control stanza as a dict, sodeb.control["Depends"]and friends come for free without picking fields one by one
load() keeps the default namespace at content only, so existing scripts see no change, and a script that uses the module says so on its first line. the module is read-only data; nothing about what a script may read or write in the rootfs changes.
prior art
- #40 proposed a
re.starmodule throughload()in 2023 and was closed
- Ngôn ngữ chính
- Go
- Star
- 434
- Fork
- 74
- Merge trung bình
- 1 ngày 30 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của canonical/chisel
-
`mode` of a generated directory is random when it has a generated childCó thể đã có người làm @Amadeus-22 đã nhận 24 ngày trước. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
cut fails on uncompressed debCó thể đã có người làm @yuminn-k đã nhận 29 ngày trước. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
-
`prefer` drops a path when the preferred package lists it `until: mutate`Có thể đã có người làm @18Abhinav07 đã nhận 8 ngày trước. Đang mởBug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Tất cả issue của canonical/chisel
Issue tương tự
-
mcpx scan: flag unsafe tool namesCó thể đã có người làm @zeyadbadawyy đã nhận hôm nay. Đang mởarea/scan enhancement good first issue priority/medium size/small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rohitgollarahalli/mcpx#45 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Windows 主机
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Lee-xeo/Claude-Cage#1550 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
(bug) ui: spanPaint can index spans past their end (panic: index out of range)Có thể đã có người làm @MaxMiksa đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày