Commit 83bac3c 1 parent 596eb92 commit 83bac3c Copy full SHA for 83bac3c
File tree 8 files changed +37
-4
lines changed
integration-tests-ansible/test-project-play-rpm
main/scala/com/typesafe/sbt/packager
8 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 1917
1917
## [ 0.1.0] ( https://github.com/sbt/sbt-native-packager/tree/0.1.0 ) (2012-01-16)
1918
1918
1919
1919
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 ) *
Original file line number Diff line number Diff line change @@ -28,3 +28,5 @@ rpmRelease := "1"
28
28
rpmVendor := " DemoVendor"
29
29
30
30
rpmLicense := Some (" Apache-2.0" )
31
+
32
+ rpmEpoch := Some (1 )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ trait RpmKeys {
21
21
// DESCRIPTION KEYS
22
22
// TODO - Summary and license are required.
23
23
val rpmLicense = SettingKey [Option [String ]](" rpm-license" , " License of the code within the RPM." )
24
+ val rpmEpoch = SettingKey [Option [Int ]](" rpm-epoch" , " Epoch of the generated RPM." )
24
25
val rpmDistribution = SettingKey [Option [String ]](" rpm-distribution" )
25
26
val rpmUrl =
26
27
SettingKey [Option [String ]](" rpm-url" , " Url to include in the RPM." )
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ case class RpmMetadata(name: String,
18
18
summary : String ,
19
19
description : String ,
20
20
autoprov : String ,
21
- autoreq : String )
21
+ autoreq : String ,
22
+ epoch : Option [Int ])
22
23
23
24
/**
24
25
* The Description used to generate an RPM
@@ -222,6 +223,11 @@ case class RpmSpec(meta: RpmMetadata,
222
223
sb append (" Version: %s\n " format meta.version)
223
224
sb append (" Release: %s\n " format meta.release)
224
225
sb append (" Summary: %s\n " format meta.summary)
226
+
227
+ meta.epoch filter (_ >= 0 ) foreach { epoch =>
228
+ sb append (" Epoch: %d\n " format epoch)
229
+ }
230
+
225
231
meta.prefix foreach { v =>
226
232
sb append (" prefix: %s\n " format v)
227
233
}
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ object RpmPlugin extends AutoPlugin {
69
69
rpmPrefix := None ,
70
70
rpmVendor := " " , // TODO - Maybe pull in organization?
71
71
rpmLicense := None ,
72
+ rpmEpoch := None ,
72
73
rpmDistribution := None ,
73
74
rpmUrl := None ,
74
75
rpmGroup := None ,
@@ -105,7 +106,8 @@ object RpmPlugin extends AutoPlugin {
105
106
validatePackageValidators in Rpm := Seq (
106
107
nonEmptyMappings((linuxPackageMappings in Rpm ).value.flatMap(_.mappings)),
107
108
filesExist((linuxPackageMappings in Rpm ).value.flatMap(_.mappings)),
108
- checkMaintainer((maintainer in Rpm ).value, asWarning = false )
109
+ checkMaintainer((maintainer in Rpm ).value, asWarning = false ),
110
+ epochIsNaturalNumber((rpmEpoch in Rpm ).value.getOrElse(0 ))
109
111
),
110
112
// override the linux sourceDirectory setting
111
113
sourceDirectory in Rpm := sourceDirectory.value,
@@ -121,7 +123,8 @@ object RpmPlugin extends AutoPlugin {
121
123
(packageSummary in Rpm ).value,
122
124
(packageDescription in Rpm ).value,
123
125
rpmAutoprov.value,
124
- rpmAutoreq.value
126
+ rpmAutoreq.value,
127
+ rpmEpoch.value
125
128
),
126
129
rpmDescription := RpmDescription (
127
130
rpmLicense.value,
Original file line number Diff line number Diff line change @@ -63,4 +63,16 @@ package object validation {
63
63
}
64
64
}
65
65
66
+ def epochIsNaturalNumber (epoch : Int ): Validation .Validator = () => {
67
+ sys.error(s " Passed: $epoch" )
68
+ if (epoch < 0 ) {
69
+ ValidationError (
70
+ description = s " The Epoch cannot be a negative number (found $epoch) " ,
71
+ howToFix = " Change rpmEpoch to Some(n), where n >= 0"
72
+ ) :: Nil
73
+ } else {
74
+ Nil
75
+ }
76
+ }
77
+
66
78
}
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ rpmUrl := Some("http://github.com/sbt/sbt-native-packager")
21
21
22
22
rpmLicense := Some (" BSD" )
23
23
24
+ rpmEpoch := Some (1 )
25
+
24
26
packageArchitecture in Rpm := " x86_64"
25
27
26
28
linuxPackageMappings in Rpm := {
@@ -38,6 +40,7 @@ TaskKey[Unit]("checkSpecFile") := {
38
40
assert(spec contains " Release: 1" , " Contains project release" )
39
41
assert(spec contains " Summary: Test rpm package" , " Contains project summary" )
40
42
assert(spec contains " License: BSD" , " Contains project license" )
43
+ assert(spec contains " Epoch: 1" , " Contains epoch of 1" )
41
44
assert(spec contains " Vendor: typesafe" , " Contains project vendor" )
42
45
assert(spec contains " URL: http://github.com/sbt/sbt-native-packager" , " Contains project url" )
43
46
assert(spec contains " BuildArch: x86_64" , " Contains project package architecture" )
Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ Informational Settings
123
123
``rpmLicense ``
124
124
The license associated with software in the RPM.
125
125
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
+
126
132
Dependency Settings
127
133
~~~~~~~~~~~~~~~~~~~
128
134
You can’t perform that action at this time.
0 commit comments