fi
}
+# Usage: package_workbench2
+package_workbench2() {
+ local pkgname=arvados-workbench2
+ local src=services/workbench2
+ local dst=/var/www/arvados-workbench2/workbench2
+ local description="Arvados Workbench 2"
+ local version="$(version_from_git)"
+ cd "$WORKSPACE/$src"
+ rm -rf ./build
+ NODE_ENV=production yarn install
+ VERSION="$VERSION" BUILD_NUMBER="$(default_iteration "$pkgname" "$version" yarn)" GIT_COMMIT="$(git rev-parse HEAD | head -c9)" yarn build
+ cd "$WORKSPACE/packages/$TARGET"
+ fpm_build "${WORKSPACE}/$src" "${WORKSPACE}/$src/build/=$dst" "$pkgname" dir "$version" \
+ --license="GNU Affero General Public License, version 3.0" \
+ --description="${description}" \
+ --config-files="/etc/arvados/$pkgname/workbench2.example.json" \
+ "$WORKSPACE/services/workbench2/etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$pkgname/workbench2.example.json"
+}
+
calculate_go_package_version() {
# $__returnvar has the nameref attribute set, which means it is a reference
# to another variable that is passed in as the first argument to this function.
local license_file="${1:-agpl-3.0.txt}"; shift
if [[ -n "$ONLY_BUILD" ]] && [[ "$prog" != "$ONLY_BUILD" ]]; then
- # arvados-workbench depends on arvados-server at build time, so even when
- # only arvados-workbench is being built, we need to build arvados-server too
- if [[ "$prog" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
debug_echo -e "Skipping build of $prog package."
return 0
- fi
fi
native_arch=$(get_native_arch)
return 1
fi
- cross_compilation=1
- if [[ "$TARGET" == "centos7" ]]; then
- if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then
- echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch"
- return 1
- fi
- cross_compilation=0
- fi
-
- if [[ "$package_format" == "deb" ]] &&
- [[ "$TARGET" == "debian10" ]] || [[ "$TARGET" == "ubuntu1804" ]] || [[ "$TARGET" == "ubuntu2004" ]]; then
- # Due to bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477 the libfuse-dev package for arm64 does
- # not install properly side by side with the amd64 version before Debian 11.
- if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then
- echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch"
- return 1
- fi
- cross_compilation=0
- fi
+ case "$package_format-$TARGET" in
+ # Older Debian/Ubuntu do not support cross compilation because the
+ # libfuse package does not support multiarch. See
+ # <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477>.
+ # Red Hat-based distributions do not support native cross compilation at
+ # all (they use a qemu-based solution we haven't implemented yet).
+ deb-debian10|deb-ubuntu1804|deb-ubuntu2004|rpm-*)
+ cross_compilation=0
+ if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then
+ echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch"
+ return 1
+ fi
+ ;;
+ *)
+ cross_compilation=1
+ ;;
+ esac
if [[ -n "$target_arch" ]]; then
archs=($target_arch)
return
fi
local version="$(version_from_git)"
- if [ $pkgname = "arvados-api-server" -o $pkgname = "arvados-workbench" ] ; then
+ if [ $pkgname = "arvados-api-server" ] ; then
calculate_go_package_version version cmd/arvados-server "$srcdir"
fi
echo $version
local iteration="$1"; shift
local arch="$1"; shift
if [[ -n "$ONLY_BUILD" ]] && [[ "$pkgname" != "$ONLY_BUILD" ]] ; then
- # arvados-workbench depends on arvados-server at build time, so even when
- # only arvados-workbench is being built, we need to build arvados-server too
- if [[ "$pkgname" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
return 1
- fi
fi
local full_pkgname
declare -A dd
dd[debian10]=buster
dd[debian11]=bullseye
+ dd[debian12]=bookworm
dd[ubuntu1804]=bionic
dd[ubuntu2004]=focal
+ dd[ubuntu2204]=jammy
D=${dd[$TARGET]}
if [ ${pkgname:0:3} = "lib" ]; then
repo_subdir=${pkgname:0:4}
return 0
fi
else
- centos_repo="http://rpm.arvados.org/CentOS/7/dev/x86_64/"
-
- repo_pkg_list=$(curl -s -o - ${centos_repo})
- echo ${repo_pkg_list} |grep -q ${full_pkgname}
- if [ $? -eq 0 ]; then
+ local rpm_root
+ case "$TARGET" in
+ centos7) rpm_root="CentOS/7/dev" ;;
+ rocky8) rpm_root="CentOS/8/dev" ;;
+ *)
+ echo "FIXME: Don't know RPM URL path for $TARGET, building"
+ return 0
+ ;;
+ esac
+ local rpm_url="http://rpm.arvados.org/$rpm_root/$arch/$full_pkgname"
+
+ if curl -fs -o "$WORKSPACE/packages/$TARGET/$full_pkgname" "$rpm_url"; then
echo "Package $full_pkgname exists upstream, not rebuilding, downloading instead!"
- curl -s -o "$WORKSPACE/packages/$TARGET/${full_pkgname}" ${centos_repo}${full_pkgname}
return 1
- elif test -f "$WORKSPACE/packages/$TARGET/processed/${full_pkgname}" ; then
+ elif [[ -f "$WORKSPACE/packages/$TARGET/processed/$full_pkgname" ]]; then
echo "Package $full_pkgname exists, not rebuilding!"
return 1
else
fi
# For some reason fpm excludes need to not start with /.
local exclude_root="${railsdir#/}"
- local -a exclude_list=(tmp log coverage Capfile\* \
- config/deploy\* config/application.yml)
- # for arvados-workbench, we need to have the (dummy) config/database.yml in the package
- if [[ "$pkgname" != "arvados-workbench" ]]; then
- exclude_list+=('config/database.yml')
- fi
- for exclude in ${exclude_list[@]}; do
+ for exclude in tmp log coverage Capfile\* \
+ config/deploy\* \
+ config/application.yml \
+ config/database.yml; do
switches+=(-x "$exclude_root/$exclude")
done
fpm_build "${srcdir}" "${pos_args[@]}" "${switches[@]}" \
fi
}
-# Usage: handle_workbench [amd64|arm64]
-handle_workbench () {
- local target_arch="${1:-amd64}"; shift
- if [[ -n "$ONLY_BUILD" ]] && [[ "$ONLY_BUILD" != "arvados-workbench" ]] ; then
- debug_echo -e "Skipping build of arvados-workbench package."
- return 0
- fi
-
- native_arch=$(get_native_arch)
- if [[ "$target_arch" != "$native_arch" ]]; then
- echo "Error: no cross compilation support for Rails yet, can not build arvados-workbench for $native_arch"
- echo
- exit 1
- fi
-
- if [[ "$native_arch" != "amd64" ]]; then
- echo "Error: building the arvados-workbench package is not yet supported on this architecture ($native_arch)."
- echo
- exit 1
- fi
-
- # Build the workbench server package
- test_rails_package_presence arvados-workbench "$WORKSPACE/apps/workbench"
- if [[ "$?" == "0" ]] ; then
- calculate_go_package_version arvados_server_version cmd/arvados-server
- arvados_server_iteration=$(default_iteration "arvados-server" "$arvados_server_version" "go")
-
- (
- set -e
-
- # The workbench package has a build-time dependency on the arvados-server
- # package for config manipulation, so install it first.
- cd $WORKSPACE/cmd/arvados-server
- get_complete_package_name arvados_server_pkgname arvados-server ${arvados_server_version} go
-
- arvados_server_pkg_path="$WORKSPACE/packages/$TARGET/${arvados_server_pkgname}"
- if [[ ! -e ${arvados_server_pkg_path} ]]; then
- arvados_server_pkg_path="$WORKSPACE/packages/$TARGET/processed/${arvados_server_pkgname}"
- fi
- if [[ "$FORMAT" == "deb" ]]; then
- dpkg -i ${arvados_server_pkg_path}
- else
- rpm -i ${arvados_server_pkg_path}
- fi
-
- cd "$WORKSPACE/apps/workbench"
-
- # We need to bundle to be ready even when we build a package without vendor directory
- # because asset compilation requires it.
- bundle config set --local system 'true' >"$STDOUT_IF_DEBUG"
- bundle install >"$STDOUT_IF_DEBUG"
-
- # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
- # and we want that in the package, so it's easier to not exclude the tmp directory
- # from the package - empty it instead.
- rm -rf tmp
- mkdir tmp
-
- # Set up an appropriate config.yml
- arvados-server config-dump -config <(cat /etc/arvados/config.yml 2>/dev/null || echo "Clusters: {zzzzz: {}}") > /tmp/x
- mkdir -p /etc/arvados/
- mv /tmp/x /etc/arvados/config.yml
- perl -p -i -e 'BEGIN{undef $/;} s/WebDAV(.*?):\n( *)ExternalURL: ""/WebDAV$1:\n$2ExternalURL: "example.com"/g' /etc/arvados/config.yml
-
- ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bin/rake npm:install >"$STDOUT_IF_DEBUG"
- ARVADOS_CONFIG=none RAILS_ENV=production RAILS_GROUPS=assets bin/rake assets:precompile >"$STDOUT_IF_DEBUG"
-
- # Remove generated configuration files so they don't go in the package.
- rm -rf /etc/arvados/
- )
-
- if [[ "$?" != "0" ]]; then
- echo "ERROR: Asset precompilation failed"
- EXITCODE=1
- else
- handle_rails_package arvados-workbench "$WORKSPACE/apps/workbench" \
- "$WORKSPACE/agpl-3.0.txt" --url="https://arvados.org" \
- --description="Arvados Workbench - Arvados is a free and open source platform for big data science." \
- --license="GNU Affero General Public License, version 3.0" --depends "arvados-server = ${arvados_server_version}-${arvados_server_iteration}"
- fi
- fi
-}
-
# Usage: handle_cwltest [deb|rpm] [amd64|arm64]
handle_cwltest () {
local package_format="$1"; shift
rm -rf "$WORKSPACE/cwltest"
fi
git clone https://github.com/common-workflow-language/cwltest.git
+
+ # The subsequent release of cwltest confirms that files exist on disk, since
+ # our files are in Keep, all the tests fail.
+ # We should add [optional] Arvados support to cwltest so it can access
+ # Keep but for the time being just package the last working version.
+ (cd cwltest && git checkout 2.3.20230108193615)
+
# signal to our build script that we want a cwltest executable installed in /usr/bin/
mkdir cwltest/bin && touch cwltest/bin/cwltest
fpm_build_virtualenv "cwltest" "cwltest" "$package_format" "$target_arch"
)
}
-# Usage: handle_libarvados_perl
-handle_libarvados_perl () {
- if [[ -n "$ONLY_BUILD" ]] && [[ "$ONLY_BUILD" != "libarvados-perl" ]] ; then
- debug_echo -e "Skipping build of libarvados-perl package."
- return 0
- fi
- # The perl sdk subdirectory is so old that it has no tag in its history,
- # which causes version_at_commit.sh to fail. Just rebuild it every time.
- cd "$WORKSPACE"
- libarvados_perl_version="$(version_from_git)"
- cd "$WORKSPACE/sdk/perl"
-
- cd $WORKSPACE/packages/$TARGET
- test_package_presence libarvados-perl "$libarvados_perl_version"
-
- if [[ "$?" == "0" ]]; then
- cd "$WORKSPACE/sdk/perl"
-
- if [[ -e Makefile ]]; then
- make realclean >"$STDOUT_IF_DEBUG"
- fi
- find -maxdepth 1 \( -name 'MANIFEST*' -or -name "libarvados-perl*.$FORMAT" \) \
- -delete
- rm -rf install
-
- perl Makefile.PL INSTALL_BASE=install >"$STDOUT_IF_DEBUG" && \
- make install INSTALLDIRS=perl >"$STDOUT_IF_DEBUG" && \
- fpm_build "$WORKSPACE/sdk/perl" install/lib/=/usr/share libarvados-perl \
- dir "$libarvados_perl_version" install/man/=/usr/share/man \
- "$WORKSPACE/apache-2.0.txt=/usr/share/doc/libarvados-perl/apache-2.0.txt" && \
- mv --no-clobber libarvados-perl*.$FORMAT "$WORKSPACE/packages/$TARGET/"
- fi
-}
-
# Build python packages with a virtualenv built-in
# Usage: fpm_build_virtualenv arvados-python-client sdk/python [deb|rpm] [amd64|arm64]
fpm_build_virtualenv () {
rm -rf dist/*
- # Get the latest setuptools
- if ! $pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -U 'setuptools<45'; then
+ # Get the latest setuptools.
+ #
+ # Note "pip3 install setuptools" fails on debian12 ("error:
+ # externally-managed-environment") even if that requirement is
+ # already satisfied, so we parse "pip3 list" output instead to check
+ # whether we need to do anything.
+ if [[ "$($pip list | grep -P -o '^setuptools\s+\K[0-9]+')" -ge 66 ]]; then
+ : # OK, already installed
+ elif ! $pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -U 'setuptools>=66'; then
echo "Error, unable to upgrade setuptools with"
- echo " $pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -U 'setuptools<45'"
+ echo " $pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -U 'setuptools>=66'"
exit 1
fi
# filter a useless warning (when building the cwltest package) from the stderr output
PACKAGE_PATH=`(cd dist; ls *tar.gz)`
if [[ "arvados-python-client" == "$PKG" ]]; then
- PYSDK_PATH=`pwd`/dist/
+ PYSDK_PATH="-f $(pwd)/dist/"
fi
if [[ -n "$ONLY_BUILD" ]] && [[ "$PYTHON_PKG" != "$ONLY_BUILD" ]] && [[ "$PKG" != "$ONLY_BUILD" ]]; then
echo "wheel version: `build/usr/share/$python/dist/$PYTHON_PKG/bin/wheel version`"
if [[ "$TARGET" != "centos7" ]] || [[ "$PYTHON_PKG" != "python-arvados-fuse" ]]; then
- build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -f $PYSDK_PATH $PACKAGE_PATH
+ build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG $PYSDK_PATH $PACKAGE_PATH
else
# centos7 needs these special tweaks to install python-arvados-fuse
build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG docutils
- PYCURL_SSL_LIBRARY=nss build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -f $PYSDK_PATH $PACKAGE_PATH
+ PYCURL_SSL_LIBRARY=nss build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG $PYSDK_PATH $PACKAGE_PATH
fi
if [[ "$?" != "0" ]]; then
echo "Error, unable to run"
- echo " build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG -f $PYSDK_PATH $PACKAGE_PATH"
+ echo " build/usr/share/$python/dist/$PYTHON_PKG/bin/$pip install $DASHQ_UNLESS_DEBUG $CACHE_FLAG $PYSDK_PATH $PACKAGE_PATH"
exit 1
fi
LICENSE_STRING=`grep license $WORKSPACE/$PKG_DIR/setup.py|cut -f2 -d=|sed -e "s/[',\\"]//g"`
COMMAND_ARR+=('--license' "$LICENSE_STRING")
- if [[ "$package_format" == "rpm" ]]; then
- # Make sure to conflict with the old rh-python36 packages we used to publish
- COMMAND_ARR+=('--conflicts' "rh-python36-python-$PKG")
- fi
-
if [[ "$DEBUG" != "0" ]]; then
COMMAND_ARR+=('--verbose' '--log' 'info')
fi
fi
COMMAND_ARR+=('--depends' "$PYTHON3_PACKAGE")
-
- # avoid warning
- COMMAND_ARR+=('--deb-no-default-config-files')
+ case "$package_format" in
+ deb)
+ COMMAND_ARR+=(
+ # Avoid warning
+ --deb-no-default-config-files
+ ) ;;
+ rpm)
+ COMMAND_ARR+=(
+ # Conflict with older packages we used to publish
+ --conflicts "rh-python36-python-$PKG"
+ # Do not generate /usr/lib/.build-id links on RH8+
+ # (otherwise our packages conflict with platform-python)
+ --rpm-rpmbuild-define "_build_id_links none"
+ ) ;;
+ esac
# Append --depends X and other arguments specified by fpm-info.sh in
# the package source dir. These are added last so they can override
}
# Build packages for everything
-fpm_build () {
+fpm_build() {
# Source dir where fpm-info.sh (if any) will be found.
SRC_DIR=$1
shift
shift
if [[ -n "$ONLY_BUILD" ]] && [[ "$PACKAGE_NAME" != "$ONLY_BUILD" ]] && [[ "$PACKAGE" != "$ONLY_BUILD" ]] ; then
- # arvados-workbench depends on arvados-server at build time, so even when
- # only arvados-workbench is being built, we need to build arvados-server too
- if [[ "$PACKAGE_NAME" != "arvados-server" ]] || [[ "$ONLY_BUILD" != "arvados-workbench" ]]; then
return 0
- fi
fi
local default_iteration_value="$(default_iteration "$PACKAGE" "$VERSION" "$PACKAGE_TYPE")"
FPM_RESULTS=$("${COMMAND_ARR[@]}")
FPM_EXIT_CODE=$?
+ echo "fpm: exit code $FPM_EXIT_CODE" >>$STDOUT_IF_DEBUG
+ echo "$FPM_RESULTS" >>$STDOUT_IF_DEBUG
fpm_verify $FPM_EXIT_CODE $FPM_RESULTS
FPM_RESULTS=$@
FPM_PACKAGE_NAME=''
- if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\.-]*\.)(deb|rpm) ]]; then
+ if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\.~-]*\.)(deb|rpm) ]]; then
FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
fi