You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2012/08/23 14:34:04 UTC

svn commit: r1376463 - in /incubator/ooo/trunk: ext_libraries/ratscan/ ext_libraries/ratscan/prj/ ext_libraries/ratscan/rat/ ext_libraries/ratscan/scan/ main/ main/instsetoo_native/prj/

Author: af
Date: Thu Aug 23 12:34:03 2012
New Revision: 1376463

URL: http://svn.apache.org/viewvc?rev=1376463&view=rev
Log:
#i120637# Added new module ext_libraries/ratscan/ and configure switch --with-rat-scan.

Added:
    incubator/ooo/trunk/ext_libraries/ratscan/
    incubator/ooo/trunk/ext_libraries/ratscan/prj/
    incubator/ooo/trunk/ext_libraries/ratscan/prj/build.lst
    incubator/ooo/trunk/ext_libraries/ratscan/prj/d.lst
    incubator/ooo/trunk/ext_libraries/ratscan/rat/
    incubator/ooo/trunk/ext_libraries/ratscan/rat/makefile.mk
    incubator/ooo/trunk/ext_libraries/ratscan/scan/
    incubator/ooo/trunk/ext_libraries/ratscan/scan/makefile.mk
    incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-output-to-html.xsl
    incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-scan.xml   (with props)
    incubator/ooo/trunk/main/rat-excludes-solver
Modified:
    incubator/ooo/trunk/main/configure.in
    incubator/ooo/trunk/main/external_deps.lst
    incubator/ooo/trunk/main/instsetoo_native/prj/build.lst
    incubator/ooo/trunk/main/set_soenv.in

Added: incubator/ooo/trunk/ext_libraries/ratscan/prj/build.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/prj/build.lst?rev=1376463&view=auto
==============================================================================
--- incubator/ooo/trunk/ext_libraries/ratscan/prj/build.lst (added)
+++ incubator/ooo/trunk/ext_libraries/ratscan/prj/build.lst Thu Aug 23 12:34:03 2012
@@ -0,0 +1,4 @@
+rat     rat : saxon NULL	
+rat     rat          usr1    -	all	rat_mkout NULL
+rat     rat\rat      nmake   -	all	rat_rat NULL
+rat     rat\scan     nmake   -	all	rat_scan rat_rat NULL

Added: incubator/ooo/trunk/ext_libraries/ratscan/prj/d.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/prj/d.lst?rev=1376463&view=auto
==============================================================================
    (empty)

Added: incubator/ooo/trunk/ext_libraries/ratscan/rat/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/rat/makefile.mk?rev=1376463&view=auto
==============================================================================
--- incubator/ooo/trunk/ext_libraries/ratscan/rat/makefile.mk (added)
+++ incubator/ooo/trunk/ext_libraries/ratscan/rat/makefile.mk Thu Aug 23 12:34:03 2012
@@ -0,0 +1,63 @@
+#**************************************************************
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+#**************************************************************
+
+PRJ=..
+
+PRJNAME=ratscan
+TARGET=so_ratscan
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :	settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(RAT_JAR_HOME)"==""
+
+all:
+	@echo "rat scan is disabled."
+
+.ELSE
+
+TARFILE_NAME=apache-rat-incubating-0.8-bin
+TARFILE_MD5=e4244e69eb3644e71c254aea5952a918
+TARFILE_ROOTDIR=apache-rat-0.8
+
+# Trigger unpacking of archive.
+PATCH_FILES=
+
+CONFIGURE_DIR=
+CONFIGURE_ACTION=
+CONFIGURE_FLAGS=
+
+BUILD_DIR=
+BUILD_ACTION=echo no building necessary
+BUILD_FLAGS=
+
+OUT2CLASS=apache-rat-0.8.jar
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : set_ext.mk
+.INCLUDE : target.mk
+.INCLUDE : tg_ext.mk
+
+.ENDIF

