pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/url2pkg



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Sep 12 18:23:00 UTC 2019

Modified Files:
        pkgsrc/pkgtools/url2pkg: Makefile PLIST
        pkgsrc/pkgtools/url2pkg/files: MakeMaker.pm url2pkg.pl url2pkg.t
Added Files:
        pkgsrc/pkgtools/url2pkg/files: Build.pm

Log Message:
pkgtools/url2pkg: update to 2.36

Changes since 2.35:

* Added support for Module::Build Perl modules.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.4 -r1.5 pkgsrc/pkgtools/url2pkg/PLIST
cvs rdiff -u -r0 -r1.1 pkgsrc/pkgtools/url2pkg/files/Build.pm
cvs rdiff -u -r1.10 -r1.11 pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm
cvs rdiff -u -r1.69 -r1.70 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl
cvs rdiff -u -r1.9 -r1.10 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/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.99 pkgsrc/pkgtools/url2pkg/Makefile:1.100
--- pkgsrc/pkgtools/url2pkg/Makefile:1.99       Thu Sep 12 05:49:03 2019
+++ pkgsrc/pkgtools/url2pkg/Makefile    Thu Sep 12 18:23:00 2019
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.99 2019/09/12 05:49:03 rillig Exp $
+# $NetBSD: Makefile,v 1.100 2019/09/12 18:23:00 rillig Exp $
 
-PKGNAME=       url2pkg-2.35
+PKGNAME=       url2pkg-2.36
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost
@@ -34,6 +34,7 @@ SUBST_SED.up+=                -e 's,@PKGSRCDIR@,${BATC
 do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/url2pkg.pl ${DESTDIR}${PREFIX}/bin/url2pkg
        ${INSTALL_MAN} ${FILESDIR}/url2pkg.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
+       ${INSTALL_DATA} ${WRKSRC}/Build.pm ${DESTDIR}${PREFIX}/lib/url2pkg/Module/
        ${INSTALL_DATA} ${WRKSRC}/MakeMaker.pm ${DESTDIR}${PREFIX}/lib/url2pkg/ExtUtils/
        ${INSTALL_DATA} ${WRKSRC}/setuptools.py ${DESTDIR}${PREFIX}/lib/url2pkg/
 

Index: pkgsrc/pkgtools/url2pkg/PLIST
diff -u pkgsrc/pkgtools/url2pkg/PLIST:1.4 pkgsrc/pkgtools/url2pkg/PLIST:1.5
--- pkgsrc/pkgtools/url2pkg/PLIST:1.4   Sun Aug 18 11:26:33 2019
+++ pkgsrc/pkgtools/url2pkg/PLIST       Thu Sep 12 18:23:00 2019
@@ -1,5 +1,6 @@
-@comment $NetBSD: PLIST,v 1.4 2019/08/18 11:26:33 rillig Exp $
+@comment $NetBSD: PLIST,v 1.5 2019/09/12 18:23:00 rillig Exp $
 bin/url2pkg
 lib/url2pkg/ExtUtils/MakeMaker.pm
+lib/url2pkg/Module/Build.pm
 lib/url2pkg/setuptools.py
 man/man8/url2pkg.8

Index: pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm
diff -u pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm:1.10 pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm:1.11
--- pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm:1.10     Wed Sep 11 05:25:55 2019
+++ pkgsrc/pkgtools/url2pkg/files/MakeMaker.pm  Thu Sep 12 18:23:00 2019
@@ -1,6 +1,6 @@
 # -*-perl-*-
 
