diff options
author | Yalei Wang <william.wangyalei@huawei.com> | 2018-03-13 16:36:34 +0800 |
---|---|---|
committer | Yalei Wang <william.wangyalei@huawei.com> | 2018-03-13 16:53:35 +0800 |
commit | 3a5bf13c0e7b427b805a372dc1ed1bd5d7759082 (patch) | |
tree | ffd702b15322b978936cd19e5a4c4e40b78c46ca /scripts | |
parent | 415f9ac8797c22c45364c38bb0dcfc1f5c202bf7 (diff) |
Clean up the src and update the doc
Change-Id: If9c9cdb3ae5167198f0a2ae085871ff7134b32b0
Signed-off-by: Yalei Wang <william.wangyalei@huawei.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/README.md | 12 | ||||
-rw-r--r-- | scripts/header.template | 16 | ||||
-rw-r--r-- | scripts/header2.template | 16 | ||||
-rw-r--r-- | scripts/lic.sh | 88 | ||||
-rw-r--r-- | scripts/remove_header.awk | 63 | ||||
-rw-r--r-- | scripts/replace_header.sh | 27 |
6 files changed, 0 insertions, 222 deletions
diff --git a/scripts/README.md b/scripts/README.md index d6c2bdc..351020e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,14 +1,2 @@ To run checkstyle : ./checkstyle.sh [-options] - -To modify license: -./lic.sh - -from - CPUB(lwip_writev) - NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size); - CPUE(lwip_writev) -to - CPUB(writev) - NSTACK_CAL_FUN(fdInf->ops, writev, (fdInf->rlfd, iov, iovcnt), size); - CPUE(writev)
\ No newline at end of file diff --git a/scripts/header.template b/scripts/header.template deleted file mode 100644 index d3fe9f2..0000000 --- a/scripts/header.template +++ /dev/null @@ -1,16 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - diff --git a/scripts/header2.template b/scripts/header2.template deleted file mode 100644 index edf38d0..0000000 --- a/scripts/header2.template +++ /dev/null @@ -1,16 +0,0 @@ -######################################################################### -# -# Copyright (c) 2018 Huawei Technologies Co.,Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -######################################################################### - diff --git a/scripts/lic.sh b/scripts/lic.sh deleted file mode 100644 index a3c95e2..0000000 --- a/scripts/lic.sh +++ /dev/null @@ -1,88 +0,0 @@ -######################################################################### -# -# Copyright (c) 2018 Huawei Technologies Co.,Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -######################################################################### - -function remove_copyright_a { - printf "%s\n" 1,14d w q | ed "$1" -} - -function remove_copyright_b { - printf "%s\n" 1,14d w q | ed "$1" -} - -function add_copyright { - if [[ $1 == Makefile ]]; then - ed "$1" <<END -0i -/* - * Copyright (c) 2015 Huawei and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -. -w -q -END - else - ed "$1" <<END -0i -/* - * Copyright (c) 2015 HUAWEI and/or its affiliates. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -. -w -q -END - fi -} - -shopt -s nullglob globstar -#for file in **/*.[ch]; do - # ./replace_header.sh "$file" -#done - -for i in $(find ./../ -type f) -do - if [[ ${i} != *"thirdparty"* ]] && [[ ${i} != *"testcode"* ]] && [[ ${i} != *"resources"* ]] && [[ ${i} != *"build"* ]] ; then - if [ "${i: -2}" == ".c" ] || [ "${i: -2}" == ".h" ] ; then - ./replace_header.sh "$i" "header.template" - elif [[ "${i}" == *"Makefile" ]] || [ "${i: -4}" == ".txt" ] || [ "${i: -3}" == ".sh" ] ; then - grep -q "Apache License" ${i} - if [ $? != 0 ]; then - ./replace_header.sh "$i" "header2.template" - fi - fi - fi -done diff --git a/scripts/remove_header.awk b/scripts/remove_header.awk deleted file mode 100644 index 9e83877..0000000 --- a/scripts/remove_header.awk +++ /dev/null @@ -1,63 +0,0 @@ -######################################################################### -# -# Copyright (c) 2018 Huawei Technologies Co.,Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -######################################################################### -# This script removes ANSI C file header comments -BEGIN { start = 0; incomment = 0;} - -{ - if (start == 0) - { - if (incomment == 0) - { - # C++ single line comment - if (/^\/\//) - { - # print "single line" - } - # single line comment - else if (/^\/\*[^\/]*\*\/$/) - { - # print "single line" - } - # multi line comment - else if (/^\/\*/) - { - #print "start comment" - # start multi line comment - incomment = 1 - } - else - { - # first line that is not a comment, start normal output - print $0; - start = 1; - } - } - else - { - # search for comment end - if (/\*\//) - { - #print "end comment" - incomment = 0; - } - } - } - else - { - # print the complete line for the rest of the file - print $0 - } -} diff --git a/scripts/replace_header.sh b/scripts/replace_header.sh deleted file mode 100644 index 3339533..0000000 --- a/scripts/replace_header.sh +++ /dev/null @@ -1,27 +0,0 @@ -######################################################################### -# -# Copyright (c) 2018 Huawei Technologies Co.,Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -######################################################################### - -#!/bin/bash -SOURCE_DIR=`dirname $0` -if [ $# != 2 ]; then - echo "Usage: replace_header.sh <file> <header.template>" - exit 1 -fi - -cat $SOURCE_DIR/$2 > $SOURCE_DIR/tmp -cat $1 | awk -f $SOURCE_DIR/remove_header.awk >> $SOURCE_DIR/tmp -mv $SOURCE_DIR/tmp $1 - |