Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6ac822b authored by Jooyung Han's avatar Jooyung Han
Browse files

apex: pass partition_tag to host_apex_verifier

host_apex_verifier can check partition-specific checks. For example,
.rc files in APEX don't support 'on' if the APEX is from /system.
To support this, pass the partition tag to host_apex_verifier.

Bug: 223896570
Test: m
Test: host_apex_verifier --apex=<path> --partition_tag=system
   # fails when the apex has .rc file with 'on' section.
Change-Id: I62141aad5823cedb114434fd19bed5d31f6c3bbc
parent 8017cca9
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -253,10 +253,10 @@ var (

	apexHostVerifierRule = pctx.StaticRule("apexHostVerifierRule", blueprint.RuleParams{
		Command: `${host_apex_verifier} --deapexer=${deapexer} --debugfs=${debugfs_static} ` +
			`--fsckerofs=${fsck_erofs} --apex=${in} && touch ${out}`,
			`--fsckerofs=${fsck_erofs} --apex=${in} --partition_tag=${partition_tag} && touch ${out}`,
		CommandDeps: []string{"${host_apex_verifier}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}"},
		Description: "run host_apex_verifier",
	})
	}, "partition_tag")

	assembleVintfRule = pctx.StaticRule("assembleVintfRule", blueprint.RuleParams{
		Command:     `rm -f $out && VINTF_IGNORE_TARGET_FCM_VERSION=true ${assemble_vintf} -i $in -o $out`,
@@ -976,7 +976,7 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
			runApexElfCheckerUnwanted(ctx, unsignedOutputFile.OutputPath, a.properties.Unwanted_transitive_deps))
	}
	if !a.testApex && android.InList(a.payloadFsType, []fsType{ext4, erofs}) {
		validations = append(validations, runApexHostVerifier(ctx, unsignedOutputFile.OutputPath))
		validations = append(validations, runApexHostVerifier(ctx, a, unsignedOutputFile.OutputPath))
	}
	ctx.Build(pctx, android.BuildParams{
		Rule:        rule,
@@ -1287,12 +1287,15 @@ func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.Outpu
	return timestamp
}

func runApexHostVerifier(ctx android.ModuleContext, apexFile android.OutputPath) android.Path {
func runApexHostVerifier(ctx android.ModuleContext, a *apexBundle, apexFile android.OutputPath) android.Path {
	timestamp := android.PathForModuleOut(ctx, "host_apex_verifier.timestamp")
	ctx.Build(pctx, android.BuildParams{
		Rule:   apexHostVerifierRule,
		Input:  apexFile,
		Output: timestamp,
		Args: map[string]string{
			"partition_tag": a.PartitionTag(ctx.DeviceConfig()),
		},
	})
	return timestamp
}