directives.go 436 Bytes
Newer Older
Mustafa Gezen's avatar
Mustafa Gezen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package directives

import (
	"github.com/go-git/go-git/v5"
	srpmprocpb "github.com/mstg/srpmproc/pb"
	"path/filepath"
	"strings"
)

func checkAddPrefix(file string) string {
	if strings.HasPrefix(file, "SOURCES/") ||
		strings.HasPrefix(file, "SPECS/") {
		return file
	}

	return filepath.Join("SOURCES", file)
}

func Apply(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) {
	replace(cfg, patchTree, pushTree)
}