added test and reafctorred kernel.Build

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-09-28 11:45:14 +02:00
committed by Jonathon Anderson
parent 8d8812468a
commit 67e526d726
6 changed files with 130 additions and 44 deletions

31
internal/pkg/util/cpio.go Normal file
View File

@@ -0,0 +1,31 @@
package util
import (
"io"
"os"
"github.com/sassoftware/go-rpmutils/cpio"
)
/*
Opens cpio archive and returns the file list
*/
func CpioFiles(name string) (files []string, err error) {
f, err := os.Open(name)
if err != nil {
return files, err
}
defer f.Close()
reader := cpio.NewReader(f)
for {
header, err := reader.Next()
if err == io.EOF {
return files, nil
}
if err != nil {
return files, err
}
files = append(files, header.Filename())
}
}

View File

@@ -421,7 +421,7 @@ func SliceAddUniqueElement(array []string, add string) []string {
}
/*
Appends a string slice to another slice. Guarantess that the elements are uniq.
Appends a string slice to another slice. Guarantees that the elements are uniq.
*/
func SliceAppendUniq(array []string, add []string) []string {
ret := array