From 05a287a9fdd331980692529589137832aa233ea8 Mon Sep 17 00:00:00 2001 From: Ted Kaminski Date: Mon, 12 Jul 2021 21:43:51 +0000 Subject: [PATCH 1/5] Define dependencies with an array Among other things, this will allow us to comment on them in the future. --- scripts/setup/ubuntu-20.04/install_deps.sh | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/scripts/setup/ubuntu-20.04/install_deps.sh b/scripts/setup/ubuntu-20.04/install_deps.sh index b7f38342fabc..d6e7de0a9d74 100755 --- a/scripts/setup/ubuntu-20.04/install_deps.sh +++ b/scripts/setup/ubuntu-20.04/install_deps.sh @@ -2,28 +2,32 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 OR MIT -set -eux +set -eu -# Install tools in Ubuntu 20.04 via `apt-get` -sudo apt-get --yes update \ - && sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \ - bison \ - cmake \ - ctags \ - curl \ - flex \ - g++ \ - gcc \ - git \ - gpg-agent \ - libssl-dev \ - lsb-release \ - make \ - ninja-build \ - patch \ - pkg-config \ - python-is-python3 \ - software-properties-common \ - wget \ - zlib1g \ +DEPS=( + bison + cmake + ctags + curl + flex + g++ + gcc + git + gpg-agent + libssl-dev + lsb-release + make + ninja-build + patch + pkg-config + python-is-python3 + software-properties-common + wget + zlib1g zlib1g-dev +) + +set -x + +sudo apt-get --yes update +sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes "${DEPS[@]}" From 9c872524ba6a9f1cabd12f7edbdde7e3024292b4 Mon Sep 17 00:00:00 2001 From: Ted Kaminski Date: Mon, 12 Jul 2021 21:47:21 +0000 Subject: [PATCH 2/5] Add missing (non-CI) dependency Running setup scripts on the default Ubuntu AMI results in this error message: ``` + sudo python3 -m pip install --upgrade cbmc_viewer-2.5-py3-none-any.whl /usr/bin/python3: No module named pip ``` This fixes the issue. --- scripts/setup/ubuntu-20.04/install_deps.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/setup/ubuntu-20.04/install_deps.sh b/scripts/setup/ubuntu-20.04/install_deps.sh index d6e7de0a9d74..24447619e1ba 100755 --- a/scripts/setup/ubuntu-20.04/install_deps.sh +++ b/scripts/setup/ubuntu-20.04/install_deps.sh @@ -25,6 +25,8 @@ DEPS=( wget zlib1g zlib1g-dev + # Default in CI, but not present on AWS AMI: + python3-pip ) set -x From eef0a090e7f6defa3eeafcd13ad9d62243a6b4d8 Mon Sep 17 00:00:00 2001 From: Ted Kaminski Date: Mon, 12 Jul 2021 22:18:10 +0000 Subject: [PATCH 3/5] Use the downloaded file, if already downloaded wget has a default behavior that causes downloads like this to get new unexpected filenames if the file already exists. The switch to curl is simply personal preference. --- scripts/setup/install_viewer.sh | 18 ++++++++++++------ scripts/setup/ubuntu-20.04/install_cbmc.sh | 15 +++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/scripts/setup/install_viewer.sh b/scripts/setup/install_viewer.sh index add257019eda..9f22c1a781e9 100755 --- a/scripts/setup/install_viewer.sh +++ b/scripts/setup/install_viewer.sh @@ -2,13 +2,19 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 OR MIT -set -eux +set -eu # Install cbmc-viewer -if [[ $# -eq 1 ]] ; then -wget https://github.com/awslabs/aws-viewer-for-cbmc/releases/download/viewer-$1/cbmc_viewer-$1-py3-none-any.whl \ - && sudo python3 -m pip install --upgrade cbmc_viewer-$1-py3-none-any.whl -else - echo "Error: Specify the version to install" + +if [[ $# -ne 1 ]]; then + echo "$0: Error: Specify the version to install" exit 1 fi + +FILE="cbmc_viewer-$1-py3-none-any.whl" +URL="https://github.com/awslabs/aws-viewer-for-cbmc/releases/download/viewer-$1/$FILE" + +set -x + +curl --fail --silent --location "$URL" -o "$FILE" +sudo python3 -m pip install --upgrade "$FILE" diff --git a/scripts/setup/ubuntu-20.04/install_cbmc.sh b/scripts/setup/ubuntu-20.04/install_cbmc.sh index 1f90ea50a36a..2c5fe53f8c3f 100755 --- a/scripts/setup/ubuntu-20.04/install_cbmc.sh +++ b/scripts/setup/ubuntu-20.04/install_cbmc.sh @@ -2,9 +2,16 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 OR MIT -set -eux +set -eu # Install CBMC 5.30.1 for Ubuntu 20.04 -wget https://github.com/diffblue/cbmc/releases/download/cbmc-5.30.1/ubuntu-20.04-cbmc-5.30.1-Linux.deb \ - && sudo dpkg -i ubuntu-20.04-cbmc-5.30.1-Linux.deb \ - && cbmc --version + +FILE="ubuntu-20.04-cbmc-5.30.1-Linux.deb" +URL="https://github.com/diffblue/cbmc/releases/download/cbmc-5.30.1/$FILE" + +set -x + +curl --fail --silent --location "$URL" -o "$FILE" +sudo dpkg -i "$FILE" + +cbmc --version From e994adc148f9557d170a7a11b744a1afc68b7108 Mon Sep 17 00:00:00 2001 From: Ted Kaminski Date: Tue, 13 Jul 2021 15:44:22 +0000 Subject: [PATCH 4/5] swap back to wget --- scripts/setup/install_viewer.sh | 2 +- scripts/setup/ubuntu-20.04/install_cbmc.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup/install_viewer.sh b/scripts/setup/install_viewer.sh index 9f22c1a781e9..1664e5937798 100755 --- a/scripts/setup/install_viewer.sh +++ b/scripts/setup/install_viewer.sh @@ -16,5 +16,5 @@ URL="https://github.com/awslabs/aws-viewer-for-cbmc/releases/download/viewer-$1/ set -x -curl --fail --silent --location "$URL" -o "$FILE" +wget -O "$FILE" "$URL" sudo python3 -m pip install --upgrade "$FILE" diff --git a/scripts/setup/ubuntu-20.04/install_cbmc.sh b/scripts/setup/ubuntu-20.04/install_cbmc.sh index 2c5fe53f8c3f..13649e4d613c 100755 --- a/scripts/setup/ubuntu-20.04/install_cbmc.sh +++ b/scripts/setup/ubuntu-20.04/install_cbmc.sh @@ -11,7 +11,7 @@ URL="https://github.com/diffblue/cbmc/releases/download/cbmc-5.30.1/$FILE" set -x -curl --fail --silent --location "$URL" -o "$FILE" +wget -O "$FILE" "$URL" sudo dpkg -i "$FILE" cbmc --version From f96bb13fd1e2f69fee61540c2070d78abe830527 Mon Sep 17 00:00:00 2001 From: Ted Kaminski Date: Tue, 13 Jul 2021 15:45:00 +0000 Subject: [PATCH 5/5] keep deps in alpha order for now --- scripts/setup/ubuntu-20.04/install_deps.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/setup/ubuntu-20.04/install_deps.sh b/scripts/setup/ubuntu-20.04/install_deps.sh index 24447619e1ba..f3f65ae9dd5e 100755 --- a/scripts/setup/ubuntu-20.04/install_deps.sh +++ b/scripts/setup/ubuntu-20.04/install_deps.sh @@ -21,12 +21,11 @@ DEPS=( patch pkg-config python-is-python3 + python3-pip # Default in CI, but missing in AWS AMI software-properties-common wget zlib1g zlib1g-dev - # Default in CI, but not present on AWS AMI: - python3-pip ) set -x