Merge "Remove flatten_apex: property" am: 7f7e8d79a9 am: d947550b6f am: a7627cf627

Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2628996

Change-Id: I928001ab7426a6a247315293d0b6a86e176f8bf1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-06-21 06:29:40 +00:00 committed by Automerger Merge Worker
commit 8743379791
3 changed files with 6 additions and 52 deletions

View file

@ -23,11 +23,6 @@ package {
// TODO(b/236681553): Remove com.android.bluetooth-file_contexts // TODO(b/236681553): Remove com.android.bluetooth-file_contexts
filegroup {
name: "apex_file_contexts_files",
srcs: ["*-file_contexts"],
}
filegroup { filegroup {
name: "apex.test-file_contexts", name: "apex.test-file_contexts",
srcs: [ srcs: [

View file

@ -18,7 +18,6 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"strings"
"github.com/google/blueprint" "github.com/google/blueprint"
"github.com/google/blueprint/proptools" "github.com/google/blueprint/proptools"
@ -50,15 +49,6 @@ type selinuxContextsProperties struct {
Recovery_available *bool Recovery_available *bool
} }
type fileContextsProperties struct {
// flatten_apex can be used to specify additional sources of file_contexts.
// Apex paths, /system/apex/{apex_name}, will be amended to the paths of file_contexts
// entries.
Flatten_apex struct {
Srcs []string `android:"path"`
}
}
type seappProperties struct { type seappProperties struct {
// Files containing neverallow rules. // Files containing neverallow rules.
Neverallow_files []string `android:"path"` Neverallow_files []string `android:"path"`
@ -70,13 +60,12 @@ type seappProperties struct {
type selinuxContextsModule struct { type selinuxContextsModule struct {
android.ModuleBase android.ModuleBase
properties selinuxContextsProperties properties selinuxContextsProperties
fileContextsProperties fileContextsProperties seappProperties seappProperties
seappProperties seappProperties build func(ctx android.ModuleContext, inputs android.Paths) android.Path
build func(ctx android.ModuleContext, inputs android.Paths) android.Path deps func(ctx android.BottomUpMutatorContext)
deps func(ctx android.BottomUpMutatorContext) outputPath android.Path
outputPath android.Path installPath android.InstallPath
installPath android.InstallPath
} }
var ( var (
@ -164,7 +153,6 @@ func newModule() *selinuxContextsModule {
m := &selinuxContextsModule{} m := &selinuxContextsModule{}
m.AddProperties( m.AddProperties(
&m.properties, &m.properties,
&m.fileContextsProperties,
&m.seappProperties, &m.seappProperties,
) )
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
@ -304,26 +292,6 @@ func (m *selinuxContextsModule) buildFileContexts(ctx android.ModuleContext, inp
if m.properties.Fc_sort == nil { if m.properties.Fc_sort == nil {
m.properties.Fc_sort = proptools.BoolPtr(true) m.properties.Fc_sort = proptools.BoolPtr(true)
} }
rule := android.NewRuleBuilder(pctx, ctx)
if ctx.Config().FlattenApex() {
for _, path := range android.PathsForModuleSrc(ctx, m.fileContextsProperties.Flatten_apex.Srcs) {
out := pathForModuleOut(ctx, "flattened_apex", path.Rel())
apex_path := "/system/apex/" + strings.Replace(
strings.TrimSuffix(path.Base(), "-file_contexts"),
".", "\\\\.", -1)
rule.Command().
Text("awk '/object_r/{printf(\""+apex_path+"%s\\n\",$0)}'").
Input(path).
FlagWithOutput("> ", out)
inputs = append(inputs, out)
}
}
rule.Build(m.Name(), "flattened_apex_file_contexts")
return m.buildGeneralContexts(ctx, inputs) return m.buildGeneralContexts(ctx, inputs)
} }

View file

@ -79,10 +79,6 @@ file_contexts {
srcs: [":file_contexts_overlayfs_files{.plat_private}"], srcs: [":file_contexts_overlayfs_files{.plat_private}"],
}, },
}, },
flatten_apex: {
srcs: [":apex_file_contexts_files"],
},
} }
file_contexts { file_contexts {
@ -97,11 +93,6 @@ file_contexts {
srcs: [":file_contexts_overlayfs_files{.plat_private}"], srcs: [":file_contexts_overlayfs_files{.plat_private}"],
}, },
}, },
flatten_apex: {
srcs: [":apex_file_contexts_files"],
},
recovery: true, recovery: true,
} }