[pkg-java] r12968 - in trunk/maven-repo-helper: debian src/main/bin src/main/java/org/debian/maven/repo

Peter Collingbourne pcc-guest at alioth.debian.org
Sat Sep 4 17:56:41 UTC 2010


Author: pcc-guest
Date: 2010-09-04 17:56:39 +0000 (Sat, 04 Sep 2010)
New Revision: 12968

Modified:
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/src/main/bin/mh_cleanpom
   trunk/maven-repo-helper/src/main/bin/mh_installpom
   trunk/maven-repo-helper/src/main/bin/mh_installpoms
   trunk/maven-repo-helper/src/main/bin/mh_patchpom
   trunk/maven-repo-helper/src/main/bin/mh_patchpoms
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
Log:
Add a --no-publish-used-rule option

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/debian/changelog	2010-09-04 17:56:39 UTC (rev 12968)
@@ -5,6 +5,7 @@
   * Escape all $ characters in usage messages
   * Fix a long option quoting bug
   * Add support for extra rule options on the command line
+  * Add a --no-publish-used-rule option
 
   [ Ludovic Claude ]
   * mh_transformpoms: Remove warning about missing parent dependency

Modified: trunk/maven-repo-helper/src/main/bin/mh_cleanpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2010-09-04 17:56:39 UTC (rev 12968)
@@ -52,6 +52,8 @@
    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"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
    echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
    echo -e "\t  used to force the versions of the Maven plugins used in the current"
    echo -e "\t  POM file with the versions found in the repository"
@@ -130,7 +132,7 @@
    exit 1
 }
 
-ARGS="p package o no-parent k keep-pom-version e set-version r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules v verbose n no-act m maven-repo" parseargs "$@"
+ARGS="p package o no-parent k keep-pom-version e set-version r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules no-publish-used-rule v verbose n no-act m maven-repo" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
@@ -147,6 +149,7 @@
 eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
@@ -189,7 +192,7 @@
     fi
 fi
 
-CLEAN_ARGS=(--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${KEEPVERSION:+--keep-pom-version} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
+CLEAN_ARGS=(--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${KEEPVERSION:+--keep-pom-version} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
 	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner "${CLEAN_ARGS[@]}" $POM $TARGET $POM_PROPS

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpom	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpom	2010-09-04 17:56:39 UTC (rev 12968)
@@ -25,6 +25,8 @@
    echo -e "\t-V --version: show the version"
    echo -e "\t-p<package> --package=<package>: package to act on "
    echo -e "\t-o --no-parent: don't inherit from a parent POM"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
    echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
@@ -43,13 +45,14 @@
    exit 1
 }
 
-ARGS="p package o no-parent r rules u published-rules i ignore-rules e set-version v verbose n no-act" parseargs "$@"
+ARGS="p package o no-parent no-publish-used-rule r rules u published-rules i ignore-rules e set-version v verbose n no-act" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
 fi
 
 NOPARENT=$(getarg o no-parent)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
 IGNORE_RULES=$(getarg i ignore-rules)
@@ -61,7 +64,7 @@
 POM="${ARGV[0]}"
 
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
-CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES}"
+CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES}"
 
 mkdir -p debian/.mh 2> /dev/null
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpoms	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpoms	2010-09-04 17:56:39 UTC (rev 12968)
@@ -14,6 +14,8 @@
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
    echo -e "\t-p<package> --package=<package>: package to act on "
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
    echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
@@ -32,7 +34,7 @@
    exit 1
 }
 
-ARGS="p package r rules v u published-rules i ignore-rules e set-version verbose n no-act" parseargs "$@"
+ARGS="p package no-publish-used-rule r rules v u published-rules i ignore-rules e set-version verbose n no-act" parseargs "$@"
 
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
@@ -40,11 +42,12 @@
 SETVERSION=$(getarg e set-version)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
 
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
-MH_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES}"
+MH_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES}"
 
 if [ -z "$NOACT" ]; then
     cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpom	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpom	2010-09-04 17:56:39 UTC (rev 12968)
@@ -47,6 +47,8 @@
    echo -e "\t  Optional, it is ignored by default"
    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"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
    echo -e "\t-k --keep-pom-version: keep the original version of the POMs but, "
    echo -e "\t  convert all other versions in dependencies and plugins"
    echo -e "\t-d --debian-build: transform during a Debian build, which means that"
@@ -61,7 +63,7 @@
    exit 1
 }
 
-ARGS="p package o no-parent k keep-pom-version e set-version r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
+ARGS="p package o no-parent k keep-pom-version e set-version r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules no-publish-used-rule v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
@@ -77,6 +79,7 @@
 eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 KEEP_POM_VERSION=$(getarg k keep-pom-version)
 MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
