pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: consistently ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bcf2dc873073
branches:  trunk
changeset: 399895:bcf2dc873073
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 18 13:49:13 2019 +0000

description:
pkgtools/url2pkg: consistently use double quotes for string literals

diffstat:

 pkgtools/url2pkg/files/url2pkg.pl |  34 +++++++++++++++++-----------------
 pkgtools/url2pkg/files/url2pkg.t  |  32 ++++++++++++++++----------------
 2 files changed, 33 insertions(+), 33 deletions(-)

diffs (213 lines):

diff -r 1ff10e688c4c -r bcf2dc873073 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 13:32:21 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 13:49:13 2019 +0000
@@ -1,5 +1,5 @@
 #! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.57 2019/08/18 13:32:21 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.58 2019/08/18 13:49:13 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,9 +37,9 @@
 # Build-time Configuration.
 #
 
-my $make               = '@MAKE@';
-my $libdir             = '@LIBDIR@';
-my $pythonbin          = '@PYTHONBIN@';
+my $make               = "@MAKE@";
+my $libdir             = "@LIBDIR@";
+my $pythonbin          = "@PYTHONBIN@";
 
 use constant true      => 1;
 use constant false     => 0;
@@ -115,15 +115,15 @@
 sub update_var_append($$$) {
        my ($lines, $varname, $value) = @_;
 
-       return if $value eq '';
+       return if $value eq "";
 
        my $i = 0;
        foreach my $line (@$lines) {
                if ($line =~ qr"^\Q$varname\E(\+?=)([ \t]+)([^#\\]*)(#.*|)$") {
                        my ($op, $indent, $old_value, $comment) = ($1, $2, $3, $4);
 
-                       my $before = $old_value =~ qr'\S$' ? ' ' : '';
-                       my $after = $comment eq '' ? '' : ' ';
+                       my $before = $old_value =~ qr"\S$" ? " " : "";
+                       my $after = $comment eq "" ? "" : " ";
                        $lines->[$i] = "$varname$op$indent$old_value$before$value$after$comment";
                        return;
                }
@@ -193,7 +193,7 @@
 my $pkgname = "";
 
 # Example:
-# add_dependency('DEPENDS', 'package', '>=1', '../../category/package');
+# add_dependency("DEPENDS", "package", ">=1", "../../category/package");
 #
 sub add_dependency($$$$) {
        my ($type, $pkgbase, $constraint, $dep_dir) = @_;
@@ -310,8 +310,8 @@
        return unless -f "$abs_wrksrc/setup.py";
 
        my %old_env = %ENV;
-       $ENV{'PYTHONDONTWRITEBYTECODE'} = 'x';
-       $ENV{'PYTHONPATH'} = $libdir;
+       $ENV{"PYTHONDONTWRITEBYTECODE"} = "x";
+       $ENV{"PYTHONPATH"} = $libdir;
 
        my @dep_lines;
        open(DEPS, "cd '$abs_wrksrc' && $pythonbin setup.py build |") or die;
@@ -451,8 +451,8 @@
                        $homepage = "https://github.com/$org/$proj/";;
                        $github_project = $proj;
                        if (index($tag, $github_project) == -1) {
-                               $pkgname = '${GITHUB_PROJECT}-${DISTNAME}';
-                               $dist_subdir = '${GITHUB_PROJECT}';
+                               $pkgname = "\${GITHUB_PROJECT}-\${DISTNAME}";
+                               $dist_subdir = "\${GITHUB_PROJECT}";
                        }
                        $distfile = "$tag$ext";
 
@@ -463,9 +463,9 @@
                        $homepage = "https://github.com/$org/$proj/";;
                        if (index($base, $proj) == -1) {
                                $github_project = $proj;
-                               $dist_subdir = '${GITHUB_PROJECT}';
+                               $dist_subdir = "\${GITHUB_PROJECT}";
                        }
-                       $github_release = $tag eq $base ? '${DISTNAME}' : $tag;
+                       $github_release = $tag eq $base ? "\${DISTNAME}" : $tag;
                        $distfile = "$base$ext";
 
                } else {
@@ -559,8 +559,8 @@
                no if $] >= 5.018, warnings => "experimental::smartmatch";
                given ($f) {
                        next when qr"^\.";
-                       next when 'pax_global_header';
-                       next when 'package.xml';
+                       next when "pax_global_header";
+                       next when "package.xml";
                        next when qr".*\.gemspec";
                        default { push(@files, $f) }
                }
@@ -640,7 +640,7 @@
 
        close(MF1);
 
-       update_var_append(\@lines, 'CATEGORIES', join(' ', @categories));
+       update_var_append(\@lines, "CATEGORIES", join(" ", @categories));
 
        write_lines("Makefile-url2pkg.new", @lines);
 
diff -r 1ff10e688c4c -r bcf2dc873073 pkgtools/url2pkg/files/url2pkg.t
--- a/pkgtools/url2pkg/files/url2pkg.t  Sun Aug 18 13:32:21 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.t  Sun Aug 18 13:49:13 2019 +0000
@@ -1,7 +1,7 @@
 # -*- perl -*-
-# $NetBSD: url2pkg.t,v 1.1 2019/08/18 13:32:21 rillig Exp $
+# $NetBSD: url2pkg.t,v 1.2 2019/08/18 13:50:32 rillig Exp $
 
-require 'url2pkg.pl';
+require "url2pkg.pl";
 
 use Test::More;
 
@@ -12,14 +12,14 @@
        my $lines = [];
 
        add_section($lines, [
-               var('1', '=', 'one'),
-               var('6', '=', 'six'),
+               var("1", "=", "one"),
+               var("6", "=", "six"),
        ]);
 
        is_deeply($lines, [
                "1=\tone",
                "6=\tsix",
-               '',
+               "",
        ]);
 }
 
@@ -27,14 +27,14 @@
        my $lines = [];
 
        add_section($lines, [
-               var('short', '=', 'value'),
-               var('long_name', '=', 'value # comment'),
+               var("short", "=", "value"),
+               var("long_name", "=", "value # comment"),
        ]);
 
        is_deeply($lines, [
                "short=\t\tvalue",
                "long_name=\tvalue # comment",
-               '',
+               "",
        ]);
 }
 
