On Sat Mar 29 14:27:53 2008, [EMAIL PROTECTED] wrote: > > Remove the commented-out code and +1 from me. > > -- c >
The attached patch removes the commented-out code. Coke: Since I originally proposed this patch, other folks have made modifications to lib/Parrot/Revision.pm which head in a different direction, i.e., making more modifications to the code relating to the other VCSes, rather than stripping it out. So I think you'll have to make one of your famous executive decisions ;-) as to how to proceed. Thank you very much. kid51
Index: tools/build/revision_c.pl =================================================================== --- tools/build/revision_c.pl (revision 26731) +++ tools/build/revision_c.pl (working copy) @@ -1,39 +0,0 @@ -# Copyright (C) 2001-2007, The Perl Foundation. -# $Id$ - -=head1 NAME - -tools/build/revision_c.pl - -=head1 DESCRIPTION - -Creates F<src/revision.c> with current rev number taken from -F<.svn/entries> or F<.svk/entries> and config rev number of last -Parrot configure run. - -=head1 SEE ALSO - -F<config/gen/revision.pl>, -F<lib/Parrot/Revision.pm>, -F<include/parrot/config.h> - -=cut - -use warnings; -use strict; -use lib qw{lib . ../lib ../../ lib}; -use Parrot::Revision::Utils qw( - get_revision_numbers - print_src_revision_c -); - -my ($current, $config) = get_revision_numbers(); - -print_src_revision_c($current, $config, $0); - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: MANIFEST =================================================================== --- MANIFEST (revision 26731) +++ MANIFEST (working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Thu Apr 3 20:06:46 2008 UT +# generated by tools/dev/mk_manifest_and_skip.pl Fri Apr 4 00:29:11 2008 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -2499,7 +2499,6 @@ lib/Parrot/Pmc2c/UtilFunctions.pm [devel] lib/Parrot/Pmc2c/VTable.pm [devel] lib/Parrot/Revision.pm [devel] -lib/Parrot/Revision/Utils.pm [devel] lib/Parrot/Test.pm [devel] lib/Parrot/Test/APL.pm [devel] lib/Parrot/Test/Cardinal.pm [devel] @@ -3302,8 +3301,6 @@ t/pmc/vtablecache.t [] t/postconfigure/01-options.t [] t/postconfigure/02-data_slurp.t [] -t/postconfigure/03-revision.t [] -t/postconfigure/04-revision.t [] t/postconfigure/05-trace.t [] t/postconfigure/06-data_slurp_temp.t [] t/run/README [] @@ -3562,8 +3559,6 @@ t/tools/pmc2cutils/07-open_file.t [] t/tools/pmc2cutils/08-pmc-pm.t [] t/tools/pmc2cutils/README [] -t/tools/revision/01-get_revision_numbers.t [] -t/tools/revision/02-print_src.t [] t/tools/smartlinks.t [] tools/build/addopstags.pl [] tools/build/c2str.pl [] @@ -3579,7 +3574,6 @@ tools/build/pbc2c.pl [devel] tools/build/pbcversion_h.pl [] tools/build/pmc2c.pl [] -tools/build/revision_c.pl [devel] tools/build/vtable_extend.pl [] tools/build/vtable_h.pl [] tools/dev/.gdbinit [devel] Index: lib/Parrot/Revision/Utils.pm =================================================================== --- lib/Parrot/Revision/Utils.pm (revision 26731) +++ lib/Parrot/Revision/Utils.pm (working copy) @@ -1,197 +0,0 @@ -# Copyright (C) 2001-2008, The Perl Foundation. -# $Id$ -package Parrot::Revision::Utils; -use strict; -use warnings; -use lib qw( lib ); -use Parrot::Revision; -use base qw( Exporter ); -our @EXPORT_OK = qw( - get_revision_numbers - print_src_revision_c -); - -sub get_revision_numbers { - my $current = 0; - my $config = 0; - if (-e 'DEVELOPING') { - $current = $Parrot::Revision::current; - eval 'use Parrot::Config; $config = $PConfig{revision};'; - } - return ($current, $config); -} - -sub print_src_revision_c { - my ($current, $config, $script) = @_; - print <<"EOF"; -/* ex: set ro: - * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! - * - * This file is generated automatically by $script. - * - * Any changes made here will be lost! - * - */ - -/* HEADERIZER HFILE: none */ -/* HEADERIZER STOP */ - -#include "parrot/config.h" - -/* also in "parrot/embed.h" */ -PARROT_API int Parrot_revision(void); -/* also in "parrot/misc.h" */ -PARROT_API int Parrot_config_revision(void); - -int Parrot_revision(void) -{ - return $current; -} - -int Parrot_config_revision(void) -{ - return $config; -} - -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */ -EOF - return 1; -} - -1; - -#################### DOCUMENTATION #################### - -=head1 NAME - -Parrot::Revision::Utils - Subroutines used in -F<tools/build/revision_c.pl>. - -=head1 SYNOPSIS - - use Parrot::Revision::Utils qw( - get_revision_numbers - print_src_revision_c - ); - - ($current, $config) = get_revision_numbers(); - - print_src_revision_c($current, $config, $script); - -=head1 DESCRIPTION - -Parrot::Revision::Utils exports on demand two subroutines, -C<get_revision_numbers()> and C<print_src_revision_c()> which are used -in F<tools/build/revision_c.pl>, a Perl 5 program invoked by Parrot's -F<make> program to generate file F<src/revision.c>. That file, in turn, -provides C function C<Parrot_revision()>. - -=head1 SUBROUTINES - -=head2 C<get_revision_numbers()> - - ($current, $config) = get_revision_numbers(); - -=over 4 - -=item * Purpose - -Provide two Parrot repository revision numbers: the first being the -revision number the last time the user made a commit or an update; the -second being the revision number at which the user last ran -F<Configure.pl>. - -=item * Arguments - -None. - -=item * Return Values - -Two-argument list: - -=over 4 - -=item 1 C<current> - -The Parrot repository revision number at which the user last made a -commit or an update. - -=item 2 C<config> - -The Parrot repository revision number prevailing when the user last ran -F<Configure.pl>. - -=back - -=item * Comment - -If the user follows this sequence: - - svn update - perl Configure.pl - make - -... then, the values for C<current> and C<config> at the point at which -F<make> invokes F<tools/build/revision_c.pl> will be identical. - -If, however, the user follows a sequence like this: - - svn update - perl Configure.pl - # some time passes and the repository revision number increases - svn update - make - -... then, the values for C<current> and C<config> at the point at which -F<make> invokes F<tools/build/revision_c.pl> will differ. - -=back - -=head2 C<print_src_revision_c()> - - print_src_revision_c($current, $config, $0); - -=over 4 - -=item * Purpose - -Prints the text for F<src/revision.c>. - -=item * Arguments - -Three-argument list: C<current> and C<config> as returned by -C<get_revision_numbers()> (above) and the name of the current script -(typically supplied by C<$0>). - -=item * Return Values - -True value. - -=item * Comment - -Output goes to C<STDOUT>. F<make> redirects this to F<src/revision.c>. - -=back - -=head1 NOTES - -The functionality in this package was transferred from -F<tools/build/revision_c.pl> by James E Keenan. - -=head1 SEE ALSO - -F<lib/Parrot/Revision.pm>, F<tools/build/revision_c.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: lib/Parrot/Revision.pm =================================================================== --- lib/Parrot/Revision.pm (revision 26731) +++ lib/Parrot/Revision.pm (working copy) @@ -29,7 +29,7 @@ sub _get_revision { my $revision; - if (-f $cache and ! -f 'Makefile') { + if (-f $cache) { eval { open my $FH, "<", $cache; chomp($revision = <$FH>); @@ -40,7 +40,7 @@ $revision = _analyze_sandbox(); - if (! -f $cache and ! -f 'Makefile') { + if (! -f $cache) { eval { open my $FH, ">", $cache; print $FH "$revision\n"; @@ -59,29 +59,6 @@ ($revision) = $line =~ /(\d+)/; } } - elsif ( -d '.git' && (my @git_info = qx/git log -1 --grep=^git-svn-id: 2>$nul/ and $? == 0) ) { - ($revision) = - $git_info[-1] =~ m[git-svn-id: https?://svn.perl.org/parrot.*?@(\d+) ]; - } - elsif ( my @svk_info = qx/svk info 2>$nul/ and $? == 0 ) { - if ( my ($line) = grep /(?:file|svn|https?)\b/, @svk_info ) { - ($revision) = $line =~ / (\d+)$/; - } - elsif ( my ($source_line) = grep /^(Copied|Merged) From/, @svk_info ) { - if ( my ($source_depot) = $source_line =~ /From: (.*?), Rev\. \d+/ ) { - - # convert /svk/trunk to //svk/trunk or /depot/svk/trunk - my ($depot_root) = map { m{Depot Path: (/[^/]*)} } @svk_info; - $depot_root ||= q{/}; - $source_depot = $depot_root . $source_depot; - if ( my @svk_info = qx/svk info $source_depot/ and $? == 0 ) { - if ( my ($line) = grep /(?:file|svn|https?)\b/, @svk_info ) { - ($revision) = $line =~ / (\d+)$/; - } - } - } - } - } return $revision; } Index: compilers/imcc/main.c =================================================================== --- compilers/imcc/main.c (revision 26731) +++ compilers/imcc/main.c (working copy) @@ -225,9 +225,7 @@ =item C<static void Parrot_version> -Print out parrot version number and copyright message. Include warning if -configuration and build were done at different revision numbers (applies only -when working from repository -- not from release versions). +Print out parrot version number. =cut @@ -236,19 +234,8 @@ static void Parrot_version(PARROT_INTERP) { - int rev; printf("This is parrot version " PARROT_VERSION); - rev = Parrot_revision(); - if (rev != 0) - printf(" (r%d)", PARROT_REVISION); printf(" built for " PARROT_ARCHNAME ".\n"); - if (rev != 0 && PARROT_REVISION != rev) { - printf("Warning: runtime has revision %d!\n", rev); - } - rev = Parrot_config_revision(); - if (rev != 0 && PARROT_REVISION != rev) { - printf("Warning: used Configure.pl revision %d!\n", rev); - } printf("Copyright (C) 2001-2008, The Perl Foundation.\n\ \n\ This code is distributed under the terms of the Artistic License 2.0.\ Index: t/configure/018-revision_to_cache.t =================================================================== --- t/configure/018-revision_to_cache.t (revision 26731) +++ t/configure/018-revision_to_cache.t (working copy) @@ -31,7 +31,7 @@ require Parrot::Revision; no warnings 'once'; like($Parrot::Revision::current, qr/^\d+$/, - "Got numeric value for reversion number"); + "Got numeric value for revision number"); use warnings; my $cache = q{.parrot_current_rev}; ok( ( -e $cache ), "Cache for revision number was created"); Index: t/postconfigure/03-revision.t =================================================================== --- t/postconfigure/03-revision.t (revision 26731) +++ t/postconfigure/03-revision.t (working copy) @@ -1,90 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# 03-revision.t - -use strict; -use warnings; - -use Test::More; -plan( skip_all => "\nRelevant only when working in checkout from repository and after configuration" ) - unless (-e 'DEVELOPING' and -e 'Makefile'); -plan( tests => 8 ); -use Carp; -use Cwd; -use File::Copy; -use File::Path (); -use File::Temp qw| tempdir |; -use lib qw( lib ); - -my $cwd = cwd(); -{ - my $rev = 16000; - my $tdir = tempdir( CLEANUP => 1 ); - ok( chdir $tdir, "Changed to temporary directory for testing" ); - my $libdir = qq{$tdir/lib}; - ok( (File::Path::mkpath( $libdir )), "Able to make libdir"); - local @INC; - unshift @INC, $libdir; - ok( (File::Path::mkpath( qq{$libdir/Parrot} )), "Able to make Parrot dir"); - ok( (copy qq{$cwd/lib/Parrot/Revision.pm}, - qq{$libdir/Parrot}), "Able to copy Parrot::Revision"); - my $cache = q{.parrot_current_rev}; - open my $FH, ">", $cache - or croak "Unable to open $cache for writing"; - print $FH qq{$rev\n}; - close $FH or croak "Unable to close $cache after writing"; - my $mtime_before = (stat($rev))[9]; - my $mkfl = 'Makefile'; - open my $MK, ">", $mkfl - or croak "Unable to open $mkfl for writing"; - print $MK qq{'make' is your friend\n}; - close $MK or croak "Unable to close $mkfl after writing"; - require Parrot::Revision; - no warnings 'once'; - like($Parrot::Revision::current, qr/^\d+$/, - "Got numeric value for reversion number"); - use warnings; - my $mtime_after = (stat($rev))[9]; - is($mtime_before, $mtime_after, - "Revision number cache file correctly untouched"); - - unlink qq{$libdir/Parrot/Revision.pm} - or croak "Unable to delete file after testing"; - ok( chdir $cwd, "Able to change back to starting directory"); -} - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -03-revision.t - test Parrot::Revision - -=head1 SYNOPSIS - - % prove t/configure/03-revision.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by F<Configure.pl>. - -The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>). - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -Parrot::Configure, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: t/postconfigure/04-revision.t =================================================================== --- t/postconfigure/04-revision.t (revision 26731) +++ t/postconfigure/04-revision.t (working copy) @@ -1,80 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# 04-revision.t - -use strict; -use warnings; - -use Test::More; -plan( skip_all => "Relevant only when working in checkout from repository and after configuration" ) - unless (-e 'DEVELOPING' and -e 'Makefile'); -plan( tests => 7 ); -use Carp; -use Cwd; -use File::Copy; -use File::Path (); -use File::Temp qw| tempdir |; -use lib qw( lib ); - -my $cwd = cwd(); -{ - my $tdir2 = tempdir( CLEANUP => 1 ); - ok( chdir $tdir2, "Changed to temporary directory for testing" ); - my $libdir = qq{$tdir2/lib}; - ok( (File::Path::mkpath( $libdir )), "Able to make libdir"); - local @INC; - unshift @INC, $libdir; - ok( (File::Path::mkpath( qq{$libdir/Parrot} )), "Able to make Parrot dir"); - ok( (copy qq{$cwd/lib/Parrot/Revision.pm}, - qq{$libdir/Parrot}), "Able to copy Parrot::Revision"); - my $mkfl = 'Makefile'; - open my $MK, ">", $mkfl - or croak "Unable to open $mkfl for writing"; - print $MK qq{'make' is your friend\n}; - close $MK or croak "Unable to close $mkfl after writing"; - require Parrot::Revision; - no warnings 'once'; - like($Parrot::Revision::current, qr/^\d+$/, - "Got numeric value for reversion number"); - use warnings; - - unlink qq{$libdir/Parrot/Revision.pm} - or croak "Unable to delete file after testing"; - ok( chdir $cwd, "Able to change back to starting directory"); -} - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -04-revision.t - test Parrot::Revision - -=head1 SYNOPSIS - - % prove t/configure/04-revision.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by F<Configure.pl>. - -The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>). - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -Parrot::Configure, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: Index: t/tools/revision/02-print_src.t =================================================================== --- t/tools/revision/02-print_src.t (revision 26731) +++ t/tools/revision/02-print_src.t (working copy) @@ -1,75 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# 02-print_src.t - -use strict; -use warnings; - -use Test::More tests => 4; -use Carp; -use Cwd; -use File::Path (); -use File::Temp qw( tempdir ); -use lib qw( lib ); -use Parrot::Revision::Utils qw( - print_src_revision_c -); -use IO::CaptureOutput qw| capture |; - -{ - my ($current, $config, $script); - my ($stdout, $rv); - $current = 7399; - $config = 7390; - $script = $0; - - capture ( - sub { $rv = print_src_revision_c($current, $config, $script); }, - \$stdout, - ); - ok($rv, "print_src_revision_c() returned true value"); - like($stdout, - qr/This file is generated automatically by $script/, - "Got expected text" - ); - like($stdout, - qr/return $current.*return $config/s, - "Got expected text" - ); -} - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -02-print_src.t - Test subroutines exported by Parrot::Revision::Utils. - -=head1 SYNOPSIS - - % prove t/tools/revision/02-print_src.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by -F<tools/build/revision_c.pl>, a program invoked by Parrot's F<make>. - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -Parrot::Configure, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: - Index: t/tools/revision/01-get_revision_numbers.t =================================================================== --- t/tools/revision/01-get_revision_numbers.t (revision 26731) +++ t/tools/revision/01-get_revision_numbers.t (working copy) @@ -1,121 +0,0 @@ -#! perl -# Copyright (C) 2007, The Perl Foundation. -# $Id$ -# 01-get_revision_numbers.t - -use strict; -use warnings; - -use Test::More tests => 11; -use Carp; -use Cwd; -use File::Path (); -use File::Temp qw( tempdir ); -use lib qw( lib ); -use Parrot::Revision::Utils qw( - get_revision_numbers -); - -my $cwd = cwd(); -{ - my @testvals = (7399, 7390); - my $tdir1 = tempdir( CLEANUP => 1 ); - ok( (chdir $tdir1), "Changed to temporary directory"); - my $libdir = qq{$tdir1/lib}; - ok( (File::Path::mkpath( $libdir )), "Able to make libdir"); - local @INC; - unshift(@INC, $libdir); - ok( (File::Path::mkpath( qq{$libdir/Parrot} )), "Able to make Parrot dir"); - - my $DEVEL = q{DEVELOPING}; - open my $FH, ">", $DEVEL; - print $FH "Hello world\n"; - close $FH; - - my $rev = qq{$libdir/Parrot/Revision.pm}; - open my $RVS, ">", $rev; - print $RVS <<EOF; -package Parrot::Revision; -use strict; -use base qw( Exporter ); -our [EMAIL PROTECTED] = qw( \$current ); -our \$current = $testvals[0]; -1; -EOF - close $RVS; - do $rev; - - my $conf = qq{$libdir/Parrot/Config.pm}; - open my $MOD, ">", $conf; - print $MOD <<EOF; -package Parrot::Config; -use strict; -use base qw( Exporter ); -our [EMAIL PROTECTED] = qw( \%PConfig ); -our %PConfig; -\$PConfig{revision} = $testvals[1]; -1; -EOF - close $MOD; - do $conf; - - my ($current, $config) = get_revision_numbers(); - is($current, $testvals[0], "Got expected value for current"); - is($config, $testvals[1], "Got expected value for config"); - - foreach my $f ( - q{DEVELOPING}, - qq{$libdir/Parrot/Revision.pm}, - qq{$libdir/Parrot/Config.pm}, - ) { - unlink $f - or croak "Unable to unlink $f from tempdir after testing"; - } - ok( (chdir $cwd), "Able to change back to starting directory"); -} - -{ - my $tdir2 = tempdir( CLEANUP => 1 ); - ok( (chdir $tdir2), "Changed to temporary directory"); - - my ($current, $config) = get_revision_numbers(); - is($current, 0, "Got expected value for current under release"); - is($config, 0, "Got expected value for config under release"); - - ok( (chdir $cwd), "Able to change back to starting directory"); -} - -pass("Completed all tests in $0"); - -################### DOCUMENTATION ################### - -=head1 NAME - -01-get_revision_numbers.t - Test subroutines exported by Parrot::Revision::Utils. - -=head1 SYNOPSIS - - % prove t/tools/revision/01-get_revision_numbers.t - -=head1 DESCRIPTION - -The files in this directory test functionality used by -F<tools/build/revision_c.pl>, a program invoked by Parrot's F<make>. - -=head1 AUTHOR - -James E Keenan - -=head1 SEE ALSO - -Parrot::Configure, F<Configure.pl>. - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: - Index: config/gen/makefiles/root.in =================================================================== --- config/gen/makefiles/root.in (revision 26731) +++ config/gen/makefiles/root.in (working copy) @@ -70,10 +70,6 @@ # source directory SRC_DIR = src -# revision control -#CONDITIONED_LINE(SVN_ENTRIES):[EMAIL PROTECTED]@ -#INVERSE_CONDITIONED_LINE(SVN_ENTRIES):SVN_ENTRIES= - ############################################################################### # # BUILD TOOL CONFIGURATIONS: @@ -200,7 +196,6 @@ lib/Parrot/PMC.pm \ runtime/parrot/include/config.fpmc \ $(SRC_DIR)/platform.c \ - $(SRC_DIR)/revision.c \ #CONDITIONED_LINE(platform_asm): $(SRC_DIR)/platform_asm.s \ $(SRC_DIR)/core_pmcs.c \ CFLAGS \ @@ -444,7 +439,6 @@ $(SRC_DIR)/platform$(O) \ $(SRC_DIR)/pmc_freeze$(O) \ $(SRC_DIR)/pmc$(O) \ - $(SRC_DIR)/revision$(O) \ $(SRC_DIR)/runops_cores$(O) \ $(SRC_DIR)/scheduler$(O) \ $(SRC_DIR)/spf_render$(O) \ @@ -979,9 +973,6 @@ lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(OPS_DIR)/ops.num $(OPS_DIR)/ops.skip $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl $(OPS_FILES) -$(SRC_DIR)/revision.c : $(SVN_ENTRIES) $(BUILD_TOOLS_DIR)/revision_c.pl - $(PERL) -Ilib $(BUILD_TOOLS_DIR)/revision_c.pl > $(SRC_DIR)/revision.c - ############################################################################### # # Examples (Assembly): Index: config/gen/config_h/config_h.in =================================================================== --- config/gen/config_h/config_h.in (revision 26731) +++ config/gen/config_h/config_h.in (working copy) @@ -16,7 +16,6 @@ */ #define PARROT_VERSION "@VERSION@@DEVEL@" -#define PARROT_REVISION @revision@ #define PARROT_CONFIG_DATE "@configdate@" #define PARROT_MAJOR_VERSION @MAJOR@ #define PARROT_MINOR_VERSION @MINOR@