From 1f687af9975fe854d7831f607b922490f4d8454b Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 May 2023 14:12:09 -0700 Subject: [PATCH] Generate all lockfiles at once --- scripts/build-setup.sh | 4 ++-- scripts/generate-conda-lockfile.sh | 31 ----------------------------- scripts/generate-conda-lockfiles.sh | 18 +++++++++++++++++ 3 files changed, 20 insertions(+), 33 deletions(-) delete mode 100755 scripts/generate-conda-lockfile.sh create mode 100755 scripts/generate-conda-lockfiles.sh diff --git a/scripts/build-setup.sh b/scripts/build-setup.sh index ccb3e8c5..02e1fd81 100755 --- a/scripts/build-setup.sh +++ b/scripts/build-setup.sh @@ -118,8 +118,8 @@ if run_step "1"; then LOCKFILE=$CONDA_LOCK_REQS/conda-requirements-$TOOLCHAIN_TYPE-linux-64.conda-lock.yml if [ "$USE_UNPINNED_DEPS" = true ]; then - # auto-gen the lockfile - $CYDIR/scripts/generate-conda-lockfile.sh $TOOLCHAIN_TYPE + # auto-gen the lockfiles + $CYDIR/scripts/generate-conda-lockfiles.sh fi # use conda-lock to create env diff --git a/scripts/generate-conda-lockfile.sh b/scripts/generate-conda-lockfile.sh deleted file mode 100755 index 7a5d72fa..00000000 --- a/scripts/generate-conda-lockfile.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -CUR_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - -TOOLCHAIN_TYPE="riscv-tools" - -# getopts does not support long options, and is inflexible -while [ "$1" != "" ]; -do - case $1 in - riscv-tools | esp-tools) - TOOLCHAIN_TYPE=$1 ;; - * ) - error "invalid option $1" - usage 1 ;; - esac - shift -done - -REQS_DIR="$CUR_DIR/../conda-reqs" -if [ ! -d "$REQS_DIR" ]; then - echo "$REQS_DIR does not exist, make sure you're calling this script from chipyard/" - exit 1 -fi - -# note: lock file must end in .conda-lock.yml - see https://github.com/conda-incubator/conda-lock/issues/154 -LOCKFILE=$REQS_DIR/conda-lock-reqs/conda-requirements-$TOOLCHAIN_TYPE-linux-64.conda-lock.yml - -conda-lock -f "$REQS_DIR/chipyard.yaml" -f "$REQS_DIR/$TOOLCHAIN_TYPE.yaml" -p linux-64 --lockfile $LOCKFILE diff --git a/scripts/generate-conda-lockfiles.sh b/scripts/generate-conda-lockfiles.sh new file mode 100755 index 00000000..f2e81106 --- /dev/null +++ b/scripts/generate-conda-lockfiles.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -ex + +CUR_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +REQS_DIR="$CUR_DIR/../conda-reqs" +if [ ! -d "$REQS_DIR" ]; then + echo "$REQS_DIR does not exist, make sure you're calling this script from chipyard/" + exit 1 +fi + +for TOOLCHAIN_TYPE in riscv-tools esp-tools; do + # note: lock file must end in .conda-lock.yml - see https://github.com/conda-incubator/conda-lock/issues/154 + LOCKFILE=$REQS_DIR/conda-lock-reqs/conda-requirements-$TOOLCHAIN_TYPE-linux-64.conda-lock.yml + + conda-lock -f "$REQS_DIR/chipyard.yaml" -f "$REQS_DIR/$TOOLCHAIN_TYPE.yaml" -p linux-64 --lockfile $LOCKFILE +done