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

Fixes issue #789 where brpJavaRepack was negated #932

Merged
merged 7 commits into from
Jan 25, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1 @@
%define __os_install_post \
%{_rpmconfigdir}/brp-compress \
%{!?__debug_package:%{_rpmconfigdir}/brp-strip %{__strip}} \
%{_rpmconfigdir}/brp-strip-static-archive %{__strip} \
%{_rpmconfigdir}/brp-strip-comment-note %{__strip} %{__objdump} \
%{nil}
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this bug entry. Did you try the line

%define __jar_repack 0

?

Copy link
Contributor Author

@YuvalItzchakov YuvalItzchakov Jan 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to try it now, I saw:

%define __jar_repack %nil

Yesterday. Will try.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works :)

4 changes: 2 additions & 2 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object RpmPlugin extends AutoPlugin {
rpmConflicts := Seq.empty,
rpmSetarch := None,
rpmChangelogFile := None,
rpmBrpJavaRepackJars := false,
rpmBrpJavaRepackJars := true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Together with the fix this doesn't change the default behaviour, right?

I'm not building rpm's on a daily basis, so I'm not sure what impact this has. When we introduced
this it was because rpm:packageBin took a long time to extract and repack all the jar files, which
is IMHO wasted time. I would prefer false as a default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@muuki88 Right, I negated the default because this is basically the behavior people had without actually knowing it so far. The time impact is pretty major if you're doing daily builds. I was waiting for one of you guys to set the tone on this, i'll revert the default to false.

rpmPretrans := None,
rpmPre := None,
rpmPost := None,
Expand Down Expand Up @@ -121,7 +121,7 @@ object RpmPlugin extends AutoPlugin {
(rpmProvides, rpmRequirements, rpmPrerequisites, rpmObsoletes, rpmConflicts) apply RpmDependencies,
maintainerScripts in Rpm := {
val scripts = (maintainerScripts in Rpm).value
if (rpmBrpJavaRepackJars.value) {
if (!rpmBrpJavaRepackJars.value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. This is the actual bug fix. Thanks :)

val pre = scripts.getOrElse(Names.Pre, Nil)
val scriptBits = IO.readStream(RpmPlugin.osPostInstallMacro.openStream, Charset forName "UTF-8")
scripts + (Names.Pre -> (pre :+ scriptBits))
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/changelog-test/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ $ exists target/rpm/SPECS/rpm-test.spec

# Check files for defaults
> check-spec-file
> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> set NativePackagerKeys.rpmBrpJavaRepackJars := false
> check-spec-file
35 changes: 35 additions & 0 deletions src/sbt-test/rpm/scriplets-no-javarepack-rpm/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

enablePlugins(JavaServerAppPackaging)

name := "rpm-test"

version := "0.1.0"

maintainer := "Josh Suereth <joshua.suereth@typesafe.com>"

packageSummary := "Test rpm package"

packageDescription :=
"""A fun package description of our software,
with multiple lines."""

rpmRelease := "1"

rpmVendor := "typesafe"

rpmUrl := Some("http://github.com/sbt/sbt-native-packager")

rpmLicense := Some("BSD")

rpmBrpJavaRepackJars := false

TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) =>
val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec")
out.log.info(spec)
assert(
spec contains
"""sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g'""",
"Missing java repack disabling in %pre")
out.log.success("Successfully tested rpm test file")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
6 changes: 6 additions & 0 deletions src/sbt-test/rpm/scriplets-no-javarepack-rpm/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Run the debian packaging.
> rpm:package-bin
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm
$ exists target/rpm/SPECS/rpm-test.spec

> check-spec-file
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/scriptlets-override-build-rpm/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ $ exists target/rpm/SPECS/rpm-test.spec

# Check files for defaults
> check-spec-file
> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> set NativePackagerKeys.rpmBrpJavaRepackJars := false
> check-spec-file
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/scriptlets-override-rpm/test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ exists var/run/rpm-test
# TODO symlinks aren't checked

> check-spec-file
> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> set NativePackagerKeys.rpmBrpJavaRepackJars := false
> check-spec-file

> unique-scripts-in-spec-file
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/scriptlets-rpm/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ $ exists target/rpm/SPECS/rpm-test.spec
# Check files for defaults
> check-spec-file
> check-rpm-version
> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> set NativePackagerKeys.rpmBrpJavaRepackJars := false
> check-spec-file
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/sysvinit-rpm/test
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ exists var/run/rpm-test

# TODO symlinks aren't checked

> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> set NativePackagerKeys.rpmBrpJavaRepackJars := false
> check-spec-file
> check-spec-autostart

Expand Down