diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala index adf0d5caf..5d5d724f7 100644 --- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala +++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala @@ -158,7 +158,8 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging { (maintainerScripts in Debian).value, (linuxScriptReplacements in Debian).value, (target in Universal).value - ) + ), + debianNativeBuildOptions := Nil ) /** diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala index 7f1a2db67..498c05222 100644 --- a/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala +++ b/src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala @@ -49,4 +49,6 @@ trait DebianKeys { val debianMakeChownReplacements = TaskKey[(String, String)]("debianMakeChownReplacements", "Creates the chown commands for correct own files and directories") val debianPackageInstallSize = TaskKey[Long]("debian-installed-size") + + val debianNativeBuildOptions = SettingKey[Seq[String]]("debian-native-build-options", "Options passed to dpkg-deb, e.g. compression level") } \ No newline at end of file diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/NativePackaging.scala b/src/main/scala/com/typesafe/sbt/packager/debian/NativePackaging.scala index 2fdc47e6b..162949692 100644 --- a/src/main/scala/com/typesafe/sbt/packager/debian/NativePackaging.scala +++ b/src/main/scala/com/typesafe/sbt/packager/debian/NativePackaging.scala @@ -43,6 +43,7 @@ trait DebianNativePackaging extends DebianPluginLike { * package. */ private[debian] def debianNativeSettings: Seq[Setting[_]] = inConfig(Debian)(Seq( + debianNativeBuildOptions += "-Znone", // packages are largely JARs, which are already compressed genChanges <<= (packageBin, target, debianChangelog, name, version, debianPackageMetadata) map { (pkg, tdir, changelog, name, version, data) => changelog match { @@ -81,12 +82,12 @@ trait DebianNativePackaging extends DebianPluginLike { }, /** Implementation of the actual packaging */ - packageBin <<= (debianExplodedPackage, debianMD5sumsFile, debianSection, debianPriority, name, version, packageArchitecture, target, streams) map { - (pkgdir, _, section, priority, name, version, arch, tdir, s) => + packageBin <<= (debianExplodedPackage, debianMD5sumsFile, debianSection, debianPriority, name, version, packageArchitecture, debianNativeBuildOptions, target, streams) map { + (pkgdir, _, section, priority, name, version, arch, options, tdir, s) => s.log.info("Building debian package with native implementation") // Make the package. We put this in fakeroot, so we can build the package with root owning files. val archive = archiveFilename(name, version, arch) - Process(Seq("fakeroot", "--", "dpkg-deb", "--build", pkgdir.getAbsolutePath, "../" + archive), Some(tdir)) ! s.log match { + Process(Seq("fakeroot", "--", "dpkg-deb", "--build") ++ options ++ Seq(pkgdir.getAbsolutePath, "../" + archive), Some(tdir)) ! s.log match { case 0 => () case x => sys.error("Failure packaging debian file. Exit code: " + x) }