summaryrefslogtreecommitdiff
path: root/doc/PROGRAMMING
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2017-06-24 11:39:50 +0000
committerNiels Thykier <niels@thykier.net>2017-06-24 11:39:50 +0000
commit27d7346bfb6e1ad8bad2e910d44e4db9639cb8ef (patch)
tree9d4301165c797d4801057ff2b8e4c509308d1c90 /doc/PROGRAMMING
parent2f9fbaa1f277e05418929de567d24f40486e1380 (diff)
downloaddebhelper-27d7346bfb6e1ad8bad2e910d44e4db9639cb8ef.tar.gz
Dh_Lib: Add on_selected_pkgs_in_parallel
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'doc/PROGRAMMING')
-rw-r--r--doc/PROGRAMMING10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 1827811f..5d1b6220 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -358,20 +358,24 @@ log_installed_files($package, @paths)
If a directory is listed, it and all paths recursively beneath is
also considered installed.
on_pkgs_in_parallel($code) - prototype: (&)
- Splits all the packages in $dh{DOPACKAGES} into a number of groups
+ Short hand for on_selected_pkgs_in_parallel with $dh{DOPACKAGES} as
+ as list of packages.
+on_selected_pkgs_in_parallel($pkg_list_ref, $code)
+ Splits all the packages in $pkg_list_ref into a number of groups
based on the max parallel (as decided by DEB_BUILD_OPTIONS)
A subprocess is forked for each group (minimum 1 process will be
forked) and each subprocess will be added a group of packages
to process. Each group is passed to the $code sub, which will
then process it and return normally on success.
Example:
- on_pkgs_in_parallel {
+ my @all_packages = getpackages();
+ on_selected_pkgs_in_parallel(\@all_packages, sub {
for my $package (@_) {
my $tmp=tmpdir($package);
my $pkgfile = pkgfile($package, 'foo');
...;
}
- }
+ });
Keep in mind that the sub will always be run in a subprocess,
so it cannot update global state.