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

4
.gitignore vendored
View file

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

View file

@ -259,6 +259,22 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
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{
"--unshare-net",
"--bind", "/bin", "/bin",
@ -275,7 +291,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
"--tmpfs", "/run",
"--tmpfs", "/tmp",
"--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",
}
@ -299,7 +315,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
Prompt: false,
})
logger.LogFunc(Log{
Level: "INFO",
Level: "DEBUG",
Content: "Command: bwrap " + strings.Join(arguments, " "),
Prompt: false,
})
@ -329,7 +345,7 @@ func BuildEPK(projectDir string, inMemory bool, buildConfig Build, logger *Logge
})
if err != nil {
logger.LogFunc(Log{
Level: "INFO",
Level: "ERROR",
Content: "Error occurred while executing build.sh, returning error",
Prompt: false,
})

View file

@ -1,13 +1,29 @@
{
"metadata": {
"name": "example-package",
"version": "1.0.0"
},
"build": {
"type": "host",
"steps": [
"echo Building the package...",
"echo Done!"
]
"metadata": {
"author": "Arzumify",
"name": "mypkg",
"desc": "A wonderful package",
"longDesc": "A very wonderful package\nWith a very long\nDescription!",
"version": "1.0.2",
"license": "MIT",
"arch": "noarch",
"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"
}
}