async def run(self): """ Build and emit `DeclarativeContent` from the Manifest data. If a cookbook specifier is set in the remote, cookbooks are filtered using this specifier. """ with ProgressBar(message="Downloading Metadata", total=1) as pb: downloader = self.remote.get_downloader(url=urljoin(self.remote.url + "/", "universe")) result = await downloader.run() pb.increment() cookbook_names = self.remote.specifier_cookbook_names() with ProgressBar(message="Parsing Metadata") as pb: universe = Universe(result.path) for entry in universe.read(): if cookbook_names and entry.name not in cookbook_names: continue cookbook = CookbookPackageContent( name=entry.name, version=entry.version, dependencies=entry.dependencies ) artifact = Artifact() da = DeclarativeArtifact( artifact=artifact, url=entry.download_url, relative_path=cookbook.relative_path(), remote=self.remote, deferred_download=not self.download_artifacts, ) dc = DeclarativeContent(content=cookbook, d_artifacts=[da]) pb.increment() await self.put(dc)
async def __call__(self, in_q, out_q): """ Build and emit `DeclarativeContent` from the Manifest data. If a cookbook specifier is set in the remote, cookbooks are filtered using this specifier. Args: in_q (asyncio.Queue): Unused because the first stage doesn't read from an input queue. out_q (asyncio.Queue): The out_q to send `DeclarativeContent` objects to """ with ProgressBar(message='Downloading Metadata', total=1) as pb: downloader = self.remote.get_downloader( url=urljoin(self.remote.url + '/', 'universe')) result = await downloader.run() pb.increment() cookbook_names = self.remote.specifier_cookbook_names() with ProgressBar(message='Parsing Metadata') as pb: universe = Universe(result.path) for entry in universe.read(): if cookbook_names and entry.name not in cookbook_names: continue cookbook = CookbookPackageContent( name=entry.name, version=entry.version, dependencies=entry.dependencies) artifact = Artifact() da = DeclarativeArtifact(artifact, entry.download_url, cookbook.relative_path(), self.remote) dc = DeclarativeContent(content=cookbook, d_artifacts=[da]) pb.increment() await out_q.put(dc) await out_q.put(None)