From 7e7cef09ac4b001a82741336ce5e3b7390d1e12f Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Mon, 4 Jan 2021 11:20:45 +0100 Subject: [PATCH] Replace black/white list with exclude/include list --- ...acklist.yml => comps-sync-exclude-list.yml | 16 +++++----- comps-sync.py | 32 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) rename comps-sync-blacklist.yml => comps-sync-exclude-list.yml (96%) diff --git a/comps-sync-blacklist.yml b/comps-sync-exclude-list.yml similarity index 96% rename from comps-sync-blacklist.yml rename to comps-sync-exclude-list.yml index 1586f48..9396069 100644 --- a/comps-sync-blacklist.yml +++ b/comps-sync-exclude-list.yml @@ -1,24 +1,24 @@ # This file has a list of packages to skip from comps that we don't want, plus -# a few whitelisted things. +# a few include listed things. # For some reason today these are just in livecd-tools... -whitelist: +include_list: - kernel - kernel-modules - kernel-modules-extra # Entirely skip all packages in libreoffice -blacklist_groups: +exclude_list_groups: - libreoffice - gnome-desktop - container-management # PackageKit is spread across various groups -blacklist_all_regexp: +exclude_list_all_regexp: - "PackageKit.*" -# Common blacklist for all ostree desktop versions -blacklist: +# Common exclude list for all ostree desktop versions +exclude_list: core: # We use rpm-ostree for the host - dnf @@ -123,8 +123,8 @@ blacklist: # For now... - ghostscript -# Desktop environment specific blacklists -desktop_blacklist: +# Desktop environment specific exclude lists +desktop_exclude_list: gnome-desktop: # Non-critical apps -> Flatpak - baobab diff --git a/comps-sync.py b/comps-sync.py index 0a4715d..cd9d73e 100755 --- a/comps-sync.py +++ b/comps-sync.py @@ -43,16 +43,16 @@ with open(base_pkgs_path) as f: manifest = yaml.safe_load(f) manifest_packages = set(manifest['packages']) -with open('comps-sync-blacklist.yml') as f: +with open('comps-sync-exclude-list.yml') as f: doc = yaml.safe_load(f) - comps_blacklist = doc['blacklist'] - comps_whitelist = doc['whitelist'] - comps_blacklist_groups = doc['blacklist_groups'] - comps_desktop_blacklist = doc['desktop_blacklist'] - comps_blacklist_all = [re.compile(x) for x in doc['blacklist_all_regexp']] + comps_exclude_list = doc['exclude_list'] + comps_include_list = doc['include_list'] + comps_exclude_list_groups = doc['exclude_list_groups'] + comps_desktop_exclude_list = doc['desktop_exclude_list'] + comps_exclude_list_all = [re.compile(x) for x in doc['exclude_list_all_regexp']] -def is_blacklisted(pkgname): - for br in comps_blacklist_all: +def is_exclude_listed(pkgname): + for br in comps_exclude_list_all: if br.match(pkgname): return True return False @@ -71,15 +71,15 @@ ws_environ = comps.environments[ws_env_name] ws_pkgs = {} for gid in ws_environ.group_ids: group = comps.groups_match(id=gid.name)[0] - if gid.name in comps_blacklist_groups: + if gid.name in comps_exclude_list_groups: continue - blacklist = comps_blacklist.get(gid.name, set()) + exclude_list = comps_exclude_list.get(gid.name, set()) for pkg in group.packages: pkgname = pkg.name if pkg.type not in (libcomps.PACKAGE_TYPE_DEFAULT, libcomps.PACKAGE_TYPE_MANDATORY): continue - if pkgname in blacklist or is_blacklisted(pkgname): + if pkgname in exclude_list or is_exclude_listed(pkgname): continue pkgdata = ws_pkgs.get(pkgname) if pkgdata is None: @@ -91,12 +91,12 @@ for gid in ws_environ.group_ids: ws_ostree_pkgs = set() for pkg in comps.groups_match(id=ws_ostree_name)[0].packages: - if not is_blacklisted(pkg.name): + if not is_exclude_listed(pkg.name): ws_ostree_pkgs.add(pkg.name) comps_unknown = set() for pkg in manifest_packages: - if (pkg not in comps_whitelist and + if (pkg not in comps_include_list and pkg not in ws_pkgs and pkg not in ws_ostree_pkgs): comps_unknown.add(pkg) @@ -141,12 +141,12 @@ for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', manifest = yaml.safe_load(f) manifest_packages = set(manifest['packages']) - # Filter packages in the comps desktop group using the blacklist + # Filter packages in the comps desktop group using the exclude_list comps_group_pkgs = set() for pkg in comps.groups_match(id=desktop)[0].packages: pkgname = pkg.name - blacklist = comps_desktop_blacklist.get(desktop, set()) - if pkgname in blacklist or is_blacklisted(pkgname): + exclude_list = comps_desktop_exclude_list.get(desktop, set()) + if pkgname in exclude_list or is_exclude_listed(pkgname): continue comps_group_pkgs.add(pkg.name)