Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 May 2020 15:17:24 +0000 (UTC)
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r537171 - in head/ports-mgmt/portlint: . src
Message-ID:  <202005311517.04VFHOJg035782@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcus
Date: Sun May 31 15:17:24 2020
New Revision: 537171
URL: https://svnweb.freebsd.org/changeset/ports/537171

Log:
  Update to 2.19.2.
  
  The makevar padding method was missing leading and trailing variable values
  when those values were undefined.  Try to be better about this.

Modified:
  head/ports-mgmt/portlint/Makefile
  head/ports-mgmt/portlint/src/portlint.pl

Modified: head/ports-mgmt/portlint/Makefile
==============================================================================
--- head/ports-mgmt/portlint/Makefile	Sun May 31 14:45:20 2020	(r537170)
+++ head/ports-mgmt/portlint/Makefile	Sun May 31 15:17:24 2020	(r537171)
@@ -2,8 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	portlint
-PORTVERSION=	2.19.1
-PORTREVISION=	1
+PORTVERSION=	2.19.2
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none

Modified: head/ports-mgmt/portlint/src/portlint.pl
==============================================================================
--- head/ports-mgmt/portlint/src/portlint.pl	Sun May 31 14:45:20 2020	(r537170)
+++ head/ports-mgmt/portlint/src/portlint.pl	Sun May 31 15:17:24 2020	(r537171)
@@ -15,7 +15,7 @@
 # was removed.
 #
 # $FreeBSD$
-# $MCom: portlint/portlint.pl,v 1.512 2020/05/30 23:14:06 jclarke Exp $
+# $MCom: portlint/portlint.pl,v 1.515 2020/05/31 15:15:06 jclarke Exp $
 #
 
 use strict;
@@ -50,7 +50,7 @@ $portdir = '.';
 # version variables
 my $major = 2;
 my $minor = 19;
-my $micro = 1;
+my $micro = 2;
 
 # default setting - for FreeBSD
 my $portsdir = '/usr/ports';
@@ -1972,7 +1972,7 @@ sub checkmakefile {
 	);
 	print "OK: checking to see if certain macros are sorted.\n" if ($verbose);
 	foreach my $sorted_macro (@macros_to_sort) {
-		while ($whole =~ /\n$sorted_macro.?=\s*([^#]+)(#.*)?\n/g) {
+		while ($whole =~ /\n$sorted_macro.?=\s*([^#\n]+)(#.*)?\n/g) {
 			my $lineno = &linenumber($`);
 			my $srex = $1;
 			$srex =~ s/\s+$//;
@@ -3831,11 +3831,19 @@ sub get_makevar {
 	$result = `$cmd`;
 	chomp $result;
 
-	$result =~ s/\n\n/\n\0\n/g;
+	# This bit of magic is interesting and repeated in the get_make* functions.
+	# It will ensure that all empty values for macros are replaced with a '\0' character
+	# to preserve their "place in line" for future parsing.  This is only needed when passing
+	# multiple variables to these functions.
+	no warnings 'uninitialized';
+	$result =~ s/(?:^|(?<=\n))(?=\n|$)/$1\0$3/g;
 	if (${^CHILD_ERROR_NATIVE} != 0) {
         die "\nFATAL ERROR: make(1) died with status ${^CHILD_ERROR_NATIVE} and returned '$result'";
 	}
 
+	# If the final value is just a '\0' strip it out.
+	$result =~ s/^\0$//;
+
 	return $result;
 }
 
@@ -3846,11 +3854,14 @@ sub get_makevar_shallow {
 	$result = `$cmd`;
 	chomp $result;
 
-	$result =~ s/\n\n/\n\0\n/g;
+	no warnings 'uninitialized';
+	$result =~ s/(?:^|(?<=\n))(?=\n|$)/$1\0$3/g;
 	if (${^CHILD_ERROR_NATIVE} != 0) {
 		die "\nFATAL ERROR: make(1) died with status ${^CHILD_ERROR_NATIVE} and returned '$result'";
 	}
 
+	$result =~ s/^\0$//;
+
 	return $result;
 }
 
@@ -3861,11 +3872,14 @@ sub get_makevar_raw {
 	$result = `$cmd`;
 	chomp $result;
 
-	$result =~ s/\n\n/\n\0\n/g;
+	no warnings 'uninitialized';
+	$result =~ s/(?:^|(?<=\n))(?=\n|$)/$1\0$3/g;
 	if (${^CHILD_ERROR_NATIVE} != 0) {
         die "\nFATAL ERROR: make(1) died with status ${^CHILD_ERROR_NATIVE} and returned '$result'";
 	}
 
+	$result =~ s/^\0$//;
+
 	return $result;
 }
 
@@ -3877,10 +3891,13 @@ sub get_makeconf_var {
 	$result =`$cmd`;
 	chomp $result;
 
-	$result =~ s/\n\n/\n\0\n/g;
+	no warnings 'uninitialized';
+	$result =~ s/(?:^|(?<=\n))(?=\n|$)/$1\0$3/g;
 	if (${^CHILD_ERROR_NATIVE} != 0) {
         die "\nFATAL ERROR: make(1) died with status ${^CHILD_ERROR_NATIVE} and returned '$result'";
     }
+
+	$result =~ s/^\0$//;
 
 	return $result;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005311517.04VFHOJg035782>