Dear Emmanuel,
Thank you for looking into this. However, I can see a problem:
debclean calls "debuild -- clean" which calls dh_auto_clean, which invokes
the clean function in maven.pm. If the debian/maven-repo folder exists,
maven is then invoked to run its own clean target using the unmodified
upstream poms, which leads to error messages.
I'd suggest a patch more like the one below, which re-runs mh_patchpoms if
necessary before calling mvn clean. Of course, this isn't fool proof - if
the pom file needs a quilt patch for even mvn clean to run then there may
be issues, but hopefully that's an edge case?
Christopher
--- share/perl/maven.pm 2017-10-10 06:09:58.997821332 +0100
+++ /usr/share/perl5/Debian/Debhelper/Buildsystem/maven.pm 2017-11-26
08:40:02.469699934 +0000
@@ -119,10 +119,13 @@
# clean up generated docs
$this->doit_in_builddir("bash", "-c", "rm -f target/apidocs/*.sh
target/apidocs/options");
}
+ $this->doit_in_sourcedir("mh_unpatchpoms", "-p$this->{package}");
+ doit("rm", "-f", "debian/stamp-poms-patched");
}
sub clean {
my $this=shift;
+ my @patch_args;
# If this directory if absent, we must not have anything to clean;
# don't populate the directory just to run a clean target.
@@ -132,6 +135,13 @@
push(@_, "clean");
}
+ if (! -e "debian/stamp-poms-patched") {
+ $this->doit_in_sourcedir("mh_patchpoms",
"-p$this->{package}",
+ "--debian-build", "--keep-pom-version",
+ "--maven-repo=$this->{cwd}/debian/maven-repo",
@patch_args);
+ doit("touch", "debian/stamp-poms-patched");
+ }
+
$this->doit_in_builddir_noerror(@{$this->{maven_cmd}}, @_);
doit("rm", "-r", "$this->{cwd}/debian/maven-repo");
}
On 25 November 2017 at 12:55, Emmanuel Bourg <[email protected]> wrote:
> Le 25/11/2017 à 13:35, Emmanuel Bourg a écrit :
>
> > Is it possible to get mh_unpatchpoms to run before quilt unpatch in the
> > --after-build step? That would solve the issue.
>
> I modified maven-debian-helper to call mh_unpatchpom at the end of the
> install phase and it seems to work for a normal build:
>
> --- a/share/perl/maven.pm
> +++ b/share/perl/maven.pm
> @@ -119,6 +119,9 @@ sub install {
> # clean up generated docs
> $this->doit_in_builddir("bash", "-c", "rm -f
> target/apidocs/*.sh target/apidocs/options");
> }
> +
> + $this->doit_in_sourcedir("mh_unpatchpoms", "-p$this->{package}");
> + doit("rm", "-f", "debian/stamp-poms-patched");
> }
>
> sub clean {
>
>
> I haven't tested with debuild -A / -B though.
>
> Emmanuel Bourg
>
>