First cut at using metapackages to allow multiple versions of SBT in the same debian repository.

This commit is contained in:
Josh Suereth 2012-05-29 08:49:02 -04:00
parent c91159b363
commit 440ad4bb0b
3 changed files with 38 additions and 4 deletions

View File

@ -0,0 +1,25 @@
import sbt._
import com.typesafe.packager.Keys._
import sbt.Keys._
import com.typesafe.packager.PackagerPlugin._
object MetaPackaging {
def settings(pkg: Project): Seq[Setting[_]] = packagerSettings ++ Seq(
name := "sbt",
version <<= sbtVersion apply {
case "0.11.3" => "0.11.3-build0300"
case v => v
},
// GENERAL LINUX PACKAGING STUFFS
maintainer := "Josh Suereth <joshua.suereth@typesafe.com>",
packageSummary := "Simple Build Tool for Scala-driven builds",
packageDescription := """This meta-package provides the most up-to-date version of the SBT package.""",
debianPackageDependencies in Debian <+= (name in Debian in pkg),
// STUBBED values
wixConfig := <dummy/>,
rpmRelease := "1",
rpmVendor := "typesafe"
)
}

View File

@ -4,4 +4,6 @@ import Keys._
object SbtExtras extends Build {
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
val root = Project("sbt-extras", file(".")) settings(Packaging.settings:_*)
val meta = Project("metapackage", file("metapackage")) settings(MetaPackaging.settings(root):_*)
}

View File

@ -17,8 +17,14 @@ object Packaging {
def localWindowsPattern = "[organisation]/[module]/[revision]/[module].[ext]"
def downloadUrlForVersion(v: String) = (v split "[^\\d]" map (_.toInt)) match {
case Array(0, 11, x, _*) if x >= 3 => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
case Array(0, y, _*) if y >= 12 => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
case _ => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/"+v+"/sbt-launch.jar"
}
val settings: Seq[Setting[_]] = packagerSettings ++ Seq(
sbtLaunchJarUrl <<= sbtVersion apply ("http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+_+"/sbt-launch.jar"),
sbtLaunchJarUrl <<= sbtVersion apply downloadUrlForVersion,
sbtLaunchJarLocation <<= target apply (_ / "sbt-launch.jar"),
sbtLaunchJar <<= (sbtLaunchJarUrl, sbtLaunchJarLocation) map { (uri, file) =>
import dispatch._
@ -88,9 +94,10 @@ object Packaging {
jar -> ("/usr/lib/sbt/"+v+"/sbt-launch.jar")) withPerms "0755"
},
// DEBIAN SPECIFIC
name in Debian := "sbt",
version in Debian <<= (version, sbtVersion) apply { (v, sv) =>
sv + "-build-" + (v split "\\." map (_.toInt) dropWhile (_ == 0) map ("%02d" format _) mkString "")
name in Debian <<= (sbtVersion) apply { (sv) => "sbt-" + (sv split "[^\\d]" take 3 mkString ".") },
version in Debian <<= (version, sbtVersion) apply { (v, sv) =>
val nums = (v split "[^\\d]")
"%s-build-%03d" format ((nums.init mkString "."), nums.last.toInt + 1)
},
debianPackageDependencies in Debian ++= Seq("curl", "java2-runtime", "bash (>= 2.05a-11)"),
debianPackageRecommends in Debian += "git",