Skip to content
Snippets Groups Projects
Commit 0b23574f authored by Alberto Pianon's avatar Alberto Pianon
Browse files

add layer support

parent 5057c1d4
No related branches found
No related tags found
1 merge request!55add layer support
Pipeline #8878 failed with stages
in 8 seconds
......@@ -5,6 +5,7 @@ import json
import logging
import sys
import re
import os
from typing import Any, Dict, List, Optional, Union
from aliens4friends.commons.package import AlienPackage
......@@ -431,3 +432,12 @@ class Harvester:
source_package.tags = aggregate_tags(container.tags)
source_package.binary_packages = self._parse_tinfoilhat_packages(container.packages)
source_package.metadata = container.recipe.metadata
source_package.layer = (
os.path.basename(container.recipe.layer)
if container.recipe.layer
else None
)
if source_package.layer:
source_package.package_id += f"@{source_package.layer}"
# FIXME temporary quick&dirty solution to add layer info in the
# dashboard
......@@ -148,7 +148,8 @@ class SourcePackage(BaseModel):
source_files: Optional[List[SourceFile]] = None,
statistics: Optional[Statistics] = None,
binary_packages: Optional[List[BinaryPackage]] = None,
tags: Optional[ Dict[str, Union[List[str], Set[str]]] ] = None
tags: Optional[ Dict[str, Union[List[str], Set[str]]] ] = None,
layer: Optional[str] = None
):
self.id = id
self.name = name
......@@ -161,6 +162,7 @@ class SourcePackage(BaseModel):
self.source_files = SourceFile.drilldown(source_files)
self.binary_packages = BinaryPackage.drilldown(binary_packages)
self.tags = aggregate_tags(tags)
self.layer = layer
class HarvestModel(BaseModel):
......
......@@ -286,11 +286,13 @@ class Recipe(BaseModel):
metadata: Optional[RecipeMetaData] = None,
cve_metadata: Optional[RecipeCveMetaData] = None,
source_files: Optional[List[SourceFile]] = None,
layer: str: Optional[str] = None,
chk_sum: Optional[str] = None
) -> None:
self.metadata = RecipeMetaData.decode(metadata)
self.cve_metadata = RecipeCveMetaData.decode(cve_metadata)
self.source_files = SourceFile.drilldown(source_files)
self.layer = layer
self.chk_sum = chk_sum
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment