|
1 | 1 | package com.typesafe.sbt.packager.rpm
|
2 | 2 |
|
3 | 3 | import sbt._
|
4 |
| -import sbt.Keys.{name, packageBin, sourceDirectory, streams, target, version} |
| 4 | +import sbt.Keys.{name, packageBin, sourceDirectory, streams, target, version, isSnapshot} |
5 | 5 | import java.nio.charset.Charset
|
6 | 6 |
|
7 | 7 | import com.typesafe.sbt.SbtNativePackager.Linux
|
@@ -59,11 +59,16 @@ object RpmPlugin extends AutoPlugin {
|
59 | 59 |
|
60 | 60 | }
|
61 | 61 |
|
| 62 | + private def stripSnapshot(version: String): String = { |
| 63 | + val suffixPosition = version.indexOf("-SNAPSHOT") |
| 64 | + version.slice(0, suffixPosition) |
| 65 | + } |
| 66 | + |
62 | 67 | override def projectConfigurations: Seq[Configuration] = Seq(Rpm)
|
63 | 68 |
|
64 | 69 | override lazy val projectSettings = Seq(
|
65 | 70 | rpmOs := "Linux", // TODO - default to something else?
|
66 |
| - rpmRelease := "1", |
| 71 | + rpmRelease := (if (isSnapshot.value) "SNAPSHOT" else "1"), |
67 | 72 | rpmPrefix := None,
|
68 | 73 | rpmVendor := "", // TODO - Maybe pull in organization?
|
69 | 74 | rpmLicense := None,
|
@@ -105,7 +110,7 @@ object RpmPlugin extends AutoPlugin {
|
105 | 110 | packageArchitecture in Rpm := "noarch",
|
106 | 111 | rpmMetadata := RpmMetadata(
|
107 | 112 | (packageName in Rpm).value,
|
108 |
| - (version in Rpm).value, |
| 113 | + if (isSnapshot.value) stripSnapshot((version in Rpm).value) else (version in Rpm).value, |
109 | 114 | rpmRelease.value,
|
110 | 115 | rpmPrefix.value,
|
111 | 116 | (packageArchitecture in Rpm).value,
|
|
0 commit comments