[pkg-java] r12980 - in trunk/maven-repo-helper: . debian src/main/bin src/main/java/org/debian/maven/repo src/main/share
Ludovic Claude
ludovicc-guest at alioth.debian.org
Thu Sep 16 21:58:45 UTC 2010
Author: ludovicc-guest
Date: 2010-09-16 21:58:43 +0000 (Thu, 16 Sep 2010)
New Revision: 12980
Modified:
trunk/maven-repo-helper/debian/changelog
trunk/maven-repo-helper/debian/control
trunk/maven-repo-helper/pom.xml
trunk/maven-repo-helper/src/main/bin/mh_cleanpom
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRuleSet.java
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
trunk/maven-repo-helper/src/main/share/mh_lib.sh
Log:
* debian/control: Update Standards-Version to 3.9.1, no changes
* Dependency class: make it Comparable, to allow easy sorting of dependencies.
* mh_cleanpoms: rules defined in --clean-ignore-rules (or
debian/maven.cleanIgnoreRules) are used in addition to the rules defined in
--ignore-rules (or debian/maven.ignoreRules), so there is no need anymore
to duplicate the list of rules to ignore when --clean-ignore-rules is used.
Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/debian/changelog 2010-09-16 21:58:43 UTC (rev 12980)
@@ -1,4 +1,4 @@
-maven-repo-helper (1.2.1) UNRELEASED; urgency=low
+maven-repo-helper (1.3) unstable; urgency=low
[ Peter Collingbourne ]
* Document the correct order of attributes in rules files
@@ -8,10 +8,16 @@
* Add a --no-publish-used-rule option
[ Ludovic Claude ]
+ * debian/control: Update Standards-Version to 3.9.1, no changes
* mh_transformpoms: Remove warning about missing parent dependency
when no-parent option is already used
+ * Dependency class: make it Comparable, to allow easy sorting of dependencies.
+ * mh_cleanpoms: rules defined in --clean-ignore-rules (or
+ debian/maven.cleanIgnoreRules) are used in addition to the rules defined in
+ --ignore-rules (or debian/maven.ignoreRules), so there is no need anymore
+ to duplicate the list of rules to ignore when --clean-ignore-rules is used.
- -- Ludovic Claude <ludovic.claude at laposte.net> Tue, 10 Aug 2010 23:18:57 +0200
+ -- Ludovic Claude <ludovic.claude at laposte.net> Thu, 16 Sep 2010 23:18:57 +0200
maven-repo-helper (1.2) unstable; urgency=low
Modified: trunk/maven-repo-helper/debian/control
===================================================================
--- trunk/maven-repo-helper/debian/control 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/debian/control 2010-09-16 21:58:43 UTC (rev 12980)
@@ -4,7 +4,7 @@
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders: Ludovic Claude <ludovic.claude at laposte.net>, Damien Raude-Morvan <drazzib at debian.org>
Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant, help2man, libstax-java
-Standards-Version: 3.8.4
+Standards-Version: 3.9.1
Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-repo-helper/
Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-repo-helper/
Homepage: https://launchpad.net/maven-packaging-support
Modified: trunk/maven-repo-helper/pom.xml
===================================================================
--- trunk/maven-repo-helper/pom.xml 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/pom.xml 2010-09-16 21:58:43 UTC (rev 12980)
@@ -5,7 +5,7 @@
<artifactId>maven-repo-helper</artifactId>
<name>Maven Repo helper</name>
<packaging>jar</packaging>
- <version>1.2</version>
+ <version>1.2.1</version>
<description>Provides support for managing the Maven repository in a Debian distribution.</description>
<inceptionYear>2009</inceptionYear>
Modified: trunk/maven-repo-helper/src/main/bin/mh_cleanpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_cleanpom 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom 2010-09-16 21:58:43 UTC (rev 12980)
@@ -48,7 +48,9 @@
echo -e "\t rules use to remove certain dependencies from the cleaned POM,"
echo -e "\t in addition to the ignore rules specified previously. This is"
echo -e "\t useful in situations such as when the Maven clean target requires more"
- echo -e "\t dependencies or plugins to ignore than the build target"
+ echo -e "\t dependencies or plugins to ignore than the build target."
+ echo -e "\t All rules defined in clean-ignore-rules will be added to the existing"
+ echo -e "\t rules in ignore-rules."
echo -e "\t Optional, the default location is debian/maven.cleanIgnoreRules"
echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
echo -e "\t do not even convert versions to the default 'debian' version"
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java 2010-09-16 21:58:43 UTC (rev 12980)
@@ -10,7 +10,7 @@
*
* @author Ludovic Claude <ludovicc at users.sourceforge.net>
*/
-public class Dependency {
+public class Dependency implements Comparable {
private String groupId;
private String artifactId;
@@ -160,6 +160,35 @@
return groupId + ":" + artifactId + ":" + type + ":" + version;
}
+ public int compareTo(Object o) {
+ Dependency dependency = (Dependency) o;
+ if (this.groupId != dependency.groupId) {
+ if (this.groupId == null) return -1;
+ if (! this.groupId.equals(dependency.groupId)) {
+ return this.groupId.compareTo(dependency.groupId);
+ }
+ }
+ if (this.artifactId != dependency.artifactId) {
+ if (this.artifactId == null) return -1;
+ if (! this.artifactId.equals(dependency.artifactId)) {
+ return this.artifactId.compareTo(dependency.artifactId);
+ }
+ }
+ if (this.type != dependency.type) {
+ if (this.type == null) return -1;
+ if (! this.type.equals(dependency.type)) {
+ return this.type.compareTo(dependency.type);
+ }
+ }
+ if (this.version != dependency.version) {
+ if (this.version == null) return -1;
+ if (! this.version.equals(dependency.version)) {
+ return this.version.compareTo(dependency.version);
+ }
+ }
+ return 0;
+ }
+
public Dependency applyRules(Collection rules) {
for (Iterator i = rules.iterator(); i.hasNext();) {
DependencyRule rule = (DependencyRule) i.next();
@@ -205,4 +234,5 @@
}
return result;
}
+
}
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRuleSet.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRuleSet.java 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRuleSet.java 2010-09-16 21:58:43 UTC (rev 12980)
@@ -1,10 +1,7 @@
package org.debian.maven.repo;
import java.io.*;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -71,6 +68,13 @@
getRules().add(rule);
}
+ public void addAll(DependencyRuleSet newRules) {
+ for (Iterator i = newRules.iterator(); i.hasNext();) {
+ DependencyRule rule = (DependencyRule) i.next();
+ add(rule);
+ }
+ }
+
public void addAll(Collection newRules) {
for (Iterator i = newRules.iterator(); i.hasNext();) {
Object rule = i.next();
@@ -82,6 +86,18 @@
}
}
+ public Set findMatchingRules(Dependency dependency) {
+ Set matchingRules = new HashSet();
+ for (Iterator i = rules.iterator(); i.hasNext();) {
+ DependencyRule rule = (DependencyRule) i.next();
+ if (rule.matches(dependency)) {
+ matchingRules.add(rule);
+ }
+ }
+ return matchingRules;
+ }
+
+
public boolean isVerbose() {
return verbose;
}
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java 2010-09-16 21:58:43 UTC (rev 12980)
@@ -42,6 +42,16 @@
pomOptions = null;
}
+ public String getFirstPOM() {
+ if (pomList == null) {
+ readPomsFile();
+ }
+ if (!pomList.isEmpty()) {
+ return (String) pomList.get(0);
+ }
+ return null;
+ }
+
public void foreachPoms(POMHandler handler) {
if (pomList == null) {
readPomsFile();
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java 2010-09-16 21:58:43 UTC (rev 12980)
@@ -224,11 +224,11 @@
String setVersion = null;
File rulesFile = null;
File publishedRulesFile = null;
- File ignoreRulesFile = null;
File mavenRepo = null;
- ArrayList rulesExtra = new ArrayList();
- ArrayList publishedRulesExtra = new ArrayList();
- ArrayList ignoreRulesExtra = new ArrayList();
+ List rulesExtra = new ArrayList();
+ List publishedRulesExtra = new ArrayList();
+ List ignoreRulesExtra = new ArrayList();
+ List ignoreRulesFiles = new ArrayList();
while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().length() == 0)) {
String arg = args[i].trim();
if ("--verbose".equals(arg) || "-v".equals(arg)) {
@@ -265,9 +265,9 @@
publishedRulesExtra.add(arg.substring("--extra-published-rule=".length()));
} else if (arg.startsWith("-i") || arg.startsWith("--ignore-rules=")) {
if (arg.startsWith("-i")) {
- ignoreRulesFile = new File(arg.substring(2));
+ ignoreRulesFiles.add(new File(arg.substring(2)));
} else {
- ignoreRulesFile = new File(arg.substring("--ignore-rules=".length()));
+ ignoreRulesFiles.add(new File(arg.substring("--ignore-rules=".length())));
}
} else if (arg.startsWith("-I")) {
ignoreRulesExtra.add(arg.substring(2));
@@ -305,11 +305,22 @@
}
cleaner.getRules().addAll(rulesExtra);
- if (ignoreRulesFile != null) {
- if (ignoreRulesFile.exists()) {
- cleaner.getIgnoreRules().setRulesFile(ignoreRulesFile);
- } else {
- System.err.println("Cannot find file: " + ignoreRulesFile);
+ if (!ignoreRulesFiles.isEmpty()) {
+ boolean firstIgnoreRule = true;
+ for (Iterator irf = ignoreRulesFiles.iterator(); irf.hasNext(); ) {
+ File ignoreRulesFile = (File) irf.next();
+ if (ignoreRulesFile.exists()) {
+ if (firstIgnoreRule) {
+ cleaner.getIgnoreRules().setRulesFile(ignoreRulesFile);
+ } else {
+ DependencyRuleSet tmpIgnoreRules = new DependencyRuleSet("Additional ignore rules");
+ tmpIgnoreRules.setRulesFile(ignoreRulesFile);
+ cleaner.getIgnoreRules().addAll(tmpIgnoreRules);
+ }
+ firstIgnoreRule = false;
+ } else {
+ System.err.println("Cannot find file: " + ignoreRulesFile);
+ }
}
}
cleaner.getIgnoreRules().addAll(ignoreRulesExtra);
Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java 2010-09-16 21:58:43 UTC (rev 12980)
@@ -14,6 +14,7 @@
private Pattern pattern;
private String replace;
private String rule;
+ private String description;
public Rule(String rule) {
this.rule = rule;
@@ -24,7 +25,7 @@
replace = st.nextToken();
} else {
String pat = escapeParameters(rule.replace(".", "\\.").replace("*", "(.*)"));
- pattern = Pattern.compile(pat);
+ pattern = Pattern.compile(pat);
replace = escapeGroupMatch(rule).replace("*", "$1");
}
}
@@ -67,7 +68,15 @@
public String getPattern() {
return pattern.pattern();
}
-
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
public boolean equals(Object obj) {
if (obj == null) {
return false;
@@ -95,24 +104,24 @@
public String toString() {
return rule;
}
-
+
/**
* Escape (ie. preprend \\) characters which can be specials chars for regexp.
- *
+ *
* @param value Input chars
* @return Escaped output chars
*/
private String escapeParameters(String value) {
- return escapeGroupMatch(value).replace("{", "\\{").replace("}", "\\}");
+ return escapeGroupMatch(value).replace("{", "\\{").replace("}", "\\}");
}
-
+
/**
* Escape (ie. preprend \\) characters which can be group identifiers for replace
- *
+ *
* @param value Input chars
* @return Escaped output chars
*/
private String escapeGroupMatch(String value) {
- return value.replace("$", "\\$");
+ return value.replace("$", "\\$");
}
}
Modified: trunk/maven-repo-helper/src/main/share/mh_lib.sh
===================================================================
--- trunk/maven-repo-helper/src/main/share/mh_lib.sh 2010-09-16 20:30:20 UTC (rev 12979)
+++ trunk/maven-repo-helper/src/main/share/mh_lib.sh 2010-09-16 21:58:43 UTC (rev 12980)
@@ -4,7 +4,7 @@
# - package selection
#
-MH_VERSION=${MH_VERSION:-1.2}
+MH_VERSION=${MH_VERSION:-1.2.1}
CLASSPATH=/usr/share/java/stax-api.jar:/usr/share/java/stax.jar:/usr/share/java/xml-apis.jar:/usr/share/java/maven-repo-helper.jar
JAVA_OPTIONS="-Djavax.xml.stream.XMLOutputFactory=com.bea.xml.stream.XMLOutputFactoryBase -Djavax.xml.stream.XMLInputFactory=com.bea.xml.stream.MXParserFactory"
More information about the pkg-java-commits
mailing list