From 804e234ced5c1ed1d312e8f87cb4d1f93e15c0f5 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 20 Jun 2023 15:38:50 +0900 Subject: [PATCH] Remove flatten_apex: property We no longer have targets using flattened apexes. Flattened apexes will be removed from the build system. Bug: 278826656 Test: m Change-Id: I657e01dbfd2525b07c29a234277062d5ac2fab9f --- apex/Android.bp | 5 ---- build/soong/selinux_contexts.go | 44 +++++---------------------------- contexts/Android.bp | 9 ------- 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/apex/Android.bp b/apex/Android.bp index 22de5d4dc..7203d9d76 100644 --- a/apex/Android.bp +++ b/apex/Android.bp @@ -23,11 +23,6 @@ package { // TODO(b/236681553): Remove com.android.bluetooth-file_contexts -filegroup { - name: "apex_file_contexts_files", - srcs: ["*-file_contexts"], -} - filegroup { name: "apex.test-file_contexts", srcs: [ diff --git a/build/soong/selinux_contexts.go b/build/soong/selinux_contexts.go index 587fe9192..2416dc91a 100644 --- a/build/soong/selinux_contexts.go +++ b/build/soong/selinux_contexts.go @@ -18,7 +18,6 @@ import ( "fmt" "io" "os" - "strings" "github.com/google/blueprint" "github.com/google/blueprint/proptools" @@ -50,15 +49,6 @@ type selinuxContextsProperties struct { 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 { // Files containing neverallow rules. Neverallow_files []string `android:"path"` @@ -70,13 +60,12 @@ type seappProperties struct { type selinuxContextsModule struct { android.ModuleBase - properties selinuxContextsProperties - fileContextsProperties fileContextsProperties - seappProperties seappProperties - build func(ctx android.ModuleContext, inputs android.Paths) android.Path - deps func(ctx android.BottomUpMutatorContext) - outputPath android.Path - installPath android.InstallPath + properties selinuxContextsProperties + seappProperties seappProperties + build func(ctx android.ModuleContext, inputs android.Paths) android.Path + deps func(ctx android.BottomUpMutatorContext) + outputPath android.Path + installPath android.InstallPath } var ( @@ -164,7 +153,6 @@ func newModule() *selinuxContextsModule { m := &selinuxContextsModule{} m.AddProperties( &m.properties, - &m.fileContextsProperties, &m.seappProperties, ) 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 { 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) } diff --git a/contexts/Android.bp b/contexts/Android.bp index d5cd8aef6..5982ae631 100644 --- a/contexts/Android.bp +++ b/contexts/Android.bp @@ -79,10 +79,6 @@ file_contexts { srcs: [":file_contexts_overlayfs_files{.plat_private}"], }, }, - - flatten_apex: { - srcs: [":apex_file_contexts_files"], - }, } file_contexts { @@ -97,11 +93,6 @@ file_contexts { srcs: [":file_contexts_overlayfs_files{.plat_private}"], }, }, - - flatten_apex: { - srcs: [":apex_file_contexts_files"], - }, - recovery: true, }