| from steps import step |
| import sh |
| import inspect |
| |
| class MetadataSetup(step.Step): |
| def append_sources_mirror_urls(self): |
| """Appends the source mirror urls to the local conf file in machine build folder""" |
| command = inspect.cleandoc( |
| f""" |
| cat << EOT >> build/{self.firmware_machine}/conf/local.conf |
| INHERIT += "own-mirrors" |
| CONNECTIVITY_CHECK_URIS = "" |
| BB_NO_NETWORK = "0" |
| # Allow fetching external mirrors |
| BB_ALLOWED_NETWORKS = "" |
| BB_GENERATE_MIRROR_TARBALLS = "1" |
| SOURCE_MIRROR_URL = "file://{self.build_script_dir}/{self.main_repo_name}/build/sources" |
| BB_NUMBER_THREADS = "16" |
| EOT |
| """) |
| sh.sh("-c", command) |
| |
| def omit_crashdump(self): |
| """Omits crashdump in vendor metadata recipes-phosphor""" |
| command = inspect.cleandoc( |
| f""" |
| # Omit crashdump and at-scale-debug. |
| # They are tested in the gBMC version of presubmit. |
| cat << EOT >> {self.metadata_obmc_repo}/{self.metadata_repo}/recipes-phosphor/images/obmc-phosphor-image.bbappend |
| OBMC_IMAGE_EXTRA_INSTALL:remove:{self.firmware_machine} = " at-scale-debug" |
| OBMC_IMAGE_EXTRA_INSTALL:remove:{self.firmware_machine} = " crashdump" |
| EOT |
| """) |
| sh.sh("-c", command) |
| |
| def replace_downstream_url(self): |
| """Replaces downstream urls (.git, .corp, .google) to .googlesource in all meta repos. |
| Downstream urls cannot be used to authenticate in GCB, must use .googlesource |
| to be able to fetch the url. Also replaces the protocol from sso to https, as |
| GCB doesn't recorgnize sso as a valid protocol. |
| """ |
| command = "find meta* -type f -exec sed -i \ |
| 's/\.git\.corp\.google/\.googlesource/;\s/protocol=sso/protocol=https/' {} \;" |
| sh.sh("-c", command) |
| |
| def run_script(self): |
| self.append_sources_mirror_urls() |
| self.omit_crashdump() |
| self.replace_downstream_url() |