Gentoo Archives: gentoo-perl

From: antoine.raillon@××××××.net
To: gentoo-perl@l.g.o
Subject: [gentoo-perl] r15 - code
Date: Thu, 12 May 2005 21:57:27
Message-Id: 20050512215631.0189582813B@gredin.dragou.net
1 Author: mcummings
2 Date: 2005-05-11 20:09:08 +0200 (Wed, 11 May 2005)
3 New Revision: 15
4
5 Modified:
6 code/g-cpan.pl
7 Log:
8 fixes packages like Bundle-W3C-Validator/Bundle-W3C-Validator-0.6.5
9
10 Modified: code/g-cpan.pl
11 ===================================================================
12 --- code/g-cpan.pl 2005-05-11 14:44:08 UTC (rev 14)
13 +++ code/g-cpan.pl 2005-05-11 18:09:08 UTC (rev 15)
14 @@ -250,8 +250,17 @@
15
16 # see if an ebuild for $dir exists already. If so, return its name.
17 my $found = '';
18 + # FIXME mcummings
19 + # Still not nice, but here's the deal. The way it was before, when this was being invoked multiple times,
20 + # it was passing through smaller and smaller sets of dirs each pass until it wasn't checking anything
21 + # Broken for some reason - foreach my $sdir (@PORTAGE_DEV_PERL, @OVERLAY_PERLS, @TMP_DEV_PERL_DIRS, $perldev_overlay) {
22 + my @dir_list;
23 + push @dir_list, @PORTAGE_DEV_PERL;
24 + push @dir_list, @OVERLAY_PERLS;
25 + push @dir_list, @TMP_DEV_PERL_DIRS;
26 + push @dir_list, $perldev_overlay;
27 SOURCE_FOLDER:
28 - foreach my $sdir (@PORTAGE_DEV_PERL, @OVERLAY_PERLS, $perldev_overlay, @TMP_DEV_PERL_DIRS) {
29 + foreach my $sdir (@dir_list) {
30 next if not -d $sdir;
31 opendir PDIR, $sdir or fatal(ERR_FOLDER_OPEN, $sdir, $!);
32 while(my $file = readdir PDIR) {
33 @@ -304,20 +313,32 @@
34
35 # FIXME Sniper
36 # not nice construct, put grep inside
37 - foreach my $sdir (@PORTAGE_DEV_PERL, @OVERLAY_PERLS, $perldev_overlay, @TMP_DEV_PERL_DIRS) {
38 +
39 + # FIXME mcummings
40 + # Still not nice, but here's the deal. The way it was before, when this was being invoked multiple times,
41 + # it was passing through smaller and smaller sets of dirs each pass until it wasn't checking anything
42 + # Broken for some reason - foreach my $sdir (@PORTAGE_DEV_PERL, @OVERLAY_PERLS, @TMP_DEV_PERL_DIRS, $perldev_overlay) {
43 + my @dir_list;
44 + push @dir_list, @PORTAGE_DEV_PERL;
45 + push @dir_list, @OVERLAY_PERLS;
46 + push @dir_list, @TMP_DEV_PERL_DIRS;
47 + push @dir_list, $perldev_overlay;
48 + foreach my $sdir (@dir_list) {
49 next if not -d $sdir;
50 # FIXME Sniper
51 # maybee replace fatal by "warn and next folder" ?
52 opendir PDIR, $sdir or fatal(ERR_FOLDER_OPEN, $sdir, $!);
53 while(my $file = readdir PDIR) {
54 - if(lc $file eq $dir) {
55 + next if $file eq ".";
56 + next if $file eq "..";
57 + if(lc $file eq $dir ) {
58 $sdir =~ s/.*\///;
59 - $found = "$sdir/$found";
60 - close PDIR;
61 - return $found;
62 + $found = "$sdir/$file";
63 + closedir(PDIR);
64 + return($found);
65 }
66 }
67 - closedir PDIR;
68 + closedir(PDIR);
69 }
70 # TODO Sniper
71 # if we are here, $found if undef, what to do ?
72 @@ -372,12 +393,21 @@
73
74 # What to call this ebuild?
75 # CGI::Builder's '1.26+' version breaks portage
76 - unless ( $file =~ m/(.*)\/(.*?)(-?)([0-9\.]+).*\.(?:tar|tgz|zip|bz2|gz)/ ) {
77 + #unless ( $file =~ m/(.*)\/(.*?)(-?)([0-9\.]+).*\.(?:tar|tgz|zip|bz2|gz)/ ) { MPC
78 + unless ( $file =~ m/.*\/.*?-?[0-9\.]+.*\.?:tar|tgz|zip|bz2|gz/ ) {
79 warn("Couldn't turn '$file' into an ebuild name\n");
80 return;
81 }
82
83 - my ( $modpath, $filename, $filenamever ) = ( $1, $2, $4 );
84 + my $re_path = '(?:.*)?';
85 + my $re_pkg = '(?:.*)?';
86 + my $re_ver = '(?:[\d\.]+[a-z]?)?';
87 + my $re_suf = '(?:_(?:alpha|beta|pre|rc|p)(?:\d+)?)?';
88 + my $re_rev = '(?:\-r\d+)?';
89 + my $re_ext = '(?:(?:tar|tgz|zip|bz2|gz|tar\.gz))?';
90 + my $re_file = qr/($re_path)\/($re_pkg)-($re_ver)($re_suf)($re_rev)\.($re_ext)/;
91 + my ( $modpath, $filename, $filenamever, $filesuf, $filerev, $fileext ) = $file =~ /^$re_file/;
92 + #my ( $modpath, $filename, $filenamever ) = ( $1, $2, $4 ); MPC
93
94 # remove underscores
95 $filename =~ tr/A-Za-z0-9\./-/c;
96 @@ -434,7 +464,9 @@
97
98 # remove trailing .pm to fix emerge breakage.
99 $dir =~ s/.pm$//;
100 + print "Testing $dir\n";
101 $dir = build_catdep($dir);
102 + print "Adding $dir unless $first\n";
103 print EBUILD "\n\t" unless $first;
104 print EBUILD "$dir";
105 }
106
107
108 --
109 gentoo-perl@g.o mailing list