Merge "Add system/sepolicy/apex to bp2build allowlist"

This commit is contained in:
Treehugger Robot
2021-09-15 08:10:14 +00:00
committed by Gerrit Code Review
2 changed files with 13 additions and 3 deletions

View File

@@ -175,6 +175,7 @@ var (
"system/core/property_service/libpropertyinfoparser": Bp2BuildDefaultTrueRecursively, "system/core/property_service/libpropertyinfoparser": Bp2BuildDefaultTrueRecursively,
"system/libbase": Bp2BuildDefaultTrueRecursively, "system/libbase": Bp2BuildDefaultTrueRecursively,
"system/logging/liblog": Bp2BuildDefaultTrueRecursively, "system/logging/liblog": Bp2BuildDefaultTrueRecursively,
"system/sepolicy/apex": Bp2BuildDefaultTrueRecursively,
"system/timezone/apex": Bp2BuildDefaultTrueRecursively, "system/timezone/apex": Bp2BuildDefaultTrueRecursively,
"system/timezone/output_data": Bp2BuildDefaultTrueRecursively, "system/timezone/output_data": Bp2BuildDefaultTrueRecursively,
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively, "external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,

View File

@@ -17,7 +17,6 @@ package apex
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort" "sort"
@@ -256,14 +255,24 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
// labeled as system_file. // labeled as system_file.
func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath { func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
var fileContexts android.Path var fileContexts android.Path
var fileContextsDir string
if a.properties.File_contexts == nil { if a.properties.File_contexts == nil {
fileContexts = android.PathForSource(ctx, "system/sepolicy/apex", ctx.ModuleName()+"-file_contexts") fileContexts = android.PathForSource(ctx, "system/sepolicy/apex", ctx.ModuleName()+"-file_contexts")
} else { } else {
if m, t := android.SrcIsModuleWithTag(*a.properties.File_contexts); m != "" {
otherModule := android.GetModuleFromPathDep(ctx, m, t)
fileContextsDir = ctx.OtherModuleDir(otherModule)
}
fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts) fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts)
} }
if fileContextsDir == "" {
fileContextsDir = filepath.Dir(fileContexts.String())
}
fileContextsDir += string(filepath.Separator)
if a.Platform() { if a.Platform() {
if matched, err := path.Match("system/sepolicy/**/*", fileContexts.String()); err != nil || !matched { if !strings.HasPrefix(fileContextsDir, "system/sepolicy/") {
ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but %q", fileContexts) ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but found in %q", fileContextsDir)
} }
} }
if !android.ExistentPathForSource(ctx, fileContexts.String()).Valid() { if !android.ExistentPathForSource(ctx, fileContexts.String()).Valid() {