You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sl...@apache.org on 2020/09/03 13:20:12 UTC

[incubator-daffodil] branch master updated: Various cleanups to sbt rpm configuration

This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git


The following commit(s) were added to refs/heads/master by this push:
     new 5061ed0  Various cleanups to sbt rpm configuration
5061ed0 is described below

commit 5061ed004f9206f2287a3186dfa40684c2d84e5e
Author: Steve Lawrence <sl...@apache.org>
AuthorDate: Tue Sep 1 14:49:50 2020 -0400

    Various cleanups to sbt rpm configuration
    
    - Update sbt native-packager version. This fixes the issue where
      rpmbuild output showed up as an error in sbt even though there was no
      error. It now shows up as normal "info"
    - Disable compression when building the rpm by injecting a define into
      the spec file using an sbt native-packager hack
    - Fixes to CLI script based on the result of shellcheck output
    
    DAFFODIL-2388
---
 daffodil-cli/build.sbt                   | 14 ++++++++++++++
 daffodil-cli/src/templates/bash-template |  6 +++---
 project/plugins.sbt                      |  2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/daffodil-cli/build.sbt b/daffodil-cli/build.sbt
index 615ca20..6072ab4 100644
--- a/daffodil-cli/build.sbt
+++ b/daffodil-cli/build.sbt
@@ -64,6 +64,20 @@ Daffodil uses this description to parse data into an XML infoset for ingestion
 and validation.
 """.trim
 
+// The below is a hack. The sbt native packager plugin does not provide a way
+// to make arbitrary changes to the RPM spec file. However, RPM spec files
+// allow %define's within a description. So if we need to add defines to change
+// rpmbuild behavior, we can simply append them to the RPM description and
+// things still work as expected.
+//
+// In this case, we want to disable zstd compression which isn't supported by
+// older versions of RPM. So we add the following special rpm %define's to use
+// gzip compression instead, which is supported by all versions of RPM.
+packageDescription in Rpm := (packageDescription in Rpm).value + """
+%define _source_payload w9.gzdio
+%define _binary_payload w9.gzdio
+"""
+
 version in Rpm := {
   val parts = version.value.split("-", 2)
   val ver = parts(0) // removes snapshot if it exists
diff --git a/daffodil-cli/src/templates/bash-template b/daffodil-cli/src/templates/bash-template
index 6f0843c..ebe6783 100755
--- a/daffodil-cli/src/templates/bash-template
+++ b/daffodil-cli/src/templates/bash-template
@@ -39,18 +39,18 @@ realpath() {
   THISPWD=$PWD
   LNK=$1
   while [ "$LNK" ]; do
-    cd "$(dirname "$LNK")"
+    cd "$(dirname "$LNK")" || return
     BN=$(basename "$LNK")
     LNK=$(readlink "$BN")
   done
   REALPATH="$PWD/$BN"
-  cd "$THISPWD"
+  cd "$THISPWD" || return
   echo "$REALPATH"
 }
 
 MAINCLASS=org.apache.daffodil.Main
 SCRIPT=$(realpath "$0")			# Full path to script, needed for symlinks
-BINDIR=`dirname ${SCRIPT}`		# Directory script is run in
+BINDIR=$(dirname "${SCRIPT}")		# Directory script is run in
 LIBDIR="$BINDIR/../lib"
 CLASSPATH=$LIBDIR/'*'
 
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 35a50b1..9805c82 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.17")
+addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.5")
 
 addSbtPlugin("org.musigma" % "sbt-rat" % "0.6.0")