[debhelper-devel] [debhelper] 01/02: Dh_Lib: Rename sub to on_items_in_parallel
Niels Thykier
nthykier at moszumanska.debian.org
Mon Jun 26 12:10:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 71dabb453dcd32e5822253a5760875e5304a9e9e
Author: Niels Thykier <niels at thykier.net>
Date: Mon Jun 26 11:06:34 2017 +0000
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 at thykier.net>
---
Debian/Debhelper/Dh_Lib.pm | 9 ++++++---
dh_installman | 2 +-
doc/PROGRAMMING | 14 ++++++++++----
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index e84222b..b64309d 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -54,7 +54,7 @@ use vars qw(@EXPORT %dh);
&open_gz &reset_perm_and_owner &deprecated_functionality
&log_installed_files &buildarch &rename_path
&on_pkgs_in_parallel &on_selected_pkgs_in_parallel
- &rm_files &make_symlink_raw_target
+ &rm_files &make_symlink_raw_target &on_items_in_parallel
);
# The Makefile changes this if debhelper is installed in a PREFIX.
@@ -1669,10 +1669,10 @@ sub log_installed_files {
sub on_pkgs_in_parallel(&) {
unshift(@_, $dh{DOPACKAGES});
- goto \&on_selected_pkgs_in_parallel;
+ goto \&on_items_in_parallel;
}
-sub on_selected_pkgs_in_parallel {
+sub on_items_in_parallel {
my ($pkgs_ref, $code) = @_;
my @pkgs = @{$pkgs_ref};
my %pids;
@@ -1726,6 +1726,9 @@ sub on_selected_pkgs_in_parallel {
return;
}
+*on_selected_pkgs_in_parallel = \&on_items_in_parallel;
+
+
1
# Local Variables:
diff --git a/dh_installman b/dh_installman
index 899bd5a..236774f 100755
--- a/dh_installman
+++ b/dh_installman
@@ -123,7 +123,7 @@ init(options => {
my (@sofiles, @sodests);
my @all_packages = getpackages();
-on_selected_pkgs_in_parallel(\@all_packages, sub {
+on_items_in_parallel(\@all_packages, sub {
foreach my $package (@_) {
next if is_udeb($package);
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 43f68c6..47f86aa 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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list