filelist/*: support comment lines starting with # (MR 41)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/filelist"
|
||||
)
|
||||
@@ -44,7 +45,7 @@ func (h *HookDirs) List() (*filelist.FileList, error) {
|
||||
s := bufio.NewScanner(f)
|
||||
for s.Scan() {
|
||||
dir := s.Text()
|
||||
if len(dir) == 0 {
|
||||
if len(dir) == 0 || strings.HasPrefix(dir, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ func slurpFiles(fd io.Reader) (*filelist.FileList, error) {
|
||||
s := bufio.NewScanner(fd)
|
||||
for s.Scan() {
|
||||
line := s.Text()
|
||||
if len(line) == 0 {
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@@ -95,10 +95,9 @@ func slurpModules(fd io.Reader, modDir string) (*filelist.FileList, error) {
|
||||
s := bufio.NewScanner(fd)
|
||||
for s.Scan() {
|
||||
line := s.Text()
|
||||
if len(line) == 0 {
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
dir, file := filepath.Split(line)
|
||||
if file == "" {
|
||||
// item is a directory
|
||||
@@ -199,7 +198,7 @@ func getModuleDeps(modName string, modulesDep io.Reader) ([]string, error) {
|
||||
s := bufio.NewScanner(modulesDep)
|
||||
for s.Scan() {
|
||||
line := s.Text()
|
||||
if len(line) == 0 {
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user