Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented the changelog to RPM #332

Merged
merged 5 commits into from
Aug 29, 2014
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait RpmKeys {
val rpmPrefix = SettingKey[Option[String]]("rpm-prefix", "File system prefix for relocatable package.")
val rpmMetadata = SettingKey[RpmMetadata]("rpm-metadata", "Metadata associated with the generated RPM.")

// Changelog
val rpmChangelogFile = SettingKey[Option[String]]("rpm-changelog-file", "RPM changelog file to be imported")

// DESCRIPTION KEYS
// TODO - Summary and license are required.
val rpmLicense = SettingKey[Option[String]]("rpm-license", "License of the code within the RPM.")
Expand Down
13 changes: 10 additions & 3 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmMetadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package rpm
import linux.{ LinuxPackageMapping, LinuxFileMetaData }
import sbt._
import com.typesafe.sbt.packager.linux.LinuxSymlink
import java.nio.file.{ Paths, Files }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overlooked this line. We are currently Java compatible, so you can't use NIO here :-(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh.. :(
And what should I use instead of it?

Em 26/08/2014, às 12:08, Nepomuk Seiler notifications@github.com escreveu:

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

@@ -5,6 +5,7 @@ package rpm
import linux.{ LinuxPackageMapping, LinuxFileMetaData }
import sbt._
import com.typesafe.sbt.packager.linux.LinuxSymlink
+import java.nio.file.{ Paths, Files }
I overlooked this line. We are currently Java compatible, so you can't use NIO here :-(


Reply to this email directly or view it on GitHub.


case class RpmMetadata(
name: String,
Expand All @@ -29,7 +30,8 @@ case class RpmDescription(
url: Option[String] = None,
group: Option[String] = None,
packager: Option[String] = None,
icon: Option[String] = None)
icon: Option[String] = None,
changelogFile: Option[String] = None)

case class RpmDependencies(
provides: Seq[String] = Seq.empty,
Expand Down Expand Up @@ -204,8 +206,13 @@ case class RpmSpec(meta: RpmMetadata,
// Write file mappings
sb append fileSection
// TODO - Write triggers...
// TODO - Write changelog...

desc.changelogFile foreach { changelog =>
if (Files.exists(Paths.get(changelog))) {
val content = scala.io.Source.fromFile(changelog).mkString
sb append "%changelog\n"
sb append ("%s\n" format content)
}
}
sb.toString
}
}
3 changes: 2 additions & 1 deletion src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
rpmPosttrans := None,
rpmPreun := None,
rpmPostun := None,
rpmChangelogFile := None,
rpmBrpJavaRepackJars := false,
rpmScriptsDirectory <<= sourceDirectory apply (_ / "rpm" / Names.Scriptlets),
// Explicitly defer default settings to generic Linux Settings.
Expand All @@ -53,7 +54,7 @@ trait RpmPlugin extends Plugin with LinuxPlugin {
rpmMetadata <<=
(packageName, version, rpmRelease, rpmPrefix, packageArchitecture, rpmVendor, rpmOs, packageSummary, packageDescription, rpmAutoprov, rpmAutoreq) apply RpmMetadata,
rpmDescription <<=
(rpmLicense, rpmDistribution, rpmUrl, rpmGroup, rpmPackager, rpmIcon) apply RpmDescription,
(rpmLicense, rpmDistribution, rpmUrl, rpmGroup, rpmPackager, rpmIcon, rpmChangelogFile) apply RpmDescription,
rpmDependencies <<=
(rpmProvides, rpmRequirements, rpmPrerequisites, rpmObsoletes, rpmConflicts) apply RpmDependencies,
rpmPre <<= (rpmPre, rpmBrpJavaRepackJars) apply {
Expand Down
26 changes: 26 additions & 0 deletions src/sphinx/DetailedTopics/redhat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Rpms require the following specific settings:
rpmVendor := "typesafe",
rpmUrl := Some("http://github.com/paulp/sbt-extras"),
rpmLicense := Some("BSD"),
rpmChangelogFile := Some("changelog")


Informational Settings
Expand Down Expand Up @@ -63,6 +64,9 @@ Meta Settings
``rpmPrefix``
The path passed set as the base for the revocable package

``rpmChangelogFile``
External file to be imported and used to generate the changelog of the RPM.


Scriptlet Settings
~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -119,6 +123,28 @@ Example Settings
defaultLinuxLogsLocation := defaultLinuxInstallLocation + "/" + name


rpmChangelogFile
----------
The rpmChangelogFile property allows you to set a source that will be imported and used on the RPM generation. So if you use rpm commands to see the changelog it brings that information. You have to create the content on that file following the RPM conventions that are available here http://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs.

Example Settings
~~~~~~~~~~~~~~~~~~

.. code-block:: scala

changelog := "changelog.txt",
rpmChangelogFile := Some(changelog)


.. code-block:: txt
* Sun Aug 24 2014 Team <contact@example.com> - 1.1.0
-Allow to login using social networks
* Wed Aug 20 2014 Team <contact@example.com> - 1.0.1
-Vulnerability fix.
* Tue Aug 19 2014 Team <contact@example.com> - 1.0.0
-First version of the system


Template Changes
~~~~~~~~~~~~~~~~~~
Apply the following changes to the default init start script. You can find this in the sbt-native-packager source.
Expand Down
2 changes: 2 additions & 0 deletions test-project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ rpmVendor := "typesafe"

rpmLicense := Some("BSD")

rpmChangelogFile := Some("changelog.txt")

//debianMakePrermScript := Some(sourceDirectory.value / "deb" / "control" / "prerm") //change defaults


Expand Down
9 changes: 9 additions & 0 deletions test-project/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* Sun Aug 24 2014 Team <contact@example.com> - 1.1.0
-Allow to login using social networks
* Wed Aug 20 2014 Team <contact@example.com> - 1.0.1
-Vulnerability fix.
-Other information.
-Feature list.
* Tue Aug 19 2014 Team <contact@example.com> - 1.0.0
-First version of the system