Skip to content

Commit

Permalink
Merge pull request #627 from binpash/cleanup-setup-scripts
Browse files Browse the repository at this point in the history
Cleanup setup scripts
  • Loading branch information
angelhof authored Sep 7, 2022
2 parents 78b2ab6 + 4e45775 commit ffa074f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
1 change: 0 additions & 1 deletion compiler/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,4 +1015,3 @@ def valid(self):
# and not self.get_stdin() is None
# and not self.get_stdout() is None)))


34 changes: 14 additions & 20 deletions scripts/distro-deps.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash

# TODO: this should be ran before cloning---otherwise cloning fails.
# It should also set up words etc.

cd $(dirname $0)

PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel)}
. "$PASH_TOP/scripts/utils.sh"

Expand All @@ -15,9 +13,6 @@ fi
read_cmd_args $@
cd $PASH_TOP

LOG_DIR=install_logs
mkdir -p $LOG_DIR

# if we aren't running in docker, use sudo to install packages
if [ ! -f /.dockerenv ]; then
export SUDO="sudo"
Expand All @@ -33,7 +28,6 @@ fi
distro=$(printf '%s\n' "$distro" | LC_ALL=C tr '[:upper:]' '[:lower:]')
# compile the list of the shared required packages
pkgs="bc curl git graphviz python sudo wget"
#libdash_pkgs="automake gcc libtool m4"
# now do different things depending on distro
case "$distro" in
ubuntu*)
Expand All @@ -44,16 +38,16 @@ case "$distro" in
fi
echo "Running preparation apt install:"
echo "|-- running apt update..."
$SUDO apt update &> $LOG_DIR/apt_update.log
$SUDO apt update
echo "|-- running apt install..."
$SUDO apt install -y $pkgs &>> $LOG_DIR/apt_install.log
$SUDO apt install -y $pkgs
if [[ "$optimized_agg_flag" == 1 ]]; then
echo "|-- installing g++-10..."
$SUDO apt install software-properties-common -y &> $LOG_DIR/apt_install.log
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test -y &> $LOG_DIR/apt_install.log
$SUDO apt install g++-10 -y &> $LOG_DIR/apt_install.log
$SUDO update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 &> $LOG_DIR/apt_install.log
$SUDO update-alternatives --set g++ /usr/bin/g++-10 &> $LOG_DIR/apt_install.log
$SUDO apt install software-properties-common -y
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test -y
$SUDO apt install g++-10 -y
$SUDO update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
$SUDO update-alternatives --set g++ /usr/bin/g++-10
fi
;;
debian*)
Expand All @@ -64,9 +58,9 @@ case "$distro" in
fi
echo "Running preparation apt install:"
echo "|-- running apt update..."
$SUDO apt-get update &> $LOG_DIR/apt_update.log
$SUDO apt-get update
echo "|-- running apt install..."
$SUDO apt-get install -y $pkgs &> $LOG_DIR/apt_install.log
$SUDO apt-get install -y $pkgs
;;
fedora*)
pkgs="$pkgs autoconf diffutils gcc-c++ glibc-langpack-en hostname libjpeg-devel make nc pip procps python-devel python3-pip python3-setuptools python3-setuptools python3-testresources zlib-devel"
Expand All @@ -75,7 +69,7 @@ case "$distro" in
exit 0
fi
echo "|-- running dnf install...."
$SUDO dnf install -y $pkgs &> $LOG_DIR/dnf_install.log
$SUDO dnf install -y $pkgs
;;
arch*)
pkgs="$pkgs autoconf inetutils libffi make openbsd-netcat pkg-config python-pip"
Expand All @@ -84,9 +78,9 @@ case "$distro" in
exit 0
fi
echo "Updating mirrors"
$SUDO pacman -Sy &> $LOG_DIR/pacman_update.log
$SUDO pacman -Sy
echo "|-- running pacman install...."
yes | $SUDO pacman -S $pkgs &> $LOG_DIR/pacman_install.log
yes | $SUDO pacman -S $pkgs
;;
freebsd*)
pkgs="$pkgs autoconf gmake gsed libffi py38-pip"
Expand All @@ -95,7 +89,7 @@ case "$distro" in
exit 0
fi
echo "Updating mirrors"
$SUDO pkg update &> $LOG_DIR/pkg_update.log
$SUDO pkg update
echo "|-- running pkg install...."
# TODO add python3-testresources dep
yes | $SUDO pkg install $pkgs
Expand Down
15 changes: 10 additions & 5 deletions scripts/setup-pash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

## TODO: Maybe hide stdout and stderr to logs by default and only if debug flag exists show

cd "$(dirname "$0")"
# set PASH_TOP
PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel)}
Expand All @@ -20,13 +22,16 @@ mkdir -p $PYTHON_PKG_DIR

echo "Installing python dependencies..."

python3 -m pip install jsonpickle --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_jsonpickle.log
python3 -m pip install graphviz --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_graphviz.log
python3 -m pip install numpy --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_numpy.log
python3 -m pip install matplotlib --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_matplotlib.log
# TODO 2022-08-01 if libdash wheel isn't available, we need autmake etc.
python3 -m pip install libdash --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_libdash.log

## numpy and matplotlib are only needed to generate the evaluation plots so they should not be in the main path
if [[ "$install_eval" == 1 ]]; then
python3 -m pip install numpy --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_numpy.log
python3 -m pip install matplotlib --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_matplotlib.log
fi

# clean the python packages
cd $PYTHON_PKG_DIR
# can we find a better alternative to that
Expand All @@ -42,10 +47,10 @@ echo "Building runtime tools..."
cd "$PASH_TOP/runtime/"
case "$distro" in
freebsd*)
gmake &> $LOG_DIR/make.log
gmake #&> $LOG_DIR/make.log
;;
*)
make &> $LOG_DIR/make.log
make #&> $LOG_DIR/make.log
if [ -f /.dockerenv ]; then
# issue with docker only
python3 -m pip install -U --force-reinstall pip
Expand Down

0 comments on commit ffa074f

Please sign in to comment.