diff options
author | Humberto Jimenez <humberto.jimenez@ni.com> | 2022-02-21 16:40:40 -0600 |
---|---|---|
committer | Humberto Jimenez <31545256+hjimenez-ni@users.noreply.github.com> | 2022-03-15 08:49:25 -0500 |
commit | 232a9a7345f0264602caba0caf2b96dd0856aed6 (patch) | |
tree | f475c37f111750cd5bfbc968c66b6942e66df48f /fpga/.ci/scripts/refresh_ip.sh | |
parent | 4fc2e3beeed4759dc108a670350276ae5554e072 (diff) | |
download | uhd-232a9a7345f0264602caba0caf2b96dd0856aed6.tar.gz uhd-232a9a7345f0264602caba0caf2b96dd0856aed6.tar.bz2 uhd-232a9a7345f0264602caba0caf2b96dd0856aed6.zip |
fpga: ci: Add stages-based pipeline
Diffstat (limited to 'fpga/.ci/scripts/refresh_ip.sh')
-rw-r--r-- | fpga/.ci/scripts/refresh_ip.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fpga/.ci/scripts/refresh_ip.sh b/fpga/.ci/scripts/refresh_ip.sh new file mode 100644 index 000000000..f4e37bf5b --- /dev/null +++ b/fpga/.ci/scripts/refresh_ip.sh @@ -0,0 +1,38 @@ +# +# Copyright 2022 Ettus Research, a National Instruments Brand +# +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# Description: +# +# This script first refreshes a given build IP directory to the current time +# (assume all the IP files within that directory were just built) and then +# the script touches all the files that changed between the current repo's +# working tree and a given hash (used to build IP). +# This allows the user to download pre-built IP (e.g. cached) and re-build +# only those IP components that changed in between the cached commit and the +# current working tree. +# +# Arguments: +# +# $1 = absolute path to build-ip/ directory +# $2 = git hash used to build IP in $1 +# +# Example: +# +# bash .refresh_ip.sh `realpath path/to/build-ip` 1234abc +# + +# # Step 1: refresh build-ip/ directory to current time +echo "[refresh_ip.sh] Resetting timestamp for files in $1" +find $1 -type f -exec touch --no-create {} + + +# # Step 2: determine all files that changed and update their time (dirty) +echo "[refresh_ip.sh] Differences between $2 and working tree (marked dirty):" +git diff --line-prefix=`git rev-parse --show-toplevel`/ --name-only $2 | \ + while read -r line; do \ + if [[ $line == *"ip/"* ]]; then \ + echo " $line"; \ + touch --no-create $line; \ + fi \ + done |