more logging and better errors related to bwrap

This commit is contained in:
Kaden Frisk 2024-10-28 08:17:08 -05:00
parent 586135170c
commit 6511663dc4
3 changed files with 49 additions and 15 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
.idea .idea
.vscode
/bin /bin
*.epk

View file

@ -259,6 +259,22 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
return 0, tempDir, err, ErrBubbleWrapInsufficientPermissions return 0, tempDir, err, ErrBubbleWrapInsufficientPermissions
} }
logger.LogFunc(Log{
Level: "DEBUG",
Content: "Temp directory: " + tempDir,
Prompt: false,
})
logger.LogFunc(Log{
Level: "DEBUG",
Content: "Target root: " + targetRoot,
Prompt: false,
})
logger.LogFunc(Log{
Level: "DEBUG",
Content: "Joined path: " + filepath.Join("/", buildConfig.TargetRoot),
Prompt: false,
})
arguments := []string{ arguments := []string{
"--unshare-net", "--unshare-net",
"--bind", "/bin", "/bin", "--bind", "/bin", "/bin",
@ -275,7 +291,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
"--tmpfs", "/run", "--tmpfs", "/run",
"--tmpfs", "/tmp", "--tmpfs", "/tmp",
"--proc", "/proc", "--proc", "/proc",
"/usr/bin/fakeroot", "--", // fakeroot-tcp still installs as "fakeroot" for some reason TODO: handle wrong fakeroot installation "/usr/bin/fakeroot-tcp", "--", // fakeroot-tcp still installs as "fakeroot" for some reason TODO: handle wrong fakeroot installation
"/bin/sh", "/eternity/build.sh", "/bin/sh", "/eternity/build.sh",
} }
@ -299,7 +315,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
Prompt: false, Prompt: false,
}) })
logger.LogFunc(Log{ logger.LogFunc(Log{
Level: "INFO", Level: "DEBUG",
Content: "Command: bwrap " + strings.Join(arguments, " "), Content: "Command: bwrap " + strings.Join(arguments, " "),
Prompt: false, Prompt: false,
}) })
@ -329,7 +345,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
}) })
if err != nil { if err != nil {
logger.LogFunc(Log{ logger.LogFunc(Log{
Level: "INFO", Level: "ERROR",
Content: "Error occurred while executing build.sh, returning error", Content: "Error occurred while executing build.sh, returning error",
Prompt: false, Prompt: false,
}) })

View file

@ -1,13 +1,29 @@
{ {
"metadata": { "metadata": {
"name": "example-package", "author": "Arzumify",
"version": "1.0.0" "name": "mypkg",
}, "desc": "A wonderful package",
"build": { "longDesc": "A very wonderful package\nWith a very long\nDescription!",
"type": "host", "version": "1.0.2",
"steps": [ "license": "MIT",
"echo Building the package...", "arch": "noarch",
"echo Done!" "deps": [],
] "specialFiles": {
"noDelete": ["/etc/config.conf"],
"noReplace": ["/var/hi/cache.thing"]
} }
},
"build": {
"type": "host",
"deps": [],
"steps": [
"mkdir -p build/t/etc/",
"mkdir -p build/t/var/hi/",
"touch build/t/etc/config.conf",
"touch build/t/var/hi/cache.thing"
],
"root": "build",
"hooks": "install-scripts",
"files": "resources"
} }
}