diff options
author | 2024-11-13 04:47:01 +0000 | |
---|---|---|
committer | 2024-11-13 04:47:01 +0000 | |
commit | 8ac00ca75bfbccee0862035226c8ac26b47d264f (patch) | |
tree | 5b3230f2695130d4228b561274b942bbdb7b61d0 /filesystem/filesystem.go | |
parent | 300c022d9261feb49ccbb91bd1aae01313d6b958 (diff) | |
parent | ad04bb892ed69bb3a8bb49dce74da4fa28ded292 (diff) |
Merge "Make ModifyPackagingSpec generic to any filesystem" into main am: ad04bb892e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3345423
Change-Id: Ie03263190c3ea1380fc69c9fc96d132d7386188d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 15 |
1 files changed, 13 insertions, 2 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") |