[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!perl -w 2 use strict; 3 4 my $dbixs_rev_file = "dbixs_rev.h"; 5 6 my $is_make_dist; 7 my $svnversion; 8 9 if (is_dbi_svn_dir(".")) { 10 $svnversion = `svnversion -n`; 11 } 12 elsif (is_dbi_svn_dir("..")) { 13 # presumably we're in a subdirectory because the user is doing a 'make dist' 14 $svnversion = `svnversion -n ..`; 15 $is_make_dist = 1; 16 } 17 else { 18 # presumably we're being run by an end-user because their file timestamps 19 # got messed up 20 print "Skipping regeneration of $dbixs_rev_file\n"; 21 utime(time(), time(), $dbixs_rev_file); # update modification time 22 exit 0; 23 } 24 25 my @warn; 26 die "Neither current directory nor parent directory are an svn working copy\n" 27 unless $svnversion and $svnversion =~ m/^\d+/; 28 push @warn, "Mixed revision working copy ($svnversion:$1)" 29 if $svnversion =~ s/:(\d+)//; 30 push @warn, "Code modified since last checkin" 31 if $svnversion =~ s/[MS]+$//; 32 warn "$dbixs_rev_file warning: $_\n" for @warn; 33 die "$0 failed\n" if $is_make_dist && @warn; 34 35 write_header($dbixs_rev_file, DBIXS_REVISION => $svnversion, \@warn); 36 37 sub write_header { 38 my ($file, $macro, $version, $comments_ref) = @_; 39 open my $fh, ">$file" or die "Can't open $file: $!\n"; 40 unshift @$comments_ref, scalar localtime(time); 41 print $fh "/* $_ */\n" for @$comments_ref; 42 print $fh "#define $macro $version\n"; 43 close $fh or die "Error closing $file: $!\n"; 44 print "Wrote $macro $version to $file\n"; 45 } 46 47 sub is_dbi_svn_dir { 48 my ($dir) = @_; 49 return (-d "$dir/.svn" && -f "$dir/MANIFEST.SKIP"); 50 } 51
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |