|
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
|
@@ -63,7 +63,7 @@ object RpmPlugin extends AutoPlugin {
|
63 | 63 |
|
64 | 64 | override lazy val projectSettings = Seq(
|
65 | 65 | rpmOs := "Linux", // TODO - default to something else?
|
66 |
| - rpmRelease := "1", |
| 66 | + rpmRelease := (if (isSnapshot.value) "SNAPSHOT" else "1"), |
67 | 67 | rpmPrefix := None,
|
68 | 68 | rpmVendor := "", // TODO - Maybe pull in organization?
|
69 | 69 | rpmLicense := None,
|
@@ -105,7 +105,7 @@ object RpmPlugin extends AutoPlugin {
|
105 | 105 | packageArchitecture in Rpm := "noarch",
|
106 | 106 | rpmMetadata := RpmMetadata(
|
107 | 107 | (packageName in Rpm).value,
|
108 |
| - (version in Rpm).value, |
| 108 | + if (isSnapshot.value) stripSnapshot((version in Rpm).value) else (version in Rpm).value, |
109 | 109 | rpmRelease.value,
|
110 | 110 | rpmPrefix.value,
|
111 | 111 | (packageArchitecture in Rpm).value,
|
@@ -163,6 +163,11 @@ object RpmPlugin extends AutoPlugin {
|
163 | 163 | }
|
164 | 164 | }
|
165 | 165 | )
|
| 166 | + |
| 167 | + def stripSnapshot(version: String): String = { |
| 168 | + val suffixPosition = version.indexOf("-SNAPSHOT") |
| 169 | + version.slice(0, suffixPosition) |
| 170 | + } |
166 | 171 | }
|
167 | 172 |
|
168 | 173 | object RpmDeployPlugin extends AutoPlugin {
|
|
0 commit comments