Merge "Fix linters issues and enable tox/zuul linters job as gate"

This commit is contained in:
Zuul 2018-09-05 16:16:26 +00:00 committed by Gerrit Code Review
commit b913f3ec37
15 changed files with 551 additions and 565 deletions

View File

@ -1,5 +1,7 @@
- project: - project:
check: check:
jobs: jobs:
- openstack-tox-linters: - openstack-tox-linters
voting: false gate:
jobs:
- openstack-tox-linters

View File

@ -50,8 +50,7 @@ for subgit in $SUBGITS; do
# check if destination branch already exists # check if destination branch already exists
echo "$subgit" echo "$subgit"
branch_check=`git branch -a --list $NEW_BRANCH` branch_check=`git branch -a --list $NEW_BRANCH`
if [ -z "$branch_check" ] if [ -z "$branch_check" ]; then
then
echo "Creating $NEW_BRANCH" echo "Creating $NEW_BRANCH"
git checkout $OLD_BRANCH git checkout $OLD_BRANCH
git checkout -b $NEW_BRANCH git checkout -b $NEW_BRANCH
@ -60,8 +59,7 @@ for subgit in $SUBGITS; do
echo "$NEW_BRANCH already exists" echo "$NEW_BRANCH already exists"
fi fi
tag_check=`git tag -l $NEW_TAG` tag_check=`git tag -l $NEW_TAG`
if [ -z "$tag_check" ] if [ -z "$tag_check" ]; then
then
echo "Creating $NEW_TAG" echo "Creating $NEW_TAG"
# create tag # create tag
git checkout $NEW_BRANCH git checkout $NEW_BRANCH
@ -76,11 +74,3 @@ for subgit in $SUBGITS; do
done done
echo "All done. branches and tags are pushed" echo "All done. branches and tags are pushed"

View File

@ -21,8 +21,7 @@ for subgit in $SUBGITS; do
# check if destination branch already exists # check if destination branch already exists
echo "$subgit" echo "$subgit"
branch_check=`git branch -a --list $branch` branch_check=`git branch -a --list $branch`
if [ -z "$branch_check" ] if [ -z "$branch_check" ]; then
then
echo "Creating branch $branch" echo "Creating branch $branch"
git checkout -b $branch git checkout -b $branch
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
@ -37,8 +36,7 @@ for subgit in $SUBGITS; do
fi fi
tag_check=`git tag -l $tag` tag_check=`git tag -l $tag`
if [ -z "$tag_check" ] if [ -z "$tag_check" ]; then
then
echo "Creating tag $tag" echo "Creating tag $tag"
git tag $tag git tag $tag
if [ $? != 0 ] ; then if [ $? != 0 ] ; then

View File

@ -17,8 +17,7 @@ for subgit in $SUBGITS; do
pushd $subgit > /dev/null pushd $subgit > /dev/null
tag_check=`git tag -l $tag` tag_check=`git tag -l $tag`
if [ -z "$tag_check" ] if [ -z "$tag_check" ]; then
then
echo "Creating tag $tag" echo "Creating tag $tag"
git tag $tag git tag $tag
if [ $? != 0 ] ; then if [ $? != 0 ] ; then

View File

