pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/url2pkg



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Apr  8 20:13:55 UTC 2018

Modified Files:
        pkgsrc/pkgtools/url2pkg: Makefile
        pkgsrc/pkgtools/url2pkg/files: url2pkg.pl

Log Message:
pkgtools/url2pkg: refactor variable alignment code

The new code is more expressive and uses fewer magic numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.35 -r1.36 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/url2pkg/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.87 pkgsrc/pkgtools/url2pkg/Makefile:1.88
--- pkgsrc/pkgtools/url2pkg/Makefile:1.87       Sun Jan  7 11:20:18 2018
+++ pkgsrc/pkgtools/url2pkg/Makefile    Sun Apr  8 20:13:54 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.87 2018/01/07 11:20:18 rillig Exp $
+# $NetBSD: Makefile,v 1.88 2018/04/08 20:13:54 rillig Exp $
 
 PKGNAME=       url2pkg-2.29
 CATEGORIES=    pkgtools
@@ -22,6 +22,7 @@ do-extract:
 
 SUBST_CLASSES+=                up
 SUBST_STAGE.up=                do-configure
+SUBST_MESSAGE.up=      Replacing variable placeholders
 SUBST_FILES.up=                url2pkg.pl MakeMaker.pm
 SUBST_SED.up=          -e 's,@MAKE@,'${MAKE:Q}',g'
 SUBST_SED.up+=         -e 's,@PERL@,${PERL5},g'

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.pl
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.35 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.36
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.35       Sun Jan  7 11:20:18 2018
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.pl    Sun Apr  8 20:13:55 2018
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: url2pkg.pl,v 1.35 2018/01/07 11:20:18 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.36 2018/04/08 20:13:55 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -76,15 +76,15 @@ sub print_section($$) {
 
        my $width = 0;
        foreach my $var (@{$vars}) {
-               my $len = length($var->[0]);
+               my $varname = $var->[0];
+               my $len = (length("$varname= ") + 7) & -8;
                $width = ($len > $width) ? $len : $width;
        }
 
        foreach my $var (@{$vars}) {
-               my $len = length($var->[0]) + 1;
-               my $adjlen = (($width + 1 + 1) + 7) &-8;
-               my $ntabs = (7 + $adjlen - $len) / 8;
-               printf $f ("%s=%s%s\n", $var->[0], "\t" x $ntabs, $var->[1]);
+               my ($varname, $varvalue) = @$var;
+               my $ntabs = ($width - length("$varname=") + 7) / 8;
+               printf $f ("%s=%s%s\n", $varname, "\t" x $ntabs, $varvalue);
        }
        printf $f ("\n");
 }



Home | Main Index | Thread Index | Old Index