Merge changes from topic "fdo_profile"

* changes:
  Reimplement afdo support for rust
  Implement fdo_profile module type
This commit is contained in:
Treehugger Robot
2023-04-03 22:35:25 +00:00
committed by Gerrit Code Review
11 changed files with 459 additions and 157 deletions

View File

@@ -1418,6 +1418,21 @@ func (c *deviceConfig) PgoAdditionalProfileDirs() []string {
return c.config.productVariables.PgoAdditionalProfileDirs
}
// AfdoProfile returns fully qualified path associated to the given module name
func (c *deviceConfig) AfdoProfile(name string) (*string, error) {
for _, afdoProfile := range c.config.productVariables.AfdoProfiles {
split := strings.Split(afdoProfile, ":")
if len(split) != 3 {
return nil, fmt.Errorf("AFDO_PROFILES has invalid value: %s. "+
"The expected format is <module>:<fully-qualified-path-to-fdo_profile>", afdoProfile)
}
if split[0] == name {
return proptools.StringPtr(strings.Join([]string{split[1], split[2]}, ":")), nil
}
}
return nil, nil
}
func (c *deviceConfig) VendorSepolicyDirs() []string {
return c.config.productVariables.BoardVendorSepolicyDirs
}