[svn:parrot] r48595 - in trunk: config/auto t/steps/auto
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Sun Aug 22 14:38:56 UTC 2010
Author: jkeenan
Date: Sun Aug 22 14:38:55 2010
New Revision: 48595
URL: https://trac.parrot.org/parrot/changeset/48595
Log:
Clean up some internal subroutines used to generate the list of currently active PMCs.
Modified:
trunk/config/auto/pmc.pm
trunk/t/steps/auto/pmc-01.t
Modified: trunk/config/auto/pmc.pm
==============================================================================
--- trunk/config/auto/pmc.pm Sat Aug 21 21:32:42 2010 (r48594)
+++ trunk/config/auto/pmc.pm Sun Aug 22 14:38:55 2010 (r48595)
@@ -36,9 +36,12 @@
sub runstep {
my ( $self, $conf ) = @_;
- my @pmc = sort_pmcs( @{ $self->{srcpmc} } );
-
- my $pmc_list = join( ' ', grep { defined $_ } @pmc );
+ # $pmc_list is a string holding a space-delimited, asciibetically-sorted
+ # list of currently active PMCs.
+ # (By 'current', we take into account the fact that there are PMCs listed
+ # in src/pmc/pmc.num that no longer exist but whose index numbers are
+ # never deleted.)
+ my $pmc_list = get_sorted_pmc_str( @{ $self->{srcpmc} } );
# names of class files for src/pmc/Makefile
( my $TEMP_pmc_o = $pmc_list ) =~ s/\.pmc/\$(O)/g;
@@ -216,23 +219,20 @@
return @parents;
}
+# Internal sub get_pmc_order parses src/pmc/pmc.num. The hash it builds
+# includes both active and deactivated PMCs.
sub get_pmc_order {
open my $IN, '<', 'src/pmc/pmc.num' or die "Can't read src/pmc/pmc.num";
my %order;
while (<$IN>) {
- next if /^#/;
-
- if (/(\w+\.\w+)\s+(\d+)/) {
- $order{$1} = $2;
- }
+ next unless (/^(\w+\.\w+)\s+(\d+)$/);
+ $order{$1} = $2;
}
-
close $IN;
-
return \%order;
}
-sub sort_pmcs {
+sub get_sorted_pmc_str {
my @pmcs = @_;
my $pmc_order = get_pmc_order();
my $n = keys %$pmc_order;
@@ -247,7 +247,9 @@
}
}
- return @sorted_pmcs;
+ # With the test for definedness below, we account for PMCs which have been
+ # deactivated but whose index numbers remain in src/pmc/pmc.num.
+ return join(' ' => grep { defined $_ } @sorted_pmcs);
}
sub contains_pccmethod {
Modified: trunk/t/steps/auto/pmc-01.t
==============================================================================
--- trunk/t/steps/auto/pmc-01.t Sat Aug 21 21:32:42 2010 (r48594)
+++ trunk/t/steps/auto/pmc-01.t Sun Aug 22 14:38:55 2010 (r48595)
@@ -114,7 +114,7 @@
);
my @pmcs = qw| env.pmc default.pmc null.pmc other.pmc |;
- my @sorted_pmcs = auto::pmc::sort_pmcs(@pmcs);
+ my @sorted_pmcs = split / /, auto::pmc::get_sorted_pmc_str(@pmcs);
is_deeply(
\@sorted_pmcs,
[ qw| default.pmc null.pmc env.pmc other.pmc | ],
More information about the parrot-commits
mailing list