Reputation: 61
I'm not very familiar with Scala or sbt-native-packager but have a scala project where we create a debian. What I've noticed is that the name of the .deb created is correct, but the control file isn't - is there a way to change this?
Versions:
Play: 2.2.3 (also tried with 2.2.6)
Sbt-Native-Packager: 0.7.6
In plugins.sbt
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.6")
This is what I've got (minus sensitive information):
Build.scala:
val main = play.Project(appName, appVersion, appDependencies)
.settings(scalaVersion := "2.10.4")
.settings(DebPackageSettings.packageSettings(appName, appVersion, baseDirectory): _*)
In DebPackageSettings:
def packageSettings(appName: String , appVersion: String, baseDirectory: SettingKey[java.io.File]): Seq[sbt.Setting[_]] = {
val baseName = "prefix-project-name"
val appPackageArchitecture = "all"
Seq(
name in Debian := "%s".format(baseName),
version in Debian := "%s".format(appVersion),
packageDescription in Linux := "something",
packageSummary in Linux := "something",
target in Debian <<= (Keys.target) apply ((t) => t / (baseName + "_" + appVersion + "_" + appPackageArchitecture))
)
...
The control file (in DEBIAN/control) that gets created:
Source: project-name
Package: project-name
Priority: optional
Architecture: all
...
The .deb created: prefix-project-name_version_all.deb
Am I missing something? I've looked through the sbt-native-packager docs and googled for some answers but no luck :(
Upvotes: 0
Views: 65
Reputation: 61
I found this to work - but what is the preferred/right way?
The imports:
import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtNativePackager._
import NativePackagerKeys._
The added line:
normalizedName in Debian := "%s".format(baseName),
Not sure what is preferable though!
Upvotes: 0
Reputation: 67280
It seems that name in Debian
only affects the .deb
file-name, not the package name in the control file. For this you should use packageName
. The plugin is quite confusing regarding its name spaces and inheritance.
After a bit of testing, I found the following should make it work:
name in Linux := baseName,
packageName in Linux := baseName,
If you use in Debian
, you get a some hybrid product where half of the names are from main scope name, the other half from debian scope.
Upvotes: 0