blob: f415bebe6eb7c4732a441acab15237df02dbd348 [file] [log] [blame]
Joey Armstrongdd334492023-07-09 17:59:02 -04001#!/bin/bash
2# -----------------------------------------------------------------------
Joey Armstrong518f3572024-02-11 07:56:25 -05003# Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrongdd334492023-07-09 17:59:02 -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 Armstrong518f3572024-02-11 07:56:25 -050017# SPDX-FileCopyrightText: 2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrongdd334492023-07-09 17:59:02 -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##----------------##
39src="$HOME/projects/sandbox/onf-make/makefiles"
40# src="$HOME/projects/sandbox/ci-management/makefiles"
41dst="$(realpath .)"
42
43while [ $# -gt 0 ]; do
44 fyl=$1; shift
45
46 echo "FYL: $fyl"
47 if [ -d "$fyl" ]; then
48 readarray -t fyls < <(find "$fyl" -type f -print)
49 [[ ${#@} -gt 0 ]] && fyls+=("$@")
50 # declare -p fyls
51 [[ ${#fyls} -gt 0 ]] && set -- "${fyls[@]}"
52 continue
53 fi
54
55 src0="$src/$fyl"
56 dst0="$dst/$fyl"
57
58 [[ ! -e "$src0" ]] && error "File does not exist in src= $src0"
59 [[ ! -e "$dst0" ]] && error "File does not exist in dst= $dst0"
60
61 if ! diff -qr "$src0" "$dst0"; then
62 emacs "$src0" "$dst0"
63 fi
64done
65
66# [EOF]