Skip to content

Commit

Permalink
Fix #195 Adding rpmBrpJavaRepackJars setting to trigger faster rpm
Browse files Browse the repository at this point in the history
builds
  • Loading branch information
muuki88 committed Mar 20, 2014
1 parent 515338d commit a548d95
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%define __os_install_post \
/usr/lib/rpm/brp-compress \
%{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip}} \
/usr/lib/rpm/brp-strip-static-archive %{__strip} \
/usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
%{nil}
2 changes: 2 additions & 0 deletions src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ trait RpmKeys {
val rpmPosttrans = SettingKey[Option[String]]("rpm-posttrans", "%posttrans scriptlet")
val rpmPreun = SettingKey[Option[String]]("rpm-preun", "%preun scriptlet")
val rpmPostun = SettingKey[Option[String]]("rpm-postun", "%postun scriptlet")
val rpmBrpJavaRepackJars = SettingKey[Boolean]("brp-java-repack-jars", """Overrides the __os_post_install scriplet

This comment has been minimized.

Copy link
@dpennell

dpennell Apr 15, 2016

Contributor

this setting seems to be reversed. false means that rpmbuild repacks the jars, true disables the rebuilding.

http://swaeku.github.io/blog/2013/08/05/how-to-disable-brp-java-repack-jars-during-rpm-build/ for details""")

// Building
val rpmLint = TaskKey[Unit]("rpm-lint", "Runs rpmlint program against the genreated RPM, if available.")
Expand Down
17 changes: 13 additions & 4 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package rpm
import Keys._
import linux._
import sbt._
import java.nio.charset.Charset

/** Plugin trait containing all generic values used for packaging linux software. */
trait RpmPlugin extends Plugin with LinuxPlugin {
Expand Down Expand Up @@ -34,6 +35,7 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
rpmPosttrans := None,
rpmPreun := None,
rpmPostun := None,
rpmBrpJavaRepackJars := false,
packageSummary in Rpm <<= packageSummary in Linux,
packageDescription in Rpm <<= packageDescription in Linux,
target in Rpm <<= target(_ / "rpm")
Expand All @@ -45,6 +47,12 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
(rpmLicense, rpmDistribution, rpmUrl, rpmGroup, rpmPackager, rpmIcon) apply RpmDescription,
rpmDependencies <<=
(rpmProvides, rpmRequirements, rpmPrerequisites, rpmObsoletes, rpmConflicts) apply RpmDependencies,
rpmPre <<= (rpmPre, rpmBrpJavaRepackJars) apply {
case (_, true) => None
case (pre, false) =>
val scriptBits = IO.readStream(RpmPlugin.osPostInstallMacro.openStream, Charset forName "UTF-8")
Some(pre.map(_ + "\n").getOrElse("") + scriptBits)
},
rpmScripts <<=
(rpmPretrans, rpmPre, rpmPost, rpmVerifyscript, rpmPosttrans, rpmPreun, rpmPostun) apply RpmScripts,
rpmSpecConfig <<=
Expand All @@ -64,8 +72,9 @@ trait RpmPlugin extends Plugin with LinuxPlugin {

object RpmPlugin {

def preinstTemplateSource: java.net.URL = getClass.getResource("preinstall")
def postinstTemplateSource: java.net.URL = getClass.getResource("postinstall")
def preuninstallTemplateSource: java.net.URL = getClass.getResource("preuninstall")
def postuninstallTemplateSource: java.net.URL = getClass.getResource("postuninstall")
def preinstTemplateSource: java.net.URL = getClass getResource "preinstall"
def postinstTemplateSource: java.net.URL = getClass getResource "postinstall"
def preuninstallTemplateSource: java.net.URL = getClass getResource "preuninstall"
def postuninstallTemplateSource: java.net.URL = getClass getResource "postuninstall"
def osPostInstallMacro: java.net.URL = getClass getResource "brpJavaRepackJar"
}

0 comments on commit a548d95

Please sign in to comment.