Skip to content

Commit

Permalink
Fix for RPM error "Unable to open temp file" #228
Browse files Browse the repository at this point in the history
define _tmppath when calling rpmbuild using temporary directory and
cleanup temporary directory afterwards.
  • Loading branch information
Graham Rhodes committed Apr 15, 2014
1 parent cae884d commit f12c5e1
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,23 @@ object RpmHelper {
val specsDir = workArea / "SPECS"
val gpg = false
// TODO - Full GPG support (with GPG plugin).
val args: Seq[String] = Seq(
"rpmbuild",
"-bb",
"--target", spec.meta.arch + '-' + spec.meta.vendor + '-' + spec.meta.os,
"--buildroot", buildRoot.getAbsolutePath,
"--define", "_topdir " + workArea.getAbsolutePath,
"--define", "_tmppath " + IO.createTemporaryDirectory.getAbsolutePath
) ++ (
IO.withTemporaryDirectory { tmpRpmBuildDir =>
val args: Seq[String] = Seq(
"rpmbuild",
"-bb",
"--target", spec.meta.arch + '-' + spec.meta.vendor + '-' + spec.meta.os,
"--buildroot", buildRoot.getAbsolutePath,
"--define", "_topdir " + workArea.getAbsolutePath,
"--define", "_tmppath " + tmpRpmBuildDir.getAbsolutePath
) ++ (
if (gpg) Seq("--define", "_gpg_name " + "<insert keyname>", "--sign")
else Seq.empty
) ++ Seq(spec.meta.name + ".spec")
log.debug("Executing rpmbuild with: " + args.mkString(" "))
(Process(args, Some(specsDir)) ! log) match {
case 0 => ()
case 1 => sys.error("Unable to run rpmbuild, check output for details.")
log.debug("Executing rpmbuild with: " + args.mkString(" "))
(Process(args, Some(specsDir)) ! log) match {
case 0 => ()
case 1 => sys.error("Unable to run rpmbuild, check output for details.")
}
}
}

Expand Down

0 comments on commit f12c5e1

Please sign in to comment.