@@ -116,7 +119,7 @@
 fi
 
 DH_OPTS="${VERBOSE:+-v}"
-MH_ARGS=(--package=${PACKAGE} ${NOPARENT:+--no-parent} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
+MH_ARGS=(--package=${PACKAGE} ${NOPARENT:+--no-parent} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
 	cp $POM $BACKUP

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-09-04 17:56:39 UTC (rev 12968)
@@ -41,6 +41,8 @@
    echo -e "\t  Optional, it is ignored by default"
    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"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
    echo -e "\t-k --keep-pom-version: keep the original version of the POMs but, "
    echo -e "\t  convert all other versions in dependencies and plugins"
    echo -e "\t-d --debian-build: transform during a Debian build, which means that"
@@ -57,7 +59,7 @@
    exit 1
 }
 
-ARGS="p package r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules k keep-pom-version v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
+ARGS="p package r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules no-publish-used-rule k keep-pom-version v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
 
 RULES=$(getarg r rules)
 eval EXTRA_RULES=$(getargs R extra-rule)
@@ -67,6 +69,7 @@
 eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 KEEP_POM_VERSION=$(getarg k keep-pom-version)
 MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
@@ -98,7 +101,7 @@
 fi
 
 DH_OPTS="${VERBOSE:+-v}"
-MH_ARGS=(--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
+MH_ARGS=(--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
     cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do

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-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java	2010-09-04 17:56:39 UTC (rev 12968)
@@ -138,6 +138,8 @@
             System.out.println("    May occur multiple times, instead of or in addition to -i");
             System.out.println("  --no-rules: don't apply any rules for converting versions, ");
             System.out.println("    do not even convert versions to the default 'debian' version");
+            System.out.println("  --no-publish-used-rule: don't publish the rule used to transform");
+            System.out.println("    a POM's own attributes in debian.mavenRules");
             System.out.println("  -e<version>, --set-version=<version>: set the version for the POM,");
             System.out.println("    do not use the version declared in the POM file.");
             System.out.println("  --keep-pom-version: keep the original version of the POM but, ");
@@ -235,6 +237,8 @@
                 noParent = true;
             } else if ("--no-rules".equals(arg)) {
                 noRules = true;
+            } else if ("--no-publish-used-rule".equals(arg)) {
+                cleaner.setPublishUsedRule(false);
             } else if ("--keep-pom-version".equals(arg)) {
                 keepPomVersion = true;
             } else if ("--keep-all-elements".equals(arg)) {

Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java	2010-09-04 17:56:17 UTC (rev 12967)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java	2010-09-04 17:56:39 UTC (rev 12968)
@@ -49,6 +49,7 @@
     private boolean verbose;
     private boolean isDebianBuild;
     private boolean isBuildWithoutDoc;
+    private boolean publishUsedRule = true;
     private ListOfPOMs listOfPOMs;
 
     public POMTransformer() {
@@ -86,6 +87,14 @@
         this.isDebianBuild = isDebianBuild;
     }
 
+    public boolean publishUsedRule() {
+        return publishUsedRule;
+    }
+
+    public void setPublishUsedRule(boolean publishUsedRule) {
+        this.publishUsedRule = publishUsedRule;
+    }
+
     public DependencyRuleSet getRules() {
         return rules;
     }
@@ -680,7 +689,7 @@
             writer.writeCharacters(debianPackage);
             writer.writeEndElement();
         }
-        if (info.getOriginalPom() != null) {
+        if (publishUsedRule && info.getOriginalPom() != null) {
             DependencyRule usedRule = info.getOriginalPom().findMatchingRule(rules.getRules());
             if (usedRule != null && !usedRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) && !usedRule.equals(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE)) {
                 addPublishedRule(usedRule);
@@ -757,6 +766,8 @@
             System.out.println("    May occur multiple times, instead of or in addition to -i");
             System.out.println("  --no-rules: don't apply any rules for converting versions, ");
             System.out.println("    do not even convert versions to the default 'debian' version");
+            System.out.println("  --no-publish-used-rule: don't publish the rule used to transform");
+            System.out.println("    a POM's own attributes in debian.mavenRules");
             System.out.println("  -e<version>, --set-version=<version>: set the version for the POM,");
             System.out.println("    do not use the version declared in the POM file.");
             System.out.println("  --keep-pom-version: keep the original version of the POMs but, ");
@@ -807,6 +818,8 @@
                 noParent = true;
             } else if ("--no-rules".equals(arg)) {
                 noRules = true;
+            } else if ("--no-publish-used-rule".equals(arg)) {
+                transformer.setPublishUsedRule(false);
             } else if ("--keep-pom-version".equals(arg)) {
                 keepPomVersion = true;
             } else if (arg.equals("--debian-build")) {




More information about the pkg-java-commits mailing list