aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--internal/rosa/state.go39
1 files changed, 25 insertions, 14 deletions
diff --git a/internal/rosa/state.go b/internal/rosa/state.go
index f2ba2059..01abf736 100644
--- a/internal/rosa/state.go
+++ b/internal/rosa/state.go
@@ -1339,6 +1339,30 @@ func (s *S) RegisterFS(fsys fs.FS) error {
return nil
}
+// setSource overrides the hakurei-source package with the specified tarball and
+// version string. The resulting IR is curable on the daemon. Must not be used
+// concurrently with any other method.
+func (s *S) setSource(p []byte, version string) {
+ const name = "hakurei-source"
+ s.p.Store(
+ H(name),
+ Artifact(func(t Toolchain) (*Metadata, pkg.Artifact) {
+ return &Metadata{
+ Name: name,
+ Description: "hakurei source tree (current)",
+ Version: version,
+ Exclude: true,
+ }, pkg.NewTar(
+ pkg.NewDecompress(
+ pkg.NewFile("hakurei-src-current.tar.gz", p),
+ pkg.Gzip,
+ ),
+ )
+ }),
+ )
+ s.DropCaches(s.Arch(), s.Flags())
+}
+
// SetSource overrides the hakurei-source package with a cached tarball of fsys.
// The resulting IR is curable on the daemon. Must not be used concurrently with
// any other method.
@@ -1416,20 +1440,7 @@ func (s *S) SetSource(fsys fs.FS) error {
return err
}
- const name = "hakurei-source"
- a := pkg.NewFile("hakurei-src-current.tar.gz", buf.Bytes())
- s.p.Store(
- H(name),
- Artifact(func(t Toolchain) (*Metadata, pkg.Artifact) {
- return &Metadata{
- Name: name,
- Description: "hakurei source tree (current)",
- Version: version,
- Exclude: true,
- }, pkg.NewTar(pkg.NewDecompress(a, pkg.Gzip))
- }),
- )
- s.DropCaches(s.Arch(), s.Flags())
+ s.setSource(buf.Bytes(), version)
return nil
}