Skip to content

Commit

Permalink
[Utils] Install script: Fix WasmEdge#1080 (WasmEdge#1084)
Browse files Browse the repository at this point in the history
* [Utils] Install Script:Add Linux aarch64 support for extensions WasmEdge#1080
* [Utils] Install Script: Cases for arch in linux packages
* [Utils] Install Script: Check availability of extension support for aarch
* [Utils] Uninstall Script: Fix shell configuration not containing sourcing

Issue: `Sourcing not found in /github/home/.bashrc `
Expected: Script should not exit

* [CI] GitHub CI: Add installation for 0.9.1-beta.1
* Extensions for image and tensorflow are available
* [Utils] Install Script: Tensorflow not supported on aarch64
* [Utils] Test Uninstall Script

Signed-off-by: Shreyas Atre <[email protected]>
  • Loading branch information
SAtacker authored Jan 30, 2022
1 parent ec00362 commit 8f0673a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-install-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ jobs:
- name: Install WasmEdge specific release (0.8.2) with all extensions
run: |
bash utils/install.sh -e all -v 0.8.2 -V
- name: Install WasmEdge and test for arm extension installation
run: |
bash utils/install.sh -e all --version=0.9.1-beta.1 \
--tf-version=0.9.1-beta.1 --tf-deps-version=0.9.1-beta.1 --tf-tools-version=0.9.1-beta.1 \
--image-version=0.9.1-beta.1 --image-deps-version=0.9.1-beta.1
- name: Uninstall WasmEdge with all extensions
run: |
bash utils/uninstall.sh -q -V
Expand Down
39 changes: 28 additions & 11 deletions utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,15 @@ detect_os_arch() {

case $OS in
'Linux')
if [ "$ARCH" = "aarch64" ]; then
RELEASE_PKG="manylinux2014_$ARCH.tar.gz"
IM_EXT_COMPAT=0
TF_EXT_COMPAT=0
fi
case $ARCH in
'x86_64') ;;
'arm64' | 'armv8*' | "aarch64") RELEASE_PKG="manylinux2014_aarch64.tar.gz" ;;
"amd64") RELEASE_PKG="manylinux2014_amd64.tar.gz" ;;
*)
echo "${RED}Detected $OS-$ARCH${NC} - currently unsupported${NC}"
exit 1
;;
esac
;;
'Darwin')
case $ARCH in
Expand Down Expand Up @@ -374,6 +378,9 @@ wasmedge_checks() {
local version=$1
shift
for var in "$@"; do
if [ "$var" == "" ]; then
continue
fi
local V=$("$IPATH/bin/$var" --version | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
local V_=$(echo $version | sed 's/\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
if [ "$V" = "$V_" ]; then
Expand Down Expand Up @@ -403,29 +410,29 @@ install_wasmedge_image() {
}

get_wasmedge_tensorflow_deps() {
echo "Fetching WasmEdge-tensorflow-deps-TF-$VERSION_TF_DEPS"
[[ "$RELEASE_PKG" =~ "aarch64" ]] && echo "Tensorflow not supported" || echo "Fetching WasmEdge-tensorflow-deps-TF-$VERSION_TF_DEPS"
_downloader "https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/$VERSION_TF_DEPS/WasmEdge-tensorflow-deps-TF-$VERSION_TF_DEPS-$RELEASE_PKG"

echo "Fetching WasmEdge-tensorflow-deps-TFLite-$VERSION_TF_DEPS"
_downloader "https://github.com/second-state/WasmEdge-tensorflow-deps/releases/download/$VERSION_TF_DEPS/WasmEdge-tensorflow-deps-TFLite-$VERSION_TF_DEPS-$RELEASE_PKG"

_extractor -C "$IPATH/lib" -vxzf "$TMP_DIR/WasmEdge-tensorflow-deps-TF-$VERSION_TF_DEPS-$RELEASE_PKG"
[[ "$RELEASE_PKG" =~ "aarch64" ]] || _extractor -C "$IPATH/lib" -vxzf "$TMP_DIR/WasmEdge-tensorflow-deps-TF-$VERSION_TF_DEPS-$RELEASE_PKG"
_extractor -C "$IPATH/lib" -vxzf "$TMP_DIR/WasmEdge-tensorflow-deps-TFLite-$VERSION_TF_DEPS-$RELEASE_PKG"

_ldconfig
}

install_wasmedge_tensorflow() {
echo "Fetching WasmEdge-tensorflow-$VERSION_TF"
_downloader "https://github.com/second-state/WasmEdge-tensorflow/releases/download/$VERSION_TF/WasmEdge-tensorflow-$VERSION_TF-$RELEASE_PKG"
[[ "$RELEASE_PKG" =~ "aarch64" ]] && echo "Tensorflow not supported" || echo "Fetching WasmEdge-tensorflow-$VERSION_TF" &&
_downloader "https://github.com/second-state/WasmEdge-tensorflow/releases/download/$VERSION_TF/WasmEdge-tensorflow-$VERSION_TF-$RELEASE_PKG"

echo "Fetching WasmEdge-tensorflowlite-$VERSION_TF"
_downloader "https://github.com/second-state/WasmEdge-tensorflow/releases/download/$VERSION_TF/WasmEdge-tensorflowlite-$VERSION_TF-$RELEASE_PKG"

echo "Fetching WasmEdge-tensorflow-tools-$VERSION_TF_TOOLS"
_downloader "https://github.com/second-state/WasmEdge-tensorflow-tools/releases/download/$VERSION_TF_TOOLS/WasmEdge-tensorflow-tools-$VERSION_TF_TOOLS-$RELEASE_PKG"

_extractor -C "$IPATH" -vxzf "$TMP_DIR/WasmEdge-tensorflow-$VERSION_TF-$RELEASE_PKG"
[[ "$RELEASE_PKG" =~ "aarch64" ]] || _extractor -C "$IPATH" -vxzf "$TMP_DIR/WasmEdge-tensorflow-$VERSION_TF-$RELEASE_PKG"
_extractor -C "$IPATH" -vxzf "$TMP_DIR/WasmEdge-tensorflowlite-$VERSION_TF-$RELEASE_PKG"
_extractor -C "$IPATH/bin" -vxzf "$TMP_DIR/WasmEdge-tensorflow-tools-$VERSION_TF_TOOLS-$RELEASE_PKG"

Expand All @@ -437,6 +444,10 @@ install_wasmedge_tensorflow() {
}

install_image_extensions() {
[[ "$RELEASE_PKG" =~ "aarch64" ]] &&
[ "$(printf %s\\n%s\\n "0.9.1-beta.1" "$VERSION_IM_DEPS")" != "$(printf %s\\n%s "0.9.1-beta.1" "$VERSION_IM_DEPS" | sort --version-sort)" ] &&
IM_EXT_COMPAT=0

if [ $IM_EXT_COMPAT == 1 ]; then

[ "$EXT_V_SET_WASMEDGE_IM" -eq 0 ] && VERSION_IM=$VERSION &&
Expand All @@ -455,6 +466,10 @@ install_image_extensions() {
}

install_tf_extensions() {
[[ "$RELEASE_PKG" =~ "aarch64" ]] &&
[ "$(printf %s\\n%s\\n "0.9.1-beta.1" "$VERSION_TF_DEPS")" != "$(printf %s\\n%s "0.9.1-beta.1" "$VERSION_TF_DEPS" | sort --version-sort)" ] &&
TF_EXT_COMPAT=0

if [ $TF_EXT_COMPAT == 1 ]; then

[ "$EXT_V_SET_WASMEDGE_TF" -eq 0 ] && VERSION_TF=$VERSION &&
Expand All @@ -469,7 +484,9 @@ install_tf_extensions() {
get_wasmedge_tensorflow_deps
install_wasmedge_tensorflow

wasmedge_checks "$VERSION_TF_TOOLS" wasmedge-tensorflow \
local _bin
[[ "$RELEASE_PKG" =~ "aarch64" ]] && _bin="" || _bin="wasmedge-tensorflow"
wasmedge_checks "$VERSION_TF_TOOLS" "$_bin" \
wasmedge-tensorflow-lite
else
echo "${YELLOW}Tensorflow extensions not supported${NC}"
Expand Down
14 changes: 5 additions & 9 deletions utils/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,12 @@ main() {

line_num="$(grep -n ". \"${IPATH}/env\"" "${__HOME__}/${_shell_rc}" | cut -d : -f 1)"

if [ "$line_num" != "" ]; then
sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/${_shell_rc}"
[[ -f "${__HOME__}/.profile" ]] && line_num="$(grep -n ". \"${IPATH}/env\"" "${__HOME__}/.profile" | cut -d : -f 1)" &&
[[ "$line_num" != "" ]] && sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/.profile"
[[ -f "${__HOME__}/.bash_profile" ]] && line_num="$(grep -n ". \"${IPATH}/env\"" "${__HOME__}/.bash_profile" | cut -d : -f 1)" &&
[[ "$line_num" != "" ]] && sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/.bash_profile"
else
[ "$line_num" != "" ] && sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/${_shell_rc}" ||
echo "${YELLOW}Sourcing not found in ${__HOME__}/${_shell_rc} ${NC}"
exit 1
fi
[[ -f "${__HOME__}/.profile" ]] && line_num="$(grep -n ". \"${IPATH}/env\"" "${__HOME__}/.profile" | cut -d : -f 1)" &&
[[ "$line_num" != "" ]] && sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/.profile"
[[ -f "${__HOME__}/.bash_profile" ]] && line_num="$(grep -n ". \"${IPATH}/env\"" "${__HOME__}/.bash_profile" | cut -d : -f 1)" &&
[[ "$line_num" != "" ]] && sed -i.wasmedge_backup -e "${line_num}"'d' "${__HOME__}/.bash_profile"

exit 0
}
Expand Down

0 comments on commit 8f0673a

Please sign in to comment.