Skip to content

Commit

Permalink
Don't compress debian packages
Browse files Browse the repository at this point in the history
Also allow custom options to dpkg-deb --build
  • Loading branch information
pauldraper committed Apr 26, 2016
1 parent ae04b90 commit ece12f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
(maintainerScripts in Debian).value,
(linuxScriptReplacements in Debian).value,
(target in Universal).value
)
),
debianNativeBuildOptions := Nil
)

/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/com/typesafe/sbt/packager/debian/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit ece12f0

Please sign in to comment.