Skip to content

Commit e300518

Browse files
author
Ty Coghlan
committed
sbt#1178 update rpmEpoch to use an option
1 parent ec6ac25 commit e300518

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

integration-tests-ansible/test-project-play-rpm/packaging.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ rpmVendor := "DemoVendor"
2929

3030
rpmLicense := Some("Apache-2.0")
3131

32-
rpmEpoch := 1
32+
rpmEpoch := Some(1)

src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait RpmKeys {
2121
// DESCRIPTION KEYS
2222
// TODO - Summary and license are required.
2323
val rpmLicense = SettingKey[Option[String]]("rpm-license", "License of the code within the RPM.")
24-
val rpmEpoch = SettingKey[Int]("rpm-epoch", "Epoch of the generated RPM.")
24+
val rpmEpoch = SettingKey[Option[Int]]("rpm-epoch", "Epoch of the generated RPM.")
2525
val rpmDistribution = SettingKey[Option[String]]("rpm-distribution")
2626
val rpmUrl =
2727
SettingKey[Option[String]]("rpm-url", "Url to include in the RPM.")

src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ case class RpmMetadata(name: String,
1919
description: String,
2020
autoprov: String,
2121
autoreq: String,
22-
epoch: Int)
22+
epoch: Option[Int])
2323

2424
/**
2525
* The Description used to generate an RPM
@@ -224,7 +224,9 @@ case class RpmSpec(meta: RpmMetadata,
224224
sb append ("Release: %s\n" format meta.release)
225225
sb append ("Summary: %s\n" format meta.summary)
226226

227-
if (meta.epoch > 0) sb append ("Epoch: %d\n" format meta.epoch)
227+
meta.epoch filter(_ >= 0) foreach{ epoch =>
228+
sb append ("Epoch: %d\n" format epoch)
229+
}
228230

229231
meta.prefix foreach { v =>
230232
sb append ("prefix: %s\n" format v)

src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ object RpmPlugin extends AutoPlugin {
6969
rpmPrefix := None,
7070
rpmVendor := "", // TODO - Maybe pull in organization?
7171
rpmLicense := None,
72-
rpmEpoch := 0,
72+
rpmEpoch := None,
7373
rpmDistribution := None,
7474
rpmUrl := None,
7575
rpmGroup := None,

src/sbt-test/rpm/simple-rpm/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rpmUrl := Some("http://github.com/sbt/sbt-native-packager")
2121

2222
rpmLicense := Some("BSD")
2323

24-
rpmEpoch := 1
24+
rpmEpoch := Some(1)
2525

2626
packageArchitecture in Rpm := "x86_64"
2727

0 commit comments

Comments
 (0)