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: rename helper...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c5faaf0c5c48
branches:  trunk
changeset: 338104:c5faaf0c5c48
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 18 16:18:04 2019 +0000

description:
pkgtools/url2pkg: rename helper functions

diffstat:

 pkgtools/url2pkg/files/url2pkg.pl |  24 ++++++++++++------------
 pkgtools/url2pkg/files/url2pkg.t  |  26 +++++++++++++-------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diffs (142 lines):

diff -r 59a6f8bf9bc3 -r c5faaf0c5c48 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 16:16:24 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 16:18:04 2019 +0000
@@ -1,5 +1,5 @@
 #! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.59 2019/08/18 16:09:01 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.60 2019/08/18 16:18:04 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
        return scalar(@candidates) == 1 ? $candidates[0] : "";
 }
 
-sub update_var_set($$$) {
+sub lines_set($$$) {
        my ($lines, $varname, $new_value) = @_;
 
        my $i = 0;
@@ -143,7 +143,7 @@
 }
 
 # appends the given value to the variable assignment.
-sub update_var_append($$$) {
+sub lines_append($$$) {
        my ($lines, $varname, $value) = @_;
 
        return if $value eq "";
@@ -164,7 +164,7 @@
        return false;
 }
 
-sub update_var_remove($$) {
+sub lines_remove($$) {
        my ($lines, $varname) = @_;
 
        my $i = 0;
@@ -179,7 +179,7 @@
        return false;
 }
 
-sub update_var_remove_if($$$) {
+sub lines_remove_if($$$) {
        my ($lines, $varname, $expected_value) = @_;
 
        my $i = 0;
@@ -642,12 +642,12 @@
        my $pkgversion_norev = $old{"DISTNAME"} =~ s/^v//r;
 
        my @tx_lines = @$lines;
-       if (update_var_remove(\@tx_lines, "GITHUB_PROJECT")
-               && update_var_set(\@tx_lines, "DISTNAME", "$pkgbase-$pkgversion_norev")
-               && update_var_set(\@tx_lines, "PKGNAME", "\${PYPKGPREFIX}-\${DISTNAME}")
-               && update_var_set(\@tx_lines, "MASTER_SITES", "\${MASTER_SITE_PYPI:=$pkgbase1/$pkgbase/}")
-               && update_var_remove(\@tx_lines, "DIST_SUBDIR")
-               && (update_var_remove_if(\@tx_lines, "EXTRACT_SUFX", ".zip") || true)) {
+       if (lines_remove(\@tx_lines, "GITHUB_PROJECT")
+               && lines_set(\@tx_lines, "DISTNAME", "$pkgbase-$pkgversion_norev")
+               && lines_set(\@tx_lines, "PKGNAME", "\${PYPKGPREFIX}-\${DISTNAME}")
+               && lines_set(\@tx_lines, "MASTER_SITES", "\${MASTER_SITE_PYPI:=$pkgbase1/$pkgbase/}")
+               && lines_remove(\@tx_lines, "DIST_SUBDIR")
+               && (lines_remove_if(\@tx_lines, "EXTRACT_SUFX", ".zip") || true)) {
 
                @$lines = @tx_lines;
                $regenerate_distinfo = true
@@ -754,7 +754,7 @@
 
        close(MF1);
 
-       update_var_append(\@lines, "CATEGORIES", join(" ", @categories));
+       lines_append(\@lines, "CATEGORIES", join(" ", @categories));
 
        adjust_lines_python_module(\@lines, $url);
 
diff -r 59a6f8bf9bc3 -r c5faaf0c5c48 pkgtools/url2pkg/files/url2pkg.t
--- a/pkgtools/url2pkg/files/url2pkg.t  Sun Aug 18 16:16:24 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.t  Sun Aug 18 16:18:04 2019 +0000
@@ -1,5 +1,5 @@
 # -*- perl -*-
-# $NetBSD: url2pkg.t,v 1.3 2019/08/18 13:59:38 rillig Exp $
+# $NetBSD: url2pkg.t,v 1.4 2019/08/18 16:18:04 rillig Exp $
 
 require "url2pkg.pl";
 
@@ -51,34 +51,34 @@
        ]);
 }
 
-sub test_var_append__not_found() {
+sub test_lines_append__not_found() {
        my $lines = [];
 
-       update_var_append($lines, "VARNAME", "value");
+       lines_append($lines, "VARNAME", "value");
 
        is_deeply($lines, []);
 }
 
-sub test_var_append__only_comment() {
+sub test_lines_append__only_comment() {
        my $lines = ["VARNAME=\t\t\t# none"];
 
-       update_var_append($lines, "VARNAME", "value");
+       lines_append($lines, "VARNAME", "value");
 
        is_deeply($lines, ["VARNAME=\t\t\tvalue # none"]);
 }
 
-sub test_var_append__value_with_comment() {
+sub test_lines_append__value_with_comment() {
        my $lines = ["VARNAME=\tvalue # comment"];
 
-       update_var_append($lines, "VARNAME", "appended");
+       lines_append($lines, "VARNAME", "appended");
 
        is_deeply($lines, ["VARNAME=\tvalue appended # comment"]);
 }
 
-sub test_var_append__value_without_comment() {
+sub test_lines_append__value_without_comment() {
        my $lines = ["VARNAME+=\tvalue"];
 
-       update_var_append($lines, "VARNAME", "appended");
+       lines_append($lines, "VARNAME", "appended");
 
        is_deeply($lines, ["VARNAME+=\tvalue appended"]);
 }
@@ -114,10 +114,10 @@
        test_add_section__simple();
        test_add_section__alignment();
        test_add_section__operators();
-       test_var_append__not_found();
-       test_var_append__only_comment();
-       test_var_append__value_with_comment();
-       test_var_append__value_without_comment();
+       test_lines_append__not_found();
+       test_lines_append__only_comment();
+       test_lines_append__value_with_comment();
+       test_lines_append__value_without_comment();
        test_generate_initial_package_Makefile_lines__GitHub();
 
        done_testing();



Home | Main Index | Thread Index | Old Index