pungi-gather: add options for excluding debug and source packages

Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
This commit is contained in:
Frédéric Pierret (fepitre) 2020-01-11 18:06:25 +01:00
parent 01ab1d2e24
commit c624aab945
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2
2 changed files with 36 additions and 2 deletions

View File

@ -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

View File

@ -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