build: reorganise build: abi4, fallback, prebuild cli

- ABI4 by default, fallback to abi 3.
- aa-prebuild cli that can be used by other project shipping profiles.
- --file option to cli to only build one dev profile.
- add abi version filter to only & exclude directives.
This commit is contained in:
Alexandre Pujol 2024-10-02 16:22:46 +01:00
parent d6b7bef89e
commit 59ac54e2fc
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
39 changed files with 473 additions and 440 deletions

View file

@ -6,16 +6,16 @@ package prepare
import (
"github.com/roddhjav/apparmor.d/pkg/paths"
"github.com/roddhjav/apparmor.d/pkg/prebuild/cfg"
"github.com/roddhjav/apparmor.d/pkg/prebuild"
)
type Ignore struct {
cfg.Base
prebuild.Base
}
func init() {
RegisterTask(&Ignore{
Base: cfg.Base{
Base: prebuild.Base{
Keyword: "ignore",
Msg: "Ignore profiles and files from:",
},
@ -24,11 +24,11 @@ func init() {
func (p Ignore) Apply() ([]string, error) {
res := []string{}
for _, name := range []string{"main", cfg.Distribution} {
for _, ignore := range cfg.Ignore.Read(name) {
profile := cfg.Root.Join(ignore)
for _, name := range []string{"main", prebuild.Distribution} {
for _, ignore := range prebuild.Ignore.Read(name) {
profile := prebuild.Root.Join(ignore)
if profile.NotExist() {
files, err := cfg.RootApparmord.ReadDirRecursiveFiltered(nil, paths.FilterNames(ignore))
files, err := prebuild.RootApparmord.ReadDirRecursiveFiltered(nil, paths.FilterNames(ignore))
if err != nil {
return res, err
}
@ -43,7 +43,7 @@ func (p Ignore) Apply() ([]string, error) {
}
}
}
res = append(res, cfg.IgnoreDir.Join(name+".ignore").String())
res = append(res, prebuild.IgnoreDir.Join(name+".ignore").String())
}
return res, nil
}