diff options
author | 2024-11-12 13:24:05 -0800 | |
---|---|---|
committer | 2024-11-12 13:30:14 -0800 | |
commit | c88cff15e034771ecd507c6729db16cd7d1d26b2 (patch) | |
tree | 78efa5451a8531ac13bd62dc0311ad64b1cc84ee | |
parent | 94010d3b14314f748ffb377788f27923baa2adc7 (diff) |
Make ModifyPackagingSpec generic to any filesystem
ModifyPackagingSpec was added to support installing product-partition
modules on the system partition for GSI, but ramdisk also has a very
similar issue, where it's modules are installed to the "ramdisk/system"
partition.
Make ModifyPackagingSpec generic so that it works on the ramdisk files.
This reduces the ramdisk file diff down to just a missing build.prop
file.
Bug: 378146476
Test: m soong_generated_ramdisk_filesystem_test on aosp_cf_x86_64_phone
Change-Id: I1d197679a1128400b6bb837d99e3aabe2ab3c68e
-rw-r--r-- | filesystem/filesystem.go | 15 | ||||
-rw-r--r-- | filesystem/system_image.go | 9 |
2 files changed, 13 insertions, 11 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 29e5ec378..fa6645187 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -301,13 +301,24 @@ func (f *filesystem) FilterPackagingSpec(ps android.PackagingSpec) bool { } if proptools.Bool(f.properties.Is_auto_generated) { // TODO (spandandas): Remove this. pt := f.PartitionType() - return pt == "ramdisk" || ps.Partition() == pt + return ps.Partition() == pt || strings.HasPrefix(ps.Partition(), pt+"/") } return true } func (f *filesystem) ModifyPackagingSpec(ps *android.PackagingSpec) { - // do nothing by default + // Sometimes, android.modulePartition() returns a path with >1 path components. + // This makes the partition field of packagingSpecs have multiple components, like + // "system/product". Right now, the filesystem module doesn't look at the partition field + // when deciding what path to install the file under, only the RelPathInPackage field, so + // we move the later path components from partition to relPathInPackage. This should probably + // be revisited in the future. + prefix := f.PartitionType() + "/" + if strings.HasPrefix(ps.Partition(), prefix) { + subPartition := strings.TrimPrefix(ps.Partition(), prefix) + ps.SetPartition(f.PartitionType()) + ps.SetRelPathInPackage(filepath.Join(subPartition, ps.RelPathInPackage())) + } } var pctx = android.NewPackageContext("android/soong/filesystem") diff --git a/filesystem/system_image.go b/filesystem/system_image.go index 4d176ae45..d03eab45b 100644 --- a/filesystem/system_image.go +++ b/filesystem/system_image.go @@ -18,7 +18,6 @@ import ( "android/soong/android" "android/soong/linkerconfig" - "path/filepath" "strings" "github.com/google/blueprint/proptools" @@ -64,11 +63,3 @@ func (s *systemImage) FilterPackagingSpec(ps android.PackagingSpec) bool { (ps.Partition() == "system" || ps.Partition() == "root" || strings.HasPrefix(ps.Partition(), "system/")) } - -func (s *systemImage) ModifyPackagingSpec(ps *android.PackagingSpec) { - if strings.HasPrefix(ps.Partition(), "system/") { - subPartition := strings.TrimPrefix(ps.Partition(), "system/") - ps.SetPartition("system") - ps.SetRelPathInPackage(filepath.Join(subPartition, ps.RelPathInPackage())) - } -} |