From 3379e050464ff5389f2397ccaefc18f78e8fbea1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 15 Aug 2024 13:43:24 +0200 Subject: [PATCH] osbuild: drop `libdir` from `download()` methods The libdir is passed down for sources but it is never used in any of our sources. As this is confusing and we want to eventually support multiple libdirs remove this code. It looks like the libdir for soruces was added a long time ago in 8423da3 but there is no indication if/how it is/was supposed to get used and AFACT from going over the git history it was very used. SourceService:dispatch() never sends "libdir" to the actual sources, so it is not an even technically an API break. --- osbuild/main_cli.py | 2 +- osbuild/pipeline.py | 4 ++-- osbuild/sources.py | 4 +--- test/run/test_sources.py | 12 ++++++------ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/osbuild/main_cli.py b/osbuild/main_cli.py index 3afd97c4a..d76a8a8d1 100644 --- a/osbuild/main_cli.py +++ b/osbuild/main_cli.py @@ -177,7 +177,7 @@ def osbuild_cli() -> int: monitor = osbuild.monitor.make(monitor_name, args.monitor_fd, total_steps) monitor.log(f"starting {args.manifest_path}", origin="osbuild.main_cli") - manifest.download(object_store, monitor, args.libdir) + manifest.download(object_store, monitor) r = manifest.build( object_store, diff --git a/osbuild/pipeline.py b/osbuild/pipeline.py index af88142c3..437a9001e 100644 --- a/osbuild/pipeline.py +++ b/osbuild/pipeline.py @@ -409,13 +409,13 @@ def add_source(self, info, items: List, options: Dict) -> Source: self.sources.append(source) return source - def download(self, store, monitor, libdir): + def download(self, store, monitor): with host.ServiceManager(monitor=monitor) as mgr: for source in self.sources: # Workaround for lack of progress from sources, this # will need to be reworked later. monitor.begin(source) - source.download(mgr, store, libdir) + source.download(mgr, store) monitor.finish({"name": source.info.name}) def depsolve(self, store: ObjectStore, targets: Iterable[str]) -> List[str]: diff --git a/osbuild/sources.py b/osbuild/sources.py index a3f532e42..b09597e94 100644 --- a/osbuild/sources.py +++ b/osbuild/sources.py @@ -8,7 +8,6 @@ from . import host from .objectstore import ObjectStore -from .util.types import PathLike class Source: @@ -25,7 +24,7 @@ def __init__(self, info, items, options) -> None: self.runner = None self.source_epoch = None - def download(self, mgr: host.ServiceManager, store: ObjectStore, libdir: PathLike): + def download(self, mgr: host.ServiceManager, store: ObjectStore): source = self.info.name cache = os.path.join(store.store, "sources") @@ -34,7 +33,6 @@ def download(self, mgr: host.ServiceManager, store: ObjectStore, libdir: PathLik "cache": cache, "output": None, "checksums": [], - "libdir": os.fspath(libdir) } client = mgr.start(f"source/{source}", self.info.path) diff --git a/test/run/test_sources.py b/test/run/test_sources.py index 0f95a7b05..d1e12dcc8 100644 --- a/test/run/test_sources.py +++ b/test/run/test_sources.py @@ -101,14 +101,14 @@ def make_test_cases(): yield source, case -def check_case(source, case, store, libdir): +def check_case(source, case_options, store): with host.ServiceManager() as mgr: - expects = case["expects"] + expects = case_options["expects"] if expects == "error": with pytest.raises(host.RemoteError): - source.download(mgr, store, libdir) + source.download(mgr, store) elif expects == "success": - source.download(mgr, store, libdir) + source.download(mgr, store) else: raise ValueError(f"invalid expectation: {expects}") @@ -131,5 +131,5 @@ def test_sources(source, case, tmp_path): with osbuild.objectstore.ObjectStore(tmp_path) as store, \ fileServer(test.TestBase.locate_test_data()): - check_case(src, case_options, store, index.path) - check_case(src, case_options, store, index.path) + check_case(src, case_options, store) + check_case(src, case_options, store)