Skip to content

Commit ec6ac25

Browse files
Ophirr33Ty Coghlan
authored and
Ty Coghlan
committed
sbt#1178 attempt at adding in rpm epochs
1 parent 596eb92 commit ec6ac25

File tree

7 files changed

+21
-3
lines changed

7 files changed

+21
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1917,4 +1917,4 @@
19171917
## [0.1.0](https://github.com/sbt/sbt-native-packager/tree/0.1.0) (2012-01-16)
19181918

19191919

1920-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
1920+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

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

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ rpmRelease := "1"
2828
rpmVendor := "DemoVendor"
2929

3030
rpmLicense := Some("Apache-2.0")
31+
32+
rpmEpoch := 1

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

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +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.")
2425
val rpmDistribution = SettingKey[Option[String]]("rpm-distribution")
2526
val rpmUrl =
2627
SettingKey[Option[String]]("rpm-url", "Url to include in the RPM.")

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ case class RpmMetadata(name: String,
1818
summary: String,
1919
description: String,
2020
autoprov: String,
21-
autoreq: String)
21+
autoreq: String,
22+
epoch: Int)
2223

2324
/**
2425
* The Description used to generate an RPM
@@ -222,6 +223,9 @@ case class RpmSpec(meta: RpmMetadata,
222223
sb append ("Version: %s\n" format meta.version)
223224
sb append ("Release: %s\n" format meta.release)
224225
sb append ("Summary: %s\n" format meta.summary)
226+
227+
if (meta.epoch > 0) sb append ("Epoch: %d\n" format meta.epoch)
228+
225229
meta.prefix foreach { v =>
226230
sb append ("prefix: %s\n" format v)
227231
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ object RpmPlugin extends AutoPlugin {
6969
rpmPrefix := None,
7070
rpmVendor := "", // TODO - Maybe pull in organization?
7171
rpmLicense := None,
72+
rpmEpoch := 0,
7273
rpmDistribution := None,
7374
rpmUrl := None,
7475
rpmGroup := None,
@@ -121,7 +122,8 @@ object RpmPlugin extends AutoPlugin {
121122
(packageSummary in Rpm).value,
122123
(packageDescription in Rpm).value,
123124
rpmAutoprov.value,
124-
rpmAutoreq.value
125+
rpmAutoreq.value,
126+
rpmEpoch.value
125127
),
126128
rpmDescription := RpmDescription(
127129
rpmLicense.value,

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

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

2222
rpmLicense := Some("BSD")
2323

24+
rpmEpoch := 1
25+
2426
packageArchitecture in Rpm := "x86_64"
2527

2628
linuxPackageMappings in Rpm := {
@@ -38,6 +40,7 @@ TaskKey[Unit]("checkSpecFile") := {
3840
assert(spec contains "Release: 1", "Contains project release")
3941
assert(spec contains "Summary: Test rpm package", "Contains project summary")
4042
assert(spec contains "License: BSD", "Contains project license")
43+
assert(spec contains "Epoch: 1", "Contains epoch of 1")
4144
assert(spec contains "Vendor: typesafe", "Contains project vendor")
4245
assert(spec contains "URL: http://github.com/sbt/sbt-native-packager", "Contains project url")
4346
assert(spec contains "BuildArch: x86_64", "Contains project package architecture")

src/sphinx/formats/rpm.rst

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ Informational Settings
123123
``rpmLicense``
124124
The license associated with software in the RPM.
125125

126+
``rpmEpoch``
127+
The epoch is the most significant number used when resolving different versions
128+
for the same RPM. For a given package, packages with the highest epoch will be
129+
used, and in the event of a tie it will fall back to comparing the version and
130+
release.
131+
126132
Dependency Settings
127133
~~~~~~~~~~~~~~~~~~~
128134

0 commit comments

Comments
 (0)