Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #195 Adding rpmBrpJavaRepackJars setting #199

Merged
merged 1 commit into from
Mar 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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"
}