Added: incubator/ooo/trunk/ext_libraries/ratscan/scan/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/scan/makefile.mk?rev=1376463&view=auto
==============================================================================
--- incubator/ooo/trunk/ext_libraries/ratscan/scan/makefile.mk (added)
+++ incubator/ooo/trunk/ext_libraries/ratscan/scan/makefile.mk Thu Aug 23 12:34:03 2012
@@ -0,0 +1,57 @@
+#**************************************************************
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+#**************************************************************
+
+PRJ=..
+
+.INCLUDE :	settings.mk
+
+.IF "$(RAT_JAR_HOME)"=="BUILD"
+rat_jar_home=$(CLASSDIR)
+.ELSE
+rat_jar_home=$(RAT_JAR_HOME)
+.ENDIF
+.IF "$(OS)"=="WNT"
+rat_jar_home!:=$(shell cygpath -u $(rat_jar_home))
+.ENDIF
+
+rat_scan_output:=$(MISC)/rat-output.xml
+.IF "$(OS)"=="WNT"
+rat_scan_output!:=$(shell cygpath -m $(rat_scan_output))
+.ENDIF
+
+all : $(MISC)/aoo-3.4.1_rat-scan-output.html
+
+show-excludes .PHONY : $(MISC)/excluded-files.txt
+
+$(MISC)/aoo-3.4.1_rat-scan-output.html : $(MISC)/rat-scan-output.xml
+	java -jar $(OUTDIR)/bin/saxon9.jar -t -s:$< -xsl:rat-output-to-html.xsl -o:$@ -l:on -warnings:fatal
+	@echo
+	@echo Find rat scan report in $@
+
+$(MISC)/rat-scan-output.xml : rat-scan.xml $(SRC_ROOT)/rat-excludes
+	$(ANT) -f rat-scan.xml -DRAT_SCAN_OUTPUT=$@ -DRAT_JAR_HOME=$(rat_jar_home)
+
+$(MISC)/excluded-files.txt : $(MISC)/excluded-files-raw.txt
+	cat $< | sed 's/;/\n/g' > $@
+
+$(MISC)/excluded-files-raw.txt : rat-scan.xml $(SRC_ROOT)/rat-excludes
+	$(ANT) -f rat-scan.xml -DEXCLUDED_FILES_OUTPUT=$@ -DEXCLUDED_SOLVER_OUTPUT=$@ \
+		-DRAT_JAR_HOME=$(rat_jar_home) show-excluded-files

