build: add a new path variable.

This commit is contained in:
Alexandre Pujol 2023-04-25 23:26:04 +01:00
parent 0b7f355269
commit 8cfc6b4574
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 4 additions and 2 deletions

View file

@ -30,6 +30,7 @@ var (
Full bool Full bool
Complain bool Complain bool
Distribution string Distribution string
DistDir *paths.Path
Root *paths.Path Root *paths.Path
RootApparmord *paths.Path RootApparmord *paths.Path
@ -44,6 +45,7 @@ type prepareFunc func() error
type buildFunc func(string) string type buildFunc func(string) string
func init() { func init() {
DistDir = paths.New("dists")
Root = paths.New(".build") Root = paths.New(".build")
RootApparmord = Root.Join("apparmor.d") RootApparmord = Root.Join("apparmor.d")
Distribution, _ = util.GetSupportedDistribution() Distribution, _ = util.GetSupportedDistribution()

View file

@ -37,7 +37,7 @@ func Synchronise() error {
// Ignore profiles and files as defined in dists/ignore/ // Ignore profiles and files as defined in dists/ignore/
func Ignore() error { func Ignore() error {
for _, name := range []string{"main.ignore", Distribution + ".ignore"} { for _, name := range []string{"main.ignore", Distribution + ".ignore"} {
path := paths.New("dists/ignore/" + name) path := DistDir.Join("ignore", name)
if !path.Exist() { if !path.Exist() {
continue continue
} }
@ -186,7 +186,7 @@ func copyTo(src *paths.Path, dst *paths.Path) error {
// Set flags on some profiles according to manifest defined in `dists/flags/` // Set flags on some profiles according to manifest defined in `dists/flags/`
func SetFlags() error { func SetFlags() error {
for _, name := range []string{"main.flags", Distribution + ".flags"} { for _, name := range []string{"main.flags", Distribution + ".flags"} {
path := paths.New("dists/flags/" + name) path := DistDir.Join("flags", name)
if !path.Exist() { if !path.Exist() {
continue continue
} }