rpm package-bin trouble

624 views
Skip to first unread message

Reik Schatz

unread,
Dec 9, 2013, 5:43:04 AM12/9/13
to simple-b...@googlegroups.com
I am trying to package a single jar file into a RPM package using the sbt-native-packager. The RPM should contain a single file in /opt/myproject/myproject-0.1.jar. In project/plugins.sbt I have added: addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4")
In project/build.scala I have this 

object SbtLauncherPackage extends Build {
  val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*) settings(
    sbtVersion <<= sbtVersion apply { v =>
      sys.props.getOrElse("sbt.build.version", sys.env.getOrElse("sbt.build.version", v))
    }
  )
}

In project/Packaging.scala I have this:

import sbt._
import com.typesafe.sbt.packager.Keys._
import sbt.Keys._
import com.typesafe.sbt.SbtNativePackager._

object Packaging {

  val settings: Seq[Setting[_]] = packagerSettings ++ deploymentSettings ++ mapGenericFilesToLinux ++ Seq(

    maintainer := "Team <what...@email.com>",
    packageSummary := "Summary",
    packageDescription := """Description.""",

    linuxPackageMappings in Rpm <+= (baseDirectory) map { _:File =>
      (packageMapping(file("target/scala-2.10/myproject_2.10-0.1-one-jar.jar") -> "/opt/myproject/myproject-0.1.jar")
        withUser "pxuser" withGroup "pxuser" withPerms "0755")
    },

    name in Rpm := "myproject",
    version in Rpm <<= version,
    rpmRelease := "1",
    rpmVendor := "2012, Foo AB",
    rpmUrl := Some("http://foo.com"),
    rpmGroup := Some("Foo/Development"),
    rpmLicense := Some("BSD")
  )
}

When I run sbt rpm:package-bin I receive the following error:

[info] Building target platforms: noarch-2012, Foo AB-Linux
[info] Building for target noarch-2012
[info] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.25059
[error] + umask 022
[error] + cd /vagrant_data/myproject/target/rpm/BUILD
[error] + LANG=C
[error] + export LANG
[error] + unset DISPLAY
[error] + '[' -e /vagrant_data/myproject/target/rpm/buildroot ']'
[error] + mv /vagrant_data/myproject/target/rpm/tmp-buildroot/opt /vagrant_data/myproject/target/rpm/buildroot
[error] + /usr/lib/rpm/redhat/brp-compress
[error] + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
[error] + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
[error] + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
[error] + /usr/lib/rpm/brp-python-bytecompile
[error] + /usr/lib/rpm/redhat/brp-java-repack-jars
[info] Processing files: myproject-0.1-1
[info] Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
[info] Checking for unpackaged file(s): /usr/lib/rpm/check-files /vagrant_data/myproject/target/rpm/buildroot
[info] Wrote: /vagrant_data/myproject/target/rpm/RPMS/noarch/myproject-0.1-1.noarch.rpm
[info] Building for target  Foo AB-Linux
[info] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.58128
[error] + umask 022
[error] + cd /vagrant_data/myproject/target/rpm/BUILD
[error] + LANG=C
[error] + export LANG
[error] + unset DISPLAY
[error] + '[' -e /vagrant_data/myproject/target/rpm/buildroot ']'
[error] + mv '/vagrant_data/myproject/target/rpm/tmp-buildroot/*' /vagrant_data/myproject/target/rpm/buildroot
[error] mv: cannot stat `/vagrant_data/myproject/target/rpm/tmp-buildroot/*': No such file or directory
[error] error: Bad exit status from /var/tmp/rpm-tmp.58128 (%install)
[info]
[info]
[info] RPM build errors:
[error]     Bad exit status from /var/tmp/rpm-tmp.58128 (%install)
java.lang.RuntimeException: Unable to run rpmbuild, check output for details.
        at scala.sys.package$.error(package.scala:27)
        at com.typesafe.sbt.packager.rpm.RpmHelper$.buildPackage(RpmHelper.scala:88)
        at com.typesafe.sbt.packager.rpm.RpmHelper$.buildRpm(RpmHelper.scala:20)
        at com.typesafe.sbt.packager.rpm.RpmPlugin$$anonfun$rpmSettings$27.apply(RpmPlugin.scala:53)
        at com.typesafe.sbt.packager.rpm.RpmPlugin$$anonfun$rpmSettings$27.apply(RpmPlugin.scala:52)
        at scala.Function3$$anonfun$tupled$1.apply(Function3.scala:35)
        at scala.Function3$$anonfun$tupled$1.apply(Function3.scala:34)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
        at sbt.std.Transform$$anon$4.work(System.scala:64)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.Execute.work(Execute.scala:244)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
[error] (rpm:packageBin) Unable to run rpmbuild, check output for details.
[error] Total time: 12 s, completed Dec 9, 2013 5:36:42 AM



First there are a bunch of [error] logs, then Executing(%install) is run twice and fails for the second run since the files have already been moved. Any help appreciated :)



Jon Shanks

unread,
Feb 25, 2014, 9:52:53 AM2/25/14
to simple-b...@googlegroups.com
Hey 

Just wondering if you got anywhere with this?

I have a similar issue, but not with it doing it twice but more with the fact that SBT sees the output of RPM as an error? i.e. the shell commands when it is executing the %install script 

Matt Brown

unread,
May 5, 2014, 3:04:28 PM5/5/14
to simple-b...@googlegroups.com
I've seen this issue and it's usually fixed by making sure you have rpmbuild installed on your machine. You can get it by installing the rpm-devel package. 
Reply all
Reply to author
Forward
0 new messages