@@ -42,19 +42,19 @@
        my $lines = [];
 
        add_section($lines, [
-               var('123456', '+=', 'value'),
+               var("123456", "+=", "value"),
        ]);
 
        is_deeply($lines, [
                "123456+=\tvalue",
-               '',
+               "",
        ]);
 }
 
 sub test_var_append__not_found() {
        my $lines = [];
 
-       update_var_append($lines, 'VARNAME', 'value');
+       update_var_append($lines, "VARNAME", "value");
 
        is_deeply($lines, []);
 }
@@ -62,7 +62,7 @@
 sub test_var_append__only_comment() {
        my $lines = ["VARNAME=\t\t\t# none"];
 
-       update_var_append($lines, 'VARNAME', 'value');
+       update_var_append($lines, "VARNAME", "value");
 
        is_deeply($lines, ["VARNAME=\t\t\tvalue # none"]);
 }
@@ -70,7 +70,7 @@
 sub test_var_append__value_with_comment() {
        my $lines = ["VARNAME=\tvalue # comment"];
 
-       update_var_append($lines, 'VARNAME', 'appended');
+       update_var_append($lines, "VARNAME", "appended");
 
        is_deeply($lines, ["VARNAME=\tvalue appended # comment"]);
 }
@@ -78,14 +78,14 @@
 sub test_var_append__value_without_comment() {
        my $lines = ["VARNAME+=\tvalue"];
 
-       update_var_append($lines, 'VARNAME', 'appended');
+       update_var_append($lines, "VARNAME", "appended");
 
        is_deeply($lines, ["VARNAME+=\tvalue appended"]);
 }
 
 sub test_generate_initial_package_Makefile_lines__GitHub() {
-       my $url = 'https://github.com/org/proj/archive/v1.0.0.tar.gz';
-       my $pkgsrcdir = $ENV{'PKGSRCDIR'} or die;
+       my $url = "https://github.com/org/proj/archive/v1.0.0.tar.gz";;
+       my $pkgsrcdir = $ENV{"PKGSRCDIR"} or die;
        chdir("$pkgsrcdir/pkgtools/url2pkg") or die;
 
        my @lines = generate_initial_package_Makefile_lines($url);



Home | Main Index | Thread Index | Old Index