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

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


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

Modified:
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/src/main/bin/mh_cleanpom
   trunk/maven-repo-helper/src/main/bin/mh_patchpom
   trunk/maven-repo-helper/src/main/bin/mh_patchpoms
Log:
Add support for extra rule options to mh_cleanpom, mh_patchpom and mh_patchpoms

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2010-09-04 17:56:04 UTC (rev 12966)
+++ trunk/maven-repo-helper/debian/changelog	2010-09-04 17:56:17 UTC (rev 12967)
@@ -4,6 +4,7 @@
   * Document the correct order of attributes in rules files
   * Escape all $ characters in usage messages
   * Fix a long option quoting bug
+  * Add support for extra rule options on the command line
 
   [ 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:04 UTC (rev 12966)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2010-09-04 17:56:17 UTC (rev 12967)
@@ -30,13 +30,20 @@
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
+   echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -r"
    echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to publish in the property debian.mavenRules in the"
    echo -e "\t  cleaned POM."
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
+   echo -e "\t-U<rule>, --extra-published-rule=<rule>: extra rule to publish"
+   echo -e "\t  May occur multiple times, instead of or in addition to -u"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-I<rule>, --extra-ignore-rule=<rule>: extra rule used to remove dependencies"
+   echo -e "\t  from the transformed POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -i"
    echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
    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"
@@ -114,11 +121,16 @@
    echo -e "\tAnother default rule (* * maven-plugin * *) keep the version for all"
    echo -e "\tplugins as the plugin mechanism requires a version in Maven."
    echo -e ""
+   echo -e "\tAny rules given on the command line (using -R/--extra-rule,"
+   echo -e "\t-U/--extra-published-rule or -I/--extra-ignore-rule) are applied"
+   echo -e "\tin the order given, in between the rules given in the rules file"
+   echo -e "\t(if any) and the default rules."
+   echo -e ""
    echo -e "See also: mh_installpom(1), mh_installpoms(1)"
    exit 1
 }
 
-ARGS="p package o no-parent k keep-pom-version e set-version r rules u published-rules i ignore-rules 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 v verbose n no-act m maven-repo" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
@@ -128,8 +140,11 @@
 KEEPVERSION=$(getarg k keep-pom-version)
 SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
+eval EXTRA_RULES=$(getargs R extra-rule)
 PUBLISHED_RULES=$(getarg u published-rules)
+eval EXTRA_PUBLISHED_RULES=$(getargs U extra-published-rule)
 IGNORE_RULES=$(getarg i ignore-rules)
+eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 MAVEN_REPO=$(getarg m maven-repo)
@@ -174,9 +189,9 @@
     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}"
+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=}")
 
 if [ -z "$NOACT" ]; then
-	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner $CLEAN_ARGS $POM $TARGET $POM_PROPS
+	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner "${CLEAN_ARGS[@]}" $POM $TARGET $POM_PROPS
 fi
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpom	2010-09-04 17:56:04 UTC (rev 12966)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpom	2010-09-04 17:56:17 UTC (rev 12967)
@@ -25,13 +25,20 @@
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
+   echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -r"
    echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to publish in the property debian.mavenRules in the"
    echo -e "\t  cleaned POM."
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
+   echo -e "\t-U<rule>, --extra-published-rule=<rule>: extra rule to publish"
+   echo -e "\t  May occur multiple times, instead of or in addition to -u"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
    echo -e "\t  rules used to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-I<rule>, --extra-ignore-rule=<rule>: extra rule used to remove dependencies"
+   echo -e "\t  from the transformed POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -i"
    echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
    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"
@@ -54,7 +61,7 @@
    exit 1
 }
 
-ARGS="p package o no-parent k keep-pom-version e set-version r rules u published-rules i ignore-rules 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 v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
@@ -63,8 +70,11 @@
 NOPARENT=$(getarg o no-parent)
 SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
+eval EXTRA_RULES=$(getargs R extra-rule)
 PUBLISHED_RULES=$(getarg u published-rules)
+eval EXTRA_PUBLISHED_RULES=$(getargs U extra-published-rule)
 IGNORE_RULES=$(getarg i ignore-rules)
+eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 KEEP_POM_VERSION=$(getarg k keep-pom-version)
@@ -106,10 +116,10 @@
 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}"
+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=}")
 
 if [ -z "$NOACT" ]; then
 	cp $POM $BACKUP
-	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMTransformer --single $DH_OPTS $MH_ARGS $POM
+	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMTransformer --single $DH_OPTS "${MH_ARGS[@]}" $POM
 fi
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-09-04 17:56:04 UTC (rev 12966)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-09-04 17:56:17 UTC (rev 12967)
@@ -19,13 +19,20 @@
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
+   echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -r"
    echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules to publish in the property debian.mavenRules in the"
    echo -e "\t  cleaned POM."
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
+   echo -e "\t-U<rule>, --extra-published-rule=<rule>: extra rule to publish"
+   echo -e "\t  May occur multiple times, instead of or in addition to -u"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
    echo -e "\t  rules used to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-I<rule>, --extra-ignore-rule=<rule>: extra rule used to remove dependencies"
+   echo -e "\t  from the transformed POM"
+   echo -e "\t  May occur multiple times, instead of or in addition to -i"
    echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
    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"
@@ -50,11 +57,14 @@
    exit 1
 }
 
-ARGS="p package r rules u published-rules i ignore-rules 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 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)
 PUBLISHED_RULES=$(getarg u published-rules)
+eval EXTRA_PUBLISHED_RULES=$(getargs U extra-published-rule)
 IGNORE_RULES=$(getarg i ignore-rules)
+eval EXTRA_IGNORE_RULES=$(getargs I extra-ignore-rule)
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 KEEP_POM_VERSION=$(getarg k keep-pom-version)
@@ -88,7 +98,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}"
+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=}")
 
 if [ -z "$NOACT" ]; then
     cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do
@@ -98,6 +108,6 @@
             cp $POM $POM.save
         fi
     done
-    java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMTransformer $DH_OPTS $MH_ARGS
+    java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMTransformer $DH_OPTS "${MH_ARGS[@]}"
 fi
 




More information about the pkg-java-commits mailing list