-# Copyright (c) 2010 The NetBSD Foundation, Inc.
+# Copyright (c) 2010, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@ package ExtUtils::MakeMaker;
 require 5.013002;
 
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
 my $url2pkg_pkgsrcdir = '@PKGSRCDIR@';
 

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.pl
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.69 pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.70
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.pl:1.69       Thu Sep 12 05:56:59 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.pl    Thu Sep 12 18:23:00 2019
@@ -1,5 +1,5 @@
 #! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.69 2019/09/12 05:56:59 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.70 2019/09/12 18:23:00 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -134,10 +134,10 @@ sub lines_set($$$) {
 
        my $i = 0;
        foreach my $line (@$lines) {
-               if ($line =~ qr"^\Q$varname\E(\+?=)([ \t]+)([^#\\]*?)(\s*)(#.*|)$") {
+               if ($line =~ qr"^#?\Q$varname\E(\+?=)([ \t]+)([^#\\]*?)(\s*)(#.*|)$") {
                        my ($op, $indent, $old_value, $space_after_value, $comment) = ($1, $2, $3, $4, $5);
 
-                       $lines->[$i] = "$varname$op$indent$new_value$space_after_value$comment";
+                       $lines->[$i] = "$varname$op$indent$new_value";
                        return true;
                }
                $i++;
@@ -208,7 +208,7 @@ sub lines_remove_if($$$) {
 sub lines_index($$) {
        my ($lines, $re) = @_;
 
-       foreach my $i (0..$#$lines) {
+       foreach my $i (0 .. $#$lines) {
                return $i if $lines->[$i] =~ $re;
        }
        return -1;
@@ -275,11 +275,14 @@ our @build_vars;
 # the Makefile, thereby forming the fifth paragraph.
 our @extra_vars;
 
+# variables from the initial Makefile whose values are replaced
+our %update_vars;
+
 # these are inserted below the second paragraph in the Makefile.
 our @todos;
 
 # the package name is $pkgname_prefix${DISTNAME$pkgname_transform}.
-our $pkgname_prefix = "";  # example: ${PYPKGPREFIX}-
+our $pkgname_prefix = "";     # example: ${PYPKGPREFIX}-
 our $pkgname_transform = "";  # example: :S,-v,-,
 
 our $regenerate_distinfo = false;
@@ -326,9 +329,15 @@ sub read_dependencies($$$) {
        while (defined (my $line = <DEPS>)) {
                chomp($line);
 
-               next unless $line =~ qr"^(\w+)\t([^\s:>]+)(>[^\s:]+|)(?::(\.\./\.\./\S+))?$";
-               push(@dep_lines, [$1, $2, $3 || ">=0", $4 || ""]);
+               if ($line =~ qr"^(\w+)\t([^\s:>]+)(>[^\s:]+|)(?::(\.\./\.\./\S+))?$") {
+                       push(@dep_lines, [ $1, $2, $3 || ">=0", $4 || "" ]);
+               } elsif ($line =~ qr"^var\t(\S+)\t(.+)$") {
+                       $main::update_vars{$1} = $2;
+               } else {
+                       printf STDERR "url2pkg: unknown dependency line: %s\n", $line;
+               }
        }
+
        close(DEPS) or die;
 
        foreach my $dep_line (@dep_lines) {
@@ -401,9 +410,7 @@ sub adjust_libtool() {
 # devel/p5-Algorithm-CheckDigits
 sub adjust_perl_module_Build_PL() {
 
-       # TODO: Implement this similarly to the Makefile.PL mock below.
-
-       push(@todos, "Look for the dependencies in Build.PL.");
+       read_dependencies("cd '$abs_wrksrc' && perl -I$libdir -I. Build.PL", {}, "");
 
        push(@build_vars, var("PERL5_MODULE_TYPE", "=", "Module::Build"));
 }
@@ -448,7 +455,7 @@ sub adjust_python_module() {
        my $cmd = "cd '$abs_wrksrc' && $pythonbin setup.py build";
        my $env = {
                "PYTHONDONTWRITEBYTECODE" => "x",
-               "PYTHONPATH" => $libdir
+               "PYTHONPATH"              => $libdir
        };
        read_dependencies($cmd, $env, "py-");
 
@@ -709,8 +716,7 @@ sub adjust_lines_python_module($$) {
        }
 }
 
-sub adjust_package_from_extracted_distfiles($)
-{
+sub adjust_package_from_extracted_distfiles($) {
        my ($url) = @_;
 
        chomp($abs_wrkdir = `$make show-var VARNAME=WRKDIR`);
@@ -758,8 +764,6 @@ sub adjust_package_from_extracted_distfi
 
        print("url2pkg> Adjusting the Makefile\n");
 
-       my $seen_marker = false;
-
        my @prev_lines = read_lines("Makefile");
        my $marker_index = lines_index(\@prev_lines, qr"^# url2pkg-marker");
        if ($marker_index == -1) {
@@ -801,6 +805,10 @@ sub adjust_package_from_extracted_distfi
 
        adjust_lines_python_module(\@lines, $url);
 
+       foreach my $varname (keys %update_vars) {
+               lines_set(\@lines, $varname, $update_vars{$varname});
+       }
+
        write_lines("Makefile", @lines);
 
        if ($regenerate_distinfo) {

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.t
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.9 pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.10
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.t:1.9 Thu Sep 12 05:45:34 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.t     Thu Sep 12 18:23:00 2019
@@ -1,5 +1,5 @@
 # -*- perl -*-
-# $NetBSD: url2pkg.t,v 1.9 2019/09/12 05:45:34 rillig Exp $
+# $NetBSD: url2pkg.t,v 1.10 2019/09/12 18:23:00 rillig Exp $
 
 require "url2pkg.pl";
 
@@ -83,6 +83,22 @@ sub test_lines_append__value_without_com
        is_deeply($lines, ["VARNAME+=\tvalue appended"]);
 }
 
+sub test_lines_set__previously_with_comment() {
+       my $lines = ["LICENSE=\t# TODO: see mk/license.mk"];
+
+       lines_set($lines, "LICENSE", "\${PERL5_LICENSE}");
+
+       is_deeply($lines, ["LICENSE=\t\${PERL5_LICENSE}"]);
+}
+
+sub test_lines_set__not_found() {
+       my $lines = ["OLD_VAR=\told value # old comment"];
+
+       lines_set($lines, "NEW_VAR", "new value");
+
+       is_deeply($lines, ["OLD_VAR=\told value # old comment"]);
+}
+
 sub test_lines_index() {
        my $lines = ["1", "2", "345"];
 
@@ -243,6 +259,7 @@ sub set_up_test() {
        @main::includes = ();
        @main::build_vars = ();
        @main::extra_vars = ();
+       %main::update_vars = ();
        @main::todos = ();
 
        $main::pkgname_prefix = "";

Added files:

Index: pkgsrc/pkgtools/url2pkg/files/Build.pm
diff -u /dev/null pkgsrc/pkgtools/url2pkg/files/Build.pm:1.1
--- /dev/null   Thu Sep 12 18:23:00 2019
+++ pkgsrc/pkgtools/url2pkg/files/Build.pm      Thu Sep 12 18:23:00 2019
@@ -0,0 +1,89 @@
+# -*-perl-*-
+
+# Copyright (c) 2019 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Roland Illig.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# This is a drop-in replacement for the Module::Build Perl module. Instead
+# of generating a Makefile, it extracts the dependency information for
+# other Perl modules. It is used to simplify the generation of pkgsrc
+# packages for Perl modules.
+
+package Module::Build;
+
+use strict;
+use warnings FATAL => 'all';
+
+our $VERSION = 0.4224; # from Perl-5.30
+
+sub url2pkg_write_dependencies($$$) {
+       my ($self, $varname, $key) = @_;
+       return unless defined $self->{$key};
+
+       my $deps = $self->{$key};
+       foreach my $item (keys %$deps) {
+               my $pkgbase = "p5-$item" =~ s/::/-/gr;
+               printf("%s\t%s>=%s\n", $varname, $pkgbase, $deps->{$item});
+       }
+}
+
+sub url2pkg_write_var($$$) {
+       my ($self, $varname, $value) = @_;
+       return unless defined($value) && $value ne "";
+       printf("var\t%s\t%s\n", $varname, $value);
+}
+
+sub VERSION($$) {
+       my ($class, $min_version) = @_;
+       return $min_version <= $VERSION;
+}
+
+sub new(%) {
+       my ($class, %args) = @_;
+       my $self = \%args;
+       bless($self, $class);
+       return $self;
+}
+
+sub create_build_script($) {
+       my ($self) = @_;
+
+       $self->url2pkg_write_dependencies("BUILD_DEPENDS", "configure_requires");
+       $self->url2pkg_write_dependencies("BUILD_DEPENDS", "build_requires");
+       $self->url2pkg_write_dependencies("DEPENDS", "requires");
+       $self->url2pkg_write_dependencies("TEST_DEPENDS", "test_requires");
+       $self->url2pkg_write_dependencies("#RECOMMENDS", "recommends");
+
+       $self->url2pkg_write_var("COMMENT", $self->{"dist_abstract"});
+       my $license = $self->{"license"} || "";
+       if ($license eq "perxl") {
+               $self->url2pkg_write_var("LICENSE", "\${PERL5_LICENSE}");
+       } elsif ($license ne "") {
+               $self->url2pkg_write_var("#LICENSE", "# TODO: $license (from Build.PL)")
+       }
+}
+
+1;



Home | Main Index | Thread Index | Old Index