X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fbranch_cut%2Fbranch_cutter.sh;h=80fc652863f09b35f5baccb9a3b3896bb7a77b25;hb=f264f649c1af02f14ee066cf7468c836c99bf6c4;hp=6f9c7a3cadeb8c6224c7b267d6b51c324e1d1cbf;hpb=67a1e272f9034acffdc283707b72b6af7cf3dd4f;p=releng%2Fbuilder.git diff --git a/scripts/branch_cut/branch_cutter.sh b/scripts/branch_cut/branch_cutter.sh index 6f9c7a3ca..80fc65286 100755 --- a/scripts/branch_cut/branch_cutter.sh +++ b/scripts/branch_cut/branch_cutter.sh @@ -1,6 +1,5 @@ #!/bin/bash - -# @License EPL-1.0 +# SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. # @@ -11,17 +10,24 @@ # ############################################################################## -# List of files exclude -declare -a excludes=("releng-defaults.yaml" - "releng-macros.yaml") +# List of directories, files to exclude +declare -a excludes=("defaults.yaml" + "releng-macros.yaml" + "global-jjb" + "lf-infra" + "-macros.yaml" + "validate-autorelease" + "opflex-dependencies.yaml") TEMP="/tmp/tmp.yaml" mod=0 count=0 function usage { - echo "Usage: $(basename $0) options (-n [next release]) (-c [current release]) (-p [previous release]) -h for help"; - exit 1; + echo "Usage: $(basename "$0") options (-c [current release]) (-n [next release]) (-p [previous release]) -h for help"; + echo "example:" + echo "branch_cutter.sh -n oxygen -c nitrogen -p carbon" + exit 0; } if ( ! getopts ":n:c:p:h" opt ); then @@ -55,21 +61,21 @@ done echo "Start Branch Cutting:" -while IFS="" read -r y; do +while IFS="" read -r file; do found=0 - for f in "${excludes[@]}"; do - if [[ $y =~ $f && $found -eq 0 ]]; then + for exclude in "${excludes[@]}"; do + if [[ $file =~ $exclude && $found -eq 0 ]]; then found=1 break fi done if [[ $found -eq 1 ]]; then - echo "Ignore file $y found in excludes list" + echo "Ignore file $file found in excludes list" else - ./branch_cut.awk -v new_reltag="$new_reltag" -v curr_reltag="$curr_reltag" -v prev_reltag="$prev_reltag" "$y" > "$TEMP" - [[ ! -s "$TEMP" ]] && echo "$y: excluded" - [[ -s "$TEMP" ]] && mv "$TEMP" "$y" && echo "$y: Done" && let "mod++" - let "count++" + ./branch_cut.awk -v new_reltag="$new_reltag" -v curr_reltag="$curr_reltag" -v prev_reltag="$prev_reltag" "$file" > "$TEMP" + [[ ! -s "$TEMP" ]] && echo "$file: excluded" + [[ -s "$TEMP" ]] && mv "$TEMP" "$file" && echo "$file: Done" && (( mod++ )) + (( count++ )) fi done < <(find ../../jjb -name "*.yaml")