1
0

refactor: move fs-related functions to submodule

This commit is contained in:
2023-05-13 09:17:57 +00:00
parent 9b987bcc82
commit da5797766b
8 changed files with 63 additions and 47 deletions

10
pew.go
View File

@ -24,6 +24,7 @@ import (
"gopkg.in/logrusorgru/aurora.v2"
"code.dumpstack.io/tools/out-of-tree/config"
"code.dumpstack.io/tools/out-of-tree/fs"
"code.dumpstack.io/tools/out-of-tree/qemu"
)
@ -691,7 +692,7 @@ func (cmd PewCmd) testArtifact(swg *sizedwaitgroup.SizedWaitGroup,
if cmd.Test == "" {
cmd.Test = result.BuildArtifact + "_test"
if !exists(cmd.Test) {
if !fs.PathExists(cmd.Test) {
slog.Debug().Msgf("%s does not exist", cmd.Test)
cmd.Test = tmp + "/source/" + "test.sh"
} else {
@ -824,13 +825,6 @@ func (cmd PewCmd) performCI(ka config.Artifact) (err error) {
return
}
func exists(path string) bool {
if _, err := os.Stat(path); err != nil {
return false
}
return true
}
func kernelMask(kernel string) (km config.KernelMask, err error) {
parts := strings.Split(kernel, ":")
if len(parts) != 2 {