From c624aab94552d159e4b355bf11f8b32ddf97f1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 11 Jan 2020 18:06:25 +0100 Subject: [PATCH] pungi-gather: add options for excluding debug and source packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Frédéric Pierret (fepitre) --- pungi/gather_dnf.py | 20 ++++++++++++++++++-- pungi/scripts/pungi_gather.py | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index 1c7e0f06..2006ecc5 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -69,6 +69,12 @@ class GatherOptions(pungi.common.OptionsBase): # lookaside repos; packages will be flagged accordingly self.lookaside_repos = [] + # exclude source packages + self.exclude_source = False + + # exclude debug packages + self.exclude_debug = False + self.merge_options(**kwargs) def __str__(self): @@ -83,7 +89,9 @@ class GatherOptions(pungi.common.OptionsBase): 'multilib_blacklist=%d items' % len(self.multilib_blacklist), 'multilib_whitelist=%d items' % len(self.multilib_whitelist), 'lookaside_repos=%s' % self.lookaside_repos, - 'prepopulate=%d items' % len(self.prepopulate) + 'prepopulate=%d items' % len(self.prepopulate), + 'exclude_source=%s' % self.exclude_source, + 'exclude_debug=%s' % self.exclude_debug ] return '[\n%s\n]' % '\n'.join(' ' + l for l in lines) @@ -531,7 +539,7 @@ class Gather(GatherBase): def add_debug_package_deps(self): added = set() - if not self.opts.resolve_deps: + if not self.opts.resolve_deps or self.opts.exclude_debug: return added for pkg in self.result_debug_packages.copy(): @@ -597,6 +605,8 @@ class Gather(GatherBase): return added if not self.opts.selfhosting: return added + if self.opts.exclude_source: + return added for pkg in self.result_source_packages: assert pkg is not None @@ -632,6 +642,9 @@ class Gather(GatherBase): """ added = set() + if self.opts.exclude_source: + return added + for pkg in self.result_binary_packages: assert pkg is not None @@ -669,6 +682,9 @@ class Gather(GatherBase): """ added = set() + if self.opts.exclude_debug: + return added + for pkg in self.result_binary_packages: assert pkg is not None diff --git a/pungi/scripts/pungi_gather.py b/pungi/scripts/pungi_gather.py index 6924f2ba..3c6b4c08 100644 --- a/pungi/scripts/pungi_gather.py +++ b/pungi/scripts/pungi_gather.py @@ -78,6 +78,18 @@ def get_parser(): help="path to temp dir (default: /tmp)", default="/tmp", ) + group.add_argument( + "--exclude-source", + action="store_true", + default=False, + help="exclude source packages from gathering", + ) + group.add_argument( + "--exclude-debug", + action="store_true", + default=False, + help="exclude debug packages from gathering", + ) return parser @@ -107,6 +119,12 @@ def main(ns, persistdir, cachedir): if ns.nodeps: gather_opts.resolve_deps = False + if ns.exclude_source: + gather_opts.exclude_source = True + + if ns.exclude_debug: + gather_opts.exclude_debug = True + ksparser = pungi.ks.get_ksparser(ns.config) # read repos from ks