From f9162cc633c9a508fc4c6ab7b85d45a12572b34a Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Thu, 22 Oct 2020 15:49:39 +0200 Subject: [PATCH 1/3] Mark packages installed from groups as required Signed-off-by: Anderson Toshiyuki Sasaki --- feedback_pipeline.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/feedback_pipeline.py b/feedback_pipeline.py index 8d579ef..afd07f5 100755 --- a/feedback_pipeline.py +++ b/feedback_pipeline.py @@ -1429,15 +1429,14 @@ def _analyze_workload(tmp_dnf_cachedir, tmp_installroots, workload_conf, env_con workload["errors"]["non_existing_pkgs"].append(grp_spec) continue base.group_install(group.id, ['mandatory', 'default']) - - - # TODO: Mark group packages as required... the following code doesn't work - #for pkg in group.packages_iter(): - # print(pkg.name) - # workload_conf["packages"].append(pkg.name) - - - + + # Mark group packages as required + pkgs_from_groups = [] + for pkg in group.packages_iter(): + if pkg.name not in workload_conf["packages"]: + pkgs_from_groups.append(pkg.name) + workload_conf["packages"].extend(pkgs_from_groups) + # Filter out the relevant package placeholders for this arch package_placeholders = {} for placeholder_name,placeholder_data in workload_conf["package_placeholders"].items(): From f2698e0d4d528f6ba9b0eb5223f82bd23a217e3e Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Thu, 22 Oct 2020 15:56:51 +0200 Subject: [PATCH 2/3] Fix example for groups in workload config spec Signed-off-by: Anderson Toshiyuki Sasaki --- config_specs/workload.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_specs/workload.yaml b/config_specs/workload.yaml index c2e35ed..78a4a86 100644 --- a/config_specs/workload.yaml +++ b/config_specs/workload.yaml @@ -89,9 +89,9 @@ data: modules_enable: - module:stream - # Analyze a group + # Add packages from a group to the workload groups: - - core + - Core # Add packages to the workload that don't exist (yet) in the repositories. package_placeholders: From 681b4fa24b599204aa9abd1ef44000f2e72f07bd Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Thu, 22 Oct 2020 15:50:47 +0200 Subject: [PATCH 3/3] Add support for groups to environments Signed-off-by: Anderson Toshiyuki Sasaki --- config_specs/environment.yaml | 4 ++++ feedback_pipeline.py | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/config_specs/environment.yaml b/config_specs/environment.yaml index 6e1a9d1..901d8ba 100644 --- a/config_specs/environment.yaml +++ b/config_specs/environment.yaml @@ -57,6 +57,10 @@ data: ### OPTIONAL FIELDS ### + # Add packages from a group to the environment + groups: + - Core + # Architecture-specific packages. # # (optional field) diff --git a/feedback_pipeline.py b/feedback_pipeline.py index afd07f5..971ddc7 100755 --- a/feedback_pipeline.py +++ b/feedback_pipeline.py @@ -237,6 +237,12 @@ def _load_config_env(document_id, document, settings): for pkg in document["data"]["packages"]: config["packages"].append(str(pkg)) + # Comps groups + config["groups"] = [] + if "groups" in document["data"]: + for module in document["data"]["groups"]: + config["groups"].append(module) + # Labels connect things together. # Workloads get installed in environments with the same label. # They also get included in views with the same label. @@ -1144,6 +1150,24 @@ def _analyze_env(tmp_dnf_cachedir, tmp_installroots, env_conf, repo, arch): env["errors"]["non_existing_pkgs"].append(pkg) continue + # Groups + log(" Adding groups...") + if env_conf["groups"]: + base.read_comps(arch_filter=True) + for grp_spec in env_conf["groups"]: + group = base.comps.group_by_pattern(grp_spec) + if not group: + env["errors"]["non_existing_pkgs"].append(grp_spec) + continue + base.group_install(group.id, ['mandatory', 'default']) + + # Mark packages as required + pkgs_from_groups = [] + for pkg in group.packages_iter(): + if pkg.name not in env_conf["packages"]: + pkgs_from_groups.append(pkg.name) + env_conf["packages"].extend(pkgs_from_groups) + # Architecture-specific packages for pkg in env_conf["arch_packages"][arch]: try: