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/rosa/rosa.go | |
| 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/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 22 |
1 files changed, 12 insertions, 10 deletions
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..., ) } |
