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 18:02:48 UTC 2019
Modified Files:
pkgsrc/pkgtools/url2pkg/files: url2pkg.pl url2pkg.t
Log Message:
pkgtools/url2pkg: add a few more tests
To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl
cvs rdiff -u -r1.5 -r1.6 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.61 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.62
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.61 Sun Aug 18 17:34:13 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 18:02:48 2019
@@ -1,5 +1,5 @@
#! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.61 2019/08/18 17:34:13 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.62 2019/08/18 18:02:48 rillig Exp $
#
# Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -647,15 +647,15 @@ sub adjust_lines_python_module($$) {
my $pkgbase1 = substr($pkgbase, 0, 1);
my $pkgversion_norev = $old{"DISTNAME"} =~ s/^v//r;
- my @tx_lines = @$lines;
- 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)) {
+ my @lines = @$lines;
+ if (lines_remove(\@lines, "GITHUB_PROJECT")
+ && lines_set(\@lines, "DISTNAME", "$pkgbase-$pkgversion_norev")
+ && lines_set(\@lines, "PKGNAME", "\${PYPKGPREFIX}-\${DISTNAME}")
+ && lines_set(\@lines, "MASTER_SITES", "\${MASTER_SITE_PYPI:=$pkgbase1/$pkgbase/}")
+ && lines_remove(\@lines, "DIST_SUBDIR")
+ && (lines_remove_if(\@lines, "EXTRACT_SUFX", ".zip") || true)) {
- @$lines = @tx_lines;
+ @$lines = @lines;
$regenerate_distinfo = true
}
}
Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.t
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.5 pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.6
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.5 Sun Aug 18 17:34:13 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.t Sun Aug 18 18:02:48 2019
@@ -1,5 +1,5 @@
# -*- perl -*-
-# $NetBSD: url2pkg.t,v 1.5 2019/08/18 17:34:13 rillig Exp $
+# $NetBSD: url2pkg.t,v 1.6 2019/08/18 18:02:48 rillig Exp $
require "url2pkg.pl";
@@ -83,7 +83,7 @@ sub test_lines_append__value_without_com
is_deeply($lines, ["VARNAME+=\tvalue appended"]);
}
-sub test_generate_initial_package_Makefile_lines__GitHub() {
+sub test_generate_initial_package_Makefile_lines__GitHub_archive() {
my $url = "https://github.com/org/proj/archive/v1.0.0.tar.gz";
my @lines = generate_initial_package_Makefile_lines($url);
@@ -107,6 +107,56 @@ sub test_generate_initial_package_Makefi
]);
}
+sub test_generate_initial_package_Makefile_lines__GitHub_release_containing_project_name() {
+ my $url = "https://github.com/org/proj/releases/download/1.0.0/proj.zip";
+
+ my @lines = generate_initial_package_Makefile_lines($url);
+
+ is_deeply(\@lines, [
+ "# \$" . "NetBSD\$",
+ "",
+ "DISTNAME=\tproj",
+ "CATEGORIES=\tpkgtools",
+ "MASTER_SITES=\t\${MASTER_SITE_GITHUB:=org/}",
+ "GITHUB_RELEASE=\t1.0.0",
+ "EXTRACT_SUFX=\t.zip",
+ "",
+ "MAINTAINER=\tINSERT_YOUR_MAIL_ADDRESS_HERE",
+ "HOMEPAGE=\thttps://github.com/org/proj/",
+ "COMMENT=\tTODO: Short description of the package",
+ "#LICENSE=\t# TODO: (see mk/license.mk)",
+ "",
+ "# url2pkg-marker (please do not remove this line.)",
+ ".include \"../../mk/bsd.pkg.mk\""
+ ]);
+}
+
+sub test_generate_initial_package_Makefile_lines__GitHub_release_not_containing_project_name() {
+ my $url = "https://github.com/org/proj/releases/download/1.0.0/data.zip";
+
+ my @lines = generate_initial_package_Makefile_lines($url);
+
+ is_deeply(\@lines, [
+ "# \$" . "NetBSD\$",
+ "",
+ "GITHUB_PROJECT=\tproj",
+ "DISTNAME=\tdata",
+ "CATEGORIES=\tpkgtools",
+ "MASTER_SITES=\t\${MASTER_SITE_GITHUB:=org/}",
+ "GITHUB_RELEASE=\t1.0.0",
+ "EXTRACT_SUFX=\t.zip",
+ "DIST_SUBDIR=\t\${GITHUB_PROJECT}",
+ "",
+ "MAINTAINER=\tINSERT_YOUR_MAIL_ADDRESS_HERE",
+ "HOMEPAGE=\thttps://github.com/org/proj/",
+ "COMMENT=\tTODO: Short description of the package",
+ "#LICENSE=\t# TODO: (see mk/license.mk)",
+ "",
+ "# url2pkg-marker (please do not remove this line.)",
+ ".include \"../../mk/bsd.pkg.mk\""
+ ]);
+}
+
sub test_all() {
my $pkgsrcdir = $ENV{"PKGSRCDIR"} or die;
chdir("$pkgsrcdir/pkgtools/url2pkg") or die;
@@ -118,7 +168,9 @@ sub test_all() {
test_lines_append__only_comment();
test_lines_append__value_with_comment();
test_lines_append__value_without_comment();
- test_generate_initial_package_Makefile_lines__GitHub();
+ test_generate_initial_package_Makefile_lines__GitHub_archive();
+ test_generate_initial_package_Makefile_lines__GitHub_release_containing_project_name();
+ test_generate_initial_package_Makefile_lines__GitHub_release_not_containing_project_name();
done_testing();
}
Home |
Main Index |
Thread Index |
Old Index