pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/url2pkg/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Aug 18 16:18:04 UTC 2019

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

Log Message:
pkgtools/url2pkg: rename helper functions


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/url2pkg/files/url2pkg.t

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/files/url2pkg.pl
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.59 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.60
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.59       Sun Aug 18 16:09:01 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.pl    Sun Aug 18 16:18:04 2019
@@ -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 @@ sub find_package($) {
        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 @@ sub update_var_set($$$) {
 }
 
 # 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 @@ sub update_var_append($$$) {
        return false;
 }
 
-sub update_var_remove($$) {
+sub lines_remove($$) {
        my ($lines, $varname) = @_;
 
        my $i = 0;
@@ -179,7 +179,7 @@ sub update_var_remove($$) {
        return false;
 }
 
-sub update_var_remove_if($$$) {
+sub lines_remove_if($$$) {
        my ($lines, $varname, $expected_value) = @_;
 
        my $i = 0;
@@ -642,12 +642,12 @@ sub adjust_lines_python_module($$) {
        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 @@ sub adjust_package_from_extracted_distfi
 
        close(MF1);
 
-       update_var_append(\@lines, "CATEGORIES", join(" ", @categories));
+       lines_append(\@lines, "CATEGORIES", join(" ", @categories));
 
        adjust_lines_python_module(\@lines, $url);
 

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.t
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.3 pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.4
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.3 Sun Aug 18 13:59:38 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.t     Sun Aug 18 16:18:04 2019
@@ -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_add_section__operators() {
        ]);
 }
 
-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 @@ sub test_all() {
        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