blob: ec00dc30e4bd2ab07c6cb9be15f9d514dc17cd72 [file] [log] [blame]
Joey Armstrong7f8436c2023-07-09 20:23:27 -04001#!/bin/bash
2# -----------------------------------------------------------------------
3# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
4#
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#
17# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
18# 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"
40src="$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]