However, this now means that there are two mechanisms modifying the same file, quilt and mh_(un)patchpom, which can be confusing.
In particular, I would normally expect running debuild followed by debclean in an unpacked source package to build the package and then return the package to its original state. However, this is not what happens at the moment:
Sequence during debuild:
dpkg-source --before-build dropwizard-metrics
(This applies the quilt patch to the original pom.xml)
mh_unpatchpoms -plibdropwizard-metrics-java
(This shouldn't do anything, as there are no mh patched poms at this stage)
mh_patchpoms -plibdropwizard-metrics-java --debian-build --keep-pom-version --maven-repo=/home/mans0954/src/pkg-java/dropwizard-metrics/debian/maven-repo
(This copies the quilt patched pom.xml to pom.xml.save and then writes a mh modified pom to pom.xml)
dpkg-source --after-build dropwizard-metrics
(This then attempts to unapply the quilt patch from the mh modified pom.xml, but not pom.xml.save.)
Sequence during debclean
mh_unpatchpoms -plibdropwizard-metrics-java
(This moves pom.xml.save to pom.xml, so that pom.xml no longer has the mh modifications, but still has the quilt patch applied. Running "quilt pop -a" has no effect as quilt has previously unapplied the patch to the mh-modified pom.xml which has just been over-written))
1) Call debuild with the -tc option, which causes dpkg-buildpackage to invoke the clean target in debian/rules after the build but before the unpatching
2) Adding --no-unapply-patches to debian/source/local-options which stops dpkg-source from unapplying the patches. The package can then be cleaned with debclean && quilt pop -a