summaryrefslogtreecommitdiff
path: root/doc/PROGRAMMING
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2017-06-26 11:06:34 +0000
committerNiels Thykier <niels@thykier.net>2017-06-26 11:09:24 +0000
commit71dabb453dcd32e5822253a5760875e5304a9e9e (patch)
tree7256bcc51897b0b18d87b5d61a9623e30fc4c943 /doc/PROGRAMMING
parent0497ab2e0eae0dd146d11ce975d33cdedebe00f9 (diff)
downloaddebhelper-71dabb453dcd32e5822253a5760875e5304a9e9e.tar.gz
Dh_Lib: Rename sub to on_items_in_parallel
Turns out that the sub is not specific to packages, so rename it to make it more self-descriptive (and to avoid making consumers to believe it is more limited than it is). Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'doc/PROGRAMMING')
-rw-r--r--doc/PROGRAMMING14
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 43f68c61..47f86aa6 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -358,9 +358,9 @@ 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: (&)
- Short hand for on_selected_pkgs_in_parallel with $dh{DOPACKAGES} as
+ Short hand for on_items_in_parallel with $dh{DOPACKAGES} as
as list of packages.
-on_selected_pkgs_in_parallel($pkg_list_ref, $code)
+on_items_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
@@ -369,13 +369,19 @@ on_selected_pkgs_in_parallel($pkg_list_ref, $code)
then process it and return normally on success.
Example:
my @all_packages = getpackages();
- on_selected_pkgs_in_parallel(\@all_packages, sub {
+ on_items_in_parallel(\@all_packages, sub {
for my $package (@_) {
my $tmp=tmpdir($package);
my $pkgfile = pkgfile($package, 'foo');
...;
}
- });
+ });
+ my @work_list = compute_work_list();
+ on_items_in_parallel(\@work_list, sub {
+ for my $item (@_) {
+ ...;
+ }
+ });
If there is an error, which should stop the build, please invoke
either "error()" or "error_exitcode". Alternatively, a trappable