Merge pull request #761 from ucb-bar/init-submodules-gitconfig
Ensure git config changes are reverted on failure
This commit is contained in:
@@ -4,7 +4,7 @@ set -e
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# Enable submodule update for FPGA tools.
|
# Enable submodule update for FPGA tools.
|
||||||
git config --unset submodule.fpga/fpga-shells.update
|
git config --unset submodule.fpga/fpga-shells.update || :
|
||||||
# Initialize local FPGA tools.
|
# Initialize local FPGA tools.
|
||||||
git submodule update --init --recursive fpga/fpga-shells
|
git submodule update --init --recursive fpga/fpga-shells
|
||||||
# Disable submodule update for FPGA tools.
|
# Disable submodule update for FPGA tools.
|
||||||
|
|||||||
@@ -20,43 +20,41 @@ fi
|
|||||||
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
CHIPYARD_DIR="$(dirname "$DIR")"
|
CHIPYARD_DIR="$(dirname "$DIR")"
|
||||||
|
|
||||||
# Ignore toolchain submodules
|
|
||||||
cd "$CHIPYARD_DIR"
|
cd "$CHIPYARD_DIR"
|
||||||
for name in toolchains/*-tools/*/ ; do
|
|
||||||
git config submodule."${name%/}".update none
|
|
||||||
done
|
|
||||||
git config submodule.toolchains/libgloss.update none
|
|
||||||
git config submodule.toolchains/qemu.update none
|
|
||||||
|
|
||||||
# Don't automatically initialize generators with big submodules (e.g. linux source)
|
(
|
||||||
git config submodule.generators/sha3.update none
|
# Blocklist of submodules to initially skip:
|
||||||
git config submodule.generators/gemmini.update none
|
# - Toolchain submodules
|
||||||
|
# - Generators with huge submodules (e.g., linux sources)
|
||||||
|
# - FireSim until explicitly requested
|
||||||
|
# - Hammer tool plugins
|
||||||
|
git_submodule_exclude() {
|
||||||
|
# Call the given subcommand (shell function) on each submodule
|
||||||
|
# path to temporarily exclude during the recursive update
|
||||||
|
for name in \
|
||||||
|
toolchains/*-tools/*/ \
|
||||||
|
toolchains/libgloss \
|
||||||
|
toolchains/qemu \
|
||||||
|
generators/sha3 \
|
||||||
|
generators/gemmini \
|
||||||
|
sims/firesim \
|
||||||
|
vlsi/hammer-cadence-plugins \
|
||||||
|
vlsi/hammer-synopsys-plugins \
|
||||||
|
vlsi/hammer-mentor-plugins \
|
||||||
|
software/firemarshal \
|
||||||
|
fpga/fpga-shells
|
||||||
|
do
|
||||||
|
"$1" "${name%/}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Disable updates to the FireSim submodule until explicitly requested
|
_skip() { git config --local "submodule.${1}.update" none ; }
|
||||||
git config submodule.sims/firesim.update none
|
_unskip() { git config --local --unset-all "submodule.${1}.update" || : ; }
|
||||||
# Disable updates to the hammer tool plugins repos
|
|
||||||
git config submodule.vlsi/hammer-cadence-plugins.update none
|
|
||||||
git config submodule.vlsi/hammer-synopsys-plugins.update none
|
|
||||||
git config submodule.vlsi/hammer-mentor-plugins.update none
|
|
||||||
git config submodule.software/firemarshal.update none
|
|
||||||
# Disable update to fpga-shells
|
|
||||||
git config submodule.fpga/fpga-shells.update none
|
|
||||||
git submodule update --init --recursive #--jobs 8
|
|
||||||
|
|
||||||
# Un-ignore toolchain submodules
|
trap 'git_submodule_exclude _unskip' EXIT INT TERM
|
||||||
for name in toolchains/*-tools/*/ ; do
|
git_submodule_exclude _skip
|
||||||
git config --unset submodule."${name%/}".update
|
git submodule update --init --recursive #--jobs 8
|
||||||
done
|
)
|
||||||
git config --unset submodule.toolchains/libgloss.update
|
|
||||||
git config --unset submodule.toolchains/qemu.update
|
|
||||||
|
|
||||||
git config --unset submodule.vlsi/hammer-cadence-plugins.update
|
|
||||||
git config --unset submodule.vlsi/hammer-synopsys-plugins.update
|
|
||||||
git config --unset submodule.vlsi/hammer-mentor-plugins.update
|
|
||||||
|
|
||||||
git config --unset submodule.generators/sha3.update
|
|
||||||
git config --unset submodule.generators/gemmini.update
|
|
||||||
git config --unset submodule.software/firemarshal.update
|
|
||||||
|
|
||||||
# Non-recursive clone to exclude riscv-linux
|
# Non-recursive clone to exclude riscv-linux
|
||||||
git submodule update --init generators/sha3
|
git submodule update --init generators/sha3
|
||||||
@@ -65,10 +63,9 @@ git submodule update --init generators/sha3
|
|||||||
git submodule update --init generators/gemmini
|
git submodule update --init generators/gemmini
|
||||||
git -C generators/gemmini/ submodule update --init --recursive software/gemmini-rocc-tests
|
git -C generators/gemmini/ submodule update --init --recursive software/gemmini-rocc-tests
|
||||||
|
|
||||||
git config --unset submodule.sims/firesim.update
|
|
||||||
# Minimal non-recursive clone to initialize sbt dependencies
|
# Minimal non-recursive clone to initialize sbt dependencies
|
||||||
git submodule update --init sims/firesim
|
git submodule update --init sims/firesim
|
||||||
git config submodule.sims/firesim.update none
|
git config --local submodule.sims/firesim.update none
|
||||||
|
|
||||||
# Only shallow clone needed for basic SW tests
|
# Only shallow clone needed for basic SW tests
|
||||||
git submodule update --init software/firemarshal
|
git submodule update --init software/firemarshal
|
||||||
|
|||||||
Reference in New Issue
Block a user