pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg Updated url2pkg to 2.2.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/58d299d996bd
branches:  trunk
changeset: 522227:58d299d996bd
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Dec 06 01:00:41 2006 +0000

description:
Updated url2pkg to 2.2.

Reduced the number of external calls to find(1).

diffstat:

 pkgtools/url2pkg/Makefile         |   4 ++--
 pkgtools/url2pkg/files/url2pkg.pl |  39 +++++++++++++++++++++------------------
 2 files changed, 23 insertions(+), 20 deletions(-)

diffs (109 lines):

diff -r 1d0a2a488ae1 -r 58d299d996bd pkgtools/url2pkg/Makefile
--- a/pkgtools/url2pkg/Makefile Wed Dec 06 00:54:25 2006 +0000
+++ b/pkgtools/url2pkg/Makefile Wed Dec 06 01:00:41 2006 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.45 2006/10/02 19:39:24 rillig Exp $
+# $NetBSD: Makefile,v 1.46 2006/12/06 01:00:41 rillig Exp $
 #
 
-DISTNAME=      url2pkg-2.1
+DISTNAME=      url2pkg-2.2
 CATEGORIES=    pkgtools
 MASTER_SITES=  # none
 DISTFILES=     # none
diff -r 1d0a2a488ae1 -r 58d299d996bd pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Wed Dec 06 00:54:25 2006 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Wed Dec 06 01:00:41 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: url2pkg.pl,v 1.2 2006/10/02 19:39:24 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.3 2006/12/06 01:00:41 rillig Exp $
 #
 
 use strict;
@@ -82,6 +82,7 @@
 #
 
 my ($distname, $abs_wrkdir, $abs_wrksrc);
+my (@wrksrc_files, @wrksrc_dirs);
 my (@depends, @build_depends, @includes, @build_vars, @extra_vars, @todo);
 my ($pkgname);
 
@@ -106,12 +107,14 @@
 }
 
 sub magic_gconf2_schemas() {
-       my $gconf2_files = `cd $abs_wrksrc && find * -type f -name "*.schemas" -o -name "*.schemas.in*" -print 2>/dev/null | sed -e 's|^.*/||' -e 's/.in.in\$//' -e 's/.in\$//'`;
-       if ($gconf2_files =~ qr"\S") {
-               push(@build_vars, ["CONFIGURE_ENV+", "GCONF_SCHEMA_FILE_DIR=\${PREFIX:Q}/share/gconf/schemas/"]);
-               push(@build_vars, ["MAKE_ENV+", "GCONF_SCHEMA_FILE_DIR=\${PREFIX:Q}/share/gconf/schemas/"]);
-               foreach my $f (split(qr"\s+", $gconf2_files)) {
-                       push(@extra_vars, ["GCONF2_SCHEMAS+", $f]);
+       my @gconf2_files = grep(/schemas(?:\.in.*)$/, @wrksrc_files);
+       if (@gconf2_files) {
+               push(@build_vars, ["CONFIGURE_ENV+", "GCONF_SCHEMA_FILE_DIR=\${PREFIX}/share/gconf/schemas/"]);
+               push(@build_vars, ["MAKE_ENV+", "GCONF_SCHEMA_FILE_DIR=\${PREFIX}/share/gconf/schemas/"]);
+               foreach my $f (@gconf2_files) {
+                       if ($f =~ qr"(.*schemas)") {
+                               push(@extra_vars, ["GCONF2_SCHEMAS+", $1]);
+                       }
                }
                push(@includes, "../../devel/GConf2/schemas.mk");
        }
@@ -160,30 +163,27 @@
 }
 
 sub magic_pkg_config() {
-       my $pkg_config_files = `cd $abs_wrksrc && find * -type f -name "*.pc.in" -a ! -name "*-uninstalled.pc.in" -print 2>/dev/null`;
-       if ($pkg_config_files =~ qr"\S") {
+       my @pkg_config_files = grep { /\.pc\.in$/ && ! /-uninstalled\.pc\.in$/ } @wrksrc_files;
+       if (@pkg_config_files) {
                push(@build_vars, ["USE_TOOLS+", "pkg-config"]);
        }
-       foreach my $f (split(qr"\s+", $pkg_config_files)) {
+       foreach my $f (@pkg_config_files) {
                push(@extra_vars, ["PKGCONFIG_OVERRIDE+", $f]);
        }
 }
 
 sub magic_po() {
-       if (`cd $abs_wrksrc && find * -type f -name "*.mo" -o -name "*.gmo" -print 2>/dev/null` =~ qr"\S") {
+       if (grep(/\.g?mo$/, @wrksrc_files)) {
                push(@build_vars, ["USE_PKGLOCALEDIR", "yes"]);
        }
 }
 
 sub magic_use_languages() {
-       my $c_files = `cd $abs_wrksrc && find * -type f -name "*.c" -print 2>/dev/null`;
-       my $cxx_files = `cd $abs_wrksrc && find * -type f "(" -name "*.cpp" -o -name "*.cc" -o -name "*.C" ")" -print 2>/dev/null`;
-       my $f_files = `cd $abs_wrksrc && find * -type f -name "*.f" -print 2>/dev/null`;
        my @languages;
 
-       $c_files =~ qr"\S" and push(@languages, "c");
-       $cxx_files =~ qr"\S" and push(@languages, "c++");
-       $f_files =~ qr"\S" and push(@languages, "fortran");
+       grep(/\.c$/, @wrksrc_files) and push(@languages, "c");
+       grep(/\.(cpp|c\+\+|cxx|cc|C)$/, @wrksrc_files) and push(@languages, "c++");
+       grep(/\.f$/, @wrksrc_files) and push(@languages, "fortran");
 
        my $use_languages = join(" ", @languages);
        if ($use_languages eq "") {
@@ -337,6 +337,9 @@
                $abs_wrksrc = $abs_wrkdir;
        }
 
+       chomp(@wrksrc_files = `cd "${abs_wrkdir}" && find * -type f`);
+       chomp(@wrksrc_dirs = `cd "${abs_wrkdir}" && find * -type d`);
+
        magic_configure();
        magic_gconf2_schemas();
        magic_libtool();
@@ -364,7 +367,7 @@
                }
        }
 
-       if (scalar(@todo) != 0) {
+       if (@todo) {
                foreach my $todo (@todo) {
                        print MF2 ("# TODO: ${todo}\n");
                }



Home | Main Index | Thread Index | Old Index