diff options
Diffstat (limited to 'use-unzip-for-eopkg.patch')
-rw-r--r-- | use-unzip-for-eopkg.patch | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/use-unzip-for-eopkg.patch b/use-unzip-for-eopkg.patch new file mode 100644 index 000000000000..592c3504b760 --- /dev/null +++ b/use-unzip-for-eopkg.patch @@ -0,0 +1,89 @@ +From cfa7b0ad93b5c848ade2beb89ba1b60c597a9a8b Mon Sep 17 00:00:00 2001 +From: Ikey Doherty <ikey@solus-project.com> +Date: Wed, 22 Nov 2017 19:12:26 +0000 +Subject: [PATCH] explode/eopkg: Use a portable function to explode the eopkg + +This function is much like the RPM explosion helper, by using a simple +pipe to get directly to the contents of the package. Here we simply +pipe unzip to tar xf, explicitly passing the `install.tar.xz` payload +to tar. Internally an eopkg is simply a ZIP file with a tarball payload +and some XML data, so this is always going to work. + +Signed-off-by: Ikey Doherty <ikey@solus-project.com> +--- + src/explode/eopkg.go | 39 ++++++++++++++++++++++++++++++--------- + 1 file changed, 30 insertions(+), 9 deletions(-) + +diff --git a/src/explode/eopkg.go b/src/explode/eopkg.go +index cea004d..2ecdca5 100644 +--- a/src/explode/eopkg.go ++++ b/src/explode/eopkg.go +@@ -17,20 +17,21 @@ + package explode + + import ( ++ "io" + "io/ioutil" +- "os" + "os/exec" + "path/filepath" + "strings" + ) + +-// Eopkg will explode all .eopkg's specified and then return +-// the install/ path inside that exploded tree. ++// Eopkg will explode all eopkgs passed to it and return the path to ++// the "root" to walk. + func Eopkg(pkgs []string) (string, error) { + rootDir, err := ioutil.TempDir("", "abireport-eopkg") + if err != nil { + return "", err + } ++ + // Ensure cleanup happens + OutputDir = rootDir + +@@ -43,17 +44,37 @@ func Eopkg(pkgs []string) (string, error) { + if strings.HasSuffix(archive, ".delta.eopkg") { + continue + } +- eopkg := exec.Command("uneopkg", []string{ ++ ++ eopkg := exec.Command("unzip", []string{ ++ "-p", + fp, ++ "install.tar.xz", ++ }...) ++ tar := exec.Command("tar", []string{ ++ "-xJf", ++ "-", + }...) +- eopkg.Stdout = nil +- eopkg.Stderr = os.Stderr +- eopkg.Dir = rootDir ++ // Pipe eopkg into tar ++ r, w := io.Pipe() ++ defer r.Close() ++ eopkg.Stdout = w ++ tar.Stdin = r ++ tar.Stdout = nil ++ tar.Stderr = nil ++ tar.Dir = rootDir + +- if err = eopkg.Run(); err != nil { ++ eopkg.Start() ++ tar.Start() ++ go func() { ++ defer w.Close() ++ eopkg.Wait() ++ }() ++ if err := tar.Wait(); err != nil { ++ r.Close() + return "", err + } ++ r.Close() + } + +- return filepath.Join(rootDir, "install"), nil ++ return rootDir, nil + } |