Compare commits
94
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88a19aefaa
|
||
|
|
f01776200d
|
||
|
|
e58b6eb171
|
||
|
|
1625aaee80
|
||
|
|
203ce6864b
|
||
|
|
050051e593
|
||
|
|
530b63ca70
|
||
|
|
8821d34b10
|
||
|
|
054a8813d7
|
||
|
|
1bc16b51a6
|
||
|
|
3718c044c4
|
||
|
|
07e92db918
|
||
|
|
d2ee7cb551
|
||
|
|
39e757a84d
|
||
|
|
a431f16e6f
|
||
|
|
1f45d44e7f
|
||
|
|
92d01752ab
|
||
|
|
82bf46d23f
|
||
|
|
2abcb99ea2
|
||
|
|
2218efc0cf
|
||
|
|
30c5525d7b
|
||
|
|
bf6d1ada71
|
||
|
|
16294a35ee
|
||
|
|
22756af8fb
|
||
|
|
739ae4a7cf
|
||
|
|
eec89c4519
|
||
|
|
7193656b6a
|
||
|
|
7d86e19c07
|
||
|
|
f1ffb180bc
|
||
|
|
7f690145e3
|
||
|
|
c79ae7aed6
|
||
|
|
396ae2ba2a
|
||
|
|
1e85dca9e2
|
||
|
|
d236c9eaf7
|
||
|
|
3c1a6f0793
|
||
|
|
16f84f9499
|
||
|
|
9deed030f0
|
||
|
|
69095e03c9
|
||
|
|
8138b2a3f0
|
||
|
|
308c7d1846
|
||
|
|
807f4ccbeb
|
||
|
|
f1dd3a085b
|
||
|
|
b37c1d8993
|
||
|
|
6a7f124deb
|
||
|
|
a9a32284b6
|
||
|
|
255a1bbf74
|
||
|
|
96cdf4cc07
|
||
|
|
35a55854fd
|
||
|
|
2f057cc72f
|
||
|
|
3356ca3e46
|
||
|
|
ccef0a086a
|
||
|
|
edb694fb41
|
||
|
|
90535adc89
|
||
|
|
6fed6d67bd
|
||
|
|
dcaf67b3d7
|
||
|
|
c7de3d45e3
|
||
|
|
d9bddff160
|
||
|
|
5c6dcce543
|
||
|
|
905a69d2a0
|
||
|
|
e453bc67d0
|
||
|
|
0fa145a1a0
|
||
|
|
b5a65d1255
|
||
|
|
ccdc0fa37e
|
||
|
|
b97518552d
|
||
|
|
67d14dc12c
|
||
|
|
695b1b4845
|
||
|
|
2e5d954f49
|
||
|
|
e6af0c405a
|
||
|
|
599a761b27
|
||
|
|
b7aa91f08f
|
||
|
|
280a736ce3
|
||
|
|
4e41b9bc99
|
||
|
|
153c980a61
|
||
|
|
a2f97f7e0f
|
||
|
|
5e1b4bb0b8
|
||
|
|
e73f9e0626
|
||
|
|
ddd90b780b
|
||
|
|
89c32f5614
|
||
|
|
1567a3e582
|
||
|
|
aa9952cd9e
|
||
|
|
99efc551ad
|
||
|
|
4dbfee0698
|
||
|
|
4e65e41101
|
||
|
|
b8306fe9e2
|
||
|
|
6b246e9036
|
||
|
|
869820ec6d
|
||
|
|
6fb2065a51
|
||
|
|
698fd2d66a
|
||
|
|
4cfbc93aa0
|
||
|
|
feec4b0d22
|
||
|
|
6487b41d92
|
||
|
|
7908fb9583
|
||
|
|
95aa7c205c
|
||
|
|
bd0cc3656f
|
@@ -11,7 +11,7 @@
|
|||||||
<a href="https://git.gensokyo.uk/rosa/hakurei/actions"><img src="https://git.gensokyo.uk/rosa/hakurei/actions/workflows/test.yml/badge.svg?branch=staging&style=flat-square" alt="Gitea Workflow Status" /></a>
|
<a href="https://git.gensokyo.uk/rosa/hakurei/actions"><img src="https://git.gensokyo.uk/rosa/hakurei/actions/workflows/test.yml/badge.svg?branch=staging&style=flat-square" alt="Gitea Workflow Status" /></a>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://git.gensokyo.uk/rosa/hakurei/releases"><img src="https://img.shields.io/gitea/v/release/rosa/hakurei?gitea_url=https%3A%2F%2Fgit.gensokyo.uk&color=purple" alt="Release" /></a>
|
<a href="https://git.gensokyo.uk/rosa/hakurei/releases"><img src="https://img.shields.io/gitea/v/release/rosa/hakurei?gitea_url=https%3A%2F%2Fgit.gensokyo.uk&color=purple" alt="Release" /></a>
|
||||||
<a href="https://goreportcard.com/report/hakurei.app"><img src="https://goreportcard.com/badge/hakurei.app" alt="Go Report Card" /></a>
|
<a href="https://git.gensokyo.uk/rosa/hakurei/src/branch/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-pink" alt="MIT License" /></a>
|
||||||
<a href="https://hakurei.app"><img src="https://img.shields.io/website?url=https%3A%2F%2Fhakurei.app" alt="Website" /></a>
|
<a href="https://hakurei.app"><img src="https://img.shields.io/website?url=https%3A%2F%2Fhakurei.app" alt="Website" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
v0.4.5
|
v0.4.6
|
||||||
|
|||||||
Vendored
+6
@@ -36,6 +36,11 @@ _hakurei_show() {
|
|||||||
'files:files:__hakurei_files'
|
'files:files:__hakurei_files'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hakurei_kill() {
|
||||||
|
_alternative \
|
||||||
|
'instances:domains:__hakurei_instances'
|
||||||
|
}
|
||||||
|
|
||||||
__hakurei_files() {
|
__hakurei_files() {
|
||||||
_files -g "*.(json|hakurei)"
|
_files -g "*.(json|hakurei)"
|
||||||
return $?
|
return $?
|
||||||
@@ -60,6 +65,7 @@ __hakurei_instances() {
|
|||||||
"run:Load and start container from configuration file"
|
"run:Load and start container from configuration file"
|
||||||
"exec:Configure and start a permissive container"
|
"exec:Configure and start a permissive container"
|
||||||
"show:Show live or local instance configuration"
|
"show:Show live or local instance configuration"
|
||||||
|
"kill:Terminate an active instance"
|
||||||
"ps:List active instances"
|
"ps:List active instances"
|
||||||
"version:Display version information"
|
"version:Display version information"
|
||||||
"license:Show full license text"
|
"license:Show full license text"
|
||||||
|
|||||||
Vendored
+2
-2
@@ -217,7 +217,7 @@ func main() {
|
|||||||
mustWriteFile("comp/", nil, os.ModeDir|0755)
|
mustWriteFile("comp/", nil, os.ModeDir|0755)
|
||||||
mustWriteFile("comp/_hakurei", comp, 0644)
|
mustWriteFile("comp/_hakurei", comp, 0644)
|
||||||
mustWriteFile("install.sh", []byte(`#!/bin/sh -e
|
mustWriteFile("install.sh", []byte(`#!/bin/sh -e
|
||||||
cd "$(dirname -- "$0")" || exit 1
|
cd "$(dirname -- "$0")"
|
||||||
|
|
||||||
install -vDm0755 "bin/hakurei" "${DESTDIR}`+prefix+`/bin/hakurei"
|
install -vDm0755 "bin/hakurei" "${DESTDIR}`+prefix+`/bin/hakurei"
|
||||||
install -vDm0755 "bin/sharefs" "${DESTDIR}`+prefix+`/bin/sharefs"
|
install -vDm0755 "bin/sharefs" "${DESTDIR}`+prefix+`/bin/sharefs"
|
||||||
@@ -230,7 +230,7 @@ fi
|
|||||||
install -vDm0644 "comp/_hakurei" "${DESTDIR}`+prefix+`/share/zsh/site-functions/_hakurei"
|
install -vDm0644 "comp/_hakurei" "${DESTDIR}`+prefix+`/share/zsh/site-functions/_hakurei"
|
||||||
`), 0755)
|
`), 0755)
|
||||||
|
|
||||||
mustWriteFromPath("README.md", "README.md", 0)
|
mustWriteFromPath("LICENSE", "LICENSE", 0)
|
||||||
mustWriteFile("hsurc.default", []byte("1000 0"), 0400)
|
mustWriteFile("hsurc.default", []byte("1000 0"), 0400)
|
||||||
mustWriteFromPath("bin/hsu", filepath.Join(s, "hsu"), 04511)
|
mustWriteFromPath("bin/hsu", filepath.Join(s, "hsu"), 04511)
|
||||||
for _, name := range []string{
|
for _, name := range []string{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"os/user"
|
"os/user"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"hakurei.app/check"
|
"hakurei.app/check"
|
||||||
@@ -372,6 +373,23 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
|
|||||||
Flag(&flagNoStore, "no-store", command.BoolFlag(false), "Do not attempt to match from active instances")
|
Flag(&flagNoStore, "no-store", command.BoolFlag(false), "Do not attempt to match from active instances")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.NewCommand("kill", "Terminate an active instance", func(args []string) error {
|
||||||
|
if len(args) != 1 {
|
||||||
|
log.Fatal("kill requires 1 argument")
|
||||||
|
}
|
||||||
|
|
||||||
|
var sc hst.Paths
|
||||||
|
env.CopyPaths().Copy(&sc, new(outcome.Hsu).MustID(nil))
|
||||||
|
entry := tryIdentifier(msg, args[0], outcome.NewStore(&sc))
|
||||||
|
if entry == nil {
|
||||||
|
log.Fatalf("%q does not match any active instance", args[0])
|
||||||
|
}
|
||||||
|
if err := syscall.Kill(entry.PID, syscall.SIGTERM); err != nil {
|
||||||
|
log.Fatalf("cannot terminate %s: %v", entry.ID.String(), err)
|
||||||
|
}
|
||||||
|
return errSuccess
|
||||||
|
})
|
||||||
|
|
||||||
{
|
{
|
||||||
var flagShort bool
|
var flagShort bool
|
||||||
c.NewCommand("ps", "List active instances", func(args []string) error {
|
c.NewCommand("ps", "List active instances", func(args []string) error {
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ func TestHelp(t *testing.T) {
|
|||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"main", []string{}, `
|
"main", []string{}, `usage: hakurei [-h | --help] [-v] [--insecure] [--json] <command> [<args>]
|
||||||
Usage: hakurei [-h | --help] [-v] [--insecure] [--json] COMMAND [OPTIONS]
|
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
run Load and start container from configuration file
|
run Load and start container from configuration file
|
||||||
exec Configure and start a permissive container
|
exec Configure and start a permissive container
|
||||||
show Show live or local instance configuration
|
show Show live or local instance configuration
|
||||||
|
kill Terminate an active instance
|
||||||
ps List active instances
|
ps List active instances
|
||||||
version Display version information
|
version Display version information
|
||||||
license Show full license text
|
license Show full license text
|
||||||
@@ -35,10 +35,14 @@ Commands:
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"exec", []string{"exec", "-h"}, `
|
"exec", []string{"exec", "-h"}, `usage: hakurei exec [-h | --help] [--dbus-config <value>]
|
||||||
Usage: hakurei exec [-h | --help] [--dbus-config <value>] [--dbus-system <value>] [--mpris] [--dbus-log] [--id <value>] [-a <int>] [-g <value>] [-d <value>] [-u <value>] [--policy <value>] [--priority <int>] [--private-runtime] [--private-tmpdir] [--wayland] [-X] [--dbus] [--pipewire] [--pulse] COMMAND [OPTIONS]
|
[--dbus-system <value>] [--mpris] [--dbus-log]
|
||||||
|
[--id <value>] [-a <int>] [-g <value>] [-d <value>]
|
||||||
|
[-u <value>] [--policy <value>] [--priority <int>]
|
||||||
|
[--private-runtime] [--private-tmpdir] [--wayland] [-X]
|
||||||
|
[--dbus] [--pipewire] [--pulse] <command> [<args>]
|
||||||
|
|
||||||
Flags:
|
flags:
|
||||||
-X Enable direct connection to X11
|
-X Enable direct connection to X11
|
||||||
-a int
|
-a int
|
||||||
Application identity
|
Application identity
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"hakurei.app/check"
|
"hakurei.app/check"
|
||||||
@@ -28,6 +29,8 @@ type cache struct {
|
|||||||
idle bool
|
idle bool
|
||||||
// Unset [pkg.CSuppressInit].
|
// Unset [pkg.CSuppressInit].
|
||||||
verboseInit bool
|
verboseInit bool
|
||||||
|
// Whether to enable output colours.
|
||||||
|
color bool
|
||||||
// Unset [pkg.CExternShallow].
|
// Unset [pkg.CExternShallow].
|
||||||
deep bool
|
deep bool
|
||||||
// Loaded artifact of [rosa.QEMU].
|
// Loaded artifact of [rosa.QEMU].
|
||||||
@@ -36,18 +39,32 @@ type cache struct {
|
|||||||
base, mirror string
|
base, mirror string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// writeTitle sets title of the terminal connected to [message.Msg].
|
||||||
|
func writeTitle(msg message.Msg, s string) {
|
||||||
|
msg.Suspend()
|
||||||
|
w := msg.GetLogger().Writer()
|
||||||
|
_, _ = w.Write([]byte("\x1b]0;" + s + "\a"))
|
||||||
|
msg.Resume()
|
||||||
|
}
|
||||||
|
|
||||||
// open opens the underlying [pkg.Cache].
|
// open opens the underlying [pkg.Cache].
|
||||||
func (cache *cache) open() (err error) {
|
func (cache *cache) open() (err error) {
|
||||||
if cache.c != nil {
|
if cache.c != nil {
|
||||||
return os.ErrInvalid
|
return os.ErrInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hostname string
|
||||||
|
if hostname, err = os.Hostname(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var base *check.Absolute
|
var base *check.Absolute
|
||||||
if cache.base, err = filepath.Abs(cache.base); err != nil {
|
if cache.base, err = filepath.Abs(cache.base); err != nil {
|
||||||
return
|
return
|
||||||
} else if base, err = check.NewAbs(cache.base); err != nil {
|
} else if base, err = check.NewAbs(cache.base); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var notify chan bool
|
||||||
|
|
||||||
if cache.idle {
|
if cache.idle {
|
||||||
cache.attr.Flags |= pkg.CSchedIdle
|
cache.attr.Flags |= pkg.CSchedIdle
|
||||||
@@ -61,6 +78,11 @@ func (cache *cache) open() (err error) {
|
|||||||
if !cache.deep {
|
if !cache.deep {
|
||||||
cache.attr.Flags |= pkg.CExternShallow
|
cache.attr.Flags |= pkg.CExternShallow
|
||||||
}
|
}
|
||||||
|
if cache.color {
|
||||||
|
cache.attr.Flags |= pkg.CColourOutput
|
||||||
|
notify = make(chan bool, 1<<12)
|
||||||
|
cache.attr.Notify = notify
|
||||||
|
}
|
||||||
|
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
defer close(done)
|
defer close(done)
|
||||||
@@ -104,6 +126,33 @@ func (cache *cache) open() (err error) {
|
|||||||
cache.c.SetExternal(r)
|
cache.c.SetExternal(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cache.attr.Notify != nil {
|
||||||
|
cache.msg.Suspend()
|
||||||
|
_, _ = cache.msg.GetLogger().Writer().Write([]byte("\x1b[22;0t"))
|
||||||
|
cache.msg.Resume()
|
||||||
|
|
||||||
|
prefix := hostname + ": mbf "
|
||||||
|
go func() {
|
||||||
|
var n, nc uint64
|
||||||
|
for enter := range notify {
|
||||||
|
if enter {
|
||||||
|
nc++
|
||||||
|
} else {
|
||||||
|
nc--
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
|
||||||
|
if nc == 0 {
|
||||||
|
writeTitle(cache.msg, prefix[:len(prefix)-1])
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
writeTitle(cache.msg, prefix+
|
||||||
|
"("+strconv.FormatUint(nc, 10)+
|
||||||
|
" running, "+strconv.FormatUint(n, 10)+" complete)")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
if cache.qemu != nil {
|
if cache.qemu != nil {
|
||||||
var pathname *check.Absolute
|
var pathname *check.Absolute
|
||||||
pathname, _, err = cache.c.Cure(cache.qemu)
|
pathname, _, err = cache.c.Cure(cache.qemu)
|
||||||
@@ -124,6 +173,11 @@ func (cache *cache) open() (err error) {
|
|||||||
func (cache *cache) Close() {
|
func (cache *cache) Close() {
|
||||||
if cache.c != nil {
|
if cache.c != nil {
|
||||||
cache.c.Close()
|
cache.c.Close()
|
||||||
|
if cache.attr.Notify != nil {
|
||||||
|
cache.msg.Suspend()
|
||||||
|
_, _ = cache.msg.GetLogger().Writer().Write([]byte("\x1b[23;0t"))
|
||||||
|
cache.msg.Resume()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+45
-7
@@ -92,6 +92,11 @@ func main() {
|
|||||||
|
|
||||||
var cm cache
|
var cm cache
|
||||||
defer func() { cm.Close() }()
|
defer func() { cm.Close() }()
|
||||||
|
if cm.color = ext.Isatty(syscall.Stderr) &&
|
||||||
|
os.Getenv("NO_COLOR") == "" &&
|
||||||
|
os.Getenv("TERM") != "dumb"; cm.color {
|
||||||
|
log.SetPrefix("\x1b[2mmbf: \x1b[0m")
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
flagQuiet bool
|
flagQuiet bool
|
||||||
@@ -278,7 +283,7 @@ func main() {
|
|||||||
if _, err := io.Copy(h, os.Stdin); err != nil {
|
if _, err := io.Copy(h, os.Stdin); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Println(pkg.Encode(pkg.Checksum(h.Sum(nil))))
|
fmt.Println(pkg.Encode(pkg.Checksum(h.Sum(nil))))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -616,7 +621,7 @@ func main() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
"stage3",
|
"stage4",
|
||||||
"Check for toolchain 3-stage non-determinism",
|
"Check for toolchain 3-stage non-determinism",
|
||||||
func(args []string) (err error) {
|
func(args []string) (err error) {
|
||||||
var (
|
var (
|
||||||
@@ -636,21 +641,31 @@ func main() {
|
|||||||
|
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(rosa.Std - 1).Load(_llvm)
|
_, llvm := rosa.Native().New(rosa.Std - 1).Load(_llvm)
|
||||||
pathname, checksum[0], err = cache.Cure(llvm)
|
pathname, _, err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("stage2:", pathname)
|
log.Println("stage2:", pathname)
|
||||||
|
|
||||||
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
_, llvm := rosa.Native().New(rosa.Std).Load(_llvm)
|
_, llvm := rosa.Native().New(rosa.Std).Load(_llvm)
|
||||||
pathname, checksum[1], err = cache.Cure(llvm)
|
pathname, checksum[0], err = cache.Cure(llvm)
|
||||||
return
|
return
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("stage3:", pathname)
|
log.Println("stage3:", pathname)
|
||||||
|
|
||||||
|
if err = cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
|
_, llvm := rosa.Native().New(rosa.Stage3).Load(_llvm)
|
||||||
|
pathname, checksum[1], err = cache.Cure(llvm)
|
||||||
|
return
|
||||||
|
}); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Println("stage4:", pathname)
|
||||||
|
|
||||||
if checksum[0] != checksum[1] {
|
if checksum[0] != checksum[1] {
|
||||||
err = &pkg.ChecksumMismatchError{
|
err = &pkg.ChecksumMismatchError{
|
||||||
Got: checksum[0].Value(),
|
Got: checksum[0].Value(),
|
||||||
@@ -658,7 +673,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Println(
|
log.Println(
|
||||||
"stage2 is identical to stage3",
|
"stage3 is identical to stage4",
|
||||||
"("+pkg.Encode(checksum[0].Value())+")",
|
"("+pkg.Encode(checksum[0].Value())+")",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -667,6 +682,25 @@ func main() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.NewCommand(
|
||||||
|
"all",
|
||||||
|
command.UsageInternal,
|
||||||
|
func([]string) error {
|
||||||
|
all := rosa.Native().CollectAll()
|
||||||
|
a := make(pkg.Collect, len(all))
|
||||||
|
for i, h := range all {
|
||||||
|
_, a[i] = rosa.Native().Std().Load(h)
|
||||||
|
}
|
||||||
|
return cm.Do(func(cache *pkg.Cache) (err error) {
|
||||||
|
_, _, err = cache.Cure(&a)
|
||||||
|
if pkg.IsCollected(err) {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
return
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
var (
|
var (
|
||||||
flagDump string
|
flagDump string
|
||||||
@@ -730,7 +764,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Println(pathname)
|
fmt.Println(pathname)
|
||||||
|
|
||||||
if flagExport != "" {
|
if flagExport != "" {
|
||||||
msg.Verbosef("exporting %s to %s...", args[0], flagExport)
|
msg.Verbosef("exporting %s to %s...", args[0], flagExport)
|
||||||
@@ -791,7 +825,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
pathname, err := cureRemote(ctx, &addr, a, flags)
|
pathname, err := cureRemote(ctx, &addr, a, flags)
|
||||||
if !flagNoReply && err == nil {
|
if !flagNoReply && err == nil {
|
||||||
log.Println(pathname)
|
fmt.Println(pathname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errors.Is(err, context.Canceled) {
|
if errors.Is(err, context.Canceled) {
|
||||||
@@ -1162,6 +1196,10 @@ func main() {
|
|||||||
if w, ok := err.(interface{ Unwrap() []error }); !ok {
|
if w, ok := err.(interface{ Unwrap() []error }); !ok {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
if _, ok = w.(pkg.InputError); ok {
|
||||||
|
log.Fatal(w)
|
||||||
|
}
|
||||||
|
|
||||||
errs := w.Unwrap()
|
errs := w.Unwrap()
|
||||||
for i, e := range errs {
|
for i, e := range errs {
|
||||||
if i == len(errs)-1 {
|
if i == len(errs)-1 {
|
||||||
|
|||||||
+3
-2
@@ -13,6 +13,7 @@ func New(output io.Writer, logf LogFunc, name string, early HandlerFunc) Command
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newNode initialises a subcommand tree and returns its address.
|
||||||
func newNode(output io.Writer, logf LogFunc, name, usage string) *node {
|
func newNode(output io.Writer, logf LogFunc, name, usage string) *node {
|
||||||
n := &node{
|
n := &node{
|
||||||
name: name, usage: usage,
|
name: name, usage: usage,
|
||||||
@@ -22,8 +23,8 @@ func newNode(output io.Writer, logf LogFunc, name, usage string) *node {
|
|||||||
n.set.SetOutput(output)
|
n.set.SetOutput(output)
|
||||||
n.set.Usage = func() {
|
n.set.Usage = func() {
|
||||||
_ = n.writeHelp()
|
_ = n.writeHelp()
|
||||||
if n.suffix.Len() > 0 {
|
if len(n.suffix) > 0 {
|
||||||
_, _ = fmt.Fprintln(output, "Flags:")
|
_, _ = fmt.Fprintln(output, "flags:")
|
||||||
n.set.PrintDefaults()
|
n.set.PrintDefaults()
|
||||||
_, _ = fmt.Fprintln(output)
|
_, _ = fmt.Fprintln(output)
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-4
@@ -18,8 +18,14 @@ func TestBuild(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("direct zero length", func(t *testing.T) {
|
t.Run("direct zero length", func(t *testing.T) {
|
||||||
wantPanic := "invalid subcommand"
|
wantPanic := "invalid subcommand"
|
||||||
t.Run("zero length name", func(t *testing.T) { defer checkRecover(t, "Command", wantPanic); c.Command("", "usage", stubHandler) })
|
t.Run("zero length name", func(t *testing.T) {
|
||||||
t.Run("zero length usage", func(t *testing.T) { defer checkRecover(t, "Command", wantPanic); c.Command("name", "", stubHandler) })
|
defer checkRecover(t, "Command", wantPanic)
|
||||||
|
c.Command("", "usage", stubHandler)
|
||||||
|
})
|
||||||
|
t.Run("zero length usage", func(t *testing.T) {
|
||||||
|
defer checkRecover(t, "Command", wantPanic)
|
||||||
|
c.Command("name", "", stubHandler)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("direct adopt unique names", func(t *testing.T) {
|
t.Run("direct adopt unique names", func(t *testing.T) {
|
||||||
@@ -34,8 +40,14 @@ func TestBuild(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("zero length", func(t *testing.T) {
|
t.Run("zero length", func(t *testing.T) {
|
||||||
wantPanic := "invalid subcommand tree"
|
wantPanic := "invalid subcommand tree"
|
||||||
t.Run("zero length name", func(t *testing.T) { defer checkRecover(t, "New", wantPanic); c.New("", "usage") })
|
t.Run("zero length name", func(t *testing.T) {
|
||||||
t.Run("zero length usage", func(t *testing.T) { defer checkRecover(t, "New", wantPanic); c.New("name", "") })
|
defer checkRecover(t, "New", wantPanic)
|
||||||
|
c.New("", "usage")
|
||||||
|
})
|
||||||
|
t.Run("zero length usage", func(t *testing.T) {
|
||||||
|
defer checkRecover(t, "New", wantPanic)
|
||||||
|
c.New("name", "")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("direct adopt unique names", func(t *testing.T) {
|
t.Run("direct adopt unique names", func(t *testing.T) {
|
||||||
|
|||||||
+26
-6
@@ -6,36 +6,43 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UsageInternal causes the command to be hidden from help text when set as the usage string.
|
// UsageInternal is a special usage string that hides the command from the
|
||||||
const UsageInternal = "internal"
|
// generated help message.
|
||||||
|
const UsageInternal = "\x00"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// HandlerFunc is called when matching a directly handled subcommand tree.
|
// HandlerFunc is called when matching a directly handled subcommand tree.
|
||||||
HandlerFunc = func(args []string) error
|
HandlerFunc = func(args []string) error
|
||||||
|
|
||||||
// LogFunc is the function signature of a printf function.
|
// LogFunc is the function signature of a printf function. The zero value
|
||||||
|
// implies [log.Printf].
|
||||||
LogFunc = func(format string, a ...any)
|
LogFunc = func(format string, a ...any)
|
||||||
|
|
||||||
// FlagDefiner is a deferred flag definer value, usually encapsulating the default value.
|
// FlagDefiner is a deferred flag definer value, usually encapsulating the
|
||||||
|
// default value.
|
||||||
FlagDefiner interface {
|
FlagDefiner interface {
|
||||||
// Define defines the flag in set.
|
// Define defines the flag in set.
|
||||||
Define(b *strings.Builder, set *flag.FlagSet, p any, name, usage string)
|
Define(b *strings.Builder, set *flag.FlagSet, p any, name, usage string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A Flag is satisfied by command objects capable of receiving flags.
|
||||||
Flag[T any] interface {
|
Flag[T any] interface {
|
||||||
// Flag defines a generic flag type in Node's flag set.
|
// Flag defines a generic flag type in Node's flag set.
|
||||||
Flag(p any, name string, value FlagDefiner, usage string) T
|
Flag(p any, name string, value FlagDefiner, usage string) T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A Command is the root of a command tree.
|
||||||
Command interface {
|
Command interface {
|
||||||
Parse(arguments []string) error
|
Parse(arguments []string) error
|
||||||
|
|
||||||
// MustParse determines exit outcomes for Parse errors
|
// MustParse determines exit outcomes for Parse errors and calls
|
||||||
// and calls handleError if [HandlerFunc] returns a non-nil error.
|
// handleError if [HandlerFunc] returns a non-nil error.
|
||||||
MustParse(arguments []string, handleError func(error))
|
MustParse(arguments []string, handleError func(error))
|
||||||
|
|
||||||
baseNode[Command]
|
baseNode[Command]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A Node is a subcommand under a [Command].
|
||||||
Node baseNode[Node]
|
Node baseNode[Node]
|
||||||
|
|
||||||
baseNode[T any] interface {
|
baseNode[T any] interface {
|
||||||
@@ -53,3 +60,16 @@ type (
|
|||||||
Flag[T]
|
Flag[T]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// rootNode satisfies baseNode for [Command].
|
||||||
|
type rootNode struct{ *node }
|
||||||
|
|
||||||
|
func (r rootNode) Command(name, usage string, f HandlerFunc) Command {
|
||||||
|
r.node.Command(name, usage, f)
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r rootNode) Flag(p any, name string, value FlagDefiner, usage string) Command {
|
||||||
|
r.node.Flag(p, name, value, usage)
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|||||||
+7
-1
@@ -16,7 +16,13 @@ func (e FlagError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) Flag(p any, name string, value FlagDefiner, usage string) Node {
|
func (n *node) Flag(p any, name string, value FlagDefiner, usage string) Node {
|
||||||
value.Define(&n.suffix, n.set, p, name, usage)
|
var buf strings.Builder
|
||||||
|
value.Define(&buf, n.set, p, name, usage)
|
||||||
|
s := buf.String()
|
||||||
|
if len(s) > 0 && s[0] == ' ' {
|
||||||
|
s = s[1:]
|
||||||
|
}
|
||||||
|
n.suffix = append(n.suffix, s)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-3
@@ -1,6 +1,7 @@
|
|||||||
package command
|
package command
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@@ -13,14 +14,31 @@ var ErrHelp = errors.New("help requested")
|
|||||||
func (n *node) PrintHelp() { _ = n.writeHelp() }
|
func (n *node) PrintHelp() { _ = n.writeHelp() }
|
||||||
|
|
||||||
func (n *node) writeHelp() error {
|
func (n *node) writeHelp() error {
|
||||||
|
prefix := strings.Join(append(n.prefix, n.name), " ")
|
||||||
|
var buf strings.Builder
|
||||||
|
offset := 7 + len(prefix)
|
||||||
|
line := offset + 14
|
||||||
|
w := bytes.Repeat([]byte{' '}, offset+1)
|
||||||
|
w[0] = '\n'
|
||||||
|
|
||||||
|
for _, flag := range n.suffix {
|
||||||
|
line += len(flag) + 1
|
||||||
|
if line >= 80 {
|
||||||
|
line = offset + len(flag) + 1
|
||||||
|
buf.Write(w)
|
||||||
|
}
|
||||||
|
buf.WriteByte(' ')
|
||||||
|
buf.WriteString(flag)
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := fmt.Fprintf(n.out,
|
if _, err := fmt.Fprintf(n.out,
|
||||||
"\nUsage:\t%s [-h | --help]%s COMMAND [OPTIONS]\n",
|
"usage: %s [-h | --help]%s <command> [<args>]\n",
|
||||||
strings.Join(append(n.prefix, n.name), " "), &n.suffix,
|
prefix, &buf,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if n.child != nil {
|
if n.child != nil {
|
||||||
if _, err := fmt.Fprint(n.out, "\nCommands:\n"); err != nil {
|
if _, err := fmt.Fprint(n.out, "\ncommands:\n"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -3,9 +3,9 @@ package command
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// A node represents a command.
|
||||||
type node struct {
|
type node struct {
|
||||||
child, next *node
|
child, next *node
|
||||||
name, usage string
|
name, usage string
|
||||||
@@ -13,13 +13,16 @@ type node struct {
|
|||||||
out io.Writer
|
out io.Writer
|
||||||
logf LogFunc
|
logf LogFunc
|
||||||
|
|
||||||
|
// Names of commands preceding node.
|
||||||
prefix []string
|
prefix []string
|
||||||
suffix strings.Builder
|
// Short user-facing representations of flags received by node.
|
||||||
|
suffix []string
|
||||||
|
|
||||||
f HandlerFunc
|
f HandlerFunc
|
||||||
set *flag.FlagSet
|
set *flag.FlagSet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adopt adds v as the last child of n.
|
||||||
func (n *node) adopt(v *node) bool {
|
func (n *node) adopt(v *node) bool {
|
||||||
if n.child != nil {
|
if n.child != nil {
|
||||||
return n.child.append(v)
|
return n.child.append(v)
|
||||||
@@ -28,6 +31,7 @@ func (n *node) adopt(v *node) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// append adds v as the last sibling of n.
|
||||||
func (n *node) append(v *node) bool {
|
func (n *node) append(v *node) bool {
|
||||||
if n.name == v.name {
|
if n.name == v.name {
|
||||||
return false
|
return false
|
||||||
|
|||||||
+18
-22
@@ -70,7 +70,7 @@ func TestParse(t *testing.T) {
|
|||||||
"d=0 out of order string flag",
|
"d=0 out of order string flag",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"string", "--string", "64d3b4b7b21788585845060e2199a78f"},
|
[]string{"string", "--string", "64d3b4b7b21788585845060e2199a78f"},
|
||||||
"flag provided but not defined: -string\n\nUsage:\ttest string [-h | --help] COMMAND [OPTIONS]\n\n", "",
|
"flag provided but not defined: -string\nusage: test string [-h | --help] <command> [<args>]\n\n", "",
|
||||||
errors.New("flag provided but not defined: -string"),
|
errors.New("flag provided but not defined: -string"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ func TestParse(t *testing.T) {
|
|||||||
"d=1 empty sub help",
|
"d=1 empty sub help",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"empty", "-h"},
|
[]string{"empty", "-h"},
|
||||||
"\nUsage:\ttest empty [-h | --help] COMMAND [OPTIONS]\n\n", "", flag.ErrHelp,
|
"usage: test empty [-h | --help] <command> [<args>]\n\n", "", flag.ErrHelp,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"d=1 no match",
|
"d=1 no match",
|
||||||
@@ -151,10 +151,10 @@ func TestParse(t *testing.T) {
|
|||||||
"d=0 help",
|
"d=0 help",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{},
|
[]string{},
|
||||||
`
|
`usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>]
|
||||||
Usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>] [--repeat <value>] COMMAND [OPTIONS]
|
[--repeat <value>] <command> [<args>]
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
error return an error
|
error return an error
|
||||||
print wraps Fprint
|
print wraps Fprint
|
||||||
string print string passed by flag
|
string print string passed by flag
|
||||||
@@ -171,10 +171,10 @@ Commands:
|
|||||||
"d=0 help flag",
|
"d=0 help flag",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"-h"},
|
[]string{"-h"},
|
||||||
`
|
`usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>]
|
||||||
Usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>] [--repeat <value>] COMMAND [OPTIONS]
|
[--repeat <value>] <command> [<args>]
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
error return an error
|
error return an error
|
||||||
print wraps Fprint
|
print wraps Fprint
|
||||||
string print string passed by flag
|
string print string passed by flag
|
||||||
@@ -185,7 +185,7 @@ Commands:
|
|||||||
succeed this command succeeds
|
succeed this command succeeds
|
||||||
deep top level of command tree with various levels
|
deep top level of command tree with various levels
|
||||||
|
|
||||||
Flags:
|
flags:
|
||||||
-fail
|
-fail
|
||||||
fail early
|
fail early
|
||||||
-int int
|
-int int
|
||||||
@@ -203,10 +203,9 @@ Flags:
|
|||||||
"d=1 help",
|
"d=1 help",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"join"},
|
[]string{"join"},
|
||||||
`
|
`usage: test join [-h | --help] <command> [<args>]
|
||||||
Usage: test join [-h | --help] COMMAND [OPTIONS]
|
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
out write result to wout
|
out write result to wout
|
||||||
log log result to wlog
|
log log result to wlog
|
||||||
|
|
||||||
@@ -216,10 +215,9 @@ Commands:
|
|||||||
"d=1 help flag",
|
"d=1 help flag",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"join", "-h"},
|
[]string{"join", "-h"},
|
||||||
`
|
`usage: test join [-h | --help] <command> [<args>]
|
||||||
Usage: test join [-h | --help] COMMAND [OPTIONS]
|
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
out write result to wout
|
out write result to wout
|
||||||
log log result to wlog
|
log log result to wlog
|
||||||
|
|
||||||
@@ -230,10 +228,9 @@ Commands:
|
|||||||
"d=2 help",
|
"d=2 help",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"deep", "d=2"},
|
[]string{"deep", "d=2"},
|
||||||
`
|
`usage: test deep d=2 [-h | --help] <command> [<args>]
|
||||||
Usage: test deep d=2 [-h | --help] COMMAND [OPTIONS]
|
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
d=3 relative third level
|
d=3 relative third level
|
||||||
|
|
||||||
`, "", command.ErrHelp,
|
`, "", command.ErrHelp,
|
||||||
@@ -242,10 +239,9 @@ Commands:
|
|||||||
"d=2 help flag",
|
"d=2 help flag",
|
||||||
buildTestCommand,
|
buildTestCommand,
|
||||||
[]string{"deep", "d=2", "-h"},
|
[]string{"deep", "d=2", "-h"},
|
||||||
`
|
`usage: test deep d=2 [-h | --help] <command> [<args>]
|
||||||
Usage: test deep d=2 [-h | --help] COMMAND [OPTIONS]
|
|
||||||
|
|
||||||
Commands:
|
commands:
|
||||||
d=3 relative third level
|
d=3 relative third level
|
||||||
|
|
||||||
`, "", flag.ErrHelp,
|
`, "", flag.ErrHelp,
|
||||||
@@ -261,7 +257,7 @@ Commands:
|
|||||||
t.Errorf("Parse: error = %v; wantErr %v", err, tc.wantErr)
|
t.Errorf("Parse: error = %v; wantErr %v", err, tc.wantErr)
|
||||||
}
|
}
|
||||||
if got := wout.String(); got != tc.want {
|
if got := wout.String(); got != tc.want {
|
||||||
t.Errorf("Parse: %s want %s", got, tc.want)
|
t.Errorf("Parse:\n%s\nwant\n%s", got, tc.want)
|
||||||
}
|
}
|
||||||
if gotLog := wlog.String(); gotLog != tc.wantLog {
|
if gotLog := wlog.String(); gotLog != tc.wantLog {
|
||||||
t.Errorf("Parse: log = %s wantLog %s", gotLog, tc.wantLog)
|
t.Errorf("Parse: log = %s wantLog %s", gotLog, tc.wantLog)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package command
|
|
||||||
|
|
||||||
// the top level node wants [Command] returned for its builder methods
|
|
||||||
type rootNode struct{ *node }
|
|
||||||
|
|
||||||
func (r rootNode) Command(name, usage string, f HandlerFunc) Command {
|
|
||||||
r.node.Command(name, usage, f)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r rootNode) Flag(p any, name string, value FlagDefiner, usage string) Command {
|
|
||||||
r.node.Flag(p, name, value, usage)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
+12
-3
@@ -73,7 +73,10 @@ func (c *Cache) Clean(dry, inputs bool, keep ...Artifact) (
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
c.msg.Verbosef("arranging for destruction of %s...", name)
|
c.msg.Verbosef(
|
||||||
|
"arranging for destruction of %s%s%s...",
|
||||||
|
c.sgrIdent, name, c.sgrRes,
|
||||||
|
)
|
||||||
idents = append(idents, identPair{id, name})
|
idents = append(idents, identPair{id, name})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +105,10 @@ func (c *Cache) Clean(dry, inputs bool, keep ...Artifact) (
|
|||||||
if err = c.parent.Err(); err != nil {
|
if err = c.parent.Err(); err != nil {
|
||||||
return destroyedIdents, destroyedChecksums, err
|
return destroyedIdents, destroyedChecksums, err
|
||||||
}
|
}
|
||||||
c.msg.Verbosef("destroying checksum %s...", name)
|
c.msg.Verbosef(
|
||||||
|
"destroying checksum %s%s%s...",
|
||||||
|
c.sgrIdent, name, c.sgrRes,
|
||||||
|
)
|
||||||
if !dry {
|
if !dry {
|
||||||
if err = errors.Join(removeAll(c.base.Append(
|
if err = errors.Join(removeAll(c.base.Append(
|
||||||
dirChecksum,
|
dirChecksum,
|
||||||
@@ -130,7 +136,10 @@ func (c *Cache) Clean(dry, inputs bool, keep ...Artifact) (
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
c.msg.Verbosef("destroying substitute %s...", name)
|
c.msg.Verbosef(
|
||||||
|
"destroying substitute %s%s%s...",
|
||||||
|
c.sgrIdent, name, c.sgrRes,
|
||||||
|
)
|
||||||
if !dry {
|
if !dry {
|
||||||
if err = os.Remove(c.base.Append(
|
if err = os.Remove(c.base.Append(
|
||||||
dirStatus,
|
dirStatus,
|
||||||
|
|||||||
+15
-4
@@ -444,7 +444,7 @@ func scanVerbose(
|
|||||||
msg message.Msg,
|
msg message.Msg,
|
||||||
cancel context.CancelFunc,
|
cancel context.CancelFunc,
|
||||||
done chan<- struct{},
|
done chan<- struct{},
|
||||||
prefix string,
|
prefix, suffix string,
|
||||||
r io.Reader,
|
r io.Reader,
|
||||||
) {
|
) {
|
||||||
defer close(done)
|
defer close(done)
|
||||||
@@ -454,7 +454,7 @@ func scanVerbose(
|
|||||||
bufio.MaxScanTokenSize<<12,
|
bufio.MaxScanTokenSize<<12,
|
||||||
)
|
)
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
msg.Verbose(prefix, s.Text())
|
msg.Verbose(prefix, s.Text()+suffix)
|
||||||
}
|
}
|
||||||
if err := s.Err(); err != nil && !errors.Is(err, os.ErrClosed) {
|
if err := s.Err(); err != nil && !errors.Is(err, os.ErrClosed) {
|
||||||
cancel()
|
cancel()
|
||||||
@@ -728,14 +728,25 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) {
|
|||||||
|
|
||||||
brStdout, brStderr := f.cache.getReader(stdout), f.cache.getReader(stderr)
|
brStdout, brStderr := f.cache.getReader(stdout), f.cache.getReader(stderr)
|
||||||
stdoutDone, stderrDone := make(chan struct{}), make(chan struct{})
|
stdoutDone, stderrDone := make(chan struct{}), make(chan struct{})
|
||||||
|
|
||||||
|
var suffix, prefixO, prefixE string
|
||||||
|
if f.cache.attr.Flags&CColourOutput != 0 {
|
||||||
|
suffix = "\x1b[0m"
|
||||||
|
prefixO = "\x1b[1;37m(" + a.name + ")\x1b[0m"
|
||||||
|
prefixE = "\x1b[1;97m(" + a.name + ")\x1b[0m"
|
||||||
|
} else {
|
||||||
|
prefixO = "(" + a.name + ":1)"
|
||||||
|
prefixE = "(" + a.name + ":2)"
|
||||||
|
}
|
||||||
|
|
||||||
go scanVerbose(
|
go scanVerbose(
|
||||||
msg, cancel, stdoutDone,
|
msg, cancel, stdoutDone,
|
||||||
"("+a.name+":1)",
|
prefixO, suffix,
|
||||||
io.TeeReader(brStdout, status),
|
io.TeeReader(brStdout, status),
|
||||||
)
|
)
|
||||||
go scanVerbose(
|
go scanVerbose(
|
||||||
msg, cancel, stderrDone,
|
msg, cancel, stderrDone,
|
||||||
"("+a.name+":2)",
|
prefixE, suffix,
|
||||||
io.TeeReader(brStderr, status),
|
io.TeeReader(brStderr, status),
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|||||||
@@ -118,11 +118,8 @@ func TestExec(t *testing.T) {
|
|||||||
[]string{"testtool"},
|
[]string{"testtool"},
|
||||||
|
|
||||||
pkg.MustPath("/proc/nonexistent", false, failingArtifact),
|
pkg.MustPath("/proc/nonexistent", false, failingArtifact),
|
||||||
), nil, nil, pkg.WNew, &pkg.DependencyCureError{
|
), nil, nil, pkg.WNew, pkg.InputError{
|
||||||
{
|
failingArtifact: stub.UniqueError(0xcafe),
|
||||||
A: failingArtifact,
|
|
||||||
Err: stub.UniqueError(0xcafe),
|
|
||||||
},
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{"invalid paths", pkg.NewExec(
|
{"invalid paths", pkg.NewExec(
|
||||||
|
|||||||
+2
-2
@@ -823,8 +823,8 @@ func (d *IRDecoder) decode() (a Artifact, err error) {
|
|||||||
d.ident[id] = a
|
d.ident[id] = a
|
||||||
} else {
|
} else {
|
||||||
d.c.msg.Verbosef(
|
d.c.msg.Verbosef(
|
||||||
"artifact %s appeared more than once in IR stream",
|
"artifact %s%s%s appeared more than once in IR stream",
|
||||||
Encode(id.Value()),
|
d.c.sgrIdent, Encode(id.Value()), d.c.sgrRes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+124
-108
@@ -15,10 +15,10 @@ import (
|
|||||||
"hash"
|
"hash"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
"iter"
|
||||||
"maps"
|
"maps"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -654,10 +654,10 @@ type pendingArtifactDep struct {
|
|||||||
// if curing succeeds.
|
// if curing succeeds.
|
||||||
resP *cureRes
|
resP *cureRes
|
||||||
|
|
||||||
// Address of result error slice populated during [Cache.Cure], dereferenced
|
// Address of result error map populated during [Cache.Cure], dereferenced
|
||||||
// after acquiring errsMu if curing fails. No additional action is taken,
|
// after acquiring errsMu if curing fails. No additional action is taken,
|
||||||
// [Cache] and its caller are responsible for further error handling.
|
// [Cache] and its caller are responsible for further error handling.
|
||||||
errs *DependencyCureError
|
errs InputError
|
||||||
// Address of mutex synchronising access to errs.
|
// Address of mutex synchronising access to errs.
|
||||||
errsMu *sync.Mutex
|
errsMu *sync.Mutex
|
||||||
|
|
||||||
@@ -721,6 +721,9 @@ const (
|
|||||||
// CExternShallow arranges for only non-flood inputs to be fetched when
|
// CExternShallow arranges for only non-flood inputs to be fetched when
|
||||||
// curing an [Artifact] available via the external cache.
|
// curing an [Artifact] available via the external cache.
|
||||||
CExternShallow
|
CExternShallow
|
||||||
|
|
||||||
|
// CColourOutput enables output colouring via ANSI control sequences.
|
||||||
|
CColourOutput
|
||||||
)
|
)
|
||||||
|
|
||||||
// toplevel holds [context.WithCancel] over caller-supplied context, where all
|
// toplevel holds [context.WithCancel] over caller-supplied context, where all
|
||||||
@@ -776,6 +779,8 @@ type Cache struct {
|
|||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
// Reports new cures and passed to [Artifact].
|
// Reports new cures and passed to [Artifact].
|
||||||
msg message.Msg
|
msg message.Msg
|
||||||
|
// Select graphics rendition sequences, populated by Open.
|
||||||
|
sgrRes, sgrIdent, sgrWarn, sgrErr string
|
||||||
|
|
||||||
// Directory where all [Cache] related files are placed.
|
// Directory where all [Cache] related files are placed.
|
||||||
base *check.Absolute
|
base *check.Absolute
|
||||||
@@ -1132,7 +1137,10 @@ func (c *Cache) Scrub(checks int) error {
|
|||||||
} else if !ce.check(ent, want) {
|
} else if !ce.check(ent, want) {
|
||||||
wg.Go(func() { condemn(ent) })
|
wg.Go(func() { condemn(ent) })
|
||||||
} else {
|
} else {
|
||||||
c.msg.Verbosef("%s is consistent", ent.Name())
|
c.msg.Verbosef(
|
||||||
|
"%s%s%s is consistent",
|
||||||
|
c.sgrIdent, ent.Name(), c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
p.Put(want)
|
p.Put(want)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
@@ -1508,10 +1516,10 @@ func (c *Cache) openFile(
|
|||||||
id := c.Ident(f)
|
id := c.Ident(f)
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
rn := reportName(f, id)
|
rn := reportName(f, id)
|
||||||
c.msg.Verbosef("curing %s in memory...", rn)
|
c.msg.Verbosef("curing %s%s%s in memory...", c.sgrIdent, rn, c.sgrRes)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.msg.Verbosef("opened %s for reading", rn)
|
c.msg.Verbosef("opened %s%s%s for reading", c.sgrIdent, rn, c.sgrRes)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -1713,111 +1721,67 @@ retry:
|
|||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
|
|
||||||
// CureError wraps a non-nil error returned attempting to cure an [Artifact].
|
// An InputError describes inputs of a [FloodArtifact] which had failed to cure.
|
||||||
type CureError struct {
|
type InputError map[Artifact]error
|
||||||
A Artifact
|
|
||||||
Err error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unwrap returns the underlying error.
|
// unwrap returns an iterator over sorted, deduplicated [Artifact] and their
|
||||||
func (e *CureError) Unwrap() error { return e.Err }
|
// corresponding identifier.
|
||||||
|
func (e InputError) unwrap() iter.Seq2[Artifact, unique.Handle[ID]] {
|
||||||
|
ir := NewIR()
|
||||||
|
|
||||||
// Error returns the error message from the underlying Err.
|
type input struct {
|
||||||
func (e *CureError) Error() string { return e.Err.Error() }
|
a Artifact
|
||||||
|
|
||||||
// A DependencyCureError wraps errors returned while curing dependencies.
|
|
||||||
type DependencyCureError []*CureError
|
|
||||||
|
|
||||||
// unwrapM recursively expands underlying errors into a caller-supplied map.
|
|
||||||
func (e *DependencyCureError) unwrapM(
|
|
||||||
ctx context.Context,
|
|
||||||
ir *IRCache,
|
|
||||||
me map[unique.Handle[ID]]*CureError,
|
|
||||||
) {
|
|
||||||
for _, err := range *e {
|
|
||||||
if ctx.Err() != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
id := ir.Ident(err.A)
|
|
||||||
if _, ok := me[id]; ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if _e, ok := err.Err.(*DependencyCureError); ok {
|
|
||||||
_e.unwrapM(ctx, ir, me)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
me[id] = err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// unwrap recursively expands and deduplicates underlying errors.
|
|
||||||
func (e *DependencyCureError) unwrap(
|
|
||||||
ctx context.Context,
|
|
||||||
ir *IRCache,
|
|
||||||
) DependencyCureError {
|
|
||||||
me := make(map[unique.Handle[ID]]*CureError)
|
|
||||||
e.unwrapM(ctx, ir, me)
|
|
||||||
type ent struct {
|
|
||||||
id unique.Handle[ID]
|
id unique.Handle[ID]
|
||||||
err *CureError
|
|
||||||
}
|
}
|
||||||
errs := make([]*ent, 0, len(me))
|
p := make([]input, 0, len(e))
|
||||||
for id, err := range me {
|
for a := range e {
|
||||||
errs = append(errs, &ent{id, err})
|
p = append(p, input{a, ir.Ident(a)})
|
||||||
}
|
}
|
||||||
|
|
||||||
var identBuf [2]ID
|
var identBuf [2]ID
|
||||||
slices.SortFunc(errs, func(a, b *ent) int {
|
slices.SortFunc(p, func(a, b input) int {
|
||||||
identBuf[0], identBuf[1] = a.id.Value(), b.id.Value()
|
identBuf[0], identBuf[1] = a.id.Value(), b.id.Value()
|
||||||
return slices.Compare(identBuf[0][:], identBuf[1][:])
|
return slices.Compare(identBuf[0][:], identBuf[1][:])
|
||||||
})
|
})
|
||||||
|
p = slices.CompactFunc(p, func(a, b input) bool { return a.id == b.id })
|
||||||
|
|
||||||
_errs := make(DependencyCureError, len(errs))
|
return func(yield func(Artifact, unique.Handle[ID]) bool) {
|
||||||
for i, v := range errs {
|
for _, i := range p {
|
||||||
_errs[i] = v.err
|
if !yield(i.a, i.id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return _errs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unwrap returns a deduplicated slice of underlying errors.
|
// Error returns a user-facing, deterministic text representation of e.
|
||||||
func (e *DependencyCureError) Unwrap() []error {
|
func (e InputError) Error() string {
|
||||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
errs := e.unwrap(ctx, NewIR())
|
|
||||||
_errs := make([]error, len(errs))
|
|
||||||
for i, err := range errs {
|
|
||||||
_errs[i] = err
|
|
||||||
}
|
|
||||||
return _errs
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns a user-facing multiline error message.
|
|
||||||
func (e *DependencyCureError) Error() string {
|
|
||||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
ir := NewIR()
|
|
||||||
errs := e.unwrap(ctx, ir)
|
|
||||||
if len(errs) == 0 {
|
|
||||||
return "invalid dependency cure outcome"
|
|
||||||
}
|
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
buf.WriteString("errors curing dependencies:")
|
buf.WriteString("errors curing inputs:")
|
||||||
for _, err := range errs {
|
for a, id := range e.unwrap() {
|
||||||
buf.WriteString("\n\t" +
|
buf.WriteString("\n\t")
|
||||||
reportName(err.A, ir.Ident(err.A)) + ": " +
|
buf.WriteString(reportName(a, id))
|
||||||
err.Error())
|
buf.WriteString(": ")
|
||||||
}
|
buf.WriteString(e[a].Error())
|
||||||
if ctx.Err() != nil {
|
|
||||||
buf.WriteString("\nerror resolution cancelled")
|
|
||||||
}
|
}
|
||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unwrap returns a slice of underlying errors sorted by identifier.
|
||||||
|
func (e InputError) Unwrap() []error {
|
||||||
|
errs := make([]error, 0, len(e))
|
||||||
|
for a := range e.unwrap() {
|
||||||
|
errs = append(errs, e[a])
|
||||||
|
}
|
||||||
|
return errs
|
||||||
|
}
|
||||||
|
|
||||||
// enterCure must be called before entering an [Artifact] implementation.
|
// enterCure must be called before entering an [Artifact] implementation.
|
||||||
func (c *Cache) enterCure(a Artifact, curesExempt bool) error {
|
func (c *Cache) enterCure(a Artifact, curesExempt bool) error {
|
||||||
|
if c.attr.Notify != nil {
|
||||||
|
c.attr.Notify <- true
|
||||||
|
}
|
||||||
|
|
||||||
if a.IsExclusive() {
|
if a.IsExclusive() {
|
||||||
c.exclMu.Lock()
|
c.exclMu.Lock()
|
||||||
}
|
}
|
||||||
@@ -1840,6 +1804,10 @@ func (c *Cache) enterCure(a Artifact, curesExempt bool) error {
|
|||||||
|
|
||||||
// exitCure must be called after exiting an [Artifact] implementation.
|
// exitCure must be called after exiting an [Artifact] implementation.
|
||||||
func (c *Cache) exitCure(a Artifact, curesExempt bool) {
|
func (c *Cache) exitCure(a Artifact, curesExempt bool) {
|
||||||
|
if c.attr.Notify != nil {
|
||||||
|
c.attr.Notify <- false
|
||||||
|
}
|
||||||
|
|
||||||
if a.IsExclusive() {
|
if a.IsExclusive() {
|
||||||
c.exclMu.Unlock()
|
c.exclMu.Unlock()
|
||||||
}
|
}
|
||||||
@@ -1890,7 +1858,10 @@ func (mr *measuredReader) Close() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
mr.c.msg.Verbosef("missed %d bytes on measured reader", n)
|
mr.c.msg.Verbosef(
|
||||||
|
"%smissed %d bytes on measured reader%s",
|
||||||
|
mr.c.sgrWarn, n, mr.c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = mr.r.Close(); err != nil {
|
if err = mr.r.Close(); err != nil {
|
||||||
@@ -2004,7 +1975,7 @@ func (c *Cache) cureMany(
|
|||||||
wg.Add(len(inputs))
|
wg.Add(len(inputs))
|
||||||
var mask []bool
|
var mask []bool
|
||||||
res := make([]cureRes, len(inputs))
|
res := make([]cureRes, len(inputs))
|
||||||
errs := make(DependencyCureError, 0, len(inputs))
|
errs := make(InputError)
|
||||||
var errsMu sync.Mutex
|
var errsMu sync.Mutex
|
||||||
if shallow {
|
if shallow {
|
||||||
mask = make([]bool, len(inputs))
|
mask = make([]bool, len(inputs))
|
||||||
@@ -2023,13 +1994,13 @@ func (c *Cache) cureMany(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pending := pendingArtifactDep{d, &res[i], &errs, &errsMu, &wg}
|
pending := pendingArtifactDep{d, &res[i], errs, &errsMu, &wg}
|
||||||
go pending.cure(c)
|
go pending.cure(c)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
return mask, &errs
|
return mask, errs
|
||||||
}
|
}
|
||||||
for i, p := range res {
|
for i, p := range res {
|
||||||
if shallow && mask[i] {
|
if shallow && mask[i] {
|
||||||
@@ -2151,8 +2122,9 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
)
|
)
|
||||||
if errors.Is(err, os.ErrExist) {
|
if errors.Is(err, os.ErrExist) {
|
||||||
c.msg.Verbosef(
|
c.msg.Verbosef(
|
||||||
"creating alternative over %s for artifact %s",
|
"creating alternative over %s%s%s for artifact %s%s%s",
|
||||||
Encode(substitute.Value()), ids,
|
c.sgrIdent, Encode(substitute.Value()), c.sgrRes,
|
||||||
|
c.sgrIdent, ids, c.sgrRes,
|
||||||
)
|
)
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
@@ -2195,15 +2167,18 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
whence = WNew
|
whence = WNew
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
rn := reportName(a, id)
|
rn := reportName(a, id)
|
||||||
c.msg.Verbosef("curing %s...", rn)
|
c.msg.Verbosef("curing %s%s%s...", c.sgrIdent, rn, c.sgrRes)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if checksums != "" {
|
if checksums != "" {
|
||||||
c.msg.Verbosef("cured %s checksum %s", rn, checksums)
|
c.msg.Verbosef(
|
||||||
|
"cured %s%s%s checksum %s%s%s",
|
||||||
|
c.sgrIdent, rn, c.sgrRes,
|
||||||
|
c.sgrIdent, checksums, c.sgrRes)
|
||||||
} else {
|
} else {
|
||||||
c.msg.Verbosef("cured %s", rn)
|
c.msg.Verbosef("cured %s%s%s", c.sgrIdent, rn, c.sgrRes)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -2298,7 +2273,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
c.exitCure(a, curesExempt)
|
c.exitCure(a, curesExempt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("cure file %s: %v", reportName(f, id), err)
|
c.msg.Verbosef(
|
||||||
|
"cure file %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(f, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2345,7 +2324,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
c.exitCure(a, curesExempt)
|
c.exitCure(a, curesExempt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("cure trivial %s: %v", reportName(ca, id), err)
|
c.msg.Verbosef(
|
||||||
|
"cure trivial %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(ca, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2355,7 +2338,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
var externChecksum unique.Handle[Checksum]
|
var externChecksum unique.Handle[Checksum]
|
||||||
if externChecksum, err = c.tryExtern(ctx, id); err != nil {
|
if externChecksum, err = c.tryExtern(ctx, id); err != nil {
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("extern %s: %v", reportName(ca, id), err)
|
c.msg.Verbosef(
|
||||||
|
"extern %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(ca, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2395,8 +2382,8 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
if sum == zeroChecksum {
|
if sum == zeroChecksum {
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef(
|
c.msg.Verbosef(
|
||||||
"input %s not available",
|
"input %s%s%s not available",
|
||||||
reportName(d, did),
|
c.sgrIdent, reportName(d, did), c.sgrRes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
err = HangingInputError(did)
|
err = HangingInputError(did)
|
||||||
@@ -2460,7 +2447,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
if checksum != zeroChecksum && externChecksum != checksum {
|
if checksum != zeroChecksum && externChecksum != checksum {
|
||||||
err = &ChecksumMismatchError{externChecksum.Value(), checksum.Value()}
|
err = &ChecksumMismatchError{externChecksum.Value(), checksum.Value()}
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("extern %s: %v", reportName(ca, id), err)
|
c.msg.Verbosef(
|
||||||
|
"extern %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(ca, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2509,7 +2500,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("cure %s: %v", reportName(ca, id), err)
|
c.msg.Verbosef(
|
||||||
|
"cure %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(ca, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2560,7 +2555,11 @@ func (c *Cache) cure(a Artifact, curesExempt, rebuild bool) (
|
|||||||
Want: checksum.Value(),
|
Want: checksum.Value(),
|
||||||
}
|
}
|
||||||
if c.msg.IsVerbose() {
|
if c.msg.IsVerbose() {
|
||||||
c.msg.Verbosef("validate %s: %v", reportName(a, id), err)
|
c.msg.Verbosef(
|
||||||
|
"validate %s%s%s: %s%v%s",
|
||||||
|
c.sgrIdent, reportName(a, id), c.sgrRes,
|
||||||
|
c.sgrErr, err, c.sgrRes,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -2604,7 +2603,11 @@ func (pending *pendingArtifactDep) cure(c *Cache) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pending.errsMu.Lock()
|
pending.errsMu.Lock()
|
||||||
*pending.errs = append(*pending.errs, &CureError{pending.a, err})
|
if errs, ok := err.(InputError); ok {
|
||||||
|
maps.Copy(pending.errs, errs)
|
||||||
|
} else {
|
||||||
|
pending.errs[pending.a] = err
|
||||||
|
}
|
||||||
pending.errsMu.Unlock()
|
pending.errsMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2702,6 +2705,10 @@ func (c *Cache) Close() {
|
|||||||
c.wg.Wait()
|
c.wg.Wait()
|
||||||
close(c.cures)
|
close(c.cures)
|
||||||
c.unlock()
|
c.unlock()
|
||||||
|
|
||||||
|
if c.attr.Notify != nil {
|
||||||
|
close(c.attr.Notify)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnsupportedVariantError describes an on-disk cache with an extension variant
|
// UnsupportedVariantError describes an on-disk cache with an extension variant
|
||||||
@@ -2729,6 +2736,8 @@ type CacheAttr struct {
|
|||||||
Jobs int
|
Jobs int
|
||||||
// Preferred loadavg target, when applicable.
|
// Preferred loadavg target, when applicable.
|
||||||
Load int
|
Load int
|
||||||
|
// Optional cure entry and exit notification.
|
||||||
|
Notify chan<- bool
|
||||||
|
|
||||||
// Omit the [lockedfile] lock.
|
// Omit the [lockedfile] lock.
|
||||||
skipLock bool
|
skipLock bool
|
||||||
@@ -2895,6 +2904,13 @@ func Open(
|
|||||||
return nil, UnsupportedVariantError(s)
|
return nil, UnsupportedVariantError(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if a.Flags&CColourOutput != 0 {
|
||||||
|
c.sgrRes = "\x1b[0m"
|
||||||
|
c.sgrIdent = "\x1b[1m"
|
||||||
|
c.sgrWarn = "\x1b[35m"
|
||||||
|
c.sgrErr = "\x1b[1;31m"
|
||||||
|
}
|
||||||
|
|
||||||
return &c, nil
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
-49
@@ -861,14 +861,11 @@ func TestCache(t *testing.T) {
|
|||||||
cure: func(f *pkg.FContext) error {
|
cure: func(f *pkg.FContext) error {
|
||||||
panic("attempting to cure impossible artifact")
|
panic("attempting to cure impossible artifact")
|
||||||
},
|
},
|
||||||
}, nil, nil, pkg.WNew, &pkg.DependencyCureError{
|
}, nil, nil, pkg.WNew, pkg.InputError{
|
||||||
{
|
failingFile: struct {
|
||||||
A: failingFile,
|
|
||||||
Err: struct {
|
|
||||||
_ []byte
|
_ []byte
|
||||||
stub.UniqueError
|
stub.UniqueError
|
||||||
}{UniqueError: 0xbad},
|
}{UniqueError: 0xbad},
|
||||||
},
|
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1949,7 +1946,7 @@ errors during scrub:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDependencyCureError(t *testing.T) {
|
func TestInputError(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
makeIdent := func(ident ...byte) pkg.Artifact {
|
makeIdent := func(ident ...byte) pkg.Artifact {
|
||||||
@@ -1962,56 +1959,40 @@ func TestDependencyCureError(t *testing.T) {
|
|||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
err pkg.DependencyCureError
|
err pkg.InputError
|
||||||
want string
|
want string
|
||||||
unwrap []error
|
unwrap []error
|
||||||
}{
|
}{
|
||||||
{"simple", pkg.DependencyCureError{
|
{"simple", pkg.InputError{
|
||||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
makeIdent(0xff, 9): stub.UniqueError(0xbad09),
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
makeIdent(0xff, 0): stub.UniqueError(0xbad00),
|
||||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
makeIdent(0xff, 0xf): stub.UniqueError(0xbad0f),
|
||||||
{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
makeIdent(0xff, 1): stub.UniqueError(0xbad01),
|
||||||
}, `errors curing dependencies:
|
}, `errors curing inputs:
|
||||||
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
||||||
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
||||||
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite
|
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite
|
||||||
_w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765199 injected by the test suite`, []error{
|
_w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765199 injected by the test suite`, []error{
|
||||||
&pkg.CureError{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
stub.UniqueError(0xbad00),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
stub.UniqueError(0xbad01),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
stub.UniqueError(0xbad09),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
stub.UniqueError(0xbad0f),
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{"dedup", pkg.DependencyCureError{
|
{"dedup", pkg.InputError{
|
||||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
makeIdent(0xff, 9): stub.UniqueError(0xbad09),
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
makeIdent(0xff, 9): stub.UniqueError(0xbad09),
|
||||||
{A: makeIdent(0xff, 0xfd), Err: &pkg.DependencyCureError{
|
makeIdent(0xff, 9): stub.UniqueError(0xbad09),
|
||||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
makeIdent(0xff, 0): stub.UniqueError(0xbad00),
|
||||||
{A: makeIdent(0xff, 0xc), Err: &pkg.DependencyCureError{
|
makeIdent(0xff, 0): stub.UniqueError(0xbad00),
|
||||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
makeIdent(0xff, 1): stub.UniqueError(0xbad01),
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
}, `errors curing inputs:
|
||||||
}},
|
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
|
||||||
}},
|
|
||||||
{A: makeIdent(0xff, 0xff), Err: &pkg.DependencyCureError{
|
|
||||||
{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
|
||||||
{A: makeIdent(0xff, 0xc), Err: &pkg.DependencyCureError{
|
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
|
||||||
}},
|
|
||||||
{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
|
||||||
}},
|
|
||||||
{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
|
||||||
{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
|
||||||
}, `errors curing dependencies:
|
|
||||||
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
_wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765184 injected by the test suite
|
||||||
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
_wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765185 injected by the test suite
|
||||||
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite
|
_wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765193 injected by the test suite`, []error{
|
||||||
_w8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: unique error 765199 injected by the test suite`, []error{
|
stub.UniqueError(0xbad00),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 0), Err: stub.UniqueError(0xbad00)},
|
stub.UniqueError(0xbad01),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 1), Err: stub.UniqueError(0xbad01)},
|
stub.UniqueError(0xbad09),
|
||||||
&pkg.CureError{A: makeIdent(0xff, 9), Err: stub.UniqueError(0xbad09)},
|
|
||||||
&pkg.CureError{A: makeIdent(0xff, 0xf), Err: stub.UniqueError(0xbad0f)},
|
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
@@ -2055,19 +2036,21 @@ func (a earlyFailureF) Cure(*pkg.FContext) error {
|
|||||||
func BenchmarkEarlyDCE(b *testing.B) {
|
func BenchmarkEarlyDCE(b *testing.B) {
|
||||||
msg := message.New(log.New(os.Stderr, "dce: ", 0))
|
msg := message.New(log.New(os.Stderr, "dce: ", 0))
|
||||||
msg.SwapVerbose(testing.Verbose())
|
msg.SwapVerbose(testing.Verbose())
|
||||||
|
|
||||||
|
for b.Loop() {
|
||||||
|
b.StopTimer()
|
||||||
c, err := pkg.Open(b.Context(), msg, check.MustAbs(b.TempDir()), nil)
|
c, err := pkg.Open(b.Context(), msg, check.MustAbs(b.TempDir()), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
b.StartTimer()
|
||||||
_, _, err = c.Cure(earlyFailureF(8))
|
_, _, err = c.Cure(earlyFailureF(8))
|
||||||
|
b.StopTimer()
|
||||||
if !errors.Is(err, stub.UniqueError(0xcafe)) {
|
if !errors.Is(err, stub.UniqueError(0xcafe)) {
|
||||||
b.Fatalf("Cure: error = %v", err)
|
b.Fatalf("Cure: error = %v", err)
|
||||||
}
|
}
|
||||||
c.Close()
|
c.Close()
|
||||||
dce := err.(*pkg.DependencyCureError)
|
b.StartTimer()
|
||||||
|
|
||||||
for b.Loop() {
|
|
||||||
dce.Unwrap()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -174,8 +174,8 @@ func (a *tarArtifact) Cure(t *TContext) (err error) {
|
|||||||
|
|
||||||
case tar.TypeChar:
|
case tar.TypeChar:
|
||||||
t.GetMessage().Verbosef(
|
t.GetMessage().Verbosef(
|
||||||
"skipping character device %d, %d %q",
|
"%sskipping character device %d, %d %q%s",
|
||||||
header.Devmajor, header.Devminor, header.Name,
|
t.cache.sgrWarn, header.Devmajor, header.Devminor, header.Name, t.cache.sgrRes,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
// Value are types supported by the language.
|
// Value are types supported by the language.
|
||||||
type Value interface {
|
type Value interface {
|
||||||
bool | int64 | string | []string | []int64 | [][2]string
|
bool | int64 | string | []string | []int64 | [][2]string | Nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -33,6 +33,29 @@ type (
|
|||||||
F func(args FArgs) (v any, set bool, err error)
|
F func(args FArgs) (v any, set bool, err error)
|
||||||
V map[unique.Handle[Ident]]any
|
V map[unique.Handle[Ident]]any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nil represents an untyped nil.
|
||||||
|
Nil struct{}
|
||||||
|
|
||||||
|
// AString represents an argument string that may be nil.
|
||||||
|
AString struct {
|
||||||
|
V string
|
||||||
|
Nil bool
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NilError is returned for an invalid nil assignment.
|
||||||
|
type NilError struct{ reflect.Type }
|
||||||
|
|
||||||
|
func (e NilError) Error() string {
|
||||||
|
return fmt.Sprintf("attempting to assign nil to %s", e.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// nilStringV is the [reflect.Value] of an Azalea nil assigned to an [AString].
|
||||||
|
nilStringV = reflect.ValueOf(AString{Nil: true})
|
||||||
|
// nilStringT is the [reflect.Type] of nilStringV.
|
||||||
|
nilStringT = nilStringV.Type()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Apply applies named arguments and rejects unused arguments.
|
// Apply applies named arguments and rejects unused arguments.
|
||||||
@@ -50,8 +73,8 @@ func (args FArgs) Apply(v map[unique.Handle[Ident]]any) error {
|
|||||||
}
|
}
|
||||||
return UndefinedError(arg.K.Value())
|
return UndefinedError(arg.K.Value())
|
||||||
}
|
}
|
||||||
err := storeE(r, arg.V)
|
|
||||||
if err != nil {
|
if err := storeE(r, arg.V); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,11 +138,38 @@ func (e TypeError) Is(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// storeE is a convenience function to set the value of a result pointer.
|
// storeE is a convenience function to set the value of a result pointer.
|
||||||
func storeE(rp any, r any) error {
|
func storeE(rp, r any) error {
|
||||||
pv := reflect.ValueOf(rp).Elem()
|
pv := reflect.ValueOf(rp).Elem()
|
||||||
|
pt := pv.Type()
|
||||||
|
as := nilStringT.AssignableTo(pt)
|
||||||
|
|
||||||
|
if r == (Nil{}) {
|
||||||
|
switch kind := pt.Kind(); kind {
|
||||||
|
case reflect.Bool, reflect.String:
|
||||||
|
return NilError{pt}
|
||||||
|
default:
|
||||||
|
if rv, ok := rp.(*any); ok && !reflect.ValueOf(*rv).IsValid() {
|
||||||
|
*rv = Nil{}
|
||||||
|
} else if as {
|
||||||
|
pv.Set(nilStringV)
|
||||||
|
} else {
|
||||||
|
pv.SetZero()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
v := reflect.ValueOf(r)
|
v := reflect.ValueOf(r)
|
||||||
pt, vt := pv.Type(), v.Type()
|
if vt := v.Type(); !vt.AssignableTo(pt) {
|
||||||
if !vt.AssignableTo(pt) {
|
if as {
|
||||||
|
var asv AString
|
||||||
|
if err := storeE(&asv.V, r); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
pv.Set(reflect.ValueOf(asv))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return TypeError{vt, pt}
|
return TypeError{vt, pt}
|
||||||
}
|
}
|
||||||
pv.Set(v)
|
pv.Set(v)
|
||||||
@@ -226,6 +276,9 @@ func evaluateAny(d PF, s []Frame, expr, rp any) bool {
|
|||||||
case "false":
|
case "false":
|
||||||
store(rp, false)
|
store(rp, false)
|
||||||
return true
|
return true
|
||||||
|
case "nil":
|
||||||
|
store(rp, Nil{})
|
||||||
|
return true
|
||||||
default:
|
default:
|
||||||
return evaluateAny(d, s, v, rp)
|
return evaluateAny(d, s, v, rp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,15 +100,79 @@ func TestEvaluate(t *testing.T) {
|
|||||||
Err: UndefinedError("f"),
|
Err: UndefinedError("f"),
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{"error wrap deep", `f { v = nil; }`, makeStackCheck(func(
|
{"error wrap deep", `f { v = nonexistent; }`, makeStackCheck(func(
|
||||||
FArgs,
|
FArgs,
|
||||||
) (any, error) {
|
) (any, error) {
|
||||||
panic("unreachable")
|
panic("unreachable")
|
||||||
}), "", EvaluationError{
|
}), "", EvaluationError{
|
||||||
Expr: Ident("nil"),
|
Expr: Ident("nonexistent"),
|
||||||
Err: UndefinedError("nil"),
|
Err: UndefinedError("nonexistent"),
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
{"nil", `f { v = nil; }`, checkArgs(FArgs{
|
||||||
|
{K: unique.Make(Ident("v")), V: Nil{}},
|
||||||
|
}), "\xfd", nil},
|
||||||
|
|
||||||
|
{"apply nil string", `f { v = nil; }`, makeStackCheck(func(
|
||||||
|
args FArgs,
|
||||||
|
) (v any, err error) {
|
||||||
|
var s string
|
||||||
|
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("v")): &s,
|
||||||
|
})
|
||||||
|
v = s
|
||||||
|
return
|
||||||
|
}), "", EvaluationError{
|
||||||
|
Expr: Func{
|
||||||
|
Ident: Ident("f"),
|
||||||
|
Args: []Arg{
|
||||||
|
{K: []Ident{"v"}, V: Val{Ident("nil")}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Err: NilError{Type: reflect.TypeFor[string]()},
|
||||||
|
}},
|
||||||
|
|
||||||
|
{"apply nil AString", `f { v = nil; }`, makeStackCheck(func(
|
||||||
|
args FArgs,
|
||||||
|
) (v any, err error) {
|
||||||
|
s := AString{}
|
||||||
|
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("v")): &s,
|
||||||
|
})
|
||||||
|
v = s.V
|
||||||
|
if !s.Nil {
|
||||||
|
err = fmt.Errorf("got non-nil string %q", s.V)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}), "", nil},
|
||||||
|
|
||||||
|
{"apply AString", `f { v = "\xfd"; }`, makeStackCheck(func(
|
||||||
|
args FArgs,
|
||||||
|
) (v any, err error) {
|
||||||
|
s := AString{}
|
||||||
|
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("v")): &s,
|
||||||
|
})
|
||||||
|
v = s.V
|
||||||
|
if s.Nil {
|
||||||
|
err = fmt.Errorf("unexpected nil %q", s.V)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}), "\xfd", nil},
|
||||||
|
|
||||||
|
{"apply nil", `f { v = nil; }`, makeStackCheck(func(
|
||||||
|
args FArgs,
|
||||||
|
) (v any, err error) {
|
||||||
|
s := make([]struct{}, 9)
|
||||||
|
err = args.Apply(map[unique.Handle[Ident]]any{
|
||||||
|
unique.Make(Ident("v")): &s,
|
||||||
|
})
|
||||||
|
if s != nil {
|
||||||
|
err = fmt.Errorf("got non-nil value %#v", s)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}), "", nil},
|
||||||
|
|
||||||
{"common inputs", `package name { inputs, v = []; }`, nil, "", EvaluationError{
|
{"common inputs", `package name { inputs, v = []; }`, nil, "", EvaluationError{
|
||||||
Expr: Func{
|
Expr: Func{
|
||||||
Ident: Ident("name"),
|
Ident: Ident("name"),
|
||||||
@@ -214,8 +278,8 @@ func TestEvaluate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var errEquals bool
|
var errEquals bool
|
||||||
if _, ok := errors.AsType[TypeError](err); ok {
|
if e, ok := errors.AsType[TypeError](err); ok {
|
||||||
errEquals = errors.Is(err, tc.err)
|
errEquals = e.Is(tc.err)
|
||||||
} else {
|
} else {
|
||||||
errEquals = reflect.DeepEqual(err, tc.err)
|
errEquals = reflect.DeepEqual(err, tc.err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ type CMakeHelper struct {
|
|||||||
var _ Helper = new(CMakeHelper)
|
var _ Helper = new(CMakeHelper)
|
||||||
|
|
||||||
// extra returns the cmake handle alongside either ninja or make.
|
// extra returns the cmake handle alongside either ninja or make.
|
||||||
func (attr *CMakeHelper) extra(int) P {
|
func (attr *CMakeHelper) extra() P {
|
||||||
if attr != nil && attr.Make {
|
if attr != nil && attr.Make {
|
||||||
return P{_cmake, _make}
|
return P{_cmake, _make}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ func init() {
|
|||||||
a := cureEtc{}
|
a := cureEtc{}
|
||||||
if r.ReadUint32() == 0 {
|
if r.ReadUint32() == 0 {
|
||||||
a.minimal = true
|
a.minimal = true
|
||||||
|
} else {
|
||||||
|
r.Next()
|
||||||
}
|
}
|
||||||
if _, ok := r.Finalise(); ok {
|
if _, ok := r.Finalise(); ok {
|
||||||
panic(pkg.ErrUnexpectedChecksum)
|
panic(pkg.ErrUnexpectedChecksum)
|
||||||
|
|||||||
+12
-5
@@ -20,10 +20,13 @@ func (t Toolchain) NewViaGit(
|
|||||||
return t.New(strings.TrimSuffix(
|
return t.New(strings.TrimSuffix(
|
||||||
path.Base(url),
|
path.Base(url),
|
||||||
".git",
|
".git",
|
||||||
)+"-src-"+path.Base(rev), THostNet, t.Append(nil,
|
)+"-src", path.Base(rev), nil, &PackageAttr{
|
||||||
_nssCACert,
|
KnownChecksum: &checksum,
|
||||||
_git,
|
|
||||||
), &checksum, nil, `
|
HostNet: true,
|
||||||
|
Paths: []pkg.ExecPath{resolvconf()},
|
||||||
|
}, &GenericHelper{
|
||||||
|
Build: `
|
||||||
git \
|
git \
|
||||||
-c advice.detachedHead=false \
|
-c advice.detachedHead=false \
|
||||||
clone \
|
clone \
|
||||||
@@ -34,5 +37,9 @@ git \
|
|||||||
` + url + ` \
|
` + url + ` \
|
||||||
/work
|
/work
|
||||||
rm -rf /work/.git
|
rm -rf /work/.git
|
||||||
`, resolvconf())
|
`,
|
||||||
|
},
|
||||||
|
_nssCACert,
|
||||||
|
_git,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ func (t Toolchain) newGo(
|
|||||||
script string,
|
script string,
|
||||||
boot ...pkg.Artifact,
|
boot ...pkg.Artifact,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
return t.NewPackage("go", version, newTar(
|
return t.New("go", version, newTar(
|
||||||
"https://go.dev/dl/go"+version+".src.tar.gz",
|
"https://go.dev/dl/go"+version+".src.tar.gz",
|
||||||
checksum,
|
checksum,
|
||||||
pkg.Gzip,
|
pkg.Gzip,
|
||||||
@@ -75,7 +75,7 @@ func init() {
|
|||||||
)
|
)
|
||||||
switch t.arch {
|
switch t.arch {
|
||||||
case "amd64":
|
case "amd64":
|
||||||
bootstrapEarly = []pkg.Artifact{t.NewPackage("go", "1.4-bootstrap", newTar(
|
bootstrapEarly = []pkg.Artifact{t.New("go", "1.4-bootstrap", newTar(
|
||||||
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
"https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
||||||
"8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23",
|
"8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23",
|
||||||
pkg.Gzip,
|
pkg.Gzip,
|
||||||
|
|||||||
+17
-3
@@ -83,9 +83,11 @@ func init() {
|
|||||||
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
{"LIBCXX_ENABLE_STATIC_ABI_LIBRARY", "OFF"},
|
||||||
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
||||||
{"LIBCXX_HARDENING_MODE", "fast"},
|
{"LIBCXX_HARDENING_MODE", "fast"},
|
||||||
|
{"LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY", "ON"},
|
||||||
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
||||||
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "OFF"},
|
{"LIBCXXABI_ENABLE_STATIC_UNWINDER", "ON"},
|
||||||
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
||||||
|
{"LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY", "ON"},
|
||||||
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
{"LLVM_INSTALL_BINUTILS_SYMLINKS", "ON"},
|
||||||
{"LLVM_INSTALL_UTILS", "ON"},
|
{"LLVM_INSTALL_UTILS", "ON"},
|
||||||
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
{"LLVM_BUILD_LLVM_DYLIB", "ON"},
|
||||||
@@ -138,6 +140,10 @@ func init() {
|
|||||||
"CodeGen/PowerPC/ppc-tmmintrin.c",
|
"CodeGen/PowerPC/ppc-tmmintrin.c",
|
||||||
"CodeGen/PowerPC/ppc-smmintrin.c",
|
"CodeGen/PowerPC/ppc-smmintrin.c",
|
||||||
"CodeGenCUDA/amdgpu-alias-undef-symbols.cu",
|
"CodeGenCUDA/amdgpu-alias-undef-symbols.cu",
|
||||||
|
// clang: deadlocks with LIBCXXABI_ENABLE_STATIC_UNWINDER
|
||||||
|
"global-value-regex",
|
||||||
|
"global-hex-value-regex",
|
||||||
|
"check-globals",
|
||||||
// cxx: fails on musl
|
// cxx: fails on musl
|
||||||
"close.dont-get-rid-of-buffer",
|
"close.dont-get-rid-of-buffer",
|
||||||
"re/re.traits",
|
"re/re.traits",
|
||||||
@@ -178,8 +184,8 @@ func init() {
|
|||||||
}...)
|
}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &meta, t.NewPackage("llvm", meta.Version, source, &PackageAttr{
|
return &meta, t.New("llvm", meta.Version, source, &PackageAttr{
|
||||||
Flag: TExclusive,
|
Exclusive: true,
|
||||||
Bin: []string{
|
Bin: []string{
|
||||||
"chmod",
|
"chmod",
|
||||||
"mkdir",
|
"mkdir",
|
||||||
@@ -187,6 +193,10 @@ func init() {
|
|||||||
"tr",
|
"tr",
|
||||||
"awk",
|
"awk",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ScriptEarly: `
|
||||||
|
rm -f /system/bin/clang++.cfg
|
||||||
|
`,
|
||||||
}, &CMakeHelper{
|
}, &CMakeHelper{
|
||||||
Append: []string{"llvm"},
|
Append: []string{"llvm"},
|
||||||
|
|
||||||
@@ -196,6 +206,10 @@ ln -s ld.lld /work/system/bin/ld
|
|||||||
ln -s clang /work/system/bin/cc
|
ln -s clang /work/system/bin/cc
|
||||||
ln -s clang /work/system/bin/cpp
|
ln -s clang /work/system/bin/cpp
|
||||||
ln -s clang++ /work/system/bin/c++
|
ln -s clang++ /work/system/bin/c++
|
||||||
|
cat << EOF > /work/system/bin/clang++.cfg
|
||||||
|
-static-libstdc++
|
||||||
|
-Wl,--exclude-libs,libunwind.a:libc++.a:libc++experimental.a:libc++abi.a
|
||||||
|
EOF
|
||||||
`,
|
`,
|
||||||
|
|
||||||
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
// LLVM_LINK_LLVM_DYLIB causes llvm test suite to leak system
|
||||||
|
|||||||
@@ -52,15 +52,16 @@ type MakeHelper struct {
|
|||||||
var _ Helper = new(MakeHelper)
|
var _ Helper = new(MakeHelper)
|
||||||
|
|
||||||
// extra returns make and other optional dependencies.
|
// extra returns make and other optional dependencies.
|
||||||
func (attr *MakeHelper) extra(flag int) P {
|
func (attr *MakeHelper) extra() P {
|
||||||
extra := P{_make}
|
if attr == nil || !attr.OmitDefaults {
|
||||||
if (attr == nil || !attr.OmitDefaults) && flag&TEarly == 0 {
|
return P{
|
||||||
extra = append(extra,
|
_make,
|
||||||
|
|
||||||
_awk,
|
_awk,
|
||||||
_coreutils,
|
_coreutils,
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return extra
|
}
|
||||||
|
return P{_make}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wantsChmod returns whether the build system needs to be generated.
|
// wantsChmod returns whether the build system needs to be generated.
|
||||||
@@ -172,6 +173,7 @@ make \
|
|||||||
scriptMake += attr.ScriptCheckEarly + `make \
|
scriptMake += attr.ScriptCheckEarly + `make \
|
||||||
` + jobsFlagE + ` \
|
` + jobsFlagE + ` \
|
||||||
` + loadFlagE + ` \
|
` + loadFlagE + ` \
|
||||||
|
AM_COLOR_TESTS=always \
|
||||||
`
|
`
|
||||||
if len(attr.Check) > 0 {
|
if len(attr.Check) > 0 {
|
||||||
scriptMake += strings.Join(attr.Check, " \\\n\t")
|
scriptMake += strings.Join(attr.Check, " \\\n\t")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ type MesonHelper struct {
|
|||||||
var _ Helper = new(MesonHelper)
|
var _ Helper = new(MesonHelper)
|
||||||
|
|
||||||
// extra returns hardcoded meson runtime dependencies.
|
// extra returns hardcoded meson runtime dependencies.
|
||||||
func (attr *MesonHelper) extra(int) P {
|
func (attr *MesonHelper) extra() P {
|
||||||
if !attr.isPython() {
|
if !attr.isPython() {
|
||||||
return P{_muon}
|
return P{_muon}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ package acl {
|
|||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// makes assumptions about uid_map/gid_map
|
// makes assumptions about uid_map/gid_map
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [ attr, kernel-headers ];
|
inputs = [ attr, kernel-headers ];
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ package awk {
|
|||||||
chmod = true;
|
chmod = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
skipConfigure = true;
|
configure = nil;
|
||||||
make = [ "YACC='yacc -d -b awkgram'" ];
|
make = [ "YACC='yacc -d -b awkgram'" ];
|
||||||
preCheck = "install -vD a.out /system/bin/awk\n";
|
preCheck = "install -vD a.out /system/bin/awk\n";
|
||||||
install = "install -vD a.out /work/system/bin/awk";
|
install = "install -vD a.out /work/system/bin/awk";
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ package bison {
|
|||||||
|
|
||||||
version# = "3.8.2";
|
version# = "3.8.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/bison/bison-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/bison/bison-"+version+".tar.gz";
|
||||||
checksum = "BhRM6K7URj1LNOkIDCFDctSErLS-Xo5d9ba9seg10o6ACrgC1uNhED7CQPgIY29Y";
|
checksum = "BhRM6K7URj1LNOkIDCFDctSErLS-Xo5d9ba9seg10o6ACrgC1uNhED7CQPgIY29Y";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
toyboxEarly = true;
|
||||||
exec = make {
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
check = [
|
check = [
|
||||||
"TESTSUITEFLAGS=" + jobsFlagE + "' " + skipGNUTests {
|
"TESTSUITEFLAGS=" + jobsFlagE + "' " + skipGNUTests {
|
||||||
tests = [
|
tests = [
|
||||||
@@ -24,6 +26,5 @@ package bison {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
toyboxEarly = true;
|
|
||||||
inputs = [ m4 ];
|
inputs = [ m4 ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ package byacc {
|
|||||||
writable = true;
|
writable = true;
|
||||||
chmod = true;
|
chmod = true;
|
||||||
|
|
||||||
exec = make {};
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,10 @@ package bzip2 {
|
|||||||
enterSource = true;
|
enterSource = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
skipConfigure = true;
|
chdir = false;
|
||||||
skipCheck = true;
|
configure = nil;
|
||||||
inPlace = true;
|
make = [ "CC=cc" ];
|
||||||
|
check = nil;
|
||||||
make = [
|
|
||||||
"CC=cc",
|
|
||||||
];
|
|
||||||
install = "make PREFIX=/work/system install";
|
install = "make PREFIX=/work/system install";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ package cairo {
|
|||||||
// runs the entire test suite in a single meson test
|
// runs the entire test suite in a single meson test
|
||||||
interactiveTest = true;
|
interactiveTest = true;
|
||||||
// only works with specific dependency versions
|
// only works with specific dependency versions
|
||||||
skipTest = true;
|
test = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package cmake {
|
|||||||
website = "https://cmake.org";
|
website = "https://cmake.org";
|
||||||
anitya = 306;
|
anitya = 306;
|
||||||
|
|
||||||
version# = "4.4.0";
|
version# = "4.4.2";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "Kitware/CMake";
|
suffix = "Kitware/CMake";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
name = "cmake-"+version+".tar.gz";
|
name = "cmake-"+version+".tar.gz";
|
||||||
checksum = "ZL0Y19_mSJWsl3dMjRRQJAaCvl4_PqbwpgUC1aBA-cdVdrK_gt4ylpUM2GMoQMku";
|
checksum = "IWlqJqJCZ6f-z-7Ft1U4ycvCX4riuihKale5NKWusiHemBgC3m5gCecrzikXoL7S";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
patches = [ "disable-broken-tests-musl.patch" ];
|
patches = [ "disable-broken-tests-musl.patch" ];
|
||||||
@@ -20,7 +20,7 @@ package cmake {
|
|||||||
chmod = true;
|
chmod = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
|
|
||||||
configureName = "/usr/src/cmake/bootstrap";
|
configureName = "/usr/src/cmake/bootstrap";
|
||||||
configure = {
|
configure = {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package connman {
|
|||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
|
||||||
dbus,
|
dbus,
|
||||||
iptables,
|
iptables,
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cryptsetup {
|
||||||
|
description = "open-source disk encryption";
|
||||||
|
website = "https://gitlab.com/cryptsetup/cryptsetup";
|
||||||
|
anitya = 13709;
|
||||||
|
|
||||||
|
version# = "2.8.7";
|
||||||
|
source = remoteGitLab {
|
||||||
|
domain = "gitlab.com";
|
||||||
|
suffix = "cryptsetup/cryptsetup";
|
||||||
|
ref = "v"+version;
|
||||||
|
checksum = "eDi_UaMtwhIzqpsdcA91aVb56zCYDrsDzeMWfWXAnPbuvn2bEgeH5dFs7mouHz8V";
|
||||||
|
};
|
||||||
|
|
||||||
|
bin = [ "bash" ];
|
||||||
|
exec = meson {
|
||||||
|
setup = {
|
||||||
|
"asciidoc": "disabled";
|
||||||
|
"ssh-token": "false";
|
||||||
|
"blkid": "false";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
bash,
|
||||||
|
gettext,
|
||||||
|
coreutils,
|
||||||
|
|
||||||
|
popt,
|
||||||
|
lvm2,
|
||||||
|
json-c,
|
||||||
|
e2fsprogs,
|
||||||
|
argp-standalone,
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
|
||||||
|
runtime = [
|
||||||
|
popt,
|
||||||
|
lvm2,
|
||||||
|
json-c,
|
||||||
|
e2fsprogs,
|
||||||
|
openssl,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ touch \
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
configureName = "../dist/configure";
|
configureName = "../dist/configure";
|
||||||
forceAutoconf = true;
|
forceAutoconf = true;
|
||||||
configure = {
|
configure = {
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ package xdg-dbus-proxy {
|
|||||||
website = "https://github.com/flatpak/xdg-dbus-proxy";
|
website = "https://github.com/flatpak/xdg-dbus-proxy";
|
||||||
anitya = 58434;
|
anitya = 58434;
|
||||||
|
|
||||||
version# = "0.1.7";
|
version# = "0.1.8";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "flatpak/xdg-dbus-proxy";
|
suffix = "flatpak/xdg-dbus-proxy";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "UW5Pe-TP-XAaN-kTbxrkOQ7eYdmlAQlr2pdreLtPT0uwdAz-7rzDP8V_8PWuZBup";
|
checksum = "ygdW0EEvZ-_PJfnFTNoobITmRzqJecTinBsJd_iJQrRvzidwqESCjeNkB55smZ2y";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {
|
exec = meson {
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package e2fsprogs {
|
||||||
|
description = "ext2/3/4 filesystem userspace utilities";
|
||||||
|
website = "http://e2fsprogs.sourceforge.net";
|
||||||
|
anitya = 646;
|
||||||
|
|
||||||
|
version# = "1.47.4";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git"+
|
||||||
|
"/snapshot/e2fsprogs-"+version+".tar.gz";
|
||||||
|
compress = gzip;
|
||||||
|
checksum = "gdnAEVjncIciqG-ZhFfYVv4wbBbCHBmPPYwRxltIfOTqdYH5L3ri8wk75YIVlgN0";
|
||||||
|
};
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
configure = {
|
||||||
|
"enable-elf-shlibs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
perl,
|
||||||
|
gzip,
|
||||||
|
bzip2,
|
||||||
|
diffutils,
|
||||||
|
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -18,17 +18,17 @@ package elfutils {
|
|||||||
];
|
];
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// nonstandard glibc extension
|
|
||||||
skipCheck = true;
|
|
||||||
|
|
||||||
configure = {
|
configure = {
|
||||||
"enable-deterministic-archives";
|
"enable-deterministic-archives";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// nonstandard glibc extension
|
||||||
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
m4,
|
m4,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
|
||||||
zlib,
|
zlib,
|
||||||
bzip2,
|
bzip2,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package firmware {
|
|||||||
website = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
website = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
||||||
anitya = 141464;
|
anitya = 141464;
|
||||||
|
|
||||||
version# = "20260622";
|
version# = "20260810";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.com";
|
domain = "gitlab.com";
|
||||||
suffix = "kernel-firmware/linux-firmware";
|
suffix = "kernel-firmware/linux-firmware";
|
||||||
ref = version;
|
ref = version;
|
||||||
checksum = "gpytkDM58EVjaUuryOekcekh_rWsfuv3S7LQxopHlNlVGmMsuqNwfug4BjgTgizE";
|
checksum = "XNUhz9QstaDKNegM3Bl0-TtZzpsvX7-E8WMnDCO7KBhBC6t_TxsdG05-ETdXynry";
|
||||||
};
|
};
|
||||||
|
|
||||||
// dedup creates temporary file
|
// dedup creates temporary file
|
||||||
@@ -22,17 +22,17 @@ package firmware {
|
|||||||
];
|
];
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
skipConfigure = true;
|
chdir = false;
|
||||||
inPlace = true;
|
|
||||||
|
|
||||||
|
configure = nil;
|
||||||
make = [
|
make = [
|
||||||
"DESTDIR=/work/system",
|
"DESTDIR=/work/system",
|
||||||
"install-zst",
|
"install-zst",
|
||||||
];
|
];
|
||||||
|
|
||||||
// requires pre-commit
|
// requires pre-commit
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
|
|
||||||
install = "make " + jobsFlagE + " " + loadFlagE + " DESTDIR=/work/system dedup";
|
install = "make " + jobsFlagE + " " + loadFlagE + " DESTDIR=/work/system dedup";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package fontconfig {
|
|||||||
website = "https://www.freedesktop.org/wiki/Software/fontconfig";
|
website = "https://www.freedesktop.org/wiki/Software/fontconfig";
|
||||||
anitya = 827;
|
anitya = 827;
|
||||||
|
|
||||||
version# = "2.18.2";
|
version# = "2.18.3";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
suffix = "fontconfig/fontconfig";
|
suffix = "fontconfig/fontconfig";
|
||||||
ref = version;
|
ref = version;
|
||||||
checksum = "P8YoQunIynBhc3gdDyPkImw_GGYoy1U4aX0jTnpkgtLmU4nqIgUyeqCH3-rNzpTd";
|
checksum = "ZZzmt8fYh-3jKJ6vHXUDbeAWM2ilRusWxdynLt3Z4E_CQQ8cCwzpuAWACXmr9qHI";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
@@ -18,7 +18,7 @@ package fontconfig {
|
|||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
gettext,
|
gettext,
|
||||||
gperf,
|
gperf,
|
||||||
gzip,
|
gzip,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package fuse {
|
|||||||
|
|
||||||
postCompile = "python3 -m pytest test/";
|
postCompile = "python3 -m pytest test/";
|
||||||
// this project uses pytest
|
// this project uses pytest
|
||||||
skipTest = true;
|
test = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ package gawk {
|
|||||||
|
|
||||||
version# = "5.4.0";
|
version# = "5.4.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/gawk/gawk-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/gawk/gawk-"+version+".tar.gz";
|
||||||
checksum = "m0RkIolC-PI7EY5q8pcx5Y-0twlIW0Yp3wXXmV-QaHorSdf8BhZ7kW9F8iWomz0C";
|
checksum = "m0RkIolC-PI7EY5q8pcx5Y-0twlIW0Yp3wXXmV-QaHorSdf8BhZ7kW9F8iWomz0C";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package binutils {
|
|||||||
website = "https://www.gnu.org/software/binutils";
|
website = "https://www.gnu.org/software/binutils";
|
||||||
anitya = 7981;
|
anitya = 7981;
|
||||||
|
|
||||||
version# = "2.46.1";
|
version# = "2.47";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/binutils/binutils-"+version+".tar.bz2";
|
url = "https://mirrors.kernel.org/gnu/binutils/binutils-"+version+".tar.bz2";
|
||||||
checksum = "ihCVohBxX-URAR-YFDdVrL3inLYsEVX8KbbQmcbHaShHgqqmtsvUue1h3LXSjW-d";
|
checksum = "VjbMg5KtZ6VSeNc77Z5p8RKg9eZ56g29ViKbbsF3tcFhZu0Yurg0nZt7UwB577LM";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@ package gcc {
|
|||||||
website = "https://www.gnu.org/software/gcc";
|
website = "https://www.gnu.org/software/gcc";
|
||||||
anitya = 6502;
|
anitya = 6502;
|
||||||
|
|
||||||
version# = "16.1.0";
|
version# = "16.2.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
|
url = "https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/"+
|
||||||
"gcc-"+version+"/gcc-"+version+".tar.gz";
|
"gcc-"+version+"/gcc-"+version+".tar.gz";
|
||||||
checksum = "4ASoWbxaA2FW7PAB0zzHDPC5XnNhyaAyjtDPpGzceSLeYnEIXsNYZR3PA_Zu5P0K";
|
checksum = "yWDNSrcKa6yA5ucD4G-a5nCN99yPA8cRlxKgQlaaT-jM4pWYR6e1EvI2qbjUqXWZ";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
patches = [
|
patches = [
|
||||||
@@ -65,7 +65,7 @@ ln -s system/lib /work/
|
|||||||
// This toolchain is hacked to pieces, it is not expected to ever work
|
// This toolchain is hacked to pieces, it is not expected to ever work
|
||||||
// well in its current state. That does not matter as long as the
|
// well in its current state. That does not matter as long as the
|
||||||
// toolchain it produces passes its own test suite.
|
// toolchain it produces passes its own test suite.
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ rm -f /system/bin/httpd
|
|||||||
bin = [ "perl" ];
|
bin = [ "perl" ];
|
||||||
populateUsrBin = true;
|
populateUsrBin = true;
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
generate = "make configure";
|
generate = "make configure";
|
||||||
|
|
||||||
preMake = `
|
preMake = `
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package glib {
|
|||||||
website = "https://developer.gnome.org/glib";
|
website = "https://developer.gnome.org/glib";
|
||||||
anitya = 10024;
|
anitya = 10024;
|
||||||
|
|
||||||
version# = "2.89.2";
|
version# = "2.89.3";
|
||||||
source = remoteGit {
|
source = remoteGit {
|
||||||
url = "https://gitlab.gnome.org/GNOME/glib.git";
|
url = "https://gitlab.gnome.org/GNOME/glib.git";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "ZetUwjVOKs0v2xtndzy7_4kvZY2VEESOTT45AAMJVLr22fmTRKit4MJOwruB0als";
|
checksum = "eM9KrXwhwKiZferwrILKmDeq-IGnSjr0EKqV90EEVl0Ee82QVcyVSf2LDMROHcOF";
|
||||||
};
|
};
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package glslang {
|
package glslang {
|
||||||
description = "reference front end for GLSL/ESSL";
|
description = "reference front end for GLSL/ESSL";
|
||||||
website = "https://github.com/KhronosGroup/glslang";
|
website = "https://github.com/KhronosGroup/glslang";
|
||||||
anitya = 205796;
|
anitya = 334917;
|
||||||
|
|
||||||
version# = "16.4.0";
|
version# = "1.4.357.0";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "KhronosGroup/glslang";
|
suffix = "KhronosGroup/glslang";
|
||||||
tag = version;
|
tag = "vulkan-sdk-"+version;
|
||||||
checksum = "u67ps8Fv_75QDiusvKjzgttPPPxb5V7HsObb0q6OvqQfHh0UGN2_x8Y0RKb9JEie";
|
checksum = "7Zq12xtSd5z_aEEeYCnsWR5WvcEGVlTsRaV6MqkmY1a3iNIrRbX_rrg-taI3wMe6";
|
||||||
};
|
};
|
||||||
|
|
||||||
// test suite writes to source
|
// test suite writes to source
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package m4 {
|
|||||||
|
|
||||||
version# = "1.4.21";
|
version# = "1.4.21";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/m4/m4-"+version+".tar.bz2";
|
url = "https://mirrors.kernel.org/gnu/m4/m4-"+version+".tar.bz2";
|
||||||
checksum = "pPa6YOo722Jw80l1OsH1tnUaklnPFjFT-bxGw5iAVrZTm1P8FQaWao_NXop46-pm";
|
checksum = "pPa6YOo722Jw80l1OsH1tnUaklnPFjFT-bxGw5iAVrZTm1P8FQaWao_NXop46-pm";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
@@ -17,9 +17,11 @@ package m4 {
|
|||||||
chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh
|
chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exec = make {};
|
|
||||||
|
|
||||||
toyboxEarly = true;
|
toyboxEarly = true;
|
||||||
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
diffutils,
|
diffutils,
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ package autoconf {
|
|||||||
|
|
||||||
version# = "2.73";
|
version# = "2.73";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/autoconf/autoconf-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/autoconf/autoconf-"+version+".tar.gz";
|
||||||
checksum = "yGabDTeOfaCUB0JX-h3REYLYzMzvpDwFmFFzHNR7QilChCUNE4hR6q7nma4viDYg";
|
checksum = "yGabDTeOfaCUB0JX-h3REYLYzMzvpDwFmFFzHNR7QilChCUNE4hR6q7nma4viDYg";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -69,7 +71,7 @@ package automake {
|
|||||||
|
|
||||||
version# = "1.18.1";
|
version# = "1.18.1";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/automake/automake-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/automake/automake-"+version+".tar.gz";
|
||||||
checksum = "FjvLG_GdQP7cThTZJLDMxYpRcKdpAVG-YDs1Fj1yaHlSdh_Kx6nRGN14E0r_BjcG";
|
checksum = "FjvLG_GdQP7cThTZJLDMxYpRcKdpAVG-YDs1Fj1yaHlSdh_Kx6nRGN14E0r_BjcG";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -105,14 +107,14 @@ package libtool {
|
|||||||
|
|
||||||
version# = "2.6.2";
|
version# = "2.6.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/libtool/libtool-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/libtool/libtool-"+version+".tar.gz";
|
||||||
checksum = "roFqdjyoGjpK7CWWLJJrTS56LuOQcIdq6Tgr4yplacSwirFHoaiDe6CojIWYinWe";
|
checksum = "roFqdjyoGjpK7CWWLJJrTS56LuOQcIdq6Tgr4yplacSwirFHoaiDe6CojIWYinWe";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// _Z2a2c: symbol not found
|
// _Z2a2c: symbol not found
|
||||||
skipEarlyStageCheck = true;
|
checkEarly = false;
|
||||||
|
|
||||||
check = [
|
check = [
|
||||||
"TESTSUITEFLAGS=" + jobsFlagE,
|
"TESTSUITEFLAGS=" + jobsFlagE,
|
||||||
@@ -133,14 +135,14 @@ package gzip {
|
|||||||
|
|
||||||
version# = "1.14";
|
version# = "1.14";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/gzip/gzip-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/gzip/gzip-"+version+".tar.gz";
|
||||||
checksum = "NWhjUavnNfTDFkZJyAUonL9aCOak8GVajWX2OMlzpFnuI0ErpBFyj88mz2xSjz0q";
|
checksum = "NWhjUavnNfTDFkZJyAUonL9aCOak8GVajWX2OMlzpFnuI0ErpBFyj88mz2xSjz0q";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// dependency loop
|
// dependency loop
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +153,7 @@ package sed {
|
|||||||
|
|
||||||
version# = "4.10";
|
version# = "4.10";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/sed/sed-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/sed/sed-"+version+".tar.gz";
|
||||||
checksum = "TXTRFQJCyflb-bpBRI2S5Y1DpplwvT7-KfXtpqN4AdZgZ5OtI6yStn1-bkhDKx51";
|
checksum = "TXTRFQJCyflb-bpBRI2S5Y1DpplwvT7-KfXtpqN4AdZgZ5OtI6yStn1-bkhDKx51";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -179,7 +181,7 @@ package diffutils {
|
|||||||
|
|
||||||
version# = "3.12";
|
version# = "3.12";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/diffutils/diffutils-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/diffutils/diffutils-"+version+".tar.gz";
|
||||||
checksum = "9J5VAq5oA7eqwzS1Yvw-l3G5o-TccUrNQR3PvyB_lgdryOFAfxtvQfKfhdpquE44";
|
checksum = "9J5VAq5oA7eqwzS1Yvw-l3G5o-TccUrNQR3PvyB_lgdryOFAfxtvQfKfhdpquE44";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -194,7 +196,9 @@ test_disable '#!/bin/sh' tests/cmp
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
toyboxEarly = true;
|
toyboxEarly = true;
|
||||||
exec = make {};
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
package patch {
|
package patch {
|
||||||
@@ -204,7 +208,7 @@ package patch {
|
|||||||
|
|
||||||
version# = "2.8";
|
version# = "2.8";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/patch/patch-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/patch/patch-"+version+".tar.gz";
|
||||||
checksum = "MA0BQc662i8QYBD-DdGgyyfTwaeALZ1K0yusV9rAmNiIsQdX-69YC4t9JEGXZkeR";
|
checksum = "MA0BQc662i8QYBD-DdGgyyfTwaeALZ1K0yusV9rAmNiIsQdX-69YC4t9JEGXZkeR";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -218,7 +222,9 @@ test_disable '#!/bin/sh' tests/need-filename
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
toyboxEarly = true;
|
toyboxEarly = true;
|
||||||
exec = make {};
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
package grep {
|
package grep {
|
||||||
@@ -228,7 +234,7 @@ package grep {
|
|||||||
|
|
||||||
version# = "3.12";
|
version# = "3.12";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/grep/grep-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/grep/grep-"+version+".tar.gz";
|
||||||
checksum = "qMB4RjaPNRRYsxix6YOrjE8gyAT1zVSTy4nW4wKW9fqa0CHYAuWgPwDTirENzm_1";
|
checksum = "qMB4RjaPNRRYsxix6YOrjE8gyAT1zVSTy4nW4wKW9fqa0CHYAuWgPwDTirENzm_1";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -253,7 +259,7 @@ package gettext {
|
|||||||
|
|
||||||
version# = "1.0";
|
version# = "1.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/gettext/gettext-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/gettext/gettext-"+version+".tar.gz";
|
||||||
checksum = "3MasKeEdPeFEgWgzsBKk7JqWqql1wEMbgPmzAfs-mluyokoW0N8oQVxPQoOnSdgC";
|
checksum = "3MasKeEdPeFEgWgzsBKk7JqWqql1wEMbgPmzAfs-mluyokoW0N8oQVxPQoOnSdgC";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -293,7 +299,7 @@ package findutils {
|
|||||||
|
|
||||||
version# = "4.11.0";
|
version# = "4.11.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/findutils/findutils-"+version+".tar.xz";
|
url = "https://mirrors.kernel.org/gnu/findutils/findutils-"+version+".tar.xz";
|
||||||
compress = xz;
|
compress = xz;
|
||||||
checksum = "X-qsv9aUoBL583q-4iZcBI3_7Ufd3fSIqFmNLXWdEpUihlRfMpGGyAUt8SAvDKae";
|
checksum = "X-qsv9aUoBL583q-4iZcBI3_7Ufd3fSIqFmNLXWdEpUihlRfMpGGyAUt8SAvDKae";
|
||||||
};
|
};
|
||||||
@@ -321,13 +327,14 @@ package bash {
|
|||||||
|
|
||||||
version# = "5.3";
|
version# = "5.3";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/bash/bash-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/bash/bash-"+version+".tar.gz";
|
||||||
checksum = "4LQ_GRoB_ko-Ih8QPf_xRKA02xAm_TOxQgcJLmFDT6udUPxTAWrsj-ZNeuTusyDq";
|
checksum = "4LQ_GRoB_ko-Ih8QPf_xRKA02xAm_TOxQgcJLmFDT6udUPxTAWrsj-ZNeuTusyDq";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
toyboxEarly = true;
|
toyboxEarly = true;
|
||||||
exec = make {
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
configure = {
|
configure = {
|
||||||
"without-bash-malloc";
|
"without-bash-malloc";
|
||||||
};
|
};
|
||||||
@@ -342,7 +349,7 @@ package coreutils {
|
|||||||
|
|
||||||
version# = "9.11";
|
version# = "9.11";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/coreutils/coreutils-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/coreutils/coreutils-"+version+".tar.gz";
|
||||||
checksum = "t8UMed5wpFEoC56aa42_yidfOAaRGzOfj7MRtQkkqgGbpXiskNA8bd-EmVSQkZie";
|
checksum = "t8UMed5wpFEoC56aa42_yidfOAaRGzOfj7MRtQkkqgGbpXiskNA8bd-EmVSQkZie";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -364,6 +371,7 @@ test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
|
defaults = false;
|
||||||
configure = {
|
configure = {
|
||||||
"enable-single-binary": "symlinks";
|
"enable-single-binary": "symlinks";
|
||||||
};
|
};
|
||||||
@@ -384,7 +392,7 @@ package tar {
|
|||||||
|
|
||||||
version# = "1.35";
|
version# = "1.35";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/tar/tar-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/tar/tar-"+version+".tar.gz";
|
||||||
checksum = "zSaoSlVUDW0dSfm4sbL4FrXLFR8U40Fh3zY5DWhR5NCIJ6GjU6Kc4VZo2-ZqpBRA";
|
checksum = "zSaoSlVUDW0dSfm4sbL4FrXLFR8U40Fh3zY5DWhR5NCIJ6GjU6Kc4VZo2-ZqpBRA";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -421,14 +429,14 @@ package texinfo {
|
|||||||
|
|
||||||
version# = "7.3";
|
version# = "7.3";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/texinfo/texinfo-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/texinfo/texinfo-"+version+".tar.gz";
|
||||||
checksum = "RRmC8Xwdof7JuZJeWGAQ_GeASIHAuJFQMbNONXBz5InooKIQGmqmWRjGNGEr5n4-";
|
checksum = "RRmC8Xwdof7JuZJeWGAQ_GeASIHAuJFQMbNONXBz5InooKIQGmqmWRjGNGEr5n4-";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// nonstandard glibc extension
|
// nonstandard glibc extension
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [ perl ];
|
inputs = [ perl ];
|
||||||
@@ -446,7 +454,7 @@ package gperf {
|
|||||||
|
|
||||||
version# = "3.3";
|
version# = "3.3";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gperf/gperf-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/gperf/gperf-"+version+".tar.gz";
|
||||||
checksum = "RtIy9pPb_Bb8-31J2Nw-rRGso2JlS-lDlVhuNYhqR7Nt4xM_nObznxAlBMnarJv7";
|
checksum = "RtIy9pPb_Bb8-31J2Nw-rRGso2JlS-lDlVhuNYhqR7Nt4xM_nObznxAlBMnarJv7";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -463,7 +471,7 @@ package bc {
|
|||||||
|
|
||||||
version# = "1.08.2";
|
version# = "1.08.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/bc/bc-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/bc/bc-"+version+".tar.gz";
|
||||||
checksum = "8h6f3hjV80XiFs6v9HOPF2KEyg1kuOgn5eeFdVspV05ODBVQss-ey5glc8AmneLy";
|
checksum = "8h6f3hjV80XiFs6v9HOPF2KEyg1kuOgn5eeFdVspV05ODBVQss-ey5glc8AmneLy";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -486,7 +494,7 @@ package libiconv {
|
|||||||
|
|
||||||
version# = "1.19";
|
version# = "1.19";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/libiconv/libiconv-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/libiconv/libiconv-"+version+".tar.gz";
|
||||||
checksum = "UibB6E23y4MksNqYmCCrA3zTFO6vJugD1DEDqqWYFZNuBsUWMVMcncb_5pPAr88x";
|
checksum = "UibB6E23y4MksNqYmCCrA3zTFO6vJugD1DEDqqWYFZNuBsUWMVMcncb_5pPAr88x";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -501,7 +509,7 @@ package parallel {
|
|||||||
|
|
||||||
version# = "20260722";
|
version# = "20260722";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/parallel/parallel-"+version+".tar.bz2";
|
url = "https://mirrors.kernel.org/gnu/parallel/parallel-"+version+".tar.bz2";
|
||||||
checksum = "liG9pBSRqUPqDuRXmnJPoVh-G53lDKkkO8GGabSxQnSho4b9BD0EaJDdScgVhnwj";
|
checksum = "liG9pBSRqUPqDuRXmnJPoVh-G53lDKkkO8GGabSxQnSho4b9BD0EaJDdScgVhnwj";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
@@ -524,7 +532,7 @@ package libunistring {
|
|||||||
|
|
||||||
version# = "1.4.2";
|
version# = "1.4.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/libunistring/libunistring-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/libunistring/libunistring-"+version+".tar.gz";
|
||||||
checksum = "iW9BbfLoVlXjWoLTZ4AekQSu4cFBnLcZ4W8OHWbv0AhJNgD3j65_zqaLMzFKylg2";
|
checksum = "iW9BbfLoVlXjWoLTZ4AekQSu4cFBnLcZ4W8OHWbv0AhJNgD3j65_zqaLMzFKylg2";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -551,7 +559,7 @@ package libtasn1 {
|
|||||||
|
|
||||||
version# = "4.21.0";
|
version# = "4.21.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/libtasn1/libtasn1-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/libtasn1/libtasn1-"+version+".tar.gz";
|
||||||
checksum = "9DYI3UYbfYLy8JsKUcY6f0irskbfL0fHZA91Q-JEOA3kiUwpodyjemRsYRjUpjuq";
|
checksum = "9DYI3UYbfYLy8JsKUcY6f0irskbfL0fHZA91Q-JEOA3kiUwpodyjemRsYRjUpjuq";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -566,7 +574,7 @@ package readline {
|
|||||||
|
|
||||||
version# = "8.3";
|
version# = "8.3";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/readline/readline-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/readline/readline-"+version+".tar.gz";
|
||||||
checksum = "r-lcGRJq_MvvBpOq47Z2Y1OI2iqrmtcqhTLVXR0xWo37ZpC2uT_md7gKq5o_qTMV";
|
checksum = "r-lcGRJq_MvvBpOq47Z2Y1OI2iqrmtcqhTLVXR0xWo37ZpC2uT_md7gKq5o_qTMV";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -640,7 +648,7 @@ package mpc {
|
|||||||
enterSource = true;
|
enterSource = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
generate = "autoreconf -vfi";
|
generate = "autoreconf -vfi";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ echo 'int main(){return 0;}' > tests/mini-dtls-fragments.c
|
|||||||
bison,
|
bison,
|
||||||
gettext,
|
gettext,
|
||||||
gperf,
|
gperf,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
|
||||||
python,
|
python,
|
||||||
texinfo,
|
texinfo,
|
||||||
|
|||||||
@@ -1,135 +0,0 @@
|
|||||||
From 06f90ebfa6f3e0a744584513e2786988b26569da Mon Sep 17 00:00:00 2001
|
|
||||||
From: Damien Neil <dneil@google.com>
|
|
||||||
Date: Wed, 08 Jul 2026 11:11:48 -0700
|
|
||||||
Subject: [PATCH] os: properly handle trailing / in Root.MkdirAll
|
|
||||||
|
|
||||||
MkdirAll("dir/") should create "dir", not return an error.
|
|
||||||
|
|
||||||
Fixes #80308
|
|
||||||
|
|
||||||
Change-Id: I75458c30b6cb94be3a3d368f6024caef6a6a6964
|
|
||||||
---
|
|
||||||
|
|
||||||
diff --git a/src/os/root_noopenat.go b/src/os/root_noopenat.go
|
|
||||||
index 228b580..a84e952 100644
|
|
||||||
--- a/src/os/root_noopenat.go
|
|
||||||
+++ b/src/os/root_noopenat.go
|
|
||||||
@@ -158,6 +158,9 @@
|
|
||||||
if err := checkPathEscapes(r, name); err == errPathEscapes {
|
|
||||||
return &PathError{Op: "mkdirat", Path: name, Err: err}
|
|
||||||
}
|
|
||||||
+ if name == "" {
|
|
||||||
+ return &PathError{Op: "mkdirat", Path: name, Err: syscall.ENOENT}
|
|
||||||
+ }
|
|
||||||
prefix := r.root.name + string(PathSeparator)
|
|
||||||
if err := MkdirAll(prefix+name, perm); err != nil {
|
|
||||||
if pe, ok := err.(*PathError); ok {
|
|
||||||
diff --git a/src/os/root_openat.go b/src/os/root_openat.go
|
|
||||||
index d7c9334..92865e4 100644
|
|
||||||
--- a/src/os/root_openat.go
|
|
||||||
+++ b/src/os/root_openat.go
|
|
||||||
@@ -167,6 +167,12 @@
|
|
||||||
fi, e := r.Stat(fullname)
|
|
||||||
if e == nil && fi.Mode().IsDir() {
|
|
||||||
err = nil
|
|
||||||
+ } else if e == nil {
|
|
||||||
+ err = syscall.ENOTDIR
|
|
||||||
+ } else if !IsNotExist(e) {
|
|
||||||
+ // EPERM, ELOOP, etc.,
|
|
||||||
+ // probably more useful than EEXIST.
|
|
||||||
+ err = e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -177,7 +183,12 @@
|
|
||||||
}
|
|
||||||
return struct{}{}, &PathError{Op: "mkdirat", Err: err}
|
|
||||||
}
|
|
||||||
- _, err := doInRoot(r, fullname, 0, openDirFunc, openLastComponentFunc)
|
|
||||||
+ flags := uint(doInRootCreatingDirectory)
|
|
||||||
+ switch runtime.GOOS {
|
|
||||||
+ case "linux", "windows":
|
|
||||||
+ flags = doInRootNoHandleTerminalSlash // see rootMkdir
|
|
||||||
+ }
|
|
||||||
+ _, err := doInRoot(r, fullname, flags, openDirFunc, openLastComponentFunc)
|
|
||||||
if err != nil {
|
|
||||||
if _, ok := err.(*PathError); !ok {
|
|
||||||
err = &PathError{Op: "mkdirat", Path: fullname, Err: err}
|
|
||||||
diff --git a/src/os/root_test.go b/src/os/root_test.go
|
|
||||||
index 5e0acf9..33a2f33 100644
|
|
||||||
--- a/src/os/root_test.go
|
|
||||||
+++ b/src/os/root_test.go
|
|
||||||
@@ -585,6 +585,11 @@
|
|
||||||
|
|
||||||
func TestRootMkdirAll(t *testing.T) {
|
|
||||||
for _, test := range rootTestCases {
|
|
||||||
+ if test.name == "directory does not exist" {
|
|
||||||
+ // Test expects error, mkdirall creates the missing directory.
|
|
||||||
+ // TestRootMultiMkdirAll covers this case better anyway, just skip.
|
|
||||||
+ continue
|
|
||||||
+ }
|
|
||||||
test.run(t, func(t *testing.T, target string, root *os.Root) {
|
|
||||||
wantError := test.wantError
|
|
||||||
if test.ltarget != "" {
|
|
||||||
@@ -593,7 +598,7 @@
|
|
||||||
wantError = true
|
|
||||||
}
|
|
||||||
|
|
||||||
- err := root.Mkdir(test.open, 0o777)
|
|
||||||
+ err := root.MkdirAll(test.open, 0o777)
|
|
||||||
if errEndsTest(t, err, wantError, "root.MkdirAll(%q)", test.open) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -3133,6 +3138,52 @@
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
+func TestRootMultiMkdirAllShallow(t *testing.T) {
|
|
||||||
+ runRootMultiTest(t, func(t *testing.T, test *rootMultiTest) (string, error) {
|
|
||||||
+ return testRootMultiMkdirAll(t, test, test.targetPath)
|
|
||||||
+ })
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func TestRootMultiMkdirAllDeep(t *testing.T) {
|
|
||||||
+ runRootMultiTest(t, func(t *testing.T, test *rootMultiTest) (string, error) {
|
|
||||||
+ targetPath := test.targetPath
|
|
||||||
+ if len(targetPath) > 0 && os.IsPathSeparator(targetPath[len(targetPath)-1]) {
|
|
||||||
+ targetPath += "a/b/"
|
|
||||||
+ } else {
|
|
||||||
+ targetPath += "/a/b"
|
|
||||||
+ }
|
|
||||||
+ return testRootMultiMkdirAll(t, test, targetPath)
|
|
||||||
+ })
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func testRootMultiMkdirAll(t *testing.T, test *rootMultiTest, targetPath string) (string, error) {
|
|
||||||
+ var mkdirAll = os.MkdirAll
|
|
||||||
+ if test.root != nil {
|
|
||||||
+ mkdirAll = test.root.MkdirAll
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ test.setOp("MkdirAll(%q, 0o777)", targetPath)
|
|
||||||
+ gotErr := mkdirAll(targetPath, 0o777)
|
|
||||||
+
|
|
||||||
+ switch {
|
|
||||||
+ case test.root != nil && test.target.lescapes():
|
|
||||||
+ // "mkdir ../target", or equivalent escaping path.
|
|
||||||
+ test.wantError(t, gotErr, os.ErrPathEscapes)
|
|
||||||
+ case test.root != nil && test.target.escapes():
|
|
||||||
+ // "mkdir ../target", or equivalent escaping path.
|
|
||||||
+ test.wantError(t, gotErr, errAny)
|
|
||||||
+ return "", errSkipRootConsistencyCheck
|
|
||||||
+ case test.root != nil && test.target.kind == testFileSymlink && test.target.target.kind == testFileAbsent && targetPath != test.targetPath:
|
|
||||||
+ // A minor inconsistency between Root.MkdirAll and os.MkdirAll:
|
|
||||||
+ // When an intermediate component of the tree being constructed is a
|
|
||||||
+ // dangling symlink, Root.MkdirAll will follow the symlink and create
|
|
||||||
+ // its target directory, while os.MkdirAll will fail with an error.
|
|
||||||
+ return "", errSkipRootConsistencyCheck
|
|
||||||
+ default:
|
|
||||||
+ }
|
|
||||||
+ return "", gotErr
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
func TestRootMultiRename(t *testing.T) {
|
|
||||||
if runtime.GOOS == "wasip1" {
|
|
||||||
switch os.Getenv("GOWASIRUNTIME") {
|
|
||||||
@@ -3,18 +3,16 @@ package go {
|
|||||||
website = "https://go.dev";
|
website = "https://go.dev";
|
||||||
anitya = 1227;
|
anitya = 1227;
|
||||||
|
|
||||||
version# = "1.26.5";
|
version# = "1.26.6";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://go.dev/dl/go"+version+".src.tar.gz";
|
url = "https://go.dev/dl/go"+version+".src.tar.gz";
|
||||||
checksum = "13yt1u_NGOd62LO-WZ8W6CUXodOrEF5CdkiTTiH9E635IHn1luvlXYjsHpBXNFSw";
|
checksum = "BJQz9rGJ7ElMsZGURH7lw48Hw0x88RwdQJpINMomtgGCMK3AtwGCxDRkLE9REh5r";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
// https://go.dev/issue/77674
|
// https://go.dev/issue/77674
|
||||||
"746640.patch",
|
"746640.patch",
|
||||||
// https://go.dev/issue/80308
|
|
||||||
"799064.patch",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
@@ -27,7 +25,7 @@ package go {
|
|||||||
enterSource = true;
|
enterSource = true;
|
||||||
|
|
||||||
exec = generic {
|
exec = generic {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
build = `
|
build = `
|
||||||
mkdir /work/system/ "${TMPDIR}"
|
mkdir /work/system/ "${TMPDIR}"
|
||||||
cp -r . /work/system/go
|
cp -r . /work/system/go
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package googletest {
|
|||||||
exclude = true;
|
exclude = true;
|
||||||
anitya = 18290;
|
anitya = 18290;
|
||||||
|
|
||||||
version# = "1.17.0";
|
version# = "1.18.0";
|
||||||
output = remoteGitHubRelease {
|
output = remoteGitHubRelease {
|
||||||
suffix = "google/googletest";
|
suffix = "google/googletest";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
name = "googletest-"+version+".tar.gz";
|
name = "googletest-"+version+".tar.gz";
|
||||||
checksum = "-1r3ch8vPP8COF7xUH5hyX6bEJ4dN9TQh4IxrmpHr6vaig6mA3DdUpV4cihQ_9dw";
|
checksum = "ABVPC5sduQR7xfkZQm7UHSmBTaAJcVPRHS_lNMhlL99HU_YffpFmXbwRKeG1ZY8A";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package hakurei-source {
|
|||||||
description = "hakurei source tree";
|
description = "hakurei source tree";
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
version# = "0.4.5";
|
version# = "0.4.6";
|
||||||
output = remoteTar {
|
output = remoteTar {
|
||||||
url = "https://git.gensokyo.uk/rosa/hakurei/archive/"+
|
url = "https://git.gensokyo.uk/rosa/hakurei/archive/"+
|
||||||
"v"+version+".tar.gz";
|
"v"+version+".tar.gz";
|
||||||
checksum = "5bvbuIRcDIrtijogwqXn3y8h5f3rVS4ZSVhOig6Galfzt3g-O3Ufb-tHL1kQCQWK";
|
checksum = "2HxvdykuSSymAu-c1WIwQAy3qT4dDm8B--93iL4uomBlBC8wfSWldbvPF1noNkUC";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -27,16 +27,9 @@ package hakurei {
|
|||||||
"CC=clang -O3 -Werror",
|
"CC=clang -O3 -Werror",
|
||||||
];
|
];
|
||||||
|
|
||||||
files = {
|
|
||||||
"hostname/main.go": "hostname";
|
|
||||||
};
|
|
||||||
|
|
||||||
exec = generic {
|
exec = generic {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
build = `
|
build = `
|
||||||
echo 'Building test helper (hostname).'
|
|
||||||
go build -o /bin/hostname /usr/src/hostname/main.go
|
|
||||||
|
|
||||||
mkdir -p /work/system/libexec/hakurei/
|
mkdir -p /work/system/libexec/hakurei/
|
||||||
|
|
||||||
echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)."
|
echo "Building hakurei for $(go env GOOS)/$(go env GOARCH)."
|
||||||
@@ -71,7 +64,8 @@ mkdir -p /work/system/bin/
|
|||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
go,
|
go,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
net-tools,
|
||||||
|
|
||||||
libseccomp,
|
libseccomp,
|
||||||
acl,
|
acl,
|
||||||
@@ -98,16 +92,9 @@ package hakurei-dist {
|
|||||||
"CC=clang -O3 -Werror",
|
"CC=clang -O3 -Werror",
|
||||||
];
|
];
|
||||||
|
|
||||||
files = {
|
|
||||||
"hostname/main.go": "hostname";
|
|
||||||
};
|
|
||||||
|
|
||||||
exec = generic {
|
exec = generic {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
build = `
|
build = `
|
||||||
echo 'Building test helper (hostname).'
|
|
||||||
go build -o /bin/hostname /usr/src/hostname/main.go
|
|
||||||
|
|
||||||
NAME=make`;
|
NAME=make`;
|
||||||
check = `
|
check = `
|
||||||
NAME=all`;
|
NAME=all`;
|
||||||
@@ -118,7 +105,8 @@ DESTDIR=/work "./${NAME}.sh"
|
|||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
go,
|
go,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
net-tools,
|
||||||
|
|
||||||
libseccomp,
|
libseccomp,
|
||||||
acl,
|
acl,
|
||||||
@@ -146,7 +134,7 @@ package earlyinit {
|
|||||||
];
|
];
|
||||||
|
|
||||||
exec = generic {
|
exec = generic {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
build = `
|
build = `
|
||||||
echo '# Building earlyinit.'
|
echo '# Building earlyinit.'
|
||||||
go build -trimpath -v -o /work/ -ldflags="-s -w
|
go build -trimpath -v -o /work/ -ldflags="-s -w
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "os"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if name, err := os.Hostname(); err != nil {
|
|
||||||
panic(err)
|
|
||||||
} else {
|
|
||||||
os.Stdout.WriteString(name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,11 @@ package harfbuzz {
|
|||||||
website = "https://harfbuzz.github.io";
|
website = "https://harfbuzz.github.io";
|
||||||
anitya = 1299;
|
anitya = 1299;
|
||||||
|
|
||||||
version# = "14.2.1";
|
version# = "14.3.1";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "harfbuzz/harfbuzz";
|
suffix = "harfbuzz/harfbuzz";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "gWl1fS1nXSH9Z9GpJSrh6w7Iv6AOjZbDL_4JZAZTiTYSyLCfxIFuCRLjYmqT2nbt";
|
checksum = "ykVwQNNbvY38Y27VjAfk16SGcEO5NY5A8CFxJCJ8z0ARh5MdLImmONpy-ZSb79Il";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {
|
exec = meson {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package hwdata {
|
|||||||
website = "https://github.com/vcrhonek/hwdata";
|
website = "https://github.com/vcrhonek/hwdata";
|
||||||
anitya = 5387;
|
anitya = 5387;
|
||||||
|
|
||||||
version# = "0.409";
|
version# = "0.410";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "vcrhonek/hwdata";
|
suffix = "vcrhonek/hwdata";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
checksum = "p2qr1_Y9dpjMNnK8OPNcuHSNwZldwb6mtiJ9Nd5HgU8z3L9fixLthnixywU8dd65";
|
checksum = "w1fbTz8NR7C6SYOupqTyNZGJHa_cDRAsGs4guZ3LddqlmawgEP_CWFw9-OYFKJ1q";
|
||||||
};
|
};
|
||||||
|
|
||||||
writable = true;
|
writable = true;
|
||||||
@@ -15,9 +15,9 @@ package hwdata {
|
|||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
// awk: fatal: cannot open file `hwdata.spec' for reading: No such file or directory
|
// awk: fatal: cannot open file `hwdata.spec' for reading: No such file or directory
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
|
|
||||||
// lspci: Unknown option 'A' (see "lspci --help")
|
// lspci: Unknown option 'A' (see "lspci --help")
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ package iproute2 {
|
|||||||
chmod = true;
|
chmod = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
// drop default autoconf options
|
// drop default autoconf options
|
||||||
configureName = "./configure";
|
configureName = "./configure";
|
||||||
configure = {
|
configure = {
|
||||||
@@ -30,11 +30,11 @@ package iproute2 {
|
|||||||
};
|
};
|
||||||
make = [ "CC=cc", "YACC=yacc" ];
|
make = [ "CC=cc", "YACC=yacc" ];
|
||||||
// wants root
|
// wants root
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
pkg-config,
|
pkgconf,
|
||||||
m4,
|
m4,
|
||||||
byacc,
|
byacc,
|
||||||
flex,
|
flex,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/x86 6.18.40 Kernel Configuration
|
# Linux/x86 6.18.44 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
||||||
CONFIG_GCC_VERSION=0
|
CONFIG_GCC_VERSION=0
|
||||||
@@ -7311,6 +7311,7 @@ CONFIG_AGP_INTEL=m
|
|||||||
CONFIG_AGP_SIS=m
|
CONFIG_AGP_SIS=m
|
||||||
CONFIG_AGP_VIA=m
|
CONFIG_AGP_VIA=m
|
||||||
CONFIG_INTEL_GTT=m
|
CONFIG_INTEL_GTT=m
|
||||||
|
CONFIG_GPU_BUDDY=y
|
||||||
CONFIG_DRM=m
|
CONFIG_DRM=m
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/arm64 6.18.40 Kernel Configuration
|
# Linux/arm64 6.18.44 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
||||||
CONFIG_GCC_VERSION=0
|
CONFIG_GCC_VERSION=0
|
||||||
@@ -7986,6 +7986,7 @@ CONFIG_HT16K33=m
|
|||||||
CONFIG_MAX6959=m
|
CONFIG_MAX6959=m
|
||||||
CONFIG_SEG_LED_GPIO=m
|
CONFIG_SEG_LED_GPIO=m
|
||||||
CONFIG_PANEL=m
|
CONFIG_PANEL=m
|
||||||
|
CONFIG_GPU_BUDDY=y
|
||||||
CONFIG_TEGRA_HOST1X_CONTEXT_BUS=y
|
CONFIG_TEGRA_HOST1X_CONTEXT_BUS=y
|
||||||
CONFIG_TEGRA_HOST1X=m
|
CONFIG_TEGRA_HOST1X=m
|
||||||
CONFIG_TEGRA_HOST1X_FIREWALL=y
|
CONFIG_TEGRA_HOST1X_FIREWALL=y
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package kernel-source {
|
|||||||
website = "https://kernel.org";
|
website = "https://kernel.org";
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
version# = "6.18.40";
|
version# = "6.18.44";
|
||||||
output = remoteTar {
|
output = remoteTar {
|
||||||
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
||||||
"snapshot/linux-"+version+".tar.gz";
|
"snapshot/linux-"+version+".tar.gz";
|
||||||
checksum = "s4lO-rWM-3FudvHLoD4zBEF5wDv21JR6XavpOqe5D4CCUsvwVCX4hWZ923cuAs-k";
|
checksum = "yNPGMl3A-EgU6LgD37PAcXIa9iUtP-AmoJuQozfGRSq6Eg1Eq4fdbpKy3iWewU9_";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,8 @@ package kernel-headers {
|
|||||||
toyboxEarly = true;
|
toyboxEarly = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
skipConfigure = true;
|
defaults = false;
|
||||||
|
configure = nil;
|
||||||
make = [
|
make = [
|
||||||
"-f /usr/src/kernel-headers/Makefile",
|
"-f /usr/src/kernel-headers/Makefile",
|
||||||
"O=/tmp/kbuild",
|
"O=/tmp/kbuild",
|
||||||
@@ -34,7 +35,7 @@ package kernel-headers {
|
|||||||
"INSTALL_HDR_PATH=/work/system",
|
"INSTALL_HDR_PATH=/work/system",
|
||||||
"headers_install",
|
"headers_install",
|
||||||
];
|
];
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
install = `
|
install = `
|
||||||
cat \
|
cat \
|
||||||
/usr/src/version.h > \
|
/usr/src/version.h > \
|
||||||
@@ -45,9 +46,9 @@ cat \
|
|||||||
checksum = arch {
|
checksum = arch {
|
||||||
default = "";
|
default = "";
|
||||||
|
|
||||||
amd64 = "U2DVl4KAYBB18KOb91ga6ob7-B0OPjTHLssLXf_Lh5XEe8TTsplPxXamV9a94WpK";
|
amd64 = "vN5Ts9yAlHTntcQcNGJSisY5guYsYfvGnQqI1NzTBzvhBMPD432WB3B0KFGYQntA";
|
||||||
arm64 = "oI4quef6uM-wrRoQa2dNYog4b7CtSjvLY84eXaNbRvTJA2tEm3oCx0guKBmScE38";
|
arm64 = "FQtpqCA0tlz17RJP8a5t9YEM_6F9kGPqQ9Z60gFrkVP3v8_P-Vnf5S7wLlxyRlOe";
|
||||||
riscv64 = "bgWRcfzfAh00TZvXy4W-EkWm4lq7VAk9-Bsv53hWh2qgz1fTMqw1Q9rgo_-aKgeS";
|
riscv64 = "U5yQ9TI5_7diyrCcm2Iqh3XCMl0P60oQGeDMWxt3OQ91zFWPQ5FCH-eoYG9tSTMT";
|
||||||
};
|
};
|
||||||
inputs = [ rsync ];
|
inputs = [ rsync ];
|
||||||
}
|
}
|
||||||
@@ -85,11 +86,12 @@ install -Dm0500 \
|
|||||||
exclusive = true;
|
exclusive = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
skipConfigure = true;
|
|
||||||
|
configure = nil;
|
||||||
|
|
||||||
// Build, install, and boot kernel before running kselftest on it.
|
// Build, install, and boot kernel before running kselftest on it.
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
|
|
||||||
make = [
|
make = [
|
||||||
"-f /usr/src/kernel/Makefile",
|
"-f /usr/src/kernel/Makefile",
|
||||||
@@ -153,7 +155,7 @@ package gen_init_cpio {
|
|||||||
|
|
||||||
enterSource = true;
|
enterSource = true;
|
||||||
exec = generic {
|
exec = generic {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
build = `
|
build = `
|
||||||
mkdir -p /work/system/bin/
|
mkdir -p /work/system/bin/
|
||||||
cc -o /work/system/bin/gen_init_cpio usr/gen_init_cpio.c
|
cc -o /work/system/bin/gen_init_cpio usr/gen_init_cpio.c
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/riscv 6.18.40 Kernel Configuration
|
# Linux/riscv 6.18.44 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
CONFIG_CC_VERSION_TEXT="clang version 22.1.8"
|
||||||
CONFIG_GCC_VERSION=0
|
CONFIG_GCC_VERSION=0
|
||||||
@@ -6897,6 +6897,7 @@ CONFIG_HT16K33=m
|
|||||||
CONFIG_MAX6959=m
|
CONFIG_MAX6959=m
|
||||||
CONFIG_SEG_LED_GPIO=m
|
CONFIG_SEG_LED_GPIO=m
|
||||||
CONFIG_PANEL=m
|
CONFIG_PANEL=m
|
||||||
|
CONFIG_GPU_BUDDY=y
|
||||||
CONFIG_DRM=m
|
CONFIG_DRM=m
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define LINUX_VERSION_CODE 397864
|
#define LINUX_VERSION_CODE 397868
|
||||||
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
|
||||||
#define LINUX_VERSION_MAJOR 6
|
#define LINUX_VERSION_MAJOR 6
|
||||||
#define LINUX_VERSION_PATCHLEVEL 18
|
#define LINUX_VERSION_PATCHLEVEL 18
|
||||||
#define LINUX_VERSION_SUBLEVEL 40
|
#define LINUX_VERSION_SUBLEVEL 44
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package kmod {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// makes assumptions about the running kernel
|
// makes assumptions about the running kernel
|
||||||
skipTest = true;
|
test = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package libaio {
|
||||||
|
description = "kernel asynchronous I/O (AIO) support";
|
||||||
|
website = "https://lse.sourceforge.net/io/aio.html";
|
||||||
|
anitya = 1557;
|
||||||
|
|
||||||
|
version# = "0.3.113";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://pagure.io/libaio/archive/libaio-"+version+
|
||||||
|
"/libaio-libaio-"+version+".tar.gz";
|
||||||
|
compress = gzip;
|
||||||
|
checksum = "vUATfur4I3D742vjRhiGMLYDCm-blbsymb3JTUiM3RV5HIEWi0wDBiPqh7jJpMWd";
|
||||||
|
};
|
||||||
|
|
||||||
|
enterSource = true;
|
||||||
|
writable = true;
|
||||||
|
chmod = true;
|
||||||
|
|
||||||
|
env = [ "PATH=/system/sbin" ];
|
||||||
|
bin = [ "bash" ];
|
||||||
|
exec = make {
|
||||||
|
chdir = false;
|
||||||
|
configure = nil;
|
||||||
|
preCheck = "rm harness/cases/20.t; "+ // flaky
|
||||||
|
"CFLAGS='"+
|
||||||
|
"-Wno-unknown-warning-option "+
|
||||||
|
"-Wno-gnu-designator "+
|
||||||
|
"-Wno-#warnings' ";
|
||||||
|
check = [ "partcheck" ];
|
||||||
|
install = "make prefix=/work/system install";
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
bash,
|
||||||
|
e2fsprogs,
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -60,4 +60,5 @@ list(APPEND CTEST_CUSTOM_TESTS_IGNORE
|
|||||||
"libarchive_test_read_format_tar_filename"
|
"libarchive_test_read_format_tar_filename"
|
||||||
"libarchive_test_read_format_ustar_filename"
|
"libarchive_test_read_format_ustar_filename"
|
||||||
"libarchive_test_read_append_wrong_filter"
|
"libarchive_test_read_append_wrong_filter"
|
||||||
|
"libarchive_test_read_format_zip_ppmd8_aes256_streaming"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package libarchive {
|
|||||||
website = "https://www.libarchive.org";
|
website = "https://www.libarchive.org";
|
||||||
anitya = 1558;
|
anitya = 1558;
|
||||||
|
|
||||||
version# = "3.8.8";
|
version# = "3.8.9";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "libarchive/libarchive";
|
suffix = "libarchive/libarchive";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
checksum = "MYlQdlxHX14rFL_zEYvDArKgGVIueTPzSEDgCzaZkmi0_N7WsaEpogGO3qnHpfTc";
|
checksum = "8C_8Mr22elOAO8Qvxl-B-R-B35M7dpdFdAlph1CeE1L75JdyUnolee-P3KDRFc8T";
|
||||||
};
|
};
|
||||||
|
|
||||||
files = { "CTestCustom.cmake"; };
|
files = { "CTestCustom.cmake"; };
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ package libbpf {
|
|||||||
chmod = true;
|
chmod = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
skipConfigure = true;
|
configure = nil;
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
install = "make DESTDIR=/work LIBSUBDIR=lib install";
|
install = "make DESTDIR=/work LIBSUBDIR=lib install";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,10 @@ package libcap {
|
|||||||
|
|
||||||
bin = [ "bash" ];
|
bin = [ "bash" ];
|
||||||
exec = make {
|
exec = make {
|
||||||
skipConfigure = true;
|
chdir = false;
|
||||||
inPlace = true;
|
configure = nil;
|
||||||
|
make = [ "CC=cc", "all" ];
|
||||||
make = [
|
check = [ "CC=cc", "test" ];
|
||||||
"CC=cc",
|
|
||||||
"all",
|
|
||||||
];
|
|
||||||
|
|
||||||
check = [
|
|
||||||
"CC=cc",
|
|
||||||
"test",
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package libexpat {
|
|||||||
website = "https://libexpat.github.io";
|
website = "https://libexpat.github.io";
|
||||||
anitya = 770;
|
anitya = 770;
|
||||||
|
|
||||||
version# = "2.8.2";
|
version# = "2.8.3";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "libexpat/libexpat";
|
suffix = "libexpat/libexpat";
|
||||||
tag = "R_"+replace {
|
tag = "R_"+replace {
|
||||||
@@ -12,7 +12,7 @@ package libexpat {
|
|||||||
new = "_";
|
new = "_";
|
||||||
};
|
};
|
||||||
name = "expat-"+version+".tar.bz2";
|
name = "expat-"+version+".tar.bz2";
|
||||||
checksum = "98Pdyj5QtO7QRtNFXTWsCNCixQDx701ZGql2B-JIrTDkw49J5WXXUwnS4AdMlM4L";
|
checksum = "prHQc14YY3Gp6BfflneNcVyRXM-AxFCqiigxrGL9TT1sGhVODvI_9JNR2xnZlZSj";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package libpsl {
|
|||||||
website = "https://rockdaboot.github.io/libpsl";
|
website = "https://rockdaboot.github.io/libpsl";
|
||||||
anitya = 7305;
|
anitya = 7305;
|
||||||
|
|
||||||
version# = "0.23.0";
|
version# = "0.23.2";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "rockdaboot/libpsl";
|
suffix = "rockdaboot/libpsl";
|
||||||
tag = version;
|
tag = version;
|
||||||
name = "libpsl-"+version+".tar.gz";
|
name = "libpsl-"+version+".tar.gz";
|
||||||
checksum = "7M0i3g6snxXGri0PcE5iYJFVGhZjBq1QxEom45ML0tCyu8b7i-ydvlcIAS2g9zqa";
|
checksum = "-XIKaQK0QoyzXpwezyvGzDdIBCUTqPyd8jU6axIusrnma-qsYxhLUO1Oycwcelr2";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c
|
|||||||
exec = make {};
|
exec = make {};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
pkg-config,
|
pkgconf,
|
||||||
python,
|
python,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package libtirpc {
|
|||||||
exec = make {
|
exec = make {
|
||||||
generate = "sh -e ./bootstrap";
|
generate = "sh -e ./bootstrap";
|
||||||
configure = {
|
configure = {
|
||||||
"CFLAGS": `"$(pkg-config --cflags libbsd-overlay) ${CFLAGS:-}"`;
|
"CFLAGS": `"$(pkgconf --cflags libbsd-overlay) ${CFLAGS:-}"`;
|
||||||
"disable-gssapi";
|
"disable-gssapi";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -28,7 +28,7 @@ package libtirpc {
|
|||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
|
||||||
libbsd,
|
libbsd,
|
||||||
kernel-headers,
|
kernel-headers,
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ package libucontext {
|
|||||||
enterSource = true;
|
enterSource = true;
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
skipConfigure = true;
|
chdir = false;
|
||||||
inPlace = true;
|
|
||||||
|
|
||||||
make = [
|
configure = nil;
|
||||||
"ARCH=" + linuxArch,
|
make = [ "ARCH=" + linuxArch ];
|
||||||
];
|
|
||||||
install = "make prefix=/system DESTDIR=/work install";
|
install = "make prefix=/system DESTDIR=/work install";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,25 +3,14 @@ package libudev-zero {
|
|||||||
website = "https://github.com/illiliti/libudev-zero";
|
website = "https://github.com/illiliti/libudev-zero";
|
||||||
anitya = 145201;
|
anitya = 145201;
|
||||||
|
|
||||||
version# = "1.0.4";
|
version# = "1.0.5";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "illiliti/libudev-zero";
|
suffix = "illiliti/libudev-zero";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "MHETnJwIdXc62qvE1Ya9xb2Shb53gWxdXzr8FVCFEacXF1rc01yE9guP3eXlKhYw";
|
checksum = "9WJKgtQH_MxqC1lB-gveIm19gWW99wvcRpEDrc3tQwqjo1SCnbk5k6WDF5Y7DUpe";
|
||||||
};
|
};
|
||||||
|
|
||||||
env = [ "CC=cc" ];
|
exec = meson {};
|
||||||
enterSource = true;
|
|
||||||
writable = true;
|
|
||||||
|
|
||||||
exec = make {
|
|
||||||
inPlace = true;
|
|
||||||
skipConfigure = true;
|
|
||||||
skipCheck = true;
|
|
||||||
|
|
||||||
make = [ "PREFIX=/system" ];
|
|
||||||
install = "make DESTDIR=/work PREFIX=/system install";
|
|
||||||
};
|
|
||||||
|
|
||||||
inputs = [ kernel-headers ];
|
inputs = [ kernel-headers ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ package libxslt {
|
|||||||
generate = "NOCONFIGURE=1 ./autogen.sh";
|
generate = "NOCONFIGURE=1 ./autogen.sh";
|
||||||
|
|
||||||
// python libxml2 cyclic dependency
|
// python libxml2 cyclic dependency
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
python,
|
python,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
|
|
||||||
libxml2,
|
libxml2,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package lit {
|
|||||||
exec = pip {
|
exec = pip {
|
||||||
append = [ "llvm", "utils", "lit" ];
|
append = [ "llvm", "utils", "lit" ];
|
||||||
// already checked during llvm
|
// already checked during llvm
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [ python-setuptools ];
|
inputs = [ python-setuptools ];
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ message(NOTICE "${LLVM_VERSION_MAJOR}")
|
|||||||
"COMPILER_RT_BUILD_PROFILE": "OFF";
|
"COMPILER_RT_BUILD_PROFILE": "OFF";
|
||||||
"COMPILER_RT_BUILD_XRAY": "OFF";
|
"COMPILER_RT_BUILD_XRAY": "OFF";
|
||||||
};
|
};
|
||||||
skipTest = true;
|
test = nil;
|
||||||
postInstall = `
|
postInstall = `
|
||||||
mkdir -p "/work/system/lib/clang/$LLVM_VERSION_MAJOR/lib/"
|
mkdir -p "/work/system/lib/clang/$LLVM_VERSION_MAJOR/lib/"
|
||||||
ln -s \
|
ln -s \
|
||||||
@@ -119,7 +119,7 @@ package early-runtimes {
|
|||||||
"LLVM_ENABLE_ZSTD": "FORCE_ON";
|
"LLVM_ENABLE_ZSTD": "FORCE_ON";
|
||||||
"LLVM_ENABLE_LIBXML2": "OFF";
|
"LLVM_ENABLE_LIBXML2": "OFF";
|
||||||
};
|
};
|
||||||
skipTest = true;
|
test = nil;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -17,20 +17,10 @@ package lm_sensors {
|
|||||||
bin = [ "perl" ];
|
bin = [ "perl" ];
|
||||||
populateUsrBin = true;
|
populateUsrBin = true;
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
chdir = false;
|
||||||
skipConfigure = true;
|
configure = nil;
|
||||||
|
make = [ "CC=cc", "ETCDIR=/system/etc", "PREFIX=/system" ];
|
||||||
make = [
|
check = [ "CC=cc", "check" ];
|
||||||
"CC=cc",
|
|
||||||
"ETCDIR=/system/etc",
|
|
||||||
"PREFIX=/system",
|
|
||||||
];
|
|
||||||
|
|
||||||
check = [
|
|
||||||
"CC=cc",
|
|
||||||
"check",
|
|
||||||
];
|
|
||||||
|
|
||||||
install = "make DESTDIR=/work PREFIX=/system install";
|
install = "make DESTDIR=/work PREFIX=/system install";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/src/luaconf.h b/src/luaconf.h
|
||||||
|
index 96a7780..0bfa66c 100644
|
||||||
|
--- a/src/luaconf.h
|
||||||
|
+++ b/src/luaconf.h
|
||||||
|
@@ -239,7 +239,7 @@
|
||||||
|
|
||||||
|
#else /* }{ */
|
||||||
|
|
||||||
|
-#define LUA_ROOT "/usr/local/"
|
||||||
|
+#define LUA_ROOT "/system/"
|
||||||
|
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
|
||||||
|
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# lua.pc -- pkg-config data for Lua
|
||||||
|
|
||||||
|
prefix=/system
|
||||||
|
INSTALL_BIN=${prefix}/bin
|
||||||
|
INSTALL_INC=${prefix}/include
|
||||||
|
INSTALL_LIB=${prefix}/lib
|
||||||
|
INSTALL_MAN=${prefix}/man/man1
|
||||||
|
INSTALL_LMOD=${prefix}/share/lua/@MAJOR_VER@.@MINOR_VER@
|
||||||
|
INSTALL_CMOD=${prefix}/lib/lua/@MAJOR_VER@.@MINOR_VER@
|
||||||
|
|
||||||
|
# canonical vars
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: Lua
|
||||||
|
Description: An Extensible Extension Language
|
||||||
|
Version: @MAJOR_VER@.@MINOR_VER@
|
||||||
|
Requires:
|
||||||
|
Libs: -L${libdir} -llua -lm
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
|
||||||
|
# (end of lua@MAJOR_VER@.pc)
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package lua {
|
||||||
|
description = "the programming language lua";
|
||||||
|
website = "https://www.lua.org/home.html";
|
||||||
|
anitya = 1847;
|
||||||
|
|
||||||
|
version# = "5.5.1";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://www.lua.org/ftp/lua-"+version+".tar.gz";
|
||||||
|
compress = gzip;
|
||||||
|
checksum = "8KCnY3UBf_oRuVhs7gc2pa18favYMzcMsjgeOOWjbbR9Y6W4qvm4gt1A-iMlXYBw";
|
||||||
|
};
|
||||||
|
patches = [ "conf-prefix.patch" ];
|
||||||
|
|
||||||
|
files = {
|
||||||
|
"lua.pc";
|
||||||
|
};
|
||||||
|
|
||||||
|
enterSource = true;
|
||||||
|
writable = true;
|
||||||
|
chmod = true;
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
chdir = false;
|
||||||
|
configure = nil;
|
||||||
|
make = [ "CC='clang -fPIC'", "all" ];
|
||||||
|
check = [ "test" ];
|
||||||
|
install = `
|
||||||
|
make INSTALL_TOP=/work/system install
|
||||||
|
mkdir /work/system/lib/pkgconfig
|
||||||
|
sed \
|
||||||
|
-e "s|@MAJOR_VER@|$(cc -P -E -include src/lua.h - <<< LUA_VERSION_MAJOR_N | tail -n 1)|g" \
|
||||||
|
-e "s|@MINOR_VER@|$(cc -P -E -include src/lua.h - <<< LUA_VERSION_MINOR_N | tail -n 1)|g" \
|
||||||
|
../lua.pc > /work/system/lib/pkgconfig/lua.pc
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||||
|
index 60739af..8b3fdf7 100644
|
||||||
|
--- a/lib/commands/toolcontext.c
|
||||||
|
+++ b/lib/commands/toolcontext.c
|
||||||
|
@@ -1661,6 +1661,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
||||||
|
reset_lvm_errno(1);
|
||||||
|
|
||||||
|
/* Set in/out stream buffering before glibc */
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
if (set_buffering
|
||||||
|
&& !cmd->running_on_valgrind /* Skipping within valgrind execution. */
|
||||||
|
#ifdef SYS_gettid
|
||||||
|
@@ -1704,6 +1705,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
||||||
|
} else if (!set_buffering)
|
||||||
|
/* Without buffering, must not use stdin/stdout */
|
||||||
|
init_silent(1);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Environment variable LVM_SYSTEM_DIR overrides this below.
|
||||||
|
@@ -2038,6 +2040,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||||
|
if (cmd->cft_def_hash)
|
||||||
|
dm_hash_destroy(cmd->cft_def_hash);
|
||||||
|
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
if (!cmd->running_on_valgrind && cmd->linebuffer) {
|
||||||
|
int flags;
|
||||||
|
/* Reset stream buffering to defaults */
|
||||||
|
@@ -2061,6 +2064,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||||
|
|
||||||
|
free(cmd->linebuffer);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
destroy_config_context(cmd);
|
||||||
|
|
||||||
|
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
||||||
|
index 7209ebd..778c8c0 100644
|
||||||
|
--- a/tools/lvmcmdline.c
|
||||||
|
+++ b/tools/lvmcmdline.c
|
||||||
|
@@ -3378,7 +3378,7 @@ static int _check_standard_fds(void)
|
||||||
|
int err = is_valid_fd(STDERR_FILENO);
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDIN_FILENO) &&
|
||||||
|
- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
|
||||||
|
+ !freopen(_PATH_DEVNULL, "r", stdin)) {
|
||||||
|
if (err)
|
||||||
|
perror("stdin stream open");
|
||||||
|
else
|
||||||
|
@@ -3388,7 +3388,7 @@ static int _check_standard_fds(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDOUT_FILENO) &&
|
||||||
|
- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
+ !freopen(_PATH_DEVNULL, "w", stdout)) {
|
||||||
|
if (err)
|
||||||
|
perror("stdout stream open");
|
||||||
|
/* else no stdout */
|
||||||
|
@@ -3396,7 +3396,7 @@ static int _check_standard_fds(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDERR_FILENO) &&
|
||||||
|
- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
+ !freopen(_PATH_DEVNULL, "w", stderr)) {
|
||||||
|
printf("stderr stream open: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
return 0;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package lvm2 {
|
||||||
|
description = "userspace toolset that provide logical volume management facilities";
|
||||||
|
website = "https://sourceware.org/lvm2";
|
||||||
|
anitya = 5354;
|
||||||
|
|
||||||
|
version# = "2.03.42";
|
||||||
|
source = remoteTar {
|
||||||
|
url = "https://mirrors.kernel.org/sourceware/lvm2/releases/LVM2."+version+".tgz";
|
||||||
|
compress = gzip;
|
||||||
|
checksum = "qzqVAeW9ttt_H5W0Wfg8twvZjFZH7x_RIzSjqYSooMsRpiXQ7yNdOL1MXY5Zntvi";
|
||||||
|
};
|
||||||
|
patches = [
|
||||||
|
"fix-stdio-usage.patch",
|
||||||
|
"remove-man.patch",
|
||||||
|
];
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
// requires root
|
||||||
|
check = nil;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
pkgconf,
|
||||||
|
|
||||||
|
libaio,
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index bf011ff4f..86713f2cd 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -18,7 +18,7 @@ top_builddir = @top_builddir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
|
|
||||||
|
-SUBDIRS = libdm conf daemons include lib libdaemon man scripts tools
|
||||||
|
+SUBDIRS = libdm conf daemons include lib libdaemon scripts tools
|
||||||
|
|
||||||
|
ifeq ("@UDEV_RULES@", "yes")
|
||||||
|
SUBDIRS += udev
|
||||||
@@ -5,7 +5,7 @@ package make {
|
|||||||
|
|
||||||
version# = "4.4.1";
|
version# = "4.4.1";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/make/make-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/make/make-"+version+".tar.gz";
|
||||||
checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a";
|
checksum = "YS_B07ZcAy9PbaK5_vKGj64SrxO2VMpnMKfc9I0Q9IC1rn0RwOH7802pJoj2Mq4a";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ package mesa {
|
|||||||
anitya = 1970;
|
anitya = 1970;
|
||||||
latest = anityaFallback;
|
latest = anityaFallback;
|
||||||
|
|
||||||
version# = "26.1.5";
|
version# = "26.2.0";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
suffix = "mesa/mesa";
|
suffix = "mesa/mesa";
|
||||||
ref = "mesa-"+version;
|
ref = "mesa-"+version;
|
||||||
checksum = "6C3NMUvTAOTjJtiHgvj9bFUO9dC1uu_by32ZgLQg5H6sNWzYQcwDpD6V3OFkWYJj";
|
checksum = "UPnIdpo5wUsE938GXY-YyYDzfF62enRoEzCYRyLLPvzBhBbP4wZ8nDiKsjivcs5v";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {
|
exec = meson {
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ package meson {
|
|||||||
website = "https://mesonbuild.com";
|
website = "https://mesonbuild.com";
|
||||||
anitya = 6472;
|
anitya = 6472;
|
||||||
|
|
||||||
version# = "1.11.2";
|
version# = "1.12.0";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "mesonbuild/meson";
|
suffix = "mesonbuild/meson";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "9AMilGxTOVqPA2DaGMASyuVs1BeTzgDZ0NH2oSYoRZk846ApvfOBa4cc18XEEK7M";
|
checksum = "K0hm0h26_6e3-1poYZKwj18IB6bdAtYE-whpROtTCSpVN5GllwSwbXC2xPYcSFAJ";
|
||||||
};
|
};
|
||||||
|
patches = [
|
||||||
|
"respect-colour.patch",
|
||||||
|
"test-strip-colour.patch",
|
||||||
|
];
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
"CMAKE_MAKE_PROGRAM=ninja",
|
"CMAKE_MAKE_PROGRAM=ninja",
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
|
||||||
|
index e1d998a5d..83d6cf9d2 100644
|
||||||
|
--- a/mesonbuild/mlog.py
|
||||||
|
+++ b/mesonbuild/mlog.py
|
||||||
|
@@ -404,6 +404,8 @@ class _Logger:
|
||||||
|
_colorize_console = os.isatty(output.fileno()) and _windows_ansi()
|
||||||
|
else:
|
||||||
|
_colorize_console = os.isatty(output.fileno()) and os.environ.get('TERM', 'dumb') != 'dumb'
|
||||||
|
+ if os.environ.get('CLICOLOR_FORCE', '') != '':
|
||||||
|
+ _colorize_console = True
|
||||||
|
except Exception:
|
||||||
|
_colorize_console = False
|
||||||
|
output.colorize_console = _colorize_console # type: ignore
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
|
||||||
|
index 0661fa529..34ab36aa9 100644
|
||||||
|
--- a/mesonbuild/mtest.py
|
||||||
|
+++ b/mesonbuild/mtest.py
|
||||||
|
@@ -1817,6 +1817,8 @@ class TestHarness:
|
||||||
|
test.exe_wrapper and test.exe_wrapper.found()):
|
||||||
|
env['MESON_EXE_WRAPPER'] = join_args(test.exe_wrapper.get_command())
|
||||||
|
env['MESON_TEST_ITERATION'] = str(iteration + 1)
|
||||||
|
+ env.pop('CLICOLOR_FORCE')
|
||||||
|
+ env.pop('FORCE_COLOR')
|
||||||
|
return SingleTestRunner(test, env, name, options)
|
||||||
|
|
||||||
|
def process_test_result(self, result: TestRun) -> None:
|
||||||
@@ -21,6 +21,6 @@ package musl-fts {
|
|||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ package musl-obstack {
|
|||||||
inputs = [
|
inputs = [
|
||||||
automake,
|
automake,
|
||||||
libtool,
|
libtool,
|
||||||
pkg-config,
|
pkgconf,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,9 @@ package musl-headers {
|
|||||||
];
|
];
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
skipCheck = true;
|
make = [ "DESTDIR=/work", "install-headers" ];
|
||||||
|
check = nil;
|
||||||
make = [
|
|
||||||
"DESTDIR=/work",
|
|
||||||
"install-headers",
|
|
||||||
];
|
|
||||||
|
|
||||||
install = "# headers installed during make";
|
install = "# headers installed during make";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,9 +48,8 @@ package musl {
|
|||||||
];
|
];
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
omitDefaults = true;
|
defaults = false;
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
|
|
||||||
postInstall = `
|
postInstall = `
|
||||||
mkdir -p /work/system/bin
|
mkdir -p /work/system/bin
|
||||||
COMPAT_LINKER_NAME="ld-musl-` + linuxArch + `.so.1"
|
COMPAT_LINKER_NAME="ld-musl-` + linuxArch + `.so.1"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package ncurses {
|
|||||||
|
|
||||||
version# = "6.6";
|
version# = "6.6";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/ncurses/ncurses-"+version+".tar.gz";
|
url = "https://mirrors.kernel.org/gnu/ncurses/ncurses-"+version+".tar.gz";
|
||||||
checksum = "XvWp4xi6hR_hH8XUoGY26L_pqBSDapJYulhzZqPuR0KNklqypqNc1yNXU-nOjf5w";
|
checksum = "XvWp4xi6hR_hH8XUoGY26L_pqBSDapJYulhzZqPuR0KNklqypqNc1yNXU-nOjf5w";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
@@ -19,7 +19,7 @@ package ncurses {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// "tests" are actual demo programs, not a test suite.
|
// "tests" are actual demo programs, not a test suite.
|
||||||
skipCheck = true;
|
check = nil;
|
||||||
|
|
||||||
postInstall = `
|
postInstall = `
|
||||||
find /work/system/lib \
|
find /work/system/lib \
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
From 7a8f42fb20013a1493d8cae1c43436f85e656f2d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zephkeks <zephyrofficialdiscord@gmail.com>
|
||||||
|
Date: Tue, 13 May 2025 11:04:17 +0200
|
||||||
|
Subject: [PATCH] CVE-2025-46836: interface.c: Stack-based Buffer Overflow in
|
||||||
|
get_name()
|
||||||
|
|
||||||
|
Coordinated as GHSA-pfwf-h6m3-63wf
|
||||||
|
---
|
||||||
|
lib/interface.c | 63 ++++++++++++++++++++++++++++++-------------------
|
||||||
|
1 file changed, 39 insertions(+), 24 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/interface.c b/lib/interface.c
|
||||||
|
index 71d4163..a054f12 100644
|
||||||
|
--- a/lib/interface.c
|
||||||
|
+++ b/lib/interface.c
|
||||||
|
@@ -211,32 +211,47 @@ static int if_readconf(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *get_name(char *name, const char *p)
|
||||||
|
+/* Safe version — guarantees at most IFNAMSIZ‑1 bytes are copied
|
||||||
|
+ and the destination buffer is always NUL‑terminated. */
|
||||||
|
{
|
||||||
|
- while (isspace(*p))
|
||||||
|
- p++;
|
||||||
|
- while (*p) {
|
||||||
|
- if (isspace(*p))
|
||||||
|
- break;
|
||||||
|
- if (*p == ':') { /* could be an alias */
|
||||||
|
- const char *dot = p++;
|
||||||
|
- while (*p && isdigit(*p)) p++;
|
||||||
|
- if (*p == ':') {
|
||||||
|
- /* Yes it is, backup and copy it. */
|
||||||
|
- p = dot;
|
||||||
|
- *name++ = *p++;
|
||||||
|
- while (*p && isdigit(*p)) {
|
||||||
|
- *name++ = *p++;
|
||||||
|
- }
|
||||||
|
- } else {
|
||||||
|
- /* No, it isn't */
|
||||||
|
- p = dot;
|
||||||
|
- }
|
||||||
|
- p++;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- *name++ = *p++;
|
||||||
|
+ char *dst = name; /* current write ptr */
|
||||||
|
+ const char *end = name + IFNAMSIZ - 1; /* last byte we may write */
|
||||||
|
+
|
||||||
|
+ /* Skip leading white‑space. */
|
||||||
|
+ while (isspace((unsigned char)*p))
|
||||||
|
+ ++p;
|
||||||
|
+
|
||||||
|
+ /* Copy until white‑space, end of string, or buffer full. */
|
||||||
|
+ while (*p && !isspace((unsigned char)*p) && dst < end) {
|
||||||
|
+ if (*p == ':') { /* possible alias veth0:123: */
|
||||||
|
+ const char *dot = p; /* remember the colon */
|
||||||
|
+ ++p;
|
||||||
|
+ while (*p && isdigit((unsigned char)*p))
|
||||||
|
+ ++p;
|
||||||
|
+
|
||||||
|
+ if (*p == ':') { /* confirmed alias */
|
||||||
|
+ p = dot; /* rewind and copy it all */
|
||||||
|
+
|
||||||
|
+ /* copy the colon */
|
||||||
|
+ if (dst < end)
|
||||||
|
+ *dst++ = *p++;
|
||||||
|
+
|
||||||
|
+ /* copy the digits */
|
||||||
|
+ while (*p && isdigit((unsigned char)*p) && dst < end)
|
||||||
|
+ *dst++ = *p++;
|
||||||
|
+
|
||||||
|
+ if (*p == ':') /* consume trailing colon */
|
||||||
|
+ ++p;
|
||||||
|
+ } else { /* if so treat as normal */
|
||||||
|
+ p = dot;
|
||||||
|
+ }
|
||||||
|
+ break; /* interface name ends here */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *dst++ = *p++; /* ordinary character copy */
|
||||||
|
}
|
||||||
|
- *name++ = '\0';
|
||||||
|
+
|
||||||
|
+ *dst = '\0'; /* always NUL‑terminate */
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
From ddb0e375fb9ca95bb69335540b85bbdaa2714348 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernd Eckenfels <net-tools@lina.inka.de>
|
||||||
|
Date: Sat, 17 May 2025 21:53:23 +0200
|
||||||
|
Subject: [PATCH] Interface statistic regression after 7a8f42fb2
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/interface.c | 5 ++---
|
||||||
|
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/interface.c b/lib/interface.c
|
||||||
|
index a054f12..ca4adf1 100644
|
||||||
|
--- a/lib/interface.c
|
||||||
|
+++ b/lib/interface.c
|
||||||
|
@@ -239,12 +239,11 @@ static const char *get_name(char *name, const char *p)
|
||||||
|
/* copy the digits */
|
||||||
|
while (*p && isdigit((unsigned char)*p) && dst < end)
|
||||||
|
*dst++ = *p++;
|
||||||
|
-
|
||||||
|
- if (*p == ':') /* consume trailing colon */
|
||||||
|
- ++p;
|
||||||
|
} else { /* if so treat as normal */
|
||||||
|
p = dot;
|
||||||
|
}
|
||||||
|
+ if (*p == ':') /* consume trailing colon */
|
||||||
|
+ ++p;
|
||||||
|
break; /* interface name ends here */
|
||||||
|
}
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user