Skip to content

Commit

Permalink
Item6034: suppress errors on shelling out to SVN to better support au…
Browse files Browse the repository at this point in the history
…to-ports; expose the twikiFilters to subclasses to allow build.pl to extend the filters; perltidy

git-svn-id: http://svn.foswiki.org/trunk@3271 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Mar 25, 2009
1 parent efb482e commit f5bb71e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
47 changes: 27 additions & 20 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -210,16 +210,17 @@ sub new {
$stubpath =~ s/[\\\/]/::/g;

# Get %$RELEASE%
if (-e $this->{pm}) {
if ( -e $this->{pm} ) {
my $fh;
if (open($fh, "<", $this->{pm})) {
if ( open( $fh, "<", $this->{pm} ) ) {
local $/;
my $text = <$fh>;
if ($text =~ /\$RELEASE\s*=\s*(['"])(.*?)\1/) {
if ( $text =~ /\$RELEASE\s*=\s*(['"])(.*?)\1/ ) {
$this->{RELEASE} = $2;
}
}
}

# where data files live
$this->{data_systemdir} =
'data/' . ( ( $targetProject eq 'TWiki' ) ? 'TWiki' : 'System' );
Expand Down Expand Up @@ -307,7 +308,8 @@ sub new {
my $cells =
CGI::th('Name') . CGI::th('Version') . CGI::th('Description');
$this->{DEPENDENCIES} =
CGI::table( { border => 1, class => 'foswikiTable' }, CGI::Tr($cells) . $deptable );
CGI::table( { border => 1, class => 'foswikiTable' },
CGI::Tr($cells) . $deptable );
}

$this->{VERSION} = $this->_get_svn_version();
Expand Down Expand Up @@ -474,8 +476,8 @@ sub _get_svn_version {
my $this = shift;

unless ( $this->{VERSION} ) {
my $max = 0; # max SVN rev no
my $maxd = 0; # max date
my $max = 0; # max SVN rev no
my $maxd = 0; # max date

#Shelling out with a large number of files dies, killing the build.
my $idx = 0;
Expand Down Expand Up @@ -506,25 +508,28 @@ sub _get_svn_version {
}
}
elsif ($getDate
&& $line =~ /^Text Last Updated: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
&& $line =~
/^Text Last Updated: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
{
$maxd = Foswiki::Time::parseTime("$1T$2".($3||''));
$maxd =
Foswiki::Time::parseTime( "$1T$2" . ( $3 || '' ) );
$getDate = 0;
}
elsif ($getDate
&& $line =~ /Last Changed Date: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
&& $line =~
/Last Changed Date: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
{
$maxd = Foswiki::Time::parseTime("$1T$2".($3||''));
$maxd =
Foswiki::Time::parseTime( "$1T$2" . ( $3 || '' ) );
$getDate = 0;
}
}
};
if ($@) {
print STDERR "WARNING: Failed to shell out to svn: $@";
#print STDERR "WARNING: Failed to shell out to svn: $@";
}
}
$this->{DATE} =
Foswiki::Time::formatTime( $maxd, '$iso', 'gmtime' );
$this->{DATE} = Foswiki::Time::formatTime( $maxd, '$iso', 'gmtime' );
my $day = $this->{DATE};
$day =~ s/T.*//;
$this->{VERSION} = "$max ($day)";
Expand Down Expand Up @@ -1410,14 +1415,14 @@ sub _getTopicName {

if ( $topicname =~ m{\d+\.\d+\.\d+} ) {

# Append 'Release' to first (word) part of name if followed by -
$topicname =~ s/^(\w+)\-/${1}Release/;
# Append 'Release' to first (word) part of name if followed by -
$topicname =~ s/^(\w+)\-/${1}Release/;

# Zero-pad numbers to two digits
$topicname =~ s/(\d+)/sprintf("%0.2i",$1)/ge;
# Zero-pad numbers to two digits
$topicname =~ s/(\d+)/sprintf("%0.2i",$1)/ge;

# replace . with x
$topicname =~ s/\./x/g;
# replace . with x
$topicname =~ s/\./x/g;
}

# remove dashes
Expand Down Expand Up @@ -2200,7 +2205,7 @@ sub _addDep {
return '';
}
my @twikiFilters = (
our @twikiFilters = (
{ RE => qr/\.pm$/, filter => '_twikify_perl' },
{ RE => qr#/Config.spec$#, filter => '_twikify_perl' },
{ RE => qr#/MANIFEST$#, filter => '_twikify_manifest' },
Expand Down Expand Up @@ -2259,6 +2264,8 @@ sub _twikify_perl {
$text =~ s/foswiki\([A-Z][A-Za-z]\+\)/twiki$1/g;
$text =~ s/'foswiki'/'twiki'/g;
$text =~ s/FOSWIKI_/TWIKI_/g;
$text =~ s/foswikiNewLink/twikiNewLink/g; # CSS
$text =~ s/new Foswiki/new TWiki/g;
return $text;
}
);
Expand Down
8 changes: 5 additions & 3 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib/BaseBuild.pm
Expand Up @@ -66,6 +66,7 @@ sub readManifest {
my ( $baseDir, $path, $file, $noManifestFileHook ) = @_;
$file ||= '';
$file = $path . $file if $path;

#print STDERR "---- $baseDir, $path, $file\n";

unless ( $file && open( PF, '<' . $file ) ) {
Expand Down Expand Up @@ -98,8 +99,8 @@ sub readManifest {
my $name = $1;
$name =~ s/^"(.*)"$/$1/;
my $permissions = $2;
my $desc = $3 || '';
if ($noci && $desc !~ /\(noci\)/) {
my $desc = $3 || '';
if ( $noci && $desc !~ /\(noci\)/ ) {
$desc .= " (noci)";
}
unless ($permissions) {
Expand All @@ -122,7 +123,8 @@ sub readManifest {
else {
$permissions = '0444';
}
if (-d $baseDir.'/'.$name) {
if ( -d $baseDir . '/' . $name ) {

#default directories to traversable.
$permissions = '0775';
}
Expand Down

0 comments on commit f5bb71e

Please sign in to comment.