Skip to content

Commit

Permalink
deb_autopkg: support default pool
Browse files Browse the repository at this point in the history
WHen no pool is given to repo-build-pool, pick the default pool(s) to build
from the config key "defaults::build-pool", which defaults to 'default'.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
  • Loading branch information
metux committed Sep 6, 2023
1 parent fb78d50 commit 09189f7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions deb_autopkg/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ def clone_all(self):
return self._run(all_clone.alloc(self.conf))

def build_pool(self, name):
if name is None or name == '':
name = self.conf['defaults::build-pool']

if isinstance(name, list):
r = True
for n in name:
if n is not None and n != '':
r = r and self.build_pool(n)
return r

pool = self.conf.get_pool(name)
if pool is None:
raise SpecError("undefined pool: "+name)
Expand Down
9 changes: 7 additions & 2 deletions deb_autopkg/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ def pool_invalidate_target_package(conffile, poolname, pkgname, targetname):

@cmdfunc
def tool_repo_build_pool(argv):
if len(argv) < 3:
print("%s <config-file> <pool>" % argv[0])
if len(argv) < 2:
print("%s <config-file> [pool]" % argv[0])
print("")
print("Build a package repo pool from given config file")
print("If no pool given, the setting defaults::build-pool is used (defaults to 'default')")
return 1

if len(argv) < 3:
return build_pool(argv[1], None)

return build_pool(argv[1], argv[2])
1 change: 1 addition & 0 deletions deb_autopkg/conf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __intrinsics(self):
'pathes::github::anonymous': 'https://github.com/',
'pathes::oss-qm::mirror': '${GLOBAL::pathes::github::current}oss-qm/',
'pathes::github::current': github_prefix,
'defaults::build-pool': 'default',
})

"""load a target config"""
Expand Down

0 comments on commit 09189f7

Please sign in to comment.