mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
Add helper scripts
This commit is contained in:
@@ -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; \
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Executable
+29
@@ -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
|
||||
Reference in New Issue
Block a user