diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-06-28 18:02:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-06-28 18:02:54 +0900 |
| commit | d1319a497cb26f1b360ab027d1f67db8f5e1c777 (patch) | |
| tree | 44cb75e89468411a0f20ba29124762ac6007bbfa /internal | |
| parent | cf7c34555c8df07d9baf582c65a9e88d1605e075 (diff) | |
internal/rosa: handle nil source
Source is not always required. This improves flexibility.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/rosa/package/images/package.az | 1 | ||||
| -rw-r--r-- | internal/rosa/rosa.go | 22 | ||||
| -rw-r--r-- | internal/rosa/state.go | 10 |
3 files changed, 18 insertions, 15 deletions
diff --git a/internal/rosa/package/images/package.az b/internal/rosa/package/images/package.az index 786068c0..5c67fbaa 100644 --- a/internal/rosa/package/images/package.az +++ b/internal/rosa/package/images/package.az @@ -25,7 +25,6 @@ package system-image { version = unversioned; exclude = true; - source = earlyinit; extra = [ musl, mksh, diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index 8a438bd3..ebb814dc 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -476,9 +476,6 @@ func (t Toolchain) NewPackage( if name == "" || version == "" { panic("name must be non-empty") } - if source == nil { - panic("source must be non-nil") - } rn := name if version != Unversioned { rn = name + "-" + version @@ -536,6 +533,17 @@ cd '/usr/src/` + name + `/' panic("cannot remain in root") } + paths := attr.Paths + if source != nil { + paths = slices.Concat(attr.Paths, []pkg.ExecPath{ + pkg.Path(AbsUsrSrc.Append( + name+sourceSuffix, + ), attr.Writable || wantsWrite, t.NewPatchedSource( + rn, source, !attr.Chmod && !wantsChmod, attr.Patches..., + )), + }) + } + return t.New( rn, attr.Flag, @@ -543,13 +551,7 @@ cd '/usr/src/` + name + `/' attr.KnownChecksum, attr.Env, scriptEarly+helper.script(t, name), - slices.Concat(attr.Paths, []pkg.ExecPath{ - pkg.Path(AbsUsrSrc.Append( - name+sourceSuffix, - ), attr.Writable || wantsWrite, t.NewPatchedSource( - rn, source, !attr.Chmod && !wantsChmod, attr.Patches..., - )), - })..., + paths..., ) } diff --git a/internal/rosa/state.go b/internal/rosa/state.go index d455149c..6b914edc 100644 --- a/internal/rosa/state.go +++ b/internal/rosa/state.go @@ -1134,10 +1134,12 @@ func (ctx *evalContext) pf( } default: - panic(azalea.TypeError{ - Concrete: reflect.TypeOf(sourceA), - Asserted: reflect.TypeFor[pkg.Artifact](), - }) + if sourceA != nil { + panic(azalea.TypeError{ + Concrete: reflect.TypeOf(sourceA), + Asserted: reflect.TypeFor[pkg.Artifact](), + }) + } } v = cachedArtifact{&meta, ctx.t.NewPackage( |
