diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2024-04-25 13:00:47 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2024-04-26 13:53:10 +0000 |
commit | 72a72cea7ee162d2211c13106ec9345e9f3ba91f (patch) | |
tree | 93a361ef77b5764a3736c44ad3e1f3a9772d97ab /jenkins-helpers.sh | |
parent | 0da630f15560b214645a5557c7f15136fa0e65ff (diff) |
tcwg-update-lnt-results.sh: Move data to $lntimport/ directory
... which will be shared with the LNT container.
Change-Id: I4c8c02d47fc840141dcd6aa6a68cc5d556b3372b
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r-- | jenkins-helpers.sh | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index 3e5ad7cd..c6e23431 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -1289,6 +1289,9 @@ breakup_changed_components () # fetches of ${paths[@]}" from appropriate revisions. # Once one of the paths is found in a given revision, we check it out and # move on to the next revision. +# Optional "--relative" option supplied as $3 will make get_git_history() +# output path names relative to the output directory. This is useful when +# output directory needs to be moved before processing. get_git_history () { ( @@ -1298,6 +1301,12 @@ get_git_history () local repo="$2" shift 2 + local relative=false + if [ "$1" = "--relative" ]; then + relative=true + shift 1 + fi + local -a paths=() while [ $# != 0 ]; do if [ "$1" = "--" ]; then @@ -1348,14 +1357,13 @@ get_git_history () echo "$tmp_root" while read rev; do - local tmp_dir found path - tmp_dir="$tmp_root/$rev" - mkdir "$tmp_dir" + local found path + mkdir "$tmp_root/$rev" found=false for path in "${paths[@]}"; do "${git_archive[@]}" "$rev" -- "$path" "${extra_paths[@]}" \ - | tar -x -C "$tmp_dir" & + | tar -x -C "$tmp_root/$rev" & # "git archive" fails when $path was deleted in $rev. if wait $!; then found=true @@ -1364,13 +1372,18 @@ get_git_history () done if $found; then - echo "$tmp_dir/$path" + if $relative; then + echo "$rev/$path" + else + echo "$tmp_root/$rev/$path" + fi n_revs=$(($n_revs-1)) if [ $n_revs = 0 ]; then break fi else - rm -r "$tmp_dir" + # shellcheck disable=SC2115 + rm -r "$tmp_root/$rev" fi done < <("${git_rev_list[@]}") ) |