incubator-rat-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r658858 - in /incubator/rat/main/trunk/scan/src/org/apache/rat/scan: antlib.xml connect.py diff.py
Date Wed, 21 May 2008 20:48:14 GMT
Author: rdonkin
Date: Wed May 21 13:48:13 2008
New Revision: 658858

URL: http://svn.apache.org/viewvc?rev=658858&view=rev
Log:
Exit gracefully on first run

Modified:
    incubator/rat/main/trunk/scan/src/org/apache/rat/scan/antlib.xml
    incubator/rat/main/trunk/scan/src/org/apache/rat/scan/connect.py
    incubator/rat/main/trunk/scan/src/org/apache/rat/scan/diff.py

Modified: incubator/rat/main/trunk/scan/src/org/apache/rat/scan/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/scan/src/org/apache/rat/scan/antlib.xml?rev=658858&r1=658857&r2=658858&view=diff
==============================================================================
--- incubator/rat/main/trunk/scan/src/org/apache/rat/scan/antlib.xml (original)
+++ incubator/rat/main/trunk/scan/src/org/apache/rat/scan/antlib.xml Wed May 21 13:48:13 2008
@@ -79,6 +79,7 @@
             </echo>
             
             <current:AuditSetup/>
+            <mkdir dir='@{result-dir}'/>
             <exec executable="python">
                 <arg path='@{src-dir}/org/apache/rat/scan/connect.py'/>
                 <arg path='@{result-dir}'/>
@@ -119,6 +120,16 @@
             
             <current:AuditSetup/>
             
+            <condition property='org.apache.rat.scan.publish.exists.diff'>
+              <available file='@{input-dir}/${org.apache.rat.scan.name.diff}'/>
+            </condition>
+            
+            <fail unless='org.apache.rat.scan.publish.exists.diff'>
+            Changes file expected at @{input-dir}/${org.apache.rat.scan.name.diff} but is
missing.
+            </fail>
+            
+            <mkdir dir='@{output-dir}'/>
+            
             <delete file="@{input-dir}/${org.apache.rat.scan.name.txt}"/>
             <xslt 
                 style="@{src-dir}/org/apache/rat/scan/summary-txt.xsl" 
@@ -153,4 +164,26 @@
               -->
         </sequential>
     </macrodef>
+    
+    <macrodef 
+      name='Audit'
+      description='Complete audit cycle with standard defaults'>
+      <attribute 
+        name='host'
+        default='apache'/>
+      <attribute
+        name='src'
+        default='src'/>
+      <attribute 
+        name='build-dir'
+        default='target'/>
+      <sequential>
+        <current:DoAudit result-dir='@{build-dir}/rat-scan-results' host='@{host}' src-dir='@{src}'/>
+        <current:PublishAuditReports 
+          input-dir='@{build-dir}/rat-scan-results' 
+          output-dir='@{build-dir}/rat-scan' 
+          src-dir='@{src}'
+          build-dir='@{build-dir}'/>
+      </sequential> 
+    </macrodef>
 </antlib>

Modified: incubator/rat/main/trunk/scan/src/org/apache/rat/scan/connect.py
URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/scan/src/org/apache/rat/scan/connect.py?rev=658858&r1=658857&r2=658858&view=diff
==============================================================================
--- incubator/rat/main/trunk/scan/src/org/apache/rat/scan/connect.py (original)
+++ incubator/rat/main/trunk/scan/src/org/apache/rat/scan/connect.py Wed May 21 13:48:13 2008
@@ -111,5 +111,9 @@
     prefix = base_file_name[0:-14]
     auditor = diff.Auditor(build_dir, prefix)
     auditor.printSignatureChecks()
-    save(diff_file, addPreamble(auditor.latestDiffs()))
+    latestDiffs = auditor.latestDiffs()
+    if latestDiffs == None:
+        print "First run so skipping comparison "
+    else:
+        save(diff_file, addPreamble(latestDiffs))
     
\ No newline at end of file

Modified: incubator/rat/main/trunk/scan/src/org/apache/rat/scan/diff.py
URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/scan/src/org/apache/rat/scan/diff.py?rev=658858&r1=658857&r2=658858&view=diff
==============================================================================
--- incubator/rat/main/trunk/scan/src/org/apache/rat/scan/diff.py (original)
+++ incubator/rat/main/trunk/scan/src/org/apache/rat/scan/diff.py Wed May 21 13:48:13 2008
@@ -197,7 +197,10 @@
                 
     def latestDiffs(self):
         latest = self.latest()
-        return self.diffs(latest[1], latest[0])
+        if len(latest)>1:
+            return self.diffs(latest[1], latest[0])
+        else:
+            return None
         
     def diffs(self, one, two):
         added, removed, modified = one.compare(two)



Mime
View raw message