Revert "Split property and file contexts modules"
Revert "Convert security/Android.mk to Android.bp" Revert "Add seapp_contexts to allowlist of makefile goal" Revert submission 1795972-Convert security/Android.mk to Android.bp Reason for revert: http://b/206976319 Broken build 7928060 on aosp-master on sdk_arm64-sdk Reverted Changes: I0e0e7f677:Split property and file contexts modules I5596d6f00:Add seapp_contexts to allowlist of makefile goal If685e5ccc:Convert security/Android.mk to Android.bp Change-Id: Ibbca0a17886d15b3fd7ecaf974a06df7107fd9aa
This commit is contained in:
parent
1b965988b7
commit
bec08097c9
2 changed files with 17 additions and 75 deletions
42
Android.bp
42
Android.bp
|
@ -494,26 +494,8 @@ file_contexts {
|
|||
flatten_apex: {
|
||||
srcs: ["apex/*-file_contexts"],
|
||||
},
|
||||
}
|
||||
|
||||
file_contexts {
|
||||
name: "plat_file_contexts.recovery",
|
||||
srcs: [":file_contexts_files"],
|
||||
stem: "plat_file_contexts",
|
||||
product_variables: {
|
||||
address_sanitize: {
|
||||
srcs: [":file_contexts_asan_files"],
|
||||
},
|
||||
debuggable: {
|
||||
srcs: [":file_contexts_overlayfs_files"],
|
||||
},
|
||||
},
|
||||
|
||||
flatten_apex: {
|
||||
srcs: ["apex/*-file_contexts"],
|
||||
},
|
||||
|
||||
recovery: true,
|
||||
recovery_available: true,
|
||||
}
|
||||
|
||||
file_contexts {
|
||||
|
@ -577,13 +559,7 @@ hwservice_contexts {
|
|||
property_contexts {
|
||||
name: "plat_property_contexts",
|
||||
srcs: [":property_contexts_files"],
|
||||
}
|
||||
|
||||
property_contexts {
|
||||
name: "plat_property_contexts.recovery",
|
||||
srcs: [":property_contexts_files"],
|
||||
stem: "plat_property_contexts",
|
||||
recovery: true,
|
||||
recovery_available: true,
|
||||
}
|
||||
|
||||
property_contexts {
|
||||
|
@ -1188,17 +1164,3 @@ se_policy_cil {
|
|||
se_freeze_test {
|
||||
name: "sepolicy_freeze_test",
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// Makefile rules temporary imported to Soong
|
||||
// TODO(b/33691272): remove these after migrating seapp to Soong
|
||||
//////////////////////////////////
|
||||
makefile_goal {
|
||||
name: "plat_seapp_contexts_rule",
|
||||
product_out_path: "obj/ETC/plat_seapp_contexts_intermediates/plat_seapp_contexts",
|
||||
}
|
||||
|
||||
makefile_goal {
|
||||
name: "plat_seapp_neverallows_rule",
|
||||
product_out_path: "obj/ETC/plat_seapp_neverallows_intermediates/plat_seapp_neverallows",
|
||||
}
|
||||
|
|
|
@ -30,9 +30,6 @@ type selinuxContextsProperties struct {
|
|||
// Filenames under sepolicy directories, which will be used to generate contexts file.
|
||||
Srcs []string `android:"path"`
|
||||
|
||||
// Output file name. Defaults to module name
|
||||
Stem *string
|
||||
|
||||
Product_variables struct {
|
||||
Debuggable struct {
|
||||
Srcs []string
|
||||
|
@ -123,10 +120,6 @@ func (m *selinuxContextsModule) propertyContextsDeps(ctx android.BottomUpMutator
|
|||
}
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) stem() string {
|
||||
return proptools.StringDefault(m.properties.Stem, m.Name())
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
if m.InRecovery() {
|
||||
// Installing context files at the root of the recovery partition
|
||||
|
@ -140,7 +133,7 @@ func (m *selinuxContextsModule) GenerateAndroidBuildActions(ctx android.ModuleCo
|
|||
|
||||
if reuseDeps, ok := dep.(*selinuxContextsModule); ok {
|
||||
m.outputPath = reuseDeps.outputPath
|
||||
ctx.InstallFile(m.installPath, m.stem(), m.outputPath)
|
||||
ctx.InstallFile(m.installPath, m.Name(), m.outputPath)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +185,7 @@ func (m *selinuxContextsModule) GenerateAndroidBuildActions(ctx android.ModuleCo
|
|||
}
|
||||
|
||||
m.outputPath = m.build(ctx, inputs)
|
||||
ctx.InstallFile(m.installPath, m.stem(), m.outputPath)
|
||||
ctx.InstallFile(m.installPath, ctx.ModuleName(), m.outputPath)
|
||||
}
|
||||
|
||||
func newModule() *selinuxContextsModule {
|
||||
|
@ -237,21 +230,21 @@ func (m *selinuxContextsModule) AndroidMk() android.AndroidMkData {
|
|||
Extra: []android.AndroidMkExtraFunc{
|
||||
func(w io.Writer, outputFile android.Path) {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", m.installPath.ToMakePath().String())
|
||||
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", m.stem())
|
||||
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", m.Name())
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) ImageMutatorBegin(ctx android.BaseModuleContext) {
|
||||
if proptools.Bool(m.properties.Recovery_available) && m.ModuleBase.InstallInRecovery() {
|
||||
if proptools.Bool(m.properties.Recovery_available) && m.InstallInRecovery() {
|
||||
ctx.PropertyErrorf("recovery_available",
|
||||
"doesn't make sense at the same time as `recovery: true`")
|
||||
}
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return !m.ModuleBase.InstallInRecovery()
|
||||
return !m.InstallInRecovery()
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
|
@ -267,7 +260,7 @@ func (m *selinuxContextsModule) DebugRamdiskVariantNeeded(ctx android.BaseModule
|
|||
}
|
||||
|
||||
func (m *selinuxContextsModule) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return m.ModuleBase.InstallInRecovery() || proptools.Bool(m.properties.Recovery_available)
|
||||
return m.InstallInRecovery() || proptools.Bool(m.properties.Recovery_available)
|
||||
}
|
||||
|
||||
func (m *selinuxContextsModule) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||
|
@ -280,7 +273,7 @@ func (m *selinuxContextsModule) SetImageVariation(ctx android.BaseModuleContext,
|
|||
var _ android.ImageInterface = (*selinuxContextsModule)(nil)
|
||||
|
||||
func (m *selinuxContextsModule) buildGeneralContexts(ctx android.ModuleContext, inputs android.Paths) android.Path {
|
||||
builtContext := android.PathForModuleGen(ctx, ctx.ModuleName()+"_m4out")
|
||||
ret := android.PathForModuleGen(ctx, ctx.ModuleName()+"_m4out")
|
||||
|
||||
rule := android.NewRuleBuilder(pctx, ctx)
|
||||
|
||||
|
@ -289,40 +282,37 @@ func (m *selinuxContextsModule) buildGeneralContexts(ctx android.ModuleContext,
|
|||
Text("--fatal-warnings -s").
|
||||
FlagForEachArg("-D", ctx.DeviceConfig().SepolicyM4Defs()).
|
||||
Inputs(inputs).
|
||||
FlagWithOutput("> ", builtContext)
|
||||
FlagWithOutput("> ", ret)
|
||||
|
||||
if proptools.Bool(m.properties.Remove_comment) {
|
||||
rule.Temporary(builtContext)
|
||||
rule.Temporary(ret)
|
||||
|
||||
remove_comment_output := android.PathForModuleGen(ctx, ctx.ModuleName()+"_remove_comment")
|
||||
|
||||
rule.Command().
|
||||
Text("sed -e 's/#.*$//' -e '/^$/d'").
|
||||
Input(builtContext).
|
||||
Input(ret).
|
||||
FlagWithOutput("> ", remove_comment_output)
|
||||
|
||||
builtContext = remove_comment_output
|
||||
ret = remove_comment_output
|
||||
}
|
||||
|
||||
if proptools.Bool(m.properties.Fc_sort) {
|
||||
rule.Temporary(builtContext)
|
||||
rule.Temporary(ret)
|
||||
|
||||
sorted_output := android.PathForModuleGen(ctx, ctx.ModuleName()+"_sorted")
|
||||
|
||||
rule.Command().
|
||||
Tool(ctx.Config().HostToolPath(ctx, "fc_sort")).
|
||||
FlagWithInput("-i ", builtContext).
|
||||
FlagWithInput("-i ", ret).
|
||||
FlagWithOutput("-o ", sorted_output)
|
||||
|
||||
builtContext = sorted_output
|
||||
ret = sorted_output
|
||||
}
|
||||
|
||||
ret := android.PathForModuleGen(ctx, m.stem())
|
||||
rule.Temporary(builtContext)
|
||||
rule.Command().Text("cp").Input(builtContext).Output(ret)
|
||||
rule.Build("selinux_contexts", "building contexts: "+m.Name())
|
||||
|
||||
rule.DeleteTemporaryFiles()
|
||||
rule.Build("selinux_contexts", "building contexts: "+m.Name())
|
||||
|
||||
return ret
|
||||
}
|
||||
|
@ -510,13 +500,3 @@ func keystoreKeyFactory() android.Module {
|
|||
m.build = m.buildGeneralContexts
|
||||
return m
|
||||
}
|
||||
|
||||
var _ android.OutputFileProducer = (*selinuxContextsModule)(nil)
|
||||
|
||||
// Implements android.OutputFileProducer
|
||||
func (m *selinuxContextsModule) OutputFiles(tag string) (android.Paths, error) {
|
||||
if tag == "" {
|
||||
return []android.Path{m.outputPath}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue