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

System Loader scripts are not being generated #869

Closed
MojoJojo opened this issue Aug 20, 2016 · 8 comments
Closed

System Loader scripts are not being generated #869

MojoJojo opened this issue Aug 20, 2016 · 8 comments
Labels

Comments

@MojoJojo
Copy link

MojoJojo commented Aug 20, 2016

Followed the documentation at offical page and created a new simple scala project (Mac OS) with the following:

plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0-M5")

build.sbt:

enablePlugins(JavaServerAppPackaging)
enablePlugins(SystemVPlugin)
startRunlevels  :=Option("3")
maintainer := "Donald Duck"
packageSummary := "Native packager test project"
packageDescription := "Native packager test project"
stopRunlevels :=Option("3")
rpmVendor:="Donald Duck"

src/main/scala/Hello.scala:

object Hi {
  def main(args: Array[String]) = println("Hi!")
}

when I run sbt packageBin I get a zip file with a bash script to run the java server application but no script to install/uninstall the SystemV service. Am I missing something or is there something wrong with the plugin?

Edit: Link to git repo: https://github.com/MojoJojo/sbt-native-packager-test

@muuki88
Copy link
Contributor

muuki88 commented Aug 20, 2016

Your configuration is correct. Your sbt command isn't :)

with packageBin ( which IIRC triggers universal:packageBin ) generates only a universal zip file. A systemloader is a operating system specific part. That's why it's not included in a universal zip.

Generate a debian or rpm file with

debian:packageBin
rpm:packageBin

The generated deb or rpm package will have the systemloader files included, because they are in the place a rpm/debian based system would expect them.

@muuki88 muuki88 closed this as completed Aug 20, 2016
@MojoJojo
Copy link
Author

Ah. I see. I was hoping that just enabling the right plugin would automagically tell the pluing to generate the right scripts 😛 . thank you for your help.

I installed the rpm and rpm-build packages but now I get the error below:

error: Group field must be present in package: (main package)

I tried:

rpmGroup := "Applications/MyApp"

but it still gives me the error. Not sure what I am missing now?

@MojoJojo
Copy link
Author

MojoJojo commented Aug 20, 2016

Tested a bit more and turns out that the exact build script works perfectly on Fedora and fails on Mac OS. Not sure if building an RPM is supported on Mac OS?

https://github.com/MojoJojo/sbt-native-packager-test

@MojoJojo
Copy link
Author

Okay, seems like I figured it out. A root project has to be defined with the correct rpmGroup in order for the plugin to work:


 val main = Project("sbt-native-packager-test",base = file("."))

.enablePlugins(JavaServerAppPackaging)
.enablePlugins(SystemVPlugin)
.settings(rpmGroup:=Some("Applications/SomeGroup"))
.settings(startRunlevels  :=Option("3"))
.settings(maintainer := "Donald Duck")
.settings(packageSummary := "Native packager test project")
.settings(packageDescription := "Native packager test project")
.settings(stopRunlevels :=Option("3"))
.settings(rpmVendor:="Donald Duck")
.settings(rpmRelease:="1")
.settings(version:="0.0.1")
.settings(serverLoading:= Option(ServerLoader.SystemV))
.settings(rpmLicense := Some("BSD"))

Now it gives the following errors:

[info] Executing(%install): /bin/sh -e /var/folders/4m/t8_hjrk16kncmz84wq7z9sgw0000gn/T/sbt_1ce9e82a/rpm-tmp.12111
[error] + umask 022
[error] + cd /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/BUILD
[error] + /bin/rm -rf /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/buildroot
[error] + /bin/rm -rf /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/buildroot
[error] + '[' -e /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/buildroot ']'
[error] + mv /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/tmp-buildroot /Users/donaldduck/Projects/temp/sbt-native-package-test/target/rpm/buildroot
[error] + exit 0

Permission issue perhaps?

@MojoJojo
Copy link
Author

Oh..guess I can safely ignore this one? #103

@muuki88
Copy link
Contributor

muuki88 commented Aug 21, 2016

Ah. I see. I was hoping that just enabling the right plugin would automagically tell the pluing to generate the right scripts

You still have to tell sbt what package you want to generate ;) By enabling the JavaAppArchetype you can build zip, dmg, tar, msi, deb, rpm and docker.

Oh..guess I can safely ignore this one? #103

Yes, rpm outputs are printed via stderr :(

Okay, seems like I figured it out. A root project has to be defined with the correct rpmGroup in order for the plugin to work

Hm. Not really. Your example looks good. This is a minimal example from native-packager.

Tested a bit more and turns out that the exact build script works perfectly on Fedora and fails on Mac OS. Not sure if building an RPM is supported on Mac OS?

We try to, but the main goal of native-packager is provide a working build on the native platform ( in this case Fedora/RHEL/CentOS)

@MojoJojo
Copy link
Author

Thank you for the quick responses and the support. Much appreciated.

I cloned the repository and the minimal example and tried to build it:

> rpm:packageBin
[info] Updating {file:/Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/}test-project-simple...
[info] Resolving org.scala-lang#scala-library;2.10.4 ...
[info] Packaging /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/test-project-simple_2.10-0.2.0-sources.jar ...
[info] Resolving com.typesafe#config;1.2.1 ...
[info] Done packaging.
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/classes...
[info] Main Scala API documentation to /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/api...
[info] Wrote /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/test-project-simple_2.10-0.2.0.pom
model contains 3 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/test-project-simple_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
[info] Packaging /Users/sanketsharma/Projects/temp/sbt-native-packager/test-project-simple/target/scala-2.10/test-project-simple_2.10-0.2.0.jar ...
[info] Done packaging.
[error] error: Group field must be present in package: (main package)
[info] Building target platforms: noarch-typesafe-Linux
[trace] Stack trace suppressed: run last rpm:packageBin for the full output.
[error] (rpm:packageBin) Unable to run rpmbuild, check output for details. Errorcode 1
[error] Total time: 2 s, completed 21 Aug 2016 12:34:22 PM

You are right about the root project, but it still requires rpmGroup:=Some("Applications/MyGroup") to package on Mac. On Fedora, it works out of the box.

@muuki88 muuki88 added the rpm label Aug 22, 2016
@muuki88
Copy link
Contributor

muuki88 commented Aug 22, 2016

Interesting. Thanks for testing. What version of rpm are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants