From cb261b0994c605d1e3fd04fae53b65c7de3ed39f Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 1 Nov 2016 23:01:58 +0100 Subject: [PATCH] clone: Create metadata for empty components In certain scenarios, mirror components (e.g. trusty-security) are present in both packetary configuration input, and in target system's apt source definitions, but contain no packages of interest. For such repository/requirements combinations, packetary currently skips creating metadata (Release, Packages) for those components, which leads to the partial mirror missing some critical files for apt, (an empty file would be enough). e.g.: Using packetary to create a partial Ubuntu mirror, then trying to build a bootstrap image from the new mirror leads to: W: Failed to fetch http://127.0.0.1:8080/mirrors/ubuntu/dists/\ trusty-security/multiverse/binary-amd64/Packages 404 Closes-bug: 1638631 Change-Id: I850b43d5b4d8742d99e9a5702cc9ad4de881a401 Signed-off-by: Alexandru Avadanii --- packetary/api/repositories.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packetary/api/repositories.py b/packetary/api/repositories.py index ec8c54c..c2932c9 100644 --- a/packetary/api/repositories.py +++ b/packetary/api/repositories.py @@ -117,7 +117,8 @@ class RepositoryApi(object): repositories = self.controller.load_repositories(repos_data) all_packages = self._get_packages(repositories, requirements_data) - package_groups = defaultdict(set) + # create a empty package group even repo is empty + package_groups = {repo: set() for repo in repositories} for pkg in all_packages: package_groups[pkg.repository].add(pkg)