[debhelper-devel] [debhelper] 01/06: getpackages: Use elsif's for mutually exclusive conditions

Niels Thykier nthykier at moszumanska.debian.org
Mon Apr 10 17:39:29 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 991b91cb328b3648fc0984becb1d327686dc146b
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Apr 10 11:17:23 2017 +0000

    getpackages: Use elsif's for mutually exclusive conditions
    
    Minor tweak: Also remove the trailing "\s*" which is unnecessary as
    there is a s/\s+$// just prior to all of these ifs.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 8f97401..07e2208 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -981,24 +981,21 @@ sub getpackages {
 				error("debian/control has a duplicate entry for $package");
 			}
 			$included_in_build_profile=1;
-		}
-		if (/^Section:\s(.*)\s*$/i) {
+		} elsif (/^Section:\s(.*)$/i) {
 			$section = $1;
-		}
-		if (/^Architecture:\s*(.*)/i) {
+		} elsif (/^Architecture:\s*(.*)/i) {
 			$arch=$1;
-		}
-		if (/^(?:X[BC]*-)?Package-Type:\s*(.*)/i) {
+		} elsif (/^(?:X[BC]*-)?Package-Type:\s*(.*)/i) {
 			$package_type=$1;
-		}
-		if (/^Multi-Arch:\s*(.*)\s*/i) {
+		} elsif (/^Multi-Arch:\s*(.*)/i) {
 			$multiarch = $1;
-		}
-		# rely on libdpkg-perl providing the parsing functions because
-		# if we work on a package with a Build-Profiles field, then a
-		# high enough version of dpkg-dev is needed anyways
-		if (/^Build-Profiles:\s*(.*)/i) {
-		        my $build_profiles=$1;
+
+		} elsif (/^Build-Profiles:\s*(.*)/i) {
+			# rely on libdpkg-perl providing the parsing functions
+			# because if we work on a package with a Build-Profiles
+			# field, then a high enough version of dpkg-dev is needed
+			# anyways
+			my $build_profiles=$1;
 			eval {
 				require Dpkg::BuildProfiles;
 				my @restrictions=Dpkg::BuildProfiles::parse_build_profiles($build_profiles);

-- 
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