container/check: move absolute pathname
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Hpkg (push) Successful in 4m3s
Test / Sandbox (race detector) (push) Successful in 4m26s
Test / Hakurei (race detector) (push) Successful in 5m19s
Test / Sandbox (push) Successful in 1m28s
Test / Hakurei (push) Successful in 2m16s
Test / Flake checks (push) Successful in 1m37s

This allows use of absolute pathname values without importing container.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-07 20:06:26 +09:00
parent d23b4dc9e6
commit 0e6c1a5026
72 changed files with 815 additions and 742 deletions

View File

@@ -5,6 +5,7 @@ import (
"strings"
"hakurei.app/container"
"hakurei.app/container/check"
)
func init() { gob.Register(new(FSBind)) }
@@ -15,9 +16,9 @@ const FilesystemBind = "bind"
// FSBind represents a host to container bind mount.
type FSBind struct {
// mount point in container, same as Source if empty
Target *container.Absolute `json:"dst,omitempty"`
Target *check.Absolute `json:"dst,omitempty"`
// host filesystem path to make available to the container
Source *container.Absolute `json:"src"`
Source *check.Absolute `json:"src"`
// do not mount Target read-only
Write bool `json:"write,omitempty"`
// do not disable device files on Target, implies Write
@@ -66,7 +67,7 @@ func (b *FSBind) Valid() bool {
return true
}
func (b *FSBind) Path() *container.Absolute {
func (b *FSBind) Path() *check.Absolute {
if !b.Valid() {
return nil
}
@@ -76,11 +77,11 @@ func (b *FSBind) Path() *container.Absolute {
return b.Target
}
func (b *FSBind) Host() []*container.Absolute {
func (b *FSBind) Host() []*check.Absolute {
if !b.Valid() {
return nil
}
return []*container.Absolute{b.Source}
return []*check.Absolute{b.Source}
}
func (b *FSBind) Apply(z *ApplyState) {