Add GatherPackagingSpecsWithFilter

android_system_image used GatherPackagingSpecs and then filter only
system modules. But some modules were omitted in this logic because
there are modules which has the same relative path, so the later one is
ignored even though its partition info is what we're looking for. So add
filter logic in GatherPackagingSpecs to avoid this problem

Bug: 323793487
Test: build android_system_image, and then check if it contains every
module we want

Change-Id: Iec8ae920736d3d1920eecad71ba0f8f2fe848e6c
This commit is contained in:
Jeongik Cha
2024-02-08 10:44:37 +09:00
parent c21f548fd4
commit 54bf875c97
3 changed files with 18 additions and 15 deletions

View File

@@ -37,7 +37,7 @@ func systemImageFactory() android.Module {
module := &systemImage{}
module.AddProperties(&module.properties)
module.filesystem.buildExtraFiles = module.buildExtraFiles
module.filesystem.filterPackagingSpecs = module.filterPackagingSpecs
module.filesystem.filterPackagingSpec = module.filterPackagingSpec
initFilesystemModule(&module.filesystem)
return module
}
@@ -73,10 +73,6 @@ func (s *systemImage) buildLinkerConfigFile(ctx android.ModuleContext, root andr
// Filter the result of GatherPackagingSpecs to discard items targeting outside "system" partition.
// Note that "apex" module installs its contents to "apex"(fake partition) as well
// for symbol lookup by imitating "activated" paths.
func (s *systemImage) filterPackagingSpecs(specs map[string]android.PackagingSpec) {
for k, ps := range specs {
if ps.Partition() != "system" {
delete(specs, k)
}
}
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
return ps.Partition() == "system"
}