Skip to content

Commit 1893306

Browse files
committed
Pass platform through to standalone
We need the target platform in the script that creates the dmg for macOS, since it could be either osx-64 or osx-arm64. Previously it was always osx-64 so could be hard-coded. I also added the platform name to the dmg file name to avoid a clash when making both the osx-64 and osx-arm64 standalones.
1 parent 755f7a3 commit 1893306

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

buildconfig/Jenkins/Conda/nightly_build_and_deploy.jenkinsfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pipeline {
368368

369369
package_conda("${PLATFORM}", "workbench")
370370
archive_conda_packages("${PLATFORM}")
371-
package_standalone()
371+
package_standalone("${PLATFORM}")
372372
archive_standalone_package("${PLATFORM}")
373373
}
374374
post {
@@ -622,23 +622,23 @@ def generate_git_tag() {
622622
return git_tag
623623
}
624624

625-
def package_standalone() {
625+
def package_standalone(platform) {
626626
packagescript_path = "${CISCRIPT_DIR}/package-standalone"
627627
if(isUnix()) {
628-
sh "${packagescript_path} ${WORKSPACE} ${package_standalone_options()}"
628+
sh "${packagescript_path} ${WORKSPACE} ${package_standalone_options(platform)}"
629629
} else {
630630
workspace_unix_style = toUnixStylePath("${WORKSPACE}")
631631
bat "\"${WIN_BASH}\" -ex -c \"${packagescript_path} ${workspace_unix_style}\
632-
${package_standalone_options()}\""
632+
${package_standalone_options(platform)}\""
633633
}
634634
}
635635

636-
def package_standalone_options() {
636+
def package_standalone_options(platform) {
637637
package_options = ""
638638
if(PACKAGE_SUFFIX.trim() != '') {
639639
package_options += " --package-suffix ${PACKAGE_SUFFIX}"
640640
}
641-
return package_options.trim()
641+
return package_options.trim() + " --platform ${platform}"
642642
}
643643

644644
// Determine whether this build should be marked as a prerelease on GitHub.

buildconfig/Jenkins/Conda/package-standalone

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#
1919
# Possible parameters:
2020
# --package-suffix: An optional suffix to pass to the standalone package step.
21+
# --platform: Target platform, e.g. linux-64
2122

2223
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2324
source $SCRIPT_DIR/mamba-utils
@@ -44,12 +45,16 @@ fi
4445

4546
# Parse options
4647
STANDALONE_PACKAGE_SUFFIX=
48+
PLATFORM=""
4749
while [ ! $# -eq 0 ]
4850
do
4951
case "$1" in
5052
--package-suffix)
5153
STANDALONE_PACKAGE_SUFFIX="$2"
5254
shift ;;
55+
--platform)
56+
PLATFORM="$2"
57+
shift ;;
5358
*)
5459
echo "Argument not accepted: $1"
5560
exit 1
@@ -59,7 +64,7 @@ do
5964
done
6065

6166
# Mamba
62-
setup_mamba $WORKSPACE/mambaforge "package-standalone" false ""
67+
setup_mamba $WORKSPACE/mambaforge "package-standalone" false $PLATFORM
6368
# Pin conda to known working version. In 24.9 the post-link.bat script doesn't work.
6469
mamba install --yes mamba=1.5 conda-build conda=24.7
6570

@@ -77,11 +82,15 @@ PACKAGING_ARGS="-c ${LOCAL_CHANNEL}"
7782
if [ -n "${STANDALONE_PACKAGE_SUFFIX}" ]; then
7883
PACKAGING_ARGS="${PACKAGING_ARGS} -s ${STANDALONE_PACKAGE_SUFFIX}"
7984
fi
85+
8086
if [[ $OSTYPE == 'msys'* ]]; then
8187
rm -fr *.exe
8288
${PACKAGING_SCRIPTS_DIR}/win/create_package.sh $PACKAGING_ARGS
8389
elif [[ $OSTYPE == 'darwin'* ]]; then
8490
rm -fr *.dmg
91+
if [ -n "${PLATFORM}" ]; then
92+
PACKAGING_ARGS="${PACKAGING_ARGS} -p ${PLATFORM}"
93+
fi
8594
${PACKAGING_SCRIPTS_DIR}/osx/create_bundle.sh $PACKAGING_ARGS
8695
else
8796
rm -fr *.tar.xz

installers/conda/osx/create_bundle.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,22 @@ function usage() {
136136
echo "Options:"
137137
echo " -c Optional Conda channel overriding the default mantid"
138138
echo " -s Optional Add a suffix to the output mantid file, has to be Unstable, or Nightly or not used"
139-
echo
139+
echo " -p Target platform, e.g. osx-64 or osx-arm64"
140140
exit $exitcode
141141
}
142142

143143
## Script begin
144144
# Optional arguments
145145
conda_channel=mantid
146+
platform=""
146147
suffix=
147148
while [ ! $# -eq 0 ]
148149
do
149150
case "$1" in
151+
-p)
152+
platform="$2"
153+
shift
154+
;;
150155
-c)
151156
conda_channel="$2"
152157
shift
@@ -210,7 +215,7 @@ if [[ "$suffix" == "Unstable" ]] || [[ "$suffix" == "Nightly" ]]; then
210215
fi
211216

212217
echo "Creating Conda environment in '$bundle_conda_prefix'"
213-
"$CONDA_EXE" create --quiet --prefix "$bundle_conda_prefix" --copy --platform osx-64 \
218+
"$CONDA_EXE" create --quiet --prefix "$bundle_conda_prefix" --copy --platform "$platform" \
214219
--channel "$conda_channel" --channel conda-forge --channel $mantid_channel --yes \
215220
mantidworkbench \
216221
jq # used for processing the version string
@@ -240,6 +245,6 @@ create_plist "$bundle_contents" "$bundle_name" "$bundle_icon" "$version"
240245
# `create-dmg` returns error code by default due to lack of signing - this is suppressed using a command list.
241246
# Failure of the following `mv` command likely signifies `create-dmg` error.
242247
export PATH=$PATH:/opt/homebrew/bin/
243-
version_name="$bundle_name"-"$version"
248+
version_name="$bundle_name"-"$platform"-"$version"
244249
create-dmg "$BUILD_DIR"/"$bundle_dirname" || true
245250
mv "${bundle_name} ${version}.dmg" "${version_name}.dmg"

0 commit comments

Comments
 (0)