Skip to content

Apache Lucene open-source search software

Fix the llinter issue with absolute file names intermixed with url, failing to parse them as URLs (C:/path is treated as URL with schema C). Fix other properties to be absolute in common-build.xml.

Uwe Schindler468a6650e739
diff --git a/dev-tools/scripts/checkJavadocLinks.py b/dev-tools/scripts/checkJavadocLinks.py
index 21c855b5477..35bf05eb516 100644
--- a/dev-tools/scripts/checkJavadocLinks.py
+++ b/dev-tools/scripts/checkJavadocLinks.py
@@ -136,6 +136,9 @@ def checkAll(dirName):
# Somehow even w/ java 7 generaged javadocs,
# deprecated-list.html can fail to escape generics types
fullPath = os.path.join(root, f).replace(os.path.sep,'/')
+ fullPath = 'file:%s' % urlparse.quote(fullPath)
+ # parse and unparse the URL to "normalize" it
+ fullPath = urlparse.urlunparse(urlparse.urlparse(fullPath))
#print ' %s' % fullPath
allFiles[fullPath] = parse(fullPath, open('%s/%s' % (root, f), encoding='UTF-8').read())
@@ -209,30 +212,26 @@ def checkAll(dirName):
# on annotations it seems?
pass
elif link.startswith('file:'):
- filepath = urlparse.unquote(urlparse.urlparse(link).path)
- if not (os.path.exists(filepath) or os.path.exists(filepath[1:])):
- if not printed:
- printed = True
- print()
- print(fullPath)
- print(' BROKEN LINK: %s' % link)
- elif link not in allFiles:
- # We only load HTML... so if the link is another resource (eg
- # SweetSpotSimilarity refs
- # lucene/build/docs/misc/org/apache/lucene/misc/doc-files/ss.gnuplot) then it's OK:
- if not os.path.exists(link):
- if not printed:
- printed = True
- print()
- print(fullPath)
- print(' BROKEN LINK: %s' % link)
+ if link not in allFiles:
+ filepath = urlparse.unquote(urlparse.urlparse(link).path)
+ if not (os.path.exists(filepath) or os.path.exists(filepath[1:])):
+ if not printed:
+ printed = True
+ print()
+ print(fullPath)
+ print(' BROKEN LINK: %s' % link)
elif anchor is not None and anchor not in allFiles[link][1]:
if not printed:
printed = True
print()
print(fullPath)
print(' BROKEN ANCHOR: %s' % origLink)
-
+ else:
+ if not printed:
+ printed = True
+ print()
+ print(fullPath)
+ print(' BROKEN URL SCHEME: %s' % origLink)
failures = failures or printed
return failures
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 1d8d357c204..35b650ce524 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -27,10 +27,10 @@
</description>
<dirname file="${ant.file.common}" property="common.dir"/>
- <property name="dev-tools.dir" value="${common.dir}/../dev-tools"/>
- <property name="prettify.dir" value="${common.dir}/tools/prettify"/>
- <property name="maven.build.dir" value="${build.dir}/maven"/>
- <property name="license.dir" value="${common.dir}/licenses"/>
+ <property name="dev-tools.dir" location="${common.dir}/../dev-tools"/>
+ <property name="prettify.dir" location="${common.dir}/tools/prettify"/>
+ <property name="maven.build.dir" location="${build.dir}/maven"/>
+ <property name="license.dir" location="${common.dir}/licenses"/>
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it -->
@@ -65,7 +65,7 @@
<property name="ivy.sync" value="true"/>
<property name="junit.jar" value="junit-4.10.jar"/>
- <property name="junit-location.jar" value="${common.dir}/test-framework/lib/${junit.jar}"/>
+ <property name="junit-location.jar" location="${common.dir}/test-framework/lib/${junit.jar}"/>
<path id="junit-path">
<fileset dir="${common.dir}/test-framework/lib">
@@ -90,7 +90,7 @@
<property name="tests.timezone" value="random" />
<property name="tests.directory" value="random" />
<property name="tests.linedocsfile" value="europarl.lines.txt.gz" />
- <property name="tests.loggingfile" value="${common.dir}/tools/junit4/logging.properties"/>
+ <property name="tests.loggingfile" location="${common.dir}/tools/junit4/logging.properties"/>
<property name="tests.nightly" value="false" />
<property name="tests.weekly" value="false" />
<property name="tests.slow" value="true" />
@@ -109,7 +109,7 @@
</condition>
<property name="tests.clover.args" value=""/>
- <property name="tests.tempDir" value="${build.dir}/test"/>
+ <property name="tests.tempDir" location="${build.dir}/test"/>
<property name="tests.cachefile" location="${common.dir}/tools/junit4/cached-timehints.txt" />
<property name="tests.cachefilehistory" value="20" />
@@ -144,11 +144,11 @@
<property name="bootclasspath" value=""/>
<property name="javadoc.link" value="http://download.oracle.com/javase/6/docs/api/"/>
<property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/>
- <property name="javadoc.packagelist.dir" value="${common.dir}/tools/javadoc"/>
+ <property name="javadoc.packagelist.dir" location="${common.dir}/tools/javadoc"/>
<available file="${javadoc.packagelist.dir}/java6/package-list" property="javadoc.java6.packagelist.exists"/>
<property name="javadoc.access" value="protected"/>
<property name="javadoc.charset" value="utf-8"/>
- <property name="javadoc.dir" value="${common.dir}/build/docs"/>
+ <property name="javadoc.dir" location="${common.dir}/build/docs"/>
<property name="javadoc.maxmemory" value="512m" />
<property name="javadoc.noindex" value="true"/>
<!-- Javadoc classpath -->
@@ -161,8 +161,8 @@
</fileset>
</path>
- <property name="changes.src.dir" value="${common.dir}/site/changes"/>
- <property name="changes.target.dir" value="${common.dir}/build/docs/changes"/>
+ <property name="changes.src.dir" location="${common.dir}/site/changes"/>
+ <property name="changes.target.dir" location="${common.dir}/build/docs/changes"/>
<property name="project.name" value="site"/> <!-- todo: is this used by anakia or something else? -->
<property name="build.encoding" value="utf-8"/>
@@ -1805,11 +1805,10 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
<macrodef name="check-broken-links">
<attribute name="dir"/>
- <!-- TODO: somehow, the behavior of this script has CWD-funkiness but only on windows -->
<sequential>
- <exec dir="@{dir}" executable="${python32.exe}" failonerror="true">
+ <exec dir="." executable="${python32.exe}" failonerror="true">
<arg value="${dev-tools.dir}/scripts/checkJavadocLinks.py"/>
- <arg value="."/>
+ <arg value="@{dir}"/>
</exec>
</sequential>
</macrodef>
diff --git a/solr/common-build.xml b/solr/common-build.xml
index fa481282425..25e8a040c91 100644
--- a/solr/common-build.xml
+++ b/solr/common-build.xml
@@ -46,8 +46,8 @@
<property name="tests.loggingfile" location="${common-solr.dir}/testlogging.properties"/>
<property name="tests.cleanthreads.sysprop" value="perClass"/>
- <property name="changes.target.dir" value="${dest}/docs/changes"/>
- <property name="license.dir" value="${common-solr.dir}/licenses"/>
+ <property name="changes.target.dir" location="${dest}/docs/changes"/>
+ <property name="license.dir" location="${common-solr.dir}/licenses"/>
<import file="${common-solr.dir}/../lucene/module-build.xml"/>