@ -72,8 +72,7 @@ function install_deps {
echo "Debug: List of deps to resolve: ${DEP_LIST}" echo "Debug: List of deps to resolve: ${DEP_LIST}"
if [ -z "${DEP_LIST}" ] if [ -z "${DEP_LIST}" ]; then
then
return 0 return 0
fi fi
@ -155,8 +154,7 @@ function install_deps {
>&2 echo "Installing PKG=$PKG PKG_FILE=$PKG_FILE PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH from repo $REPOID" >&2 echo "Installing PKG=$PKG PKG_FILE=$PKG_FILE PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH from repo $REPOID"
cp $PKG_PATH . cp $PKG_PATH .
if [ $? -ne 0 ] if [ $? -ne 0 ]; then
then
>&2 echo " Here's what I have to work with..." >&2 echo " Here's what I have to work with..."
>&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\"" >&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""
>&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH" >&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
@ -184,8 +182,7 @@ function install_deps {
>&2 echo "" >&2 echo ""
} }
function check_all_explicit_deps_installed function check_all_explicit_deps_installed {
{
PKGS_TO_CHECK=" " PKGS_TO_CHECK=" "
while read PKG_TO_ADD while read PKG_TO_ADD
@ -205,8 +202,7 @@ function check_all_explicit_deps_installed
fi fi
done < $TMPFILE done < $TMPFILE
if [ -z "$PKGS_TO_CHECK" ] if [ -z "$PKGS_TO_CHECK" ]; then
then
>&2 echo "All explicitly specified packages resolved!" >&2 echo "All explicitly specified packages resolved!"
else else
>&2 echo "Could not resolve packages: $PKGS_TO_CHECK" >&2 echo "Could not resolve packages: $PKGS_TO_CHECK"

View File

@ -25,8 +25,7 @@ function install_deps {
echo "Debug: List of deps to resolve: ${DEP_LIST}" echo "Debug: List of deps to resolve: ${DEP_LIST}"
if [ -z "${DEP_LIST}" ] if [ -z "${DEP_LIST}" ]; then
then
return 0 return 0
fi fi
@ -74,8 +73,7 @@ function install_deps {
>&2 echo "Installing PKG=$PKG PKG_FILE=$PKG_FILE PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH from repo $REPOID" >&2 echo "Installing PKG=$PKG PKG_FILE=$PKG_FILE PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH from repo $REPOID"
cp $PKG_PATH . cp $PKG_PATH .
if [ $? -ne 0 ] if [ $? -ne 0 ]; then
then
>&2 echo " Here's what I have to work with..." >&2 echo " Here's what I have to work with..."
>&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\"" >&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""
>&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH" >&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
@ -104,8 +102,7 @@ function install_deps {
>&2 echo "" >&2 echo ""
} }
function check_all_explicit_deps_installed function check_all_explicit_deps_installed {
{
PKGS_TO_CHECK=" " PKGS_TO_CHECK=" "
while read PKG_TO_ADD while read PKG_TO_ADD
@ -127,8 +124,7 @@ function check_all_explicit_deps_installed
fi fi
done < $TMPFILE done < $TMPFILE
if [ -z "$PKGS_TO_CHECK" ] if [ -z "$PKGS_TO_CHECK" ]; then
then
>&2 echo "All explicitly specified packages resolved!" >&2 echo "All explicitly specified packages resolved!"
else else
>&2 echo "Could not resolve packages: $PKGS_TO_CHECK" >&2 echo "Could not resolve packages: $PKGS_TO_CHECK"

View File

@ -27,9 +27,7 @@ export GIT_LIST=$(git_list "$(dirname "${MY_REPO}")")
# GIT_LIST_REL: A list of root directories for all the gits under $MY_REPO/.. # GIT_LIST_REL: A list of root directories for all the gits under $MY_REPO/..
# as relative paths. # as relative paths.
export GIT_LIST_REL=$(for p in $GIT_LIST; do export GIT_LIST_REL=$(for p in $GIT_LIST; do echo .${p#$(dirname ${MY_REPO})}; done)
echo .${p#$(dirname ${MY_REPO})};
done)
# #

View File

@ -2,13 +2,13 @@
## this script is called by "update-pxe-network-installer" and run in "sudo" ## this script is called by "update-pxe-network-installer" and run in "sudo"
## created by Yong Hu (yong.hu@intel.com), 05/24/2018 ## created by Yong Hu (yong.hu@intel.com), 05/24/2018
function clean_rootfs() { function clean_rootfs {
rootfs_dir=$1 rootfs_dir=$1
echo "--> remove old files in original rootfs" echo "--> remove old files in original rootfs"
conf="$(ls ${rootfs_dir}/etc/ld.so.conf.d/kernel-*.conf)" conf="$(ls ${rootfs_dir}/etc/ld.so.conf.d/kernel-*.conf)"
echo "conf basename = $(basename $conf)" echo "conf basename = $(basename $conf)"
old_version="tbd" old_version="tbd"
if [ -f $conf ];then if [ -f $conf ]; then
old_version="$(echo $(basename $conf) | rev | cut -d'.' -f2- | rev | cut -d'-' -f2-)" old_version="$(echo $(basename $conf) | rev | cut -d'.' -f2- | rev | cut -d'-' -f2-)"
fi fi
echo "old version is $old_version" echo "old version is $old_version"
@ -51,7 +51,9 @@ fi
work_dir=$1 work_dir=$1
mode=$2 mode=$2
output_dir=$work_dir/output output_dir=$work_dir/output
if [ ! -d $output_dir ];then mkdir -p $output_dir; fi if [ ! -d $output_dir ]; then
mkdir -p $output_dir;
fi
if [ "$mode" != "std" ] && [ "$mode" != "rt" ]; then if [ "$mode" != "std" ] && [ "$mode" != "rt" ]; then
echo "ERROR: wrong kernel mode, must be std or rt" echo "ERROR: wrong kernel mode, must be std or rt"
@ -191,7 +193,9 @@ fi
echo $ORIG_SQUASHFS echo $ORIG_SQUASHFS
mount -o loop -t squashfs $ORIG_SQUASHFS $work_dir/squashfs.mnt mount -o loop -t squashfs $ORIG_SQUASHFS $work_dir/squashfs.mnt
if [ ! -d ./LiveOS ];then mkdir -p ./LiveOS ; fi if [ ! -d ./LiveOS ]; then
mkdir -p ./LiveOS
fi
echo "--> copy rootfs.img from original squashfs.img to LiveOS folder" echo "--> copy rootfs.img from original squashfs.img to LiveOS folder"
cp -f ./squashfs.mnt/LiveOS/rootfs.img ./LiveOS/. cp -f ./squashfs.mnt/LiveOS/rootfs.img ./LiveOS/.

View File

@ -12,6 +12,9 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
[testenv:linters] [testenv:linters]
# ignore below cases
# E006 Line too long
# E010: Do not on same line as it commands
whitelist_externals = bash whitelist_externals = bash
commands = commands =
bash -c "find {toxinidir} \ bash -c "find {toxinidir} \
@ -20,7 +23,7 @@ commands =
-not -name \*~ \ -not -name \*~ \
-not -name \*.md \ -not -name \*.md \
-name \*.sh \ -name \*.sh \
-print0 | xargs -0 bashate -v" -print0 | xargs --no-run-if-empty -0 bashate -v -e 'E*' -i E006,E010"
bash -c "find {toxinidir} \ bash -c "find {toxinidir} \
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \ \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
-o \( -name .tox -prune \) \ -o \( -name .tox -prune \) \