[maven-debian-helper] 01/01: Fix "Do not modify the debian control files during package build" Add a --build option to DependenciesSolver to suppress overwriting poms and rules files (Closes: #807686)

Christopher Stuart Hoskin mans0954 at moszumanska.debian.org
Sun Jan 8 22:09:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

mans0954 pushed a commit to branch master
in repository maven-debian-helper.

commit 33e501949b35433bba41ef98c0bf611876ad0c8f
Author: Christopher Hoskin <mans0954 at debian.org>
Date:   Sun Jan 8 21:36:31 2017 +0000

    Fix "Do not modify the debian control files during package build"
      Add a --build option to DependenciesSolver to suppress overwriting poms
      and rules files (Closes: #807686)
---
 bin/mh_resolve_dependencies                                 |  8 +++++---
 debian/changelog                                            |  9 +++++++++
 .../java/org/debian/maven/packager/DependenciesSolver.java  | 13 +++++++++++--
 share/cdbs/1/class/maven.mk                                 |  2 +-
 share/perl/maven.pm                                         |  2 +-
 5 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/bin/mh_resolve_dependencies b/bin/mh_resolve_dependencies
index 0b74112..9284b24 100644
--- a/bin/mh_resolve_dependencies
+++ b/bin/mh_resolve_dependencies
@@ -7,7 +7,7 @@ CLASSPATH="/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-
 
 syntax()
 {
-   echo -e "Usage: mh_revolve_dependencies [option]... <package>"
+   echo -e "Usage: mh_resolve_dependencies [option]... <package>"
    echo -e "Resolve the dependencies and generates the substvars"
    echo -e "file containing the list of dependent packages."
    echo -e ""
@@ -27,6 +27,7 @@ syntax()
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-b --base-directory: path to root directory of package"
    echo -e "\t   --non-explore: doesn't explore directories for pom.xml"
+   echo -e "\t   --build: Don't write files to debian folder other than substvars" 
    echo -e ""
    echo -e "Description:"
    echo -e "This tool reads the POM files defined in debian/$package.poms"
@@ -42,7 +43,7 @@ syntax()
    exit 1
 }
 
-ARGS="p package a ant d javadoc v verbose n non-interactive o offline b base-directory non-explore" parseargs "$@"
+ARGS="p package a ant d javadoc v verbose n non-interactive o offline b base-directory non-explore build" parseargs "$@"
 
 PACKAGE=$(getarg p package)
 ANT=$(getarg a ant)
@@ -52,6 +53,7 @@ OFFLINE=$(getarg o offline)
 VERBOSE=$(getarg v verbose)
 BASE_DIR=$(getarg b base-directory)
 NON_EXPLORE=$(getarg non-explore)
+BUILD=$(getarg build)
 
 if [ -z "$PACKAGE" ]; then
     if [ "$ARGC" -gt "0" ]; then
@@ -74,6 +76,6 @@ if [ ! -e .debianVersion -a ! -e debian/stamp-poms-patched ]; then
     fi
 fi
 
-java $JAVA_OPTS -cp $CLASSPATH org.debian.maven.packager.DependenciesSolver ${NON_INTERACTIVE:+--non-interactive} ${NON_EXPLORE:+--non-explore} ${OFFLINE:+--offline} ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${BASE_DIR:+--base-directory=$BASE_DIR} ${VERBOSE:+--verbose} --package=$PACKAGE --maven-repo=/usr/share/maven-repo
+java $JAVA_OPTS -cp $CLASSPATH org.debian.maven.packager.DependenciesSolver ${NON_INTERACTIVE:+--non-interactive} ${NON_EXPLORE:+--non-explore} ${OFFLINE:+--offline} ${BUILD:+--build} ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${BASE_DIR:+--base-directory=$BASE_DIR} ${VERBOSE:+--verbose} --package=$PACKAGE --maven-repo=/usr/share/maven-repo
 
 perl -p -i -e 's/maven\./maven:/' debian/${PACKAGE}.substvars
diff --git a/debian/changelog b/debian/changelog
index 7b103a2..c7493b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+maven-debian-helper (2.1.4) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Fix "Do not modify the debian control files during package build"
+    Add a --build option to DependenciesSolver to suppress overwriting poms
+    and rules files (Closes: #807686)
+
+ -- Christopher Hoskin <mans0954 at debian.org>  Sun, 08 Jan 2017 21:32:55 +0000
+
 maven-debian-helper (2.1.3) unstable; urgency=medium
 
   * Team upload.
diff --git a/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java b/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
index 86a422d..3f88dbc 100644
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
@@ -879,6 +879,7 @@ public class DependenciesSolver {
             System.out.println("    POM file with the versions found in the repository");
             System.out.println("  --base-directory: path to root directory of package");
             System.out.println("  --non-explore: doesn't explore directories for pom.xml");
+            System.out.println("  --build: Don't write files to debian folder other than substvars");
             return;
         }
 
@@ -893,6 +894,7 @@ public class DependenciesSolver {
         boolean generateJavadoc = false;
         boolean interactive = true;
         boolean offline = false;
+	boolean build = false;
 
         // Parse parameters
         int i = inc(-1, args);
@@ -926,7 +928,10 @@ public class DependenciesSolver {
                 baseDirectory = new File(arg.substring("--base-directory=".length()));
             } else if (arg.equals("--non-explore")) {
                 exploreProjects = false;
+            } else if (arg.equals("--build")) {
+                build = true;
             }
+
             i = inc(i, args);
         }
 
@@ -961,8 +966,12 @@ public class DependenciesSolver {
 
         solver.solveDependencies();
 
-        solver.pomTransformer.getListOfPOMs().save();
-        solver.pomTransformer.getRulesFiles().save(outputDirectory);
+	// Don't overwrite the poms or rules files during a build
+	if (!build) {
+	        solver.pomTransformer.getListOfPOMs().save();
+	        solver.pomTransformer.getRulesFiles().save(outputDirectory);
+	}
+	// Do generate the substvars though
         solver.saveSubstvars();
 
         if (!solver.issues.isEmpty()) {
diff --git a/share/cdbs/1/class/maven.mk b/share/cdbs/1/class/maven.mk
index 89e6d0c..c35001a 100644
--- a/share/cdbs/1/class/maven.mk
+++ b/share/cdbs/1/class/maven.mk
@@ -119,7 +119,7 @@ DEB_RESOLVEDEP_ARGS += --base-directory=$(CURDIR) --non-explore
 common-install-arch common-install-indep:: common-install-impl
 common-install-impl::
 	$(if $(DEB_MAVEN_INSTALL_TARGET),$(DEB_MAVEN_INVOKE) $(PLUGIN_ARGS) $(DEB_MAVEN_INSTALL_TARGET), at echo "DEB_MAVEN_INSTALL_TARGET unset, skipping default maven.mk common-install target")
-	$(if $(cdbs_use_maven_substvars), mh_resolve_dependencies --non-interactive --offline -p$(DEB_JAR_PACKAGE) $(DEB_RESOLVEDEP_ARGS) )
+	$(if $(cdbs_use_maven_substvars), mh_resolve_dependencies --non-interactive --offline --build -p$(DEB_JAR_PACKAGE) $(DEB_RESOLVEDEP_ARGS) )
 
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
 common-build-arch common-build-indep:: debian/stamp-maven-check
diff --git a/share/perl/maven.pm b/share/perl/maven.pm
index feb8e45..6d1c1f2 100644
--- a/share/perl/maven.pm
+++ b/share/perl/maven.pm
@@ -109,7 +109,7 @@ sub install {
 		"-Dinstall.to.usj=true",
 		"org.debian.maven:debian-maven-plugin:$maven_debian_version:install");
 	$this->doit_in_builddir("mh_resolve_dependencies", "--non-interactive",
-		"--offline", "-p$this->{package}", @resolvedep_args);
+		"--offline", "--build", "-p$this->{package}", @resolvedep_args);
 	if ($this->{doc_package}) {
 		doit("cp","debian/$this->{package}.substvars",
 			"debian/$this->{doc_package}.substvars");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git



More information about the pkg-java-commits mailing list