From 4fb1f3b2d64a2faa9d961205b1c32f83028172c8 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@gnu.kitenet.net>
Date: Wed, 28 Oct 2009 16:03:46 -0400
Subject: [PATCH] move obscure function to EOF

---
 Debian/Debhelper/Buildsystem/makefile.pm |  4 +-
 Debian/Debhelper/Dh_Lib.pm               | 80 ++++++++++++------------
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/Debian/Debhelper/Buildsystem/makefile.pm b/Debian/Debhelper/Buildsystem/makefile.pm
index 6629d25..f21b2cb 100644
--- a/Debian/Debhelper/Buildsystem/makefile.pm
+++ b/Debian/Debhelper/Buildsystem/makefile.pm
@@ -33,10 +33,10 @@ sub exists_make_target {
 sub do_make {
 	my $this=shift;
 
+	# Remove unavailable jobserver options from MAKEFLAGS.
 	# Always clean MAKEFLAGS from unavailable jobserver options. If parallel
 	# is enabled, do more extensive clean up from all job control specific
-	# options and start our own jobserver if parallel building (> 1) was
-	# requested.
+	# options
 	my ($status, $makeflags) = get_make_jobserver_status();
 	if ($status eq "jobserver-unavailable" || defined $this->get_parallel()) {
 		if (defined $makeflags) {
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index ebf7db7..602b77f 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -205,46 +205,6 @@ sub _error_exitcode {
 	}
 }
 
-# A helper subroutine for detecting (based on MAKEFLAGS) if make jobserver 
-# is enabled, if it is available or MAKEFLAGS contains "jobs" option.
-# It returns current status (jobserver, jobserver-unavailable or jobs-N where
-# N is number of jobs, 0 if infinite) and MAKEFLAGS cleaned up from 
-# job control options.
-sub get_make_jobserver_status {
-	my $jobsre = qr/(?:^|\s)(?:(?:-j\s*|--jobs(?:=|\s+))(\d+)?|--jobs)\b/;
-	my $status = "";
-	my $makeflags;
-
-	if (exists $ENV{MAKEFLAGS}) {
-		$makeflags = $ENV{MAKEFLAGS};
-		if ($makeflags =~ /(?:^|\s)--jobserver-fds=(\d+)/) {
-			$status = "jobserver";
-			if (!open(my $in, "<&", "$1")) {
-				# Job server is unavailable
-				$status .= "-unavailable";
-			}
-			else {
-				close $in;
-			}
-			# Clean makeflags up
-			$makeflags =~ s/(?:^|\s)--jobserver-fds=\S+//g;
-			$makeflags =~ s/(?:^|\s)-j\b//g;
-		}
-		elsif (my @m = ($makeflags =~ /$jobsre/g)) {
-			# Job count is specified in MAKEFLAGS. Whenever make reads it, a new
-			# jobserver will be started. Job count returned is 0 if infinite.
-			$status = "jobs-" . (defined $m[$#m] ? $m[$#m] : "0");
-			# Clean makeflags up from "jobs" option(s)
-			$makeflags =~ s/$jobsre//g;
-		}
-	}
-	if ($status) {
-		# MAKEFLAGS could be unset if it is empty
-		$makeflags = undef if $makeflags =~ /^\s*$/;
-	}
-	return wantarray ? ($status, $makeflags) : $status;
-}
-
 # Run a command that may have a huge number of arguments, like xargs does.
 # Pass in a reference to an array containing the arguments, and then other
 # parameters that are the command and any parameters that should be passed to
@@ -834,4 +794,44 @@ sub debhelper_script_subst {
 	}
 }
 
+# A helper subroutine for detecting (based on MAKEFLAGS) if make jobserver 
+# is enabled, if it is available or MAKEFLAGS contains "jobs" option.
+# It returns current status (jobserver, jobserver-unavailable or jobs-N where
+# N is number of jobs, 0 if infinite) and MAKEFLAGS cleaned up from 
+# job control options.
+sub get_make_jobserver_status {
+	my $jobsre = qr/(?:^|\s)(?:(?:-j\s*|--jobs(?:=|\s+))(\d+)?|--jobs)\b/;
+	my $status = "";
+	my $makeflags;
+
+	if (exists $ENV{MAKEFLAGS}) {
+		$makeflags = $ENV{MAKEFLAGS};
+		if ($makeflags =~ /(?:^|\s)--jobserver-fds=(\d+)/) {
+			$status = "jobserver";
+			if (!open(my $in, "<&", "$1")) {
+				# Job server is unavailable
+				$status .= "-unavailable";
+			}
+			else {
+				close $in;
+			}
+			# Clean makeflags up
+			$makeflags =~ s/(?:^|\s)--jobserver-fds=\S+//g;
+			$makeflags =~ s/(?:^|\s)-j\b//g;
+		}
+		elsif (my @m = ($makeflags =~ /$jobsre/g)) {
+			# Job count is specified in MAKEFLAGS. Whenever make reads it, a new
+			# jobserver will be started. Job count returned is 0 if infinite.
+			$status = "jobs-" . (defined $m[$#m] ? $m[$#m] : "0");
+			# Clean makeflags up from "jobs" option(s)
+			$makeflags =~ s/$jobsre//g;
+		}
+	}
+	if ($status) {
+		# MAKEFLAGS could be unset if it is empty
+		$makeflags = undef if $makeflags =~ /^\s*$/;
+	}
+	return wantarray ? ($status, $makeflags) : $status;
+}
+
 1
-- 
2.39.5