blob: 0727c57925c68f539ba578e96e08b11d3cd0c5de [file] [log] [blame]
Joey Armstrongee4d8262023-08-22 15:19:19 -04001#!/bin/bash
2# -----------------------------------------------------------------------
Joey Armstrongaadcaa42024-02-01 19:54:17 -05003# Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrongee4d8262023-08-22 15:19:19 -04004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
Joey Armstrongaadcaa42024-02-01 19:54:17 -050017# SPDX-FileCopyrightText: 2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrongee4d8262023-08-22 15:19:19 -040018# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
20# https://gerrit.opencord.org/plugins/gitiles/onf-make
21# ONF.makefile.version = 1.0
22# -----------------------------------------------------------------------
23# Intent: This script is used to bulk refactor and merge makefile changes
24## between development repositories and repo:onf-make.
25## -----------------------------------------------------------------------
26
27## -----------------------------------------------------------------------
28## Intent:
29## -----------------------------------------------------------------------
30function error
31{
32 echo "$*"
33 exit 1
34}
35
36##----------------##
37##---] MAIN [---##
38##----------------##
39# src="$HOME/projects/sandbox/onf-make/makefiles"
40# src="$HOME/projects/sandbox/ci-management/makefiles"
41src="$HOME/projects/sandbox/onf-make-all/20230709/makefiles"
42
43dst="$(realpath .)"
44
45[[ $# -eq 0 ]] && error "At least one directory or file is required"
46
47while [ $# -gt 0 ]; do
48 fyl=$1; shift
49
50 echo "FYL: $fyl"
51 if [ -d "$fyl" ]; then
52 readarray -t fyls < <(find "$fyl" -type f -print)
53 [[ ${#@} -gt 0 ]] && fyls+=("$@")
54 # declare -p fyls
55 [[ ${#fyls} -gt 0 ]] && set -- "${fyls[@]}"
56 continue
57 fi
58
59 case "$fyl" in
60 *~) continue ;;
61 '#*#') continue ;;
62 '\.#*') continue ;;
63 esac
64
65 src0="$src/$fyl"
66 dst0="$dst/$fyl"
67
68 [[ ! -e "$src0" ]] && error "File does not exist in src= $src0"
69 [[ ! -e "$dst0" ]] && error "File does not exist in dst= $dst0"
70
71 if ! diff -qr "$src0" "$dst0"; then
72 emacs "$src0" "$dst0"
73 fi
74done
75
76# [EOF]
77