2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
11 ##############################################################################
13 # List of directories, files to exclude
14 declare -a excludes=("defaults.yaml"
19 "validate-autorelease"
20 "opflex-dependencies.yaml")
27 echo "Usage: $(basename "$0") options (-c [current release]) (-n [next release]) (-p [previous release]) -h for help";
29 echo "branch_cutter.sh -n oxygen -c nitrogen -p carbon"
33 if ( ! getopts ":n:c:p:h" opt ); then
37 while getopts ":n:c:p:h" opt; do
49 echo "Invalid option: -$OPTARG" >&2
56 echo "Option -$OPTARG requires an argument." >&2
62 echo "Start Branch Cutting:"
64 while IFS="" read -r file; do
66 for exclude in "${excludes[@]}"; do
67 if [[ $file =~ $exclude && $found -eq 0 ]]; then
72 if [[ $found -eq 1 ]]; then
73 echo "Ignore file $file found in excludes list"
75 ./branch_cut.awk -v new_reltag="$new_reltag" -v curr_reltag="$curr_reltag" -v prev_reltag="$prev_reltag" "$file" > "$TEMP"
76 [[ ! -s "$TEMP" ]] && echo "$file: excluded"
77 [[ -s "$TEMP" ]] && mv "$TEMP" "$file" && echo "$file: Done" && (( mod++ ))
80 done < <(find ../../jjb -name "*.yaml")
82 echo "Modified $mod out of $count files"