From 9eb87bcf3ed30e160b9da161e02fa9dc5c22783c Mon Sep 17 00:00:00 2001 From: Jure Bajic Date: Tue, 20 Sep 2022 18:42:15 +0200 Subject: [PATCH] Update release process (#564) * Fix centos 7 virtualenv issue * Fix ubuntu release issue * Fix architecture check --- environment/os/debian-11-arm.sh | 2 +- environment/util.sh | 29 ++++++++++++++++------------- init | 11 +++++++++-- release/package/run.sh | 2 ++ 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/environment/os/debian-11-arm.sh b/environment/os/debian-11-arm.sh index 434cf88c4..a5a5dfda2 100755 --- a/environment/os/debian-11-arm.sh +++ b/environment/os/debian-11-arm.sh @@ -6,7 +6,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source "$DIR/../util.sh" check_operating_system "debian-11" -check_architecture "arm64" +check_architecture "arm64" "aarch64" TOOLCHAIN_BUILD_DEPS=( coreutils gcc g++ build-essential make # generic build tools diff --git a/environment/util.sh b/environment/util.sh index 67c455f1e..206bd6267 100644 --- a/environment/util.sh +++ b/environment/util.sh @@ -1,11 +1,11 @@ #!/bin/bash -operating_system() { +function operating_system() { grep -E '^(VERSION_)?ID=' /etc/os-release | \ sort | cut -d '=' -f 2- | sed 's/"//g' | paste -s -d '-' } -check_operating_system() { +function check_operating_system() { if [ "$(operating_system)" != "$1" ]; then echo "Not the right operating system!" exit 1 @@ -14,20 +14,22 @@ check_operating_system() { fi } -architecture() { +function architecture() { uname -m } check_architecture() { - if [ "$(architecture)" != "$1" ]; then - echo "Not the right architecture!" - exit 1 - else - echo "The right architecture." - fi + for arch in "$@"; do + if [ "$(architecture)" = "$arch" ]; then + echo "The right architecture!" + exit 0 + fi + done + echo "Not the right architecture!" + exit 1 } -check_all_yum() { +function check_all_yum() { local missing="" for pkg in $1; do if ! yum list installed "$pkg" >/dev/null 2>/dev/null; then @@ -40,7 +42,7 @@ check_all_yum() { fi } -check_all_dpkg() { +function check_all_dpkg() { local missing="" for pkg in $1; do if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then @@ -53,7 +55,7 @@ check_all_dpkg() { fi } -check_all_dnf() { +function check_all_dnf() { local missing="" for pkg in $1; do if ! dnf list installed "$pkg" >/dev/null 2>/dev/null; then @@ -65,7 +67,8 @@ check_all_dnf() { exit 1 fi } -install_all_apt() { + +function install_all_apt() { for pkg in $1; do apt install -y "$pkg" done diff --git a/init b/init index 313855963..0ebc1fb79 100755 --- a/init +++ b/init @@ -5,6 +5,9 @@ cd "$DIR" source "$DIR/environment/util.sh" +DISTRO=$(operating_system) +ARCHITECTURE=$(architecture) + function print_help () { echo "Usage: $0 [OPTION]" echo -e "Check for missing packages and setup the project.\n" @@ -64,8 +67,6 @@ else done fi -DISTRO=$(operating_system) -ARCHITECTURE=$(architecture) if [ "${ARCHITECTURE}" = "arm64" ] || [ "${ARCHITECTURE}" = "aarch64" ]; then OS_SCRIPT=$DIR/environment/os/$DISTRO-arm.sh else @@ -111,6 +112,12 @@ if [[ "$setup_libs" == "true" ]]; then cd .. fi +# Fix for centos 7 during release +if [ "${ARCHITECTURE}" = "centos-7" ]; then + python3 -m pip uninstall virtualenv + python3 -m pip install virtualenv +fi + # setup gql_behave dependencies setup_virtualenv tests/gql_behave diff --git a/release/package/run.sh b/release/package/run.sh index 885a63970..7d0b9848c 100755 --- a/release/package/run.sh +++ b/release/package/run.sh @@ -72,6 +72,8 @@ make_package () { docker exec "$build_container" bash -c "/memgraph/environment/os/$os.sh install MEMGRAPH_BUILD_DEPS" echo "Building targeted package..." + # Fix issue with git marking directory as not safe + docker exec "$build_container" bash -c "cd /memgraph && git config --global --add safe.directory '*'" docker exec "$build_container" bash -c "cd /memgraph && $ACTIVATE_TOOLCHAIN && ./init" docker exec "$build_container" bash -c "cd $container_build_dir && rm -rf ./*" if [[ "$os" == "debian-11-arm" ]]; then