From 19ab4074fe365d75d7376aa922b0e8125eb4fcf1 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Sun, 13 Dec 1998 23:24:01 +0000 Subject: [PATCH] Added .log files, and modification date comparison. Should make average case build times unchanged. This is still not enabled. The MRO and sort scripting additions need to be added to the build suite. --- build/mac/MANIFESTO.pm | 67 ++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/build/mac/MANIFESTO.pm b/build/mac/MANIFESTO.pm index 0f10c9e487b8..82bf951f95f5 100644 --- a/build/mac/MANIFESTO.pm +++ b/build/mac/MANIFESTO.pm @@ -4,7 +4,7 @@ package MANIFESTO; require 5.004; require Exporter; -use strict; +#use strict; use vars qw($VERSION @ISA @EXPORT $MANIFESTOLib); use Mac::StandardFile; @@ -60,24 +60,7 @@ sub current_directory() return $current_directory; } -# just like Mac::DoAppleScript, 1 is success, 0 is failure -sub _myDoAppleScript($) -{ - my($script) = @_; - my $asresult = MacPerl::DoAppleScript($script); - if ($asresult eq "0") - { - return 1; - } - else - { - print STDERR "AppleScript error: $asresult\n"; - print STDERR "AppleScript was: \n $script \n"; - return 0; - } -} - -# _useMANIFESTOLib +# _useMANIFESTOLib() # returns 1 on success # Search the include path for the file called MANIFESTOLib sub _useMANIFESTOLib() @@ -116,6 +99,19 @@ sub _useMANIFESTOLib() return 1; } +sub getModificationDate($) { + my($filePath)=@_; + my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath); + return $mtime; +} + +sub setExtension($;$;$) { + my($filePath, $oldExtension, $newExtension)=@_; + my($name, $dir, $type) = fileparse($filePath, $oldExtension); + return "$dir$name$newExtension"; +} + # # ReconcileProject(projectPath, manifestoPath) # @@ -129,14 +125,34 @@ sub ReconcileProject($;$) { my($projectPath, $manifestoPath) = @_; my($sourceTree) = current_directory(); + my($logPath) = setExtension($manifestoPath, ".toc", ".log"); + + print STDERR "# Reconciling Project: $projectPath with $manifestoPath\n"; + + #// compare the modification dates of the .toc and .log files. If .log is newer, do nothing. + if (-e $logPath && getModificationDate($logPath) >= getModificationDate($manifestoPath)) { + print "# Project is up to date.\n"; + return 1; + } _useMANIFESTOLib() || die "Could not load MANIFESTOLib\n"; my $script = <$logPath") || die "can't open log file $logPath."; + print OUTPUT $asresult; + close(OUTPUT); + + return 1; } 1; @@ -144,17 +160,16 @@ END_OF_APPLESCRIPT =head1 NAME -MANIFEST - Scripts to process source MANIFEST files. Really need a better name. +MANIFESTO - Scripts to process source .toc files. =head1 SYNOPSIS - use MacCVS; - $session = MacCVS->new( ) || die "cannot create session"; - $session->checkout([module] [revision] [date]) || die "Could not check out"; + use MANIFESTO; + ReconcileProject(, ) || die "cannot reconcile project"; =head1 DESCRIPTION -This is a PERL interface for talking to MANIFEST AppleScripts. +This is a PERL interface for talking to MANIFESTOLib AppleScripts. =item ReconcileProject ReconcileProject(, );