def _update_yaml_with_extracted_metadata( config_data: Dict[str, Any], parts_config: project_loader.PartsConfig) -> None: if 'adopt-info' in config_data: part_name = config_data['adopt-info'] part = parts_config.get_part(part_name) if not part: raise meta_errors.AdoptedPartMissingError(part_name) # This would be caught since metadata would be missing, but we want # to be clear about the issue here. This really should be caught by the # schema, but it doesn't seem to support such dynamic behavior. if 'parse-info' not in config_data['parts'][part_name]: raise meta_errors.AdoptedPartNotParsingInfo(part_name) # Get the metadata from the pull step first, then update it using the # metadata from the build step (i.e. the data from the build step takes # precedence over the pull step) metadata = part.get_pull_state().extracted_metadata['metadata'] metadata.update(part.get_build_state().extracted_metadata['metadata']) _adopt_info(config_data, metadata) # Verify that all mandatory keys have been satisfied missing_keys = [] # type: List[str] for key in _MANDATORY_PACKAGE_KEYS: if key not in config_data: missing_keys.append(key) if missing_keys: raise meta_errors.MissingSnapcraftYamlKeysError(keys=missing_keys)
def _ensure_required_keywords(config_data): # Verify that all mandatory keys have been satisfied missing_keys = [] # type: List[str] for key in _MANDATORY_PACKAGE_KEYS: if key not in config_data: missing_keys.append(key) if missing_keys: raise meta_errors.MissingSnapcraftYamlKeysError(keys=missing_keys)