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

Adding rpm override script tests #891

Merged
merged 1 commit into from
Oct 7, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object SystemVPlugin extends AutoPlugin {
Seq(
// set the template
linuxStartScriptTemplate := linuxStartScriptUrl(
(sourceDirectory in Compile).value,
sourceDirectory.value,
serverLoading.value,
"start-rpm-template"
)
Expand Down
36 changes: 36 additions & 0 deletions src/sbt-test/rpm/override-start-script-systemd/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
enablePlugins(JavaServerAppPackaging, SystemdPlugin)

name := "rpm-test"

version := "0.1.0"

maintainer := "Mitch Seymour <mitchseymour@gmail.com>"

packageSummary := "Test rpm package"

executableScriptName := "rpm-exec"

packageDescription := """A fun package description of our software,
with multiple lines."""

rpmRelease := "1"

rpmVendor := "typesafe"

rpmUrl := Some("http://github.com/sbt/sbt-native-packager")

rpmLicense := Some("BSD")

rpmGroup := Some("test-group")

TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) =>
val rpmPath = Seq(rpmFile.getAbsolutePath)
Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log
()
}

TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) =>
val script = IO.read(file("usr/lib/systemd/system/rpm-test.service"))
assert(script.startsWith("# right systemd template"), s"override script wasn't picked, script is\n$script")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# check that old start template isn't picked
# wrong start template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# right systemd template
10 changes: 10 additions & 0 deletions src/sbt-test/rpm/override-start-script-systemd/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run the rpm packaging.
> rpm:package-bin
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm

> unzip
# Bootscript != executable Script
$ exists /usr/lib/systemd/system/rpm-test.service
# $ exists usr/share/rpm-test/bin/rpm-exec

> checkStartupScript
36 changes: 36 additions & 0 deletions src/sbt-test/rpm/override-start-script-systemv/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
enablePlugins(JavaServerAppPackaging, SystemVPlugin)

name := "rpm-test"

version := "0.1.0"

maintainer := "Mitch Seymour <mitchseymour@gmail.com>"

packageSummary := "Test rpm package"

executableScriptName := "rpm-exec"

packageDescription := """A fun package description of our software,
with multiple lines."""

rpmRelease := "1"

rpmVendor := "typesafe"

rpmUrl := Some("http://github.com/sbt/sbt-native-packager")

rpmLicense := Some("BSD")

rpmGroup := Some("test-group")

TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) =>
val rpmPath = Seq(rpmFile.getAbsolutePath)
Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log
()
}

TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) =>
val script = IO.read(file("etc/init.d/rpm-test"))
assert(script.startsWith("# right systemv template"), s"override script wasn't picked, script is\n$script")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# check that old start template isn't picked
# wrong start template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# right systemv template
10 changes: 10 additions & 0 deletions src/sbt-test/rpm/override-start-script-systemv/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run the rpm packaging.
> rpm:package-bin
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm

> unzip
# Bootscript != executable Script
$ exists etc/init.d/rpm-test
# $ exists usr/share/rpm-test/bin/rpm-exec

> checkStartupScript
36 changes: 36 additions & 0 deletions src/sbt-test/rpm/override-start-script-upstart/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
enablePlugins(JavaServerAppPackaging, UpstartPlugin)

name := "rpm-test"

version := "0.1.0"

maintainer := "Mitch Seymour <mitchseymour@gmail.com>"

packageSummary := "Test rpm package"

executableScriptName := "rpm-exec"

packageDescription := """A fun package description of our software,
with multiple lines."""

rpmRelease := "1"

rpmVendor := "typesafe"

rpmUrl := Some("http://github.com/sbt/sbt-native-packager")

rpmLicense := Some("BSD")

rpmGroup := Some("test-group")

TaskKey[Unit]("unzip") <<= (packageBin in Rpm, streams) map { (rpmFile, streams) =>
val rpmPath = Seq(rpmFile.getAbsolutePath)
Process("rpm2cpio", rpmPath) #| Process("cpio -i --make-directories") ! streams.log
()
}

TaskKey[Unit]("checkStartupScript") <<= (target, streams) map { (target, out) =>
val script = IO.read(file("etc/init/rpm-test.conf"))
assert(script.startsWith("# right upstart template"), s"override script wasn't picked, script is\n$script")
()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# check that old start template isn't picked
# wrong start template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# right upstart template
10 changes: 10 additions & 0 deletions src/sbt-test/rpm/override-start-script-upstart/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run the rpm packaging.
> rpm:package-bin
$ exists target/rpm/RPMS/noarch/rpm-test-0.1.0-1.noarch.rpm

> unzip
# Bootscript != executable Script
$ exists etc/init/rpm-test.conf
# $ exists usr/share/rpm-test/bin/rpm-exec

> checkStartupScript