15f9996aaSopenharmony_ci#!/bin/bash 25f9996aaSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd. 35f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 45f9996aaSopenharmony_ci# you may not use this file except in compliance with the License. 55f9996aaSopenharmony_ci# You may obtain a copy of the License at 65f9996aaSopenharmony_ci# 75f9996aaSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 85f9996aaSopenharmony_ci# 95f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 105f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 115f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125f9996aaSopenharmony_ci# See the License for the specific language governing permissions and 135f9996aaSopenharmony_ci# limitations under the License. 145f9996aaSopenharmony_ci# Author: Tools Team 155f9996aaSopenharmony_ci# param description: 165f9996aaSopenharmony_ci# $1 : the path of notice file to be verified. 175f9996aaSopenharmony_ci# $2 : the file of writing verification results. 185f9996aaSopenharmony_ci# $3 : the current platform dir. 195f9996aaSopenharmony_ci# notice. 205f9996aaSopenharmony_ci 215f9996aaSopenharmony_ciset -e 225f9996aaSopenharmony_ci 235f9996aaSopenharmony_ciif [ ! -f "$1" ]; then 245f9996aaSopenharmony_ci echo "Note: The notice file $1 does not exist." 255f9996aaSopenharmony_ci echo "Success" > $2 265f9996aaSopenharmony_ci exit 0 275f9996aaSopenharmony_cifi 285f9996aaSopenharmony_ci 295f9996aaSopenharmony_ciline_of_equal_in_file="$3/lineOfEqualInFile" 305f9996aaSopenharmony_ciline_of_new_file_flag_in_file="$3/lineOfNewFileFlagInFile" 315f9996aaSopenharmony_ciline_of_divide_in_file="$3/lineOfDivideInFile" 325f9996aaSopenharmony_ci 335f9996aaSopenharmony_cirm -f $line_of_equal_in_file 345f9996aaSopenharmony_cirm -f $line_of_new_file_flag_in_file 355f9996aaSopenharmony_cirm -f $line_of_divide_in_file 365f9996aaSopenharmony_ci 375f9996aaSopenharmony_ciNOTICEFILE=$1 385f9996aaSopenharmony_ci 395f9996aaSopenharmony_cigrep -n "^============================================================$" $NOTICEFILE | cut -d ':' -f 1 > $line_of_equal_in_file 405f9996aaSopenharmony_cigrep -n "Notices for file(s):" $NOTICEFILE | cut -d ':' -f 1 > $line_of_new_file_flag_in_file 415f9996aaSopenharmony_cigrep -n "^------------------------------------------------------------$" $NOTICEFILE | cut -d ':' -f 1 > $line_of_divide_in_file 425f9996aaSopenharmony_ci 435f9996aaSopenharmony_cinums_equal_in_file=$(cat $line_of_equal_in_file | wc -l) 445f9996aaSopenharmony_cinums_new_file_flag_in_file=$(cat $line_of_new_file_flag_in_file | wc -l) 455f9996aaSopenharmony_cinums_divid_in_file=$(cat $line_of_divide_in_file | wc -l) 465f9996aaSopenharmony_ci 475f9996aaSopenharmony_ciif [[ "$nums_equal_in_file" != "$nums_new_file_flag_in_file" ]];then 485f9996aaSopenharmony_ci echo "Error:nums_equal_in_file is $nums_equal_in_file,nums_new_file_flag_in_file is $nums_new_file_flag_in_file" 495f9996aaSopenharmony_ci echo "Failed" > $2 505f9996aaSopenharmony_ci exit 1 515f9996aaSopenharmony_cielif [[ "$nums_equal_in_file" != "$nums_divid_in_file" ]];then 525f9996aaSopenharmony_ci echo "Warning!! maybe something wrong! nums_equal_in_file is $nums_equal_in_file,nums_divid_in_file is $nums_divid_in_file" 535f9996aaSopenharmony_cifi 545f9996aaSopenharmony_ci 555f9996aaSopenharmony_cirm -f $line_of_equal_in_file 565f9996aaSopenharmony_cirm -f $line_of_new_file_flag_in_file 575f9996aaSopenharmony_cirm -f $line_of_divide_in_file 585f9996aaSopenharmony_ci 595f9996aaSopenharmony_ciecho "Success" > $2 605f9996aaSopenharmony_ci 615f9996aaSopenharmony_ciset +e 62