added test and reafctorred kernel.Build
Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
8d8812468a
commit
67e526d726
31
internal/pkg/util/cpio.go
Normal file
31
internal/pkg/util/cpio.go
Normal 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())
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user