mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 14:31:22 +00:00
refactor(artifacts): share inspection root metadata lookup (#16758)
This commit is contained in:
1 parent
6d3b582215
commit
5e2489e128
1 file changed
+7
-9
@@ -413,6 +413,10 @@ const uniqueOperations = (
|
||||
index,
|
||||
);
|
||||
|
||||
const rootFormatMetadata = (inventory: ArtifactInventoryResult) =>
|
||||
inventory.occurrences.find(({ logical_path }) => logical_path === ".")
|
||||
?.format_metadata;
|
||||
|
||||
const formatProbes = (
|
||||
inventory: ArtifactInventoryResult,
|
||||
rootImage: ArtifactInspectionRootImage | undefined,
|
||||
@@ -479,9 +483,7 @@ const formatProbes = (
|
||||
},
|
||||
];
|
||||
if (format === "mcuboot") {
|
||||
const rootMeta = inventory.occurrences.find(
|
||||
(row) => row.logical_path === ".",
|
||||
)?.format_metadata;
|
||||
const rootMeta = rootFormatMetadata(inventory);
|
||||
const uncompressed = rootMeta?.kind === "mcuboot" && !rootMeta.compressed;
|
||||
return uncompressed &&
|
||||
inventory.occurrences.some(
|
||||
@@ -514,9 +516,7 @@ const formatProbes = (
|
||||
const bfltProbes = (
|
||||
inventory: ArtifactInventoryResult,
|
||||
): ArtifactInspectionResult["next_probes"] => {
|
||||
const root = inventory.occurrences.find(
|
||||
({ logical_path }) => logical_path === ".",
|
||||
)?.format_metadata;
|
||||
const root = rootFormatMetadata(inventory);
|
||||
const text = inventory.occurrences.some(
|
||||
(row) =>
|
||||
row.format_metadata?.kind === "bflt-segment" &&
|
||||
@@ -557,9 +557,7 @@ const zipPackageProbes = (
|
||||
const espFlashDumpProbes = (
|
||||
inventory: ArtifactInventoryResult,
|
||||
): ArtifactInspectionResult["next_probes"] => {
|
||||
const root = inventory.occurrences.find(
|
||||
({ logical_path }) => logical_path === ".",
|
||||
)?.format_metadata;
|
||||
const root = rootFormatMetadata(inventory);
|
||||
if (root?.kind !== "esp-image") return [];
|
||||
const dump = root.flash_dump;
|
||||
if (dump === null) return [];
|
||||
|
||||
Reference in new issue
Block a user