sources: introduce source items
All sources fetch various types of `items`, the specific nature of which is dependent on the source type, but they are all identifyable by a opaque identifier. In order for osbuild to check that all the inputs that a stage needs are are indeed contained in the manifest description, osbuild must learn what ids are fetched by what source. This is done by standarzing the common "items" part, i.e. the "id" -> "options for that id" mapping that is common to all sources. For the version 1 of the format, extract the files and ostree the item information from the respective options. Adapt the sources (files, ostree) so that they use the new items information, but also fall back to the old style; the latter is needed since the sources tests still uses the SourceServer.
This commit is contained in:
parent
3b7141417c
commit
931eac23c3
5 changed files with 35 additions and 11 deletions
|
|
@ -13,14 +13,16 @@ class Source:
|
|||
"""
|
||||
A single source with is corresponding options.
|
||||
"""
|
||||
def __init__(self, info, options) -> None:
|
||||
def __init__(self, info, items, options) -> None:
|
||||
self.info = info
|
||||
self.items = items or {}
|
||||
self.options = options
|
||||
|
||||
def download(self, store: ObjectStore, libdir: PathLike):
|
||||
source = self.info.name
|
||||
cache = os.path.join(store.store, "sources", source)
|
||||
msg = {
|
||||
"items": self.items,
|
||||
"options": self.options,
|
||||
"cache": cache,
|
||||
"output": None,
|
||||
|
|
@ -69,6 +71,7 @@ class SourcesServer(api.BaseAPI):
|
|||
|
||||
def _run_source(self, source, checksums):
|
||||
msg = {
|
||||
"items": {},
|
||||
"options": self.options.get(source, {}),
|
||||
"cache": f"{self.cache}/{source}",
|
||||
"output": f"{self.output}/{source}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue