From 9165ecdcacc70aee5d7b53ca607ad93de2ae7122 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 4 Jun 2017 18:58:42 +0000 Subject: Dh_Lib: Add on_pkgs_in_parallel Signed-off-by: Niels Thykier fixup! Dh_Lib: Add on_each_pkg_in_parallel --- doc/PROGRAMMING | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/PROGRAMMING') diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING index 02362809..1827811f 100644 --- a/doc/PROGRAMMING +++ b/doc/PROGRAMMING @@ -357,6 +357,24 @@ log_installed_files($package, @paths) (e.g. avoid "foo/../bar" or "foo/./bar") 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 + 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 { + 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. Sequence Addons: --------------- -- cgit v1.2.3