Add helper scripts

This commit is contained in:
Qiu Jian
2019-03-29 02:24:25 +08:00
committed by Yousong Zhou
parent 261fd5aa1d
commit 8993b4acf9
3 changed files with 48 additions and 0 deletions
+3
View File
@@ -59,6 +59,9 @@ build: gendoc
gendoc:
@sh build/gendoc.sh
gencopyright:
@sh scripts/gencopyright.sh pkg cmd
test:
@for PKG in $$( $(PKGS) | grep "$(filter-out $@,$(MAKECMDGOALS))" ); do \
echo $$PKG; \
+16
View File
@@ -0,0 +1,16 @@
/*
Copyright 2019 Yunion
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.
*/
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
set -e
pushd $(dirname $BASH_SOURCE) > /dev/null
ROOT_DIR=$(cd .. && pwd -P)
popd > /dev/null
COPYRIGHT_TXT=$ROOT_DIR/scripts/copyright.txt
LINECNT=$(wc -l $COPYRIGHT_TXT | awk '{print $1}')
function patch() {
if ! (head -n $LINECNT $1 | diff -q $COPYRIGHT_TXT - > /dev/null); then
echo "patch $1"
OUT=$(mktemp) || { echo "Failed to create temp file"; exit 1; }
cat $COPYRIGHT_TXT > $OUT
cat $1 >> $OUT
mv $OUT $1
fi
}
for top in $@
do
for f in $(find $top -iname "*.go")
do
patch $f
done
done