From 6511663dc451c2ab3c9a268b3e3cf3cc979c25de Mon Sep 17 00:00:00 2001 From: ofluffydev Date: Mon, 28 Oct 2024 08:17:08 -0500 Subject: [PATCH] more logging and better errors related to bwrap --- .gitignore | 4 +++- lib/main.go | 22 +++++++++++++++++++--- test-package/eternity.json | 38 +++++++++++++++++++++++++++----------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 9ec3459..f2ff16a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea -/bin \ No newline at end of file +.vscode +/bin +*.epk \ No newline at end of file diff --git a/lib/main.go b/lib/main.go index de8cc47..690b770 100644 --- a/lib/main.go +++ b/lib/main.go @@ -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, }) diff --git a/test-package/eternity.json b/test-package/eternity.json index b333682..44d70cd 100644 --- a/test-package/eternity.json +++ b/test-package/eternity.json @@ -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"] } - } \ No newline at end of file + }, + "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" + } +}