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 2019/02/13 15:58:45 UTC
[incubator-daffodil] branch master updated: Support building MSI
packages with wine on Linux
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 728eb43 Support building MSI packages with wine on Linux
728eb43 is described below
commit 728eb437a910c2687c8b73cc69180a73c0ea7dcd
Author: Steve Lawrence <sl...@apache.org>
AuthorDate: Tue Feb 12 10:39:10 2019 -0500
Support building MSI packages with wine on Linux
- Disable MSI validation by providing the -sval flag to light.exe. When
generating an MSI in wine without this flag, light.exe fails with a
generic Windows error. Some reports of similar issues make it sound
like validation is performed by installing the MSI in some sort of
dry-run mode--not too surprising that would fail in wine.
- Modify release script to build the MSI and install to apache-dist.
Also clean up the release script to have consistent indentation.
- Modify RTF license generator to always output windows style line
endings, required by MSI generator
DAFFODIL-2066
---
daffodil-cli/build.sbt | 8 +++---
scripts/release-candidate.sh | 27 +++++++++++++--------
scripts/wix_wine.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 13 deletions(-)
diff --git a/daffodil-cli/build.sbt b/daffodil-cli/build.sbt
index 8ac8733..615ca20 100644
--- a/daffodil-cli/build.sbt
+++ b/daffodil-cli/build.sbt
@@ -139,6 +139,7 @@ wixProductUpgradeId := "4C966AFF-585E-4E17-8CC2-059FD70FEC77"
// specific XML to enable this, the WiX compiler and linker
// complain about it unless you specifically suppress the warning.
lightOptions := Seq(
+ "-sval", // validation does not currently work under Wine, this disables that
"-sice:ICE61",
"-ext", "WixUIExtension",
"-cultures:en-us",
@@ -161,11 +162,12 @@ wixProductLicense := {
val licenseLines = scala.io.Source.fromFile(sourceLicense, "UTF-8").getLines
val writer = new java.io.PrintWriter(targetLicense, "UTF-8")
- writer.println(rtfHeader)
+ // windows style line endings in the license are required by the WiX toolkit
+ writer.write(rtfHeader + "\r\n")
licenseLines.foreach { line =>
- writer.println(line + """\line""")
+ writer.write(line + """\line""" + "\r\n")
}
- writer.println(rtfFooter)
+ writer.write(rtfFooter + "\r\n")
writer.close
Option(targetLicense)
}
diff --git a/scripts/release-candidate.sh b/scripts/release-candidate.sh
index 3720809..43464c3 100755
--- a/scripts/release-candidate.sh
+++ b/scripts/release-candidate.sh
@@ -18,6 +18,9 @@
set -e
command -v rpmbuild &> /dev/null || { echo -e "\n!!! rpmbuild command required !!!\n"; exit; }
+command -v wine &> /dev/null || { echo -e "\n!!! wine command required, please set up the environment for WiX !!!\n"; exit; }
+command -v $WIX/\\bin\\candle.exe &> /dev/null || { echo -e "\n!!! WiX environment not set up correctly, missing candle.exe !!!\n"; exit; }
+command -v $WIX/\\bin\\light.exe &> /dev/null || { echo -e "\n!!! WiX environment not set up correctly, missing light.exe !!!\n"; exit; }
if [ -n "$(git status --porcelain)" ]; then { echo -e "\n!!! Repository is not clean. Commit changes or clean repo before building release !!!\n"; git status; exit; } fi
@@ -32,12 +35,12 @@ DAFFODIL_DIST_ROOT="$APACHE_DIST/dev/incubator/daffodil/"
DAFFODIL_RELEASE_DIR=$DAFFODIL_DIST_ROOT/$VERSION-$PRE_RELEASE
if [ ! -d "$DAFFODIL_DIST_ROOT" ]; then echo -e "\n!!! Daffodil release root directory does not exist: $DAFFODIL_DIST_ROOT !!!\n"; exit; fi
if [ -d "$DAFFODIL_RELEASE_DIR" ]; then
- read -p "\nOutput directory already exists: '$DAFFODIL_RELEASE_DIR'. Remove it? (Y/n)" REMOVE
- if [[ -z "$REMOVE" || "$REMOVE" == "Y" ]]; then
- rm -rf "$DAFFODIL_RELEASE_DIR"
+ read -p "Output directory already exists: '$DAFFODIL_RELEASE_DIR'. Remove it? (Y/n) " REMOVE
+ if [[ -z "$REMOVE" || "$REMOVE" == "Y" || "$REMOVE" == "y" ]]; then
+ rm -rf "$DAFFODIL_RELEASE_DIR"
else
- echo "Exiting."
- exit;
+ echo "Exiting."
+ exit
fi
fi
@@ -45,12 +48,12 @@ read -e -p "Path to Apache Daffodil site directory: " DAFFODIL_SITE_DIR
DAFFODIL_DOCS_DIR=$DAFFODIL_SITE_DIR/site/docs/$VERSION/
if [ ! -d "$DAFFODIL_SITE_DIR" ]; then echo -e "\n!!! Daffodil site directory does not exist: $DAFFODIL_SITE_DIR !!!\n"; exit; fi
if [ -d "$DAFFODIL_DOCS_DIR" ]; then
- read -p "\nDaffodil site doc version directory already exists: '$DAFFODIL_DOCS_DIR'. Remove it? (Y/n)" REMOVE
- if [[ -z "$REMOVE" || "$REMOVE" == "Y" ]]; then
- rm -rf "$DAFFODIL_DOCS_DIR";
+ read -p "Daffodil site doc version directory already exists: '$DAFFODIL_DOCS_DIR'. Remove it? (Y/n) " REMOVE
+ if [[ -z "$REMOVE" || "$REMOVE" == "Y" || "$REMOVE" == "y" ]]; then
+ rm -rf "$DAFFODIL_DOCS_DIR"
else
- echo "Exiting."
- exit;
+ echo "Exiting."
+ exit
fi
fi
@@ -81,6 +84,7 @@ sbt \
"+compile" \
"+publishSigned" \
"daffodil-cli/rpm:packageBin" \
+ "daffodil-cli/windows:packageBin" \
"daffodil-cli/universal:packageBin" \
"daffodil-cli/universal:packageZipTarball" \
"daffodil-japi/genjavadoc:doc" \
@@ -89,6 +93,9 @@ sbt \
cp daffodil-cli/target/universal/apache-daffodil-*.tgz $DAFFODIL_RELEASE_DIR/bin/
cp daffodil-cli/target/universal/apache-daffodil-*.zip $DAFFODIL_RELEASE_DIR/bin/
cp daffodil-cli/target/rpm/RPMS/noarch/apache-daffodil-*.rpm $DAFFODIL_RELEASE_DIR/bin/
+MSI_NAME=$(basename $DAFFODIL_RELEASE_DIR/bin/*.zip .zip).msi
+cp daffodil-cli/target/windows/Daffodil.msi $DAFFODIL_RELEASE_DIR/bin/$MSI_NAME
+chmod -x $DAFFODIL_RELEASE_DIR/bin/$MSI_NAME
cp -R daffodil-japi/target/scala-2.12/genjavadoc-api/* $DAFFODIL_DOCS_DIR/javadoc/
cp -R daffodil-sapi/target/scala-2.12/api/* $DAFFODIL_DOCS_DIR/scaladoc/
diff --git a/scripts/wix_wine.sh b/scripts/wix_wine.sh
new file mode 100755
index 0000000..3861dda
--- /dev/null
+++ b/scripts/wix_wine.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# We use sbt-native-packager plugin to build a Windows MSI installer.
+# Unfortunately, that uses WiX toolset which requires Windows. It can be run
+# under Wine, but the plugin cannot be easily configured to use Wine. This
+# script is one part of getting that to work. The full steps for setting up the
+# environment are documented in the Daffodil Release Workflow wiki page.
+
+# We run a few wine commands, let's disable all wine debug information since it
+# is interpreted by sbt as errors and makes the output look like something
+# failed.
+export WINEDEBUG=-all
+
+# If the WiX environment is setup correctly, the sbt native-packager will
+# execute a symlink to this script, and the $0 variable should look something
+# like "path/to/wix_directory/\\bin\\candle.exe". The following will extract
+# evertyhing after the last backslash, returning either "candle.exe" or
+# "light.exe" depending on what the plugin executes.
+CMD=${0##*\\}
+
+# The paths passed into this script by the plugin are all absolute Linux style
+# paths. For arguments that look like a path (i.e. starts with a /), use
+# winepath to convert them to a Windows style path that wine applications can
+# understand. Leave all other arguments unmodified.
+i=0
+NEWARGS=()
+for VAR in "$@"
+do
+ if [[ $VAR == /* ]]
+ then
+ NEWARGS[$i]=$(winepath -w "$VAR")
+ else
+ NEWARGS[$i]=$VAR
+ fi
+ ((++i))
+done
+
+# Tell bash to output the command we are about to execute, helpful for
+# debugging when something goes wrong with wine
+set -x
+
+# Execute wine with the right WiX command and modified arguments
+wine $WIX/$CMD "${NEWARGS[@]}"