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

V.1.1 This is a fix for #812 #835

Merged
merged 5 commits into from
Jul 2, 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 @@ -369,7 +369,7 @@ object JavaServerAppPackaging extends AutoPlugin {
val rpmScripts = Option(scriptDirectory.listFiles) getOrElse Array.empty

// remove all non files and already processed templates
rpmScripts.diff(predefined).filter(_.isFile).foldLeft(predefinedScripts) {
rpmScripts.filter(s => s.isFile && !predefined.contains(s.getName)).foldLeft(predefinedScripts) {
case (scripts, scriptlet) =>
val script = scriptlet.getName
val existingContent = scripts.getOrElse(script, Nil)
Expand Down
15 changes: 15 additions & 0 deletions src/sbt-test/rpm/scriptlets-override-rpm/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,18 @@ TaskKey[Unit]("check-spec-file") <<= (target, streams) map { (target, out) =>
()
}

def countSubstring(str: String, substr: String): Int =
substr.r.findAllMatchIn(str).length

def isUnique(str: String, searchstr: String): Boolean =
countSubstring(str, searchstr) == 1

TaskKey[Unit]("unique-scripts-in-spec-file") <<= (target, streams) map { (target, out) =>
val spec = IO.read(target / "rpm" / "SPECS" / "rpm-test.spec")
assert( isUnique(spec, "echo postinst"), "'echo 'postinst' not unique in \n" + spec)
assert( isUnique(spec, "echo preinst"), "'echo 'preinst' not unique in \n" + spec)
assert( isUnique(spec, "echo postun"), "'echo 'postun' not unique in \n" + spec)
assert( isUnique(spec, "echo preun"), "'echo 'preun' not unique in \n" + spec)
()
}

1 change: 1 addition & 0 deletions src/sbt-test/rpm/scriptlets-override-rpm/test
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ $ exists var/run/rpm-test
> set NativePackagerKeys.rpmBrpJavaRepackJars := true
> check-spec-file

> unique-scripts-in-spec-file
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "1.1.1"
version in ThisBuild := "1.1.2"