expose package metadata to mutate scripts
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Go
- スター
- 434
- フォーク
- 74
- 平均マージ
- 1日 30分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
canonical/chisel のほかの issue
-
`mode` of a generated directory is random when it has a generated child対応中かも @Amadeus-22 が 24 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
cut fails on uncompressed deb対応中かも @yuminn-k が 29 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 42/100
-
`prefer` drops a path when the preferred package lists it `until: mutate`対応中かも @18Abhinav07 が 8 日前に担当しました。 オープンBug
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
canonical/chisel の issue をすべて見る
似ている issue
-
mcpx scan: flag unsafe tool names対応中かも @zeyadbadawyy が今日担当しました。 オープンarea/scan enhancement good first issue priority/medium size/small
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rohitgollarahalli/mcpx#45 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Mend: dependency security vulnerability
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Windows 主机
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Lee-xeo/Claude-Cage#1550 ·
メンテナーはふだん 1 日以内に返信
-
(bug) ui: spanPaint can index spans past their end (panic: index out of range)対応中かも @MaxMiksa が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信