Received: by mail.netbsd.org (Postfix, from userid 605) id B045084D4B; Sun, 18 Aug 2019 16:18:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 3816684D2A for ; Sun, 18 Aug 2019 16:18:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id ZgfOQmZFtjG9 for ; Sun, 18 Aug 2019 16:18:04 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 78E3884CD4 for ; Sun, 18 Aug 2019 16:18:04 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 76672FBF4; Sun, 18 Aug 2019 16:18:04 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1566145084145280" MIME-Version: 1.0 Date: Sun, 18 Aug 2019 16:18:04 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/url2pkg/files To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20190818161804.76672FBF4@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1566145084145280 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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. --_----------=_1566145084145280 Content-Disposition: inline Content-Length: 4747 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii 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(); --_----------=_1566145084145280--