Added: incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-output-to-html.xsl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-output-to-html.xsl?rev=1376463&view=auto
==============================================================================
--- incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-output-to-html.xsl (added)
+++ incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-output-to-html.xsl Thu Aug 23 12:34:03 2012
@@ -0,0 +1,190 @@
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+
+<!-- This style sheet converts any rat-report.xml file.  -->
+
+<xsl:variable name="now" select="current-dateTime()"/>
+
+<xsl:template match="/">
+
+    <html>
+
+    <xsl:comment>Generated at <xsl:value-of select="$now"/></xsl:comment>
+    <head>
+     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+     <style type="text/css">
+    &lt;!--
+body {margin-top: 0px;font-size: 0.8em;background-color: #F9F7ED;}
+
+h1 {color:red;}
+h2 {color:blue;}
+h3 {color:green;}
+h4 {color:orange;}
+
+/* Table Design */
+
+table,tr,td {text-align:center;font-weight:bold;border:1px solid #000;}
+caption {color:blue;text-align:left;}
+.notes, .binaries, .archives, .standards {width:25%;}
+.notes {background:#D7EDEE;}
+.binaries {background:#D0F2F4;}
+.archives {background:#ABE7E9;}
+.standards {background:#A0F0F4;}
+.licenced, .generated {width:50%;}
+.licenced {background:#C6EBDD;}
+.generated {background:#ABE9D2;}
+.java_note {background:#D6EBC6;}
+.generated_note {background:#C9E7A9;}
+.unknown {width:100%;background:#E92020;}
+.unknown-zero {color:#00CC00;}
+.center{text-align:center;margin:0 auto;}
+--&gt;
+     </style>
+    </head>
+    <body>
+	    <xsl:apply-templates/>
+	    <xsl:call-template name="generated"/>
+    </body>
+    </html>
+</xsl:template>
+
+<xsl:template match="rat-report">
+
+	<h1>Rat Report</h1>
+	<p>This HTML version (yes, it is!) is generated from the RAT xml reports using Saxon9B. All the outputs required are displayed below, similar to the .txt version.
+           This is obviously a work in progress; and a prettier, easier to read and manage version will be available soon</p>
+<div class="center">	
+<table id="rat-reports summary" cellspacing="0" summary="A snapshot summary of this rat report">
+<caption>
+Table 1: A snapshot summary of this rat report.
+</caption>
+  <tr>
+    <td colspan="1" class="notes">Notes: <xsl:value-of select="count(descendant::type[attribute::name=&quot;notice&quot;])"/></td>
+    <td colspan="1" class="binaries">Binaries: <xsl:value-of select="count(descendant::type[attribute::name=&quot;binary&quot;])"/></td>
+    <td colspan="1" class="archives">Archives: <xsl:value-of select="count(descendant::type[attribute::name=&quot;archive&quot;])"/></td>
+    <td colspan="1" class="standards">Standards: <xsl:value-of select="count(descendant::type[attribute::name=&quot;standard&quot;])"/></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="licenced">Apache Licensed: <xsl:value-of select="count(descendant::header-type[attribute::name=&quot;AL   &quot;])"/></td>
+    <td colspan="2" class="generated">Generated Documents: <xsl:value-of select="count(descendant::header-type[attribute::name=&quot;GEN  &quot;])"/></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="java_note">Note: JavaDocs are generated and so license header is optional</td>
+    <td colspan="2" class="generated_note">Note: Generated files do not require license headers</td>
+  </tr>
+  <tr>
+<xsl:choose>
+  <xsl:when test="count(descendant::header-type[attribute::name=&quot;?????&quot;]) &gt; 0">
+    <td colspan="4" class="unknown"><xsl:value-of select="count(descendant::header-type[attribute::name=&quot;?????&quot;])"/> Unknown Licenses - or files without a license.</td>
+  </xsl:when>
+  <xsl:otherwise>
+    <td colspan="4" class="unknown-zero"><xsl:value-of select="count(descendant::header-type[attribute::name=&quot;?????&quot;])"/> Unknown Licenses - or files without a license.</td>
+  </xsl:otherwise>
+</xsl:choose>
+  </tr>
+</table>
+</div>
+<hr/>
+	<h3>Unapproved Licenses:</h3>
+
+	<xsl:for-each select="descendant::resource[license-approval/@name=&quot;false&quot;]">
+  <xsl:text>  </xsl:text>
+  <xsl:value-of select="@name"/><br/>
+  <xsl:text>
+</xsl:text>
+</xsl:for-each>
+<hr/>
+
+<h3>Archives:</h3>
+
+<xsl:for-each select="descendant::resource[type/@name=&quot;archive&quot;]">
+ + <xsl:value-of select="@name"/>
+ <br/>
+ </xsl:for-each>
+ <hr/>
+
+ <p>
+	 Files with Apache License headers will be marked AL<br/>
+	 Binary files (which do not require AL headers) will be marked B<br/>
+  Compressed archives will be marked A<br/>
+  Notices, licenses etc will be marked N<br/>
+  </p>
+
+ <xsl:for-each select="descendant::resource">
+  <xsl:choose>
+	 <xsl:when test="license-approval/@name=&quot;false&quot;">!</xsl:when>
+	 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+	 <xsl:when test="type/@name=&quot;notice&quot;">N   </xsl:when>
+	 <xsl:when test="type/@name=&quot;archive&quot;">A   </xsl:when>
+	 <xsl:when test="type/@name=&quot;binary&quot;">B   </xsl:when>
+	 <xsl:when test="type/@name=&quot;standard&quot;"><xsl:value-of select="header-type/@name"/></xsl:when>
+	 <xsl:otherwise>!!!!!</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>      </xsl:text>
+ <xsl:value-of select="@name"/><br/>
+ <xsl:text>
+ </xsl:text>
+ </xsl:for-each>
+ <hr/>
+
+ <h3>Printing headers for files without AL header...</h3>
+ 
+ <xsl:for-each select="descendant::resource[header-type/@name=&quot;?????&quot;]">
+
+	 <h4><xsl:value-of select="@name"/></h4>
+  <xsl:value-of select="header-sample"/>
+  <hr/>
+</xsl:for-each>
+<br/>
+
+ <!-- <xsl:apply-templates select="resource"/>
+    <xsl:apply-templates select="header-sample"/>
+    <xsl:apply-templates select="header-type"/>
+    <xsl:apply-templates select="license-family"/>
+    <xsl:apply-templates select="license-approval"/>
+    <xsl:apply-templates select="type"/> -->
+
+</xsl:template>   
+
+<xsl:template match="resource">
+	<div>
+		<h3>Resource: <xsl:value-of select="@name"/></h3>
+      <xsl:apply-templates/>
+    </div>
+</xsl:template>
+
+<xsl:template match="header-sample">
+	<xsl:if test="normalize-space(.) != ''">
+  <h4>First few lines of non-compliant file</h4>
+    <p>
+      <xsl:value-of select="."/>
+    </p>
+    </xsl:if>
+    <h4>Other Info:</h4>
+</xsl:template>
+
+<xsl:template match="header-type">
+	Header Type: <xsl:value-of select="@name"/>
+	<br/>
+</xsl:template>
+
+<xsl:template match="license-family">
+	License Family: <xsl:value-of select="@name"/>
+	<br/>
+</xsl:template>
+
+<xsl:template match="license-approval">
+	License Approval: <xsl:value-of select="@name"/>
+	<br/>
+</xsl:template>
+
+<xsl:template match="type">
+	Type: <xsl:value-of select="@name"/>
+	<br/>
+</xsl:template>
+
+<xsl:template name="generated">
+	<p>Generated at <xsl:value-of select="$now"/></p>
+</xsl:template>
+</xsl:transform>
\ No newline at end of file

Added: incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-scan.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-scan.xml?rev=1376463&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/ext_libraries/ratscan/scan/rat-scan.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Modified: incubator/ooo/trunk/main/configure.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/configure.in?rev=1376463&r1=1376462&r2=1376463&view=diff
==============================================================================
--- incubator/ooo/trunk/main/configure.in (original)
+++ incubator/ooo/trunk/main/configure.in Thu Aug 23 12:34:03 2012
@@ -909,15 +909,21 @@ AC_ARG_ENABLE(category-b,
                           Flags for individual libraries override this one.
 ],,)
 AC_ARG_WITH(arm-target,
-[  --arm-target        The minimal targeted arm processor
-                          used for the build environment.
-                          Cases :
-                            arm-target < 6 : armv4t compatibility
-                            arm-target = 6 : exact armv6 compatibility
-                    	    arm-target > 6 : armv7-a compatibility
+[  --arm-target            The minimal targeted arm processor
+                              used for the build environment.
+                              Cases :
+                                arm-target < 6 : armv4t compatibility
+                                arm-target = 6 : exact armv6 compatibility
+                                arm-target > 6 : armv7-a compatibility
 
-                          Usage: --with-arm-target=7
+                              Usage: --with-arm-target=7
 ],with_arm_target=$withval,with_arm_target=4)
+AC_ARG_WITH(rat-scan,
+[  --with-rat-scan         Scan source code for license headers.
+                          Use as --with-rat-scan to automatically download pre-built Rat binaries.
+                          Alternatively use as --with-rat-scan=<path-to-rat-direcetory> to use
+                          a separately installed library.
+],with_rat_scan=$withval,)
 
 BUILD_TYPE="OOo"
 ADDITIONAL_REPOSITORIES="../ext_libraries"
@@ -7077,6 +7083,34 @@ else
 fi
 AC_SUBST(SYSTEM_LIBJPEG)
 
+dnl ===================================================================
+dnl Test whether rat scan was requested and whether apache-rat is available
+dnl ===================================================================
+RAT_JAR=
+AC_MSG_CHECKING([whether to trigger rat scan])
+if test "$with_rat_scan" != "no"; then
+    if test "$WITH_JAVA" == "no"; then
+        AC_MSG_ERROR([no, java disabled, enable with --with-java])
+    elif test "$enable_saxon" == "no"; then
+        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
+    elif test "$with_rat_scan" == "yes"; then
+        AC_MSG_RESULT([yes, use pre-built library])
+        RAT_JAR_HOME="BUILD"
+        BUILD_TYPE="$BUILD_TYPE RAT"
+    else
+        AC_MSG_RESULT([yes, use pre-installed library])
+        AC_MSG_CHECKING([whether apache-rat is available])
+        if test -d "$with_rat_scan"; then
+            RAT_JAR_HOME=$with_rat_scan
+        else
+            AC_MSG_ERROR([$with_rat_scan is not a directory])
+        fi
+    fi
+else
+    AC_MSG_RESULT([no])
+fi
+AC_SUBST(RAT_JAR_HOME)
+
 
 dnl ===================================================================
 dnl Test for the presence of Ant and that it works

Modified: incubator/ooo/trunk/main/external_deps.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/external_deps.lst?rev=1376463&r1=1376462&r2=1376463&view=diff
==============================================================================
--- incubator/ooo/trunk/main/external_deps.lst (original)
+++ incubator/ooo/trunk/main/external_deps.lst Thu Aug 23 12:34:03 2012
@@ -296,6 +296,11 @@ if ( true )
     URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
     URL3 = $(SVN_TRUNK)$(MD5)-$(name)
 
+if (RAT_JAR_HOME==BUILD)
+    MD5 = e4244e69eb3644e71c254aea5952a918
+    name = apache-rat-incubating-0.8-bin.tar.bz2 
+    URL1 = http://archive.apache.org/dist/incubator/rat/binaries/$(name)
+    URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
 
 ###############################################################################
 # Libraries with category B license

Modified: incubator/ooo/trunk/main/instsetoo_native/prj/build.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/instsetoo_native/prj/build.lst?rev=1376463&r1=1376462&r2=1376463&view=diff
==============================================================================
--- incubator/ooo/trunk/main/instsetoo_native/prj/build.lst (original)
+++ incubator/ooo/trunk/main/instsetoo_native/prj/build.lst Thu Aug 23 12:34:03 2012
@@ -1,4 +1,4 @@
-oon	instsetoo_native	::	L10N:l10n postprocess packimages testautomation NULL
+oon	instsetoo_native	::	L10N:l10n postprocess packimages testautomation RAT:ratscan NULL
 oon	instsetoo_native						usr1	-	all	oon_mkout NULL
 oon	instsetoo_native\inc_openoffice\unix	nmake	-	u	oon_unix NULL
 oon	instsetoo_native\inc_openoffice\windows\msi_languages	nmake	-	all	oon_msilang NULL

Added: incubator/ooo/trunk/main/rat-excludes-solver
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/rat-excludes-solver?rev=1376463&view=auto
==============================================================================
--- incubator/ooo/trunk/main/rat-excludes-solver (added)
+++ incubator/ooo/trunk/main/rat-excludes-solver Thu Aug 23 12:34:03 2012
@@ -0,0 +1,11 @@
+###############################################################################
+#
+# Exclude output trees.  All their content is created when OpenOffice is built.
+#
+main/*/wntmsci12/
+main/*/unxlngi*/
+main/*/unxmac*/
+ext_libraries/*/wntmsci12/
+ext_libraries/*/unxlngi*/
+ext_libraries/*/unxmac*/
+main/solver/

Modified: incubator/ooo/trunk/main/set_soenv.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/set_soenv.in?rev=1376463&r1=1376462&r2=1376463&view=diff
==============================================================================
--- incubator/ooo/trunk/main/set_soenv.in (original)
+++ incubator/ooo/trunk/main/set_soenv.in Thu Aug 23 12:34:03 2012
@@ -2015,6 +2015,7 @@ ToFile( "SYSTEM_GETTEXT",    "@SYSTEM_GE
 ToFile( "SYSTEM_PANGO",      "@SYSTEM_PANGO@",   "e" );
 ToFile( "SYSTEM_LIBPNG",     "@SYSTEM_LIBPNG@",   "e" );
 ToFile( "SYSTEM_LIBJPEG",    "@SYSTEM_LIBJPEG@",   "e" );
+ToFile( "RAT_JAR_HOME",      "@RAT_JAR_HOME@",     "e" );
 ToFile( "DISABLE_XAW",       "@DISABLE_XAW@",      "e" );
 ToFile( "DMAKE_URL",         "@DMAKE_URL@",        "e" );
 ToFile( "DMAKE_PATH",        "@DMAKE_PATH@",       "e" );