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

@ -10,30 +10,30 @@ NEW_TAG=vCGCS_DEV_0019
OLD_BRANCH=CGCS_DEV_0018 OLD_BRANCH=CGCS_DEV_0018
NEW_BRANCH=CGCS_DEV_0019 NEW_BRANCH=CGCS_DEV_0019
if [ -z "$MY_REPO" ]; then if [ -z "$MY_REPO" ]; then
echo "MY_REPO is unset" echo "MY_REPO is unset"
exit 1 exit 1
else else
echo "MY_REPO is set to '$MY_REPO'" echo "MY_REPO is set to '$MY_REPO'"
fi fi
if [ -d "$MY_REPO" ]; then if [ -d "$MY_REPO" ]; then
cd $MY_REPO cd $MY_REPO
echo "checking out and pulling old branch" echo "checking out and pulling old branch"
wrgit checkout $OLD_BRANCH wrgit checkout $OLD_BRANCH
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: wrgit checkout $OLD_BRANCH" echo "ERROR: wrgit checkout $OLD_BRANCH"
exit 1 exit 1
fi fi
wrgit pull wrgit pull
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: wrgit pull" echo "ERROR: wrgit pull"
exit 1 exit 1
fi fi
else else
echo "Could not change to diectory '$MY_REPO'" echo "Could not change to diectory '$MY_REPO'"
exit 1 exit 1
fi fi
echo "Finding subgits" echo "Finding subgits"
@ -42,45 +42,35 @@ SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
# Go through all subgits and create the NEW_BRANCH if it does not already exist # Go through all subgits and create the NEW_BRANCH if it does not already exist
# Go through all subgits and create the NEW_TAG if it does not already exist # Go through all subgits and create the NEW_TAG if it does not already exist
for subgit in $SUBGITS; do for subgit in $SUBGITS; do
echo "" echo ""
echo "" echo ""
pushd $subgit > /dev/null pushd $subgit > /dev/null
git fetch git fetch
git fetch --tags git fetch --tags
# 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 git push origin $NEW_BRANCH:$NEW_BRANCH
git push origin $NEW_BRANCH:$NEW_BRANCH else
else 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" ]; then
if [ -z "$tag_check" ] echo "Creating $NEW_TAG"
then # create tag
echo "Creating $NEW_TAG" git checkout $NEW_BRANCH
# create tag git pull origin
git checkout $NEW_BRANCH git tag $NEW_TAG
git pull origin git push origin $NEW_TAG
git tag $NEW_TAG else
git push origin $NEW_TAG echo "$NEW_TAG already exists"
else fi
echo "$NEW_TAG already exists"
fi
popd > /dev/null popd > /dev/null
done done
echo "All done. branches and tags are pushed" echo "All done. branches and tags are pushed"

View File

@ -14,43 +14,41 @@ SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
# Go through all subgits and create the branch and tag if they does not already exist # Go through all subgits and create the branch and tag if they does not already exist
for subgit in $SUBGITS; do for subgit in $SUBGITS; do
echo "" echo ""
echo "" echo ""
pushd $subgit > /dev/null pushd $subgit > /dev/null
# 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 echo "ERROR: Could not exec: git checkout -b $branch"
echo "ERROR: Could not exec: git checkout -b $branch" popd > /dev/null
popd > /dev/null exit 1
exit 1 fi
fi
# git push origin $branch:$branch # git push origin $branch:$branch
else else
echo "Branch $branch already exists" echo "Branch $branch already exists"
git checkout $branch git checkout $branch
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 echo "ERROR: Could not exec: git tag $tag"
echo "ERROR: Could not exec: git tag $tag" popd > /dev/null
popd > /dev/null exit 1
exit 1 fi
fi
# git push origin $tag # git push origin $tag
else else
echo "Tag $tag already exists" echo "Tag $tag already exists"
fi fi
popd > /dev/null popd > /dev/null
done done

View File

@ -12,25 +12,24 @@ SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
# Go through all subgits and create the tag if it does not already exist # Go through all subgits and create the tag if it does not already exist
for subgit in $SUBGITS; do for subgit in $SUBGITS; do
echo "" echo ""
echo "" echo ""
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 echo "ERROR: Could not exec: git tag $tag"
echo "ERROR: Could not exec: git tag $tag" popd > /dev/null
popd > /dev/null exit 1
exit 1 fi
fi
# git push origin $tag # git push origin $tag
else else
echo "Tag $tag already exists" echo "Tag $tag already exists"
fi fi
popd > /dev/null popd > /dev/null
done done

View File

@ -15,28 +15,28 @@ SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
# Go through all subgits and create the branch and tag if they does not already exist # Go through all subgits and create the branch and tag if they does not already exist
for subgit in $SUBGITS; do for subgit in $SUBGITS; do
echo "" echo ""
echo "" echo ""
pushd $subgit > /dev/null pushd $subgit > /dev/null
# check if destination branch already exists # check if destination branch already exists
echo "$subgit" echo "$subgit"
echo "Pushing branch $branch" echo "Pushing branch $branch"
git push origin $branch:$branch git push origin $branch:$branch
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "ERROR: Could not exec: git push origin $branch:$branch" echo "ERROR: Could not exec: git push origin $branch:$branch"
popd > /dev/null popd > /dev/null
exit 1 exit 1
fi fi
echo "Pushing tag $tag" echo "Pushing tag $tag"
git push origin $tag git push origin $tag
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "ERROR: Could not exec: git push origin $tag" echo "ERROR: Could not exec: git push origin $tag"
popd > /dev/null popd > /dev/null
exit 1 exit 1
fi fi
popd > /dev/null popd > /dev/null
done done

View File

@ -12,18 +12,18 @@ SUBGITS=`find . -type d -name ".git" | sed "s%/\.git$%%"`
# Go through all subgits and create the tag if it does not already exist # Go through all subgits and create the tag if it does not already exist
for subgit in $SUBGITS; do for subgit in $SUBGITS; do
echo "" echo ""
echo "" echo ""
pushd $subgit > /dev/null pushd $subgit > /dev/null
echo "Creating tag $tag" echo "Creating tag $tag"
git push origin $tag git push origin $tag
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "ERROR: Could not exec: git push origin $tag" echo "ERROR: Could not exec: git push origin $tag"
popd > /dev/null popd > /dev/null
exit 1 exit 1
fi fi
popd > /dev/null popd > /dev/null
done done

View File

@ -2,10 +2,10 @@
BUILD_MODE='' BUILD_MODE=''
if [ "$1" == "--rt" ]; then if [ "$1" == "--rt" ]; then
BUILD_MODE="rt" BUILD_MODE="rt"
fi fi
if [ "$1" == "--std" ]; then if [ "$1" == "--std" ]; then
BUILD_MODE="std" BUILD_MODE="std"
fi fi
# Setup boot directory for syslinux configuration (/boot/extlinux.conf) # Setup boot directory for syslinux configuration (/boot/extlinux.conf)
@ -53,11 +53,11 @@ echo "touch /var/run/.init-complete" >> /etc/rc.local
if [ "$BUILD_MODE" == "rt" ]; then if [ "$BUILD_MODE" == "rt" ]; then
# Adjust system tuning knobs during init when using rt kernel (CGTS-7047) # Adjust system tuning knobs during init when using rt kernel (CGTS-7047)
echo "echo 1 > /sys/devices/virtual/workqueue/cpumask" >> /etc/rc.local echo "echo 1 > /sys/devices/virtual/workqueue/cpumask" >> /etc/rc.local
echo "echo 1 > /sys/bus/workqueue/devices/writeback/cpumask" >> /etc/rc.local echo "echo 1 > /sys/bus/workqueue/devices/writeback/cpumask" >> /etc/rc.local
echo "echo -1 > /proc/sys/kernel/sched_rt_runtime_us" >> /etc/rc.local echo "echo -1 > /proc/sys/kernel/sched_rt_runtime_us" >> /etc/rc.local
echo "echo 0 > /proc/sys/kernel/timer_migration" >> /etc/rc.local echo "echo 0 > /proc/sys/kernel/timer_migration" >> /etc/rc.local
echo "echo 10 > /proc/sys/vm/stat_interval" >> /etc/rc.local echo "echo 10 > /proc/sys/vm/stat_interval" >> /etc/rc.local
fi fi
# Disable audit service by default # Disable audit service by default
@ -68,8 +68,8 @@ systemctl disable auditd
if [ "$BUILD_MODE" == "rt" ]; then if [ "$BUILD_MODE" == "rt" ]; then
# Additional services to disable on rt guest (CGTS-7047) # Additional services to disable on rt guest (CGTS-7047)
systemctl disable polkit.service systemctl disable polkit.service
systemctl disable tuned.service systemctl disable tuned.service
fi fi
# Clean the yum cache. We don't want to maintain it on the guest file system. # Clean the yum cache. We don't want to maintain it on the guest file system.
@ -80,9 +80,9 @@ sed -i 's#OmitLocalLogging on#OmitLocalLogging off#g' /etc/rsyslog.conf
# select correct kernel and initrd # select correct kernel and initrd
if [ "$BUILD_MODE" == "rt" ]; then if [ "$BUILD_MODE" == "rt" ]; then
PATTERN=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-rt) PATTERN=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-rt)
else else
PATTERN=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel) PATTERN=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel)
fi fi
cd /boot cd /boot
rm -f vmlinuz initramfs.img rm -f vmlinuz initramfs.img

View File

@ -28,16 +28,16 @@
# This function generates a simple file of dependencies we're trying to resolve # This function generates a simple file of dependencies we're trying to resolve
function generate_dep_list { function generate_dep_list {
TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX) TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX)
mkdir -p $TMP_RPM_DB mkdir -p $TMP_RPM_DB
rpm --initdb --dbpath $TMP_RPM_DB rpm --initdb --dbpath $TMP_RPM_DB
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1 rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \ rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \
| grep -v "error:" \ | grep -v "error:" \
| grep -v "warning:" \ | grep -v "warning:" \
| grep -v "Preparing..." \ | grep -v "Preparing..." \
| sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE | sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE
\rm -rf $TMP_RPM_DB \rm -rf $TMP_RPM_DB
} }
# Takes a list of requirements (either explcit package name, or capabilities # Takes a list of requirements (either explcit package name, or capabilities
@ -53,166 +53,162 @@ function generate_dep_list {
# install the "xyz" package, rather than "something-devel" which has "xyz" # install the "xyz" package, rather than "something-devel" which has "xyz"
# capabilities. # capabilities.
function install_deps { function install_deps {
local DEP_LIST="" local DEP_LIST=""
local DEP_LIST_FILE="$1" local DEP_LIST_FILE="$1"
# Temporary files are used in a few different ways # Temporary files are used in a few different ways
# Here we essenitally create variable aliases to make it easier to read # Here we essenitally create variable aliases to make it easier to read
# the script # the script
local UNSORTED_PACKAGES=$TMPFILE local UNSORTED_PACKAGES=$TMPFILE
local SORTED_PACKAGES=$TMPFILE1 local SORTED_PACKAGES=$TMPFILE1
local UNRESOLVED_PACKAGES=$TMPFILE2 local UNRESOLVED_PACKAGES=$TMPFILE2
rm -f $UNSORTED_PACKAGES rm -f $UNSORTED_PACKAGES
while read DEP while read DEP
do do
DEP_LIST="${DEP_LIST} ${DEP}" DEP_LIST="${DEP_LIST} ${DEP}"
done < $DEP_LIST_FILE done < $DEP_LIST_FILE
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
# go through each repo and convert deps to packages based on package name # go through each repo and convert deps to packages based on package name
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch ${DEP_LIST} --qf='%{name}'" echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch ${DEP_LIST} --qf='%{name}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
\rm -rf $TMP_DIR/yum-$USER-*
done
sort $UNSORTED_PACKAGES -u > $SORTED_PACKAGES
# figure out any dependancies which could not be resolved based on
# package name. We use --whatpovides to deal with this
#
# First, we build a new DEP_LIST based on what was NOT found in
# search-by-name attempt
sort $DEP_LIST_FILE -u > $TMPFILE
comm -2 -3 $TMPFILE $SORTED_PACKAGES > $UNRESOLVED_PACKAGES
# If there are any requirements not resolved, look up the packages with
# --whatprovides
if [ -s $UNRESOLVED_PACKAGES ]; then
DEP_LIST=""
\cp $SORTED_PACKAGES $UNSORTED_PACKAGES
while read DEP
do
DEP_LIST="${DEP_LIST} ${DEP}"
done < $UNRESOLVED_PACKAGES
DEP_LIST=$(echo "$DEP_LIST" | sed 's/^ //g')
if [ "$DEP_LIST" != "" ]; then
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
\rm -rf $TMP_DIR/yum-$USER-* \rm -rf $TMP_DIR/yum-$USER-*
done done
sort $UNSORTED_PACKAGES -u > $SORTED_PACKAGES fi
# figure out any dependancies which could not be resolved based on sort -u $UNSORTED_PACKAGES > $SORTED_PACKAGES
# package name. We use --whatpovides to deal with this fi
#
# First, we build a new DEP_LIST based on what was NOT found in
# search-by-name attempt
sort $DEP_LIST_FILE -u > $TMPFILE
comm -2 -3 $TMPFILE $SORTED_PACKAGES > $UNRESOLVED_PACKAGES
# If there are any requirements not resolved, look up the packages with # clean up
# --whatprovides \rm -f $UNSORTED_PACKAGES $UNRESOLVED_PACKAGES
if [ -s $UNRESOLVED_PACKAGES ]; then
DEP_LIST=""
\cp $SORTED_PACKAGES $UNSORTED_PACKAGES
while read DEP
do
DEP_LIST="${DEP_LIST} ${DEP}"
done < $UNRESOLVED_PACKAGES
DEP_LIST=$(echo "$DEP_LIST" | sed 's/^ //g') # We now have, in SORTED_PACKAGES, a list of all packages that we need to install
if [ "$DEP_LIST" != "" ]; then # to meet our dependancies
DEP_LIST=" "
while read DEP
do
DEP_LIST="${DEP_LIST}${DEP} "
done < $SORTED_PACKAGES
rm $SORTED_PACKAGES
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do # go through each repo and install packages
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'" local TARGETS=${DEP_LIST}
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES echo "Debug: Resolved list of deps to install: ${TARGETS}"
\rm -rf $TMP_DIR/yum-$USER-* local UNRESOLVED
done for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
UNRESOLVED="$TARGETS"
if [[ ! -z "${TARGETS// }" ]]; then
REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::')
>&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V > $TMPFILE
\rm -rf $TMP_DIR/yum-$USER-*
while read STR
do
>&2 echo "STR=$STR"
if [ "x$STR" == "x" ]; then
continue
fi fi
sort -u $UNSORTED_PACKAGES > $SORTED_PACKAGES PKG=`echo $STR | cut -d " " -f 1`
fi PKG_FILE=`echo $STR | cut -d " " -f 2`
PKG_REL_PATH=`echo $STR | cut -d " " -f 3`
PKG_PATH="${REPO_PATH}/${PKG_REL_PATH}"
# clean up >&2 echo "Installing PKG=$PKG PKG_FILE=$PKG_FILE PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH from repo $REPOID"
\rm -f $UNSORTED_PACKAGES $UNRESOLVED_PACKAGES cp $PKG_PATH .
if [ $? -ne 0 ]; then
>&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 " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
fi
# We now have, in SORTED_PACKAGES, a list of all packages that we need to install echo $UNRESOLVED | grep $PKG >> /dev/null
# to meet our dependancies if [ $? -eq 0 ]; then
DEP_LIST=" " echo "$PKG found in $REPOID as $PKG" >> $BUILT_REPORT
while read DEP echo "$PKG_PATH" >> $BUILT_REPORT
do UNRESOLVED=$(echo "$UNRESOLVED" | sed "s# $PKG # #g")
DEP_LIST="${DEP_LIST}${DEP} " else
done < $SORTED_PACKAGES echo "$PKG satisfies unknown target in $REPOID" >> $BUILT_REPORT
rm $SORTED_PACKAGES echo " but it doesn't match targets, $UNRESOLVED" >> $BUILT_REPORT
echo " path $PKG_PATH" >> $BUILT_REPORT
# go through each repo and install packages FOUND_UNKNOWN=1
local TARGETS=${DEP_LIST} fi
echo "Debug: Resolved list of deps to install: ${TARGETS}" done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)"
local UNRESOLVED
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
UNRESOLVED="$TARGETS"
if [[ ! -z "${TARGETS// }" ]]; then
REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::')
>&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V > $TMPFILE
\rm -rf $TMP_DIR/yum-$USER-* \rm -rf $TMP_DIR/yum-$USER-*
TARGETS="$UNRESOLVED"
while read STR fi
do done
>&2 echo "STR=$STR" >&2 echo "Debug: Packages still unresolved: $UNRESOLVED"
if [ "x$STR" == "x" ]; then echo "Debug: Packages still unresolved: $UNRESOLVED" >> $WARNINGS_REPORT
continue echo "Debug: Packages still unresolved: $UNRESOLVED" >> $BUILT_REPORT
fi >&2 echo ""
PKG=`echo $STR | cut -d " " -f 1`
PKG_FILE=`echo $STR | cut -d " " -f 2`
PKG_REL_PATH=`echo $STR | cut -d " " -f 3`
PKG_PATH="${REPO_PATH}/${PKG_REL_PATH}"
>&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 .
if [ $? -ne 0 ]
then
>&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 " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
fi
echo $UNRESOLVED | grep $PKG >> /dev/null
if [ $? -eq 0 ]; then
echo "$PKG found in $REPOID as $PKG" >> $BUILT_REPORT
echo "$PKG_PATH" >> $BUILT_REPORT
UNRESOLVED=$(echo "$UNRESOLVED" | sed "s# $PKG # #g")
else
echo "$PKG satisfies unknown target in $REPOID" >> $BUILT_REPORT
echo " but it doesn't match targets, $UNRESOLVED" >> $BUILT_REPORT
echo " path $PKG_PATH" >> $BUILT_REPORT
FOUND_UNKNOWN=1
fi
done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)"
\rm -rf $TMP_DIR/yum-$USER-*
TARGETS="$UNRESOLVED"
fi
done
>&2 echo "Debug: Packages still unresolved: $UNRESOLVED"
echo "Debug: Packages still unresolved: $UNRESOLVED" >> $WARNINGS_REPORT
echo "Debug: Packages still unresolved: $UNRESOLVED" >> $BUILT_REPORT
>&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
do do
PKGS_TO_CHECK="$PKGS_TO_CHECK ${PKG_TO_ADD}" PKGS_TO_CHECK="$PKGS_TO_CHECK ${PKG_TO_ADD}"
done < $DEPLISTFILE done < $DEPLISTFILE
rpm -qp $MY_WORKSPACE/export/dist/isolinux/Packages/*.rpm --qf="%{name}\n" --nosignature > $TMPFILE rpm -qp $MY_WORKSPACE/export/dist/isolinux/Packages/*.rpm --qf="%{name}\n" --nosignature > $TMPFILE
while read INSTALLED_PACKAGE while read INSTALLED_PACKAGE
do do
echo $PKGS_TO_CHECK | grep -q "${INSTALLED_PACKAGE}" echo $PKGS_TO_CHECK | grep -q "${INSTALLED_PACKAGE}"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE} //"` PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE} //"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE} / /"` PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE} / /"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE}\$//"` PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE}\$//"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE}\$//"` PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE}\$//"`
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" return 1
return 1 fi
fi return 0
return 0
} }
ATTEMPTED=0 ATTEMPTED=0
@ -258,39 +254,39 @@ fi
# check that we resolved them all # check that we resolved them all
check_all_explicit_deps_installed check_all_explicit_deps_installed
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
>&2 echo "Error -- could not install all explicitly listed packages" >&2 echo "Error -- could not install all explicitly listed packages"
exit 1 exit 1
fi fi
ALL_RESOLVED=0 ALL_RESOLVED=0
while [ $ALL_RESOLVED -eq 0 ]; do while [ $ALL_RESOLVED -eq 0 ]; do
cp $DEPLISTFILE $DEPLISTFILE.old cp $DEPLISTFILE $DEPLISTFILE.old
generate_dep_list generate_dep_list
if [ ! -s $DEPLISTFILE ]; then if [ ! -s $DEPLISTFILE ]; then
# no more dependencies! # no more dependencies!
ALL_RESOLVED=1 ALL_RESOLVED=1
else else
DIFFLINES=`diff $DEPLISTFILE.old $DEPLISTFILE | wc -l` DIFFLINES=`diff $DEPLISTFILE.old $DEPLISTFILE | wc -l`
if [ $DIFFLINES -eq 0 ]; then if [ $DIFFLINES -eq 0 ]; then
>&2 echo "Warning: Infinite loop detected in dependency resolution. See $DEPLISTFILE for details -- exiting" >&2 echo "Warning: Infinite loop detected in dependency resolution. See $DEPLISTFILE for details -- exiting"
>&2 echo "These RPMS had problems (likely version conflicts)" >&2 echo "These RPMS had problems (likely version conflicts)"
>&2 cat $DEPLISTFILE >&2 cat $DEPLISTFILE
echo "Warning: Infinite loop detected in dependency resolution See $DEPLISTFILE for details -- exiting" >> $WARNINGS_REPORT echo "Warning: Infinite loop detected in dependency resolution See $DEPLISTFILE for details -- exiting" >> $WARNINGS_REPORT
echo "These RPMS had problems (likely version conflicts)" >> $WARNINGS_REPORT echo "These RPMS had problems (likely version conflicts)" >> $WARNINGS_REPORT
cat $DEPLISTFILE >> $WARNINGS_REPORT cat $DEPLISTFILE >> $WARNINGS_REPORT
date > $LAST_TEST date > $LAST_TEST
rm -f $DEPLISTFILE.old rm -f $DEPLISTFILE.old
exit 1 # nothing fixed exit 1 # nothing fixed
fi fi
install_deps $DEPLISTFILE install_deps $DEPLISTFILE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
fi fi
done done
exit 0 exit 0

View File

@ -2,17 +2,17 @@
CREATEREPO=$(which createrepo_c) CREATEREPO=$(which createrepo_c)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
CREATEREPO="createrepo" CREATEREPO="createrepo"
fi fi
# If a file listed in list.txt is missing, this function attempts to find the # If a file listed in list.txt is missing, this function attempts to find the
# RPM and copy it to the local directory. This should not be required normally # RPM and copy it to the local directory. This should not be required normally
# and is only used when collecting the source RPMs initially. # and is only used when collecting the source RPMs initially.
function findSrc { function findSrc {
local lookingFor=$1 local lookingFor=$1
find $MY_REPO/cgcs-centos-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' . find $MY_REPO/cgcs-centos-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_REPO/cgcs-tis-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' . find $MY_REPO/cgcs-tis-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_WORKSPACE/std/rpmbuild/SRPMS -name $lookingFor | xargs -I '{}' cp '{}' . find $MY_WORKSPACE/std/rpmbuild/SRPMS -name $lookingFor | xargs -I '{}' cp '{}' .
} }
rm -f success.txt rm -f success.txt
@ -23,23 +23,23 @@ infile=list.txt
while read p; do while read p; do
if [ ! -f "$p" ]; then if [ ! -f "$p" ]; then
findSrc $p findSrc $p
if [ ! -f "$p" ]; then if [ ! -f "$p" ]; then
echo "couldn't find" >> missing.txt echo "couldn't find" >> missing.txt
echo "couldn't find $p" >> missing.txt echo "couldn't find $p" >> missing.txt
continue continue
fi fi
echo "found $p" echo "found $p"
fi fi
mock -r build.cfg $p --resultdir=results --no-clean mock -r build.cfg $p --resultdir=results --no-clean
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "$p" >> success.txt echo "$p" >> success.txt
cd results cd results
$CREATEREPO . $CREATEREPO .
cd .. cd ..
else else
echo "$p" >> fail.txt echo "$p" >> fail.txt
fi fi
done < $infile done < $infile

View File

@ -4,42 +4,42 @@
CREATEREPO=$(which createrepo_c) CREATEREPO=$(which createrepo_c)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
CREATEREPO="createrepo" CREATEREPO="createrepo"
fi fi
function final_touches { function final_touches {
# create the repo # create the repo
cd ${ROOTDIR}/${DEST}/isolinux cd ${ROOTDIR}/${DEST}/isolinux
$CREATEREPO -g ../comps.xml . $CREATEREPO -g ../comps.xml .
# build the ISO # build the ISO
printf "Building image $OUTPUT_FILE\n" printf "Building image $OUTPUT_FILE\n"
cd ${ROOTDIR}/${DEST} cd ${ROOTDIR}/${DEST}
chmod 664 isolinux/isolinux.bin chmod 664 isolinux/isolinux.bin
mkisofs -o $OUTPUT_FILE \ mkisofs -o $OUTPUT_FILE \
-R -D -A 'oe_iso_boot' -V 'oe_iso_boot' \ -R -D -A 'oe_iso_boot' -V 'oe_iso_boot' \
-b isolinux.bin -c boot.cat -no-emul-boot \ -b isolinux.bin -c boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \ -boot-load-size 4 -boot-info-table \
-eltorito-alt-boot \ -eltorito-alt-boot \
-e images/efiboot.img \ -e images/efiboot.img \
-no-emul-boot \ -no-emul-boot \
isolinux/ isolinux/
isohybrid --uefi $OUTPUT_FILE isohybrid --uefi $OUTPUT_FILE
implantisomd5 $OUTPUT_FILE implantisomd5 $OUTPUT_FILE
cd $ROOTDIR cd $ROOTDIR
} }
function setup_disk { function setup_disk {
tar xJf emptyInstaller.tar.xz tar xJf emptyInstaller.tar.xz
mkdir ${DEST}/isolinux/Packages mkdir ${DEST}/isolinux/Packages
} }
function install_packages { function install_packages {
cd ${DEST}/isolinux/Packages cd ${DEST}/isolinux/Packages
ROOT=${ROOTDIR} ../../../cgts_deps.sh --deps=../../../${MINIMAL} ROOT=${ROOTDIR} ../../../cgts_deps.sh --deps=../../../${MINIMAL}
cd ${ROOTDIR} cd ${ROOTDIR}
} }

View File

@ -1,144 +1,140 @@
#!/bin/env bash #!/bin/env bash
function generate_dep_list { function generate_dep_list {
TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX) TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX)
mkdir -p $TMP_RPM_DB mkdir -p $TMP_RPM_DB
rpm --initdb --dbpath $TMP_RPM_DB rpm --initdb --dbpath $TMP_RPM_DB
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1 rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \ rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \
| grep -v "error:" \ | grep -v "error:" \
| grep -v "warning:" \ | grep -v "warning:" \
| grep -v "Preparing..." \ | grep -v "Preparing..." \
| sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE | sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE
rm -rf $TMP_RPM_DB rm -rf $TMP_RPM_DB
} }
function install_deps { function install_deps {
local DEP_LIST="" local DEP_LIST=""
local DEP_LIST_FILE="$1" local DEP_LIST_FILE="$1"
rm -f $TMPFILE rm -f $TMPFILE
while read DEP while read DEP
do do
DEP_LIST="${DEP_LIST} ${DEP}" DEP_LIST="${DEP_LIST} ${DEP}"
done < $DEP_LIST_FILE done < $DEP_LIST_FILE
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
# go through each repo and convert deps to packages # go through each repo and convert deps to packages
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'" echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $TMPFILE TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $TMPFILE
\rm -rf $TMP_DIR/yum-$USER-* \rm -rf $TMP_DIR/yum-$USER-*
done done
sort $TMPFILE -u > $TMPFILE1 sort $TMPFILE -u > $TMPFILE1
rm $TMPFILE rm $TMPFILE
DEP_LIST="" DEP_LIST=""
while read DEP while read DEP
do do
DEP_LIST="${DEP_LIST} ${DEP}" DEP_LIST="${DEP_LIST} ${DEP}"
done < $TMPFILE1 done < $TMPFILE1
rm $TMPFILE1 rm $TMPFILE1
# next go through each repo and install packages # next go through each repo and install packages
local TARGETS=${DEP_LIST} local TARGETS=${DEP_LIST}
echo "Debug: Resolved list of deps to install: ${TARGETS}" echo "Debug: Resolved list of deps to install: ${TARGETS}"
local UNRESOLVED local UNRESOLVED
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
UNRESOLVED=" $TARGETS " UNRESOLVED=" $TARGETS "
if [[ ! -z "${TARGETS// }" ]]; then if [[ ! -z "${TARGETS// }" ]]; then
REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::') REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::')
>&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'" >&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V >> $TMPFILE TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V >> $TMPFILE
\rm -rf $TMP_DIR/yum-$USER-* \rm -rf $TMP_DIR/yum-$USER-*
while read STR while read STR
do do
>&2 echo "STR=$STR" >&2 echo "STR=$STR"
if [ "x$STR" == "x" ]; then if [ "x$STR" == "x" ]; then
continue continue
fi fi
PKG=`echo $STR | cut -d " " -f 1` PKG=`echo $STR | cut -d " " -f 1`
PKG_FILE=`echo $STR | cut -d " " -f 2` PKG_FILE=`echo $STR | cut -d " " -f 2`
PKG_REL_PATH=`echo $STR | cut -d " " -f 3` PKG_REL_PATH=`echo $STR | cut -d " " -f 3`
PKG_PATH="${REPO_PATH}/${PKG_REL_PATH}" PKG_PATH="${REPO_PATH}/${PKG_REL_PATH}"
>&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" fi
fi
echo $UNRESOLVED | grep $PKG echo $UNRESOLVED | grep $PKG
echo $UNRESOLVED | grep $PKG >> /dev/null echo $UNRESOLVED | grep $PKG >> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "$PKG found in $REPOID as $PKG" >> $BUILT_REPORT echo "$PKG found in $REPOID as $PKG" >> $BUILT_REPORT
echo "$PKG_PATH" >> $BUILT_REPORT echo "$PKG_PATH" >> $BUILT_REPORT
UNRESOLVED=$(echo "$UNRESOLVED" | sed "s# $PKG # #g") UNRESOLVED=$(echo "$UNRESOLVED" | sed "s# $PKG # #g")
else else
echo "$PKG satisfies unknown target in $REPOID" >> $BUILT_REPORT echo "$PKG satisfies unknown target in $REPOID" >> $BUILT_REPORT
echo " but it doesn't match targets, $UNRESOLVED" >> $BUILT_REPORT echo " but it doesn't match targets, $UNRESOLVED" >> $BUILT_REPORT
echo " path $PKG_PATH" >> $BUILT_REPORT echo " path $PKG_PATH" >> $BUILT_REPORT
FOUND_UNKNOWN=1 FOUND_UNKNOWN=1
fi fi
done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)" done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)"
\rm -rf $TMP_DIR/yum-$USER-* \rm -rf $TMP_DIR/yum-$USER-*
TARGETS="$UNRESOLVED" TARGETS="$UNRESOLVED"
fi fi
done done
>&2 echo "Debug: Packages still unresolved: $UNRESOLVED" >&2 echo "Debug: Packages still unresolved: $UNRESOLVED"
echo "Debug: Packages still unresolved: $UNRESOLVED" >> $WARNINGS_REPORT echo "Debug: Packages still unresolved: $UNRESOLVED" >> $WARNINGS_REPORT
echo "Debug: Packages still unresolved: $UNRESOLVED" >> $BUILT_REPORT echo "Debug: Packages still unresolved: $UNRESOLVED" >> $BUILT_REPORT
>&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
do do
PKGS_TO_CHECK="$PKGS_TO_CHECK ${PKG_TO_ADD}" PKGS_TO_CHECK="$PKGS_TO_CHECK ${PKG_TO_ADD}"
done < $DEPLISTFILE done < $DEPLISTFILE
rpm -qp ${INSTALLDIR}/*.rpm --qf="%{name}\n" > $TMPFILE rpm -qp ${INSTALLDIR}/*.rpm --qf="%{name}\n" > $TMPFILE
echo "checking... $PKGS_TO_CHECK vs ${INSTALLED_PACKAGE}"
while read INSTALLED_PACKAGE echo "checking... $PKGS_TO_CHECK vs ${INSTALLED_PACKAGE}"
do
echo $PKGS_TO_CHECK | grep -q "${INSTALLED_PACKAGE}"
if [ $? -eq 0 ]; then
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE} //"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE} / /"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE}\$//"`
PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE}\$//"`
fi
done < $TMPFILE
if [ -z "$PKGS_TO_CHECK" ] while read INSTALLED_PACKAGE
then do
>&2 echo "All explicitly specified packages resolved!" echo $PKGS_TO_CHECK | grep -q "${INSTALLED_PACKAGE}"
else if [ $? -eq 0 ]; then
>&2 echo "Could not resolve packages: $PKGS_TO_CHECK" PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE} //"`
return 1 PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE} / /"`
fi PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/ ${INSTALLED_PACKAGE}\$//"`
return 0 PKGS_TO_CHECK=`echo $PKGS_TO_CHECK | sed "s/^${INSTALLED_PACKAGE}\$//"`
fi
done < $TMPFILE
if [ -z "$PKGS_TO_CHECK" ]; then
>&2 echo "All explicitly specified packages resolved!"
else
>&2 echo "Could not resolve packages: $PKGS_TO_CHECK"
return 1
fi
return 0
} }
if [ "x${ROOT}" == "x" ]; then if [ "x${ROOT}" == "x" ]; then
ROOT=/localdisk/loadbuild/centos ROOT=/localdisk/loadbuild/centos
fi fi
ATTEMPTED=0 ATTEMPTED=0
@ -184,39 +180,39 @@ fi
# check that we resolved them all # check that we resolved them all
check_all_explicit_deps_installed check_all_explicit_deps_installed
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
>&2 echo "Error -- could not install all explicitly listed packages" >&2 echo "Error -- could not install all explicitly listed packages"
exit 1 exit 1
fi fi
ALL_RESOLVED=0 ALL_RESOLVED=0
while [ $ALL_RESOLVED -eq 0 ]; do while [ $ALL_RESOLVED -eq 0 ]; do
cp $DEPLISTFILE $DEPLISTFILE.old cp $DEPLISTFILE $DEPLISTFILE.old
generate_dep_list generate_dep_list
if [ ! -s $DEPLISTFILE ]; then if [ ! -s $DEPLISTFILE ]; then
# no more dependencies! # no more dependencies!
ALL_RESOLVED=1 ALL_RESOLVED=1
else else
DIFFLINES=`diff $DEPLISTFILE.old $DEPLISTFILE | wc -l` DIFFLINES=`diff $DEPLISTFILE.old $DEPLISTFILE | wc -l`
if [ $DIFFLINES -eq 0 ]; then if [ $DIFFLINES -eq 0 ]; then
>&2 echo "Warning: Infinite loop detected in dependency resolution. See $DEPLISTFILE for details -- exiting" >&2 echo "Warning: Infinite loop detected in dependency resolution. See $DEPLISTFILE for details -- exiting"
>&2 echo "These RPMS had problems (likely version conflicts)" >&2 echo "These RPMS had problems (likely version conflicts)"
>&2 cat $DEPLISTFILE >&2 cat $DEPLISTFILE
echo "Warning: Infinite loop detected in dependency resolution See $DEPLISTFILE for details -- exiting" >> $WARNINGS_REPORT echo "Warning: Infinite loop detected in dependency resolution See $DEPLISTFILE for details -- exiting" >> $WARNINGS_REPORT
echo "These RPMS had problems (likely version conflicts)" >> $WARNINGS_REPORT echo "These RPMS had problems (likely version conflicts)" >> $WARNINGS_REPORT
cat $DEPLISTFILE >> $WARNINGS_REPORT cat $DEPLISTFILE >> $WARNINGS_REPORT
date > $LAST_TEST date > $LAST_TEST
rm -f $DEPLISTFILE.old rm -f $DEPLISTFILE.old
exit 1 # nothing fixed exit 1 # nothing fixed
fi fi
install_deps $DEPLISTFILE install_deps $DEPLISTFILE
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
fi fi
done done
exit 0 exit 0

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,25 +2,25 @@
## 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"
# remove old files in original initrd.img # remove old files in original initrd.img
# do this in chroot to avoid accidentialy wrong operations on host root # do this in chroot to avoid accidentialy wrong operations on host root
chroot $rootfs_dir /bin/bash -x <<EOF chroot $rootfs_dir /bin/bash -x <<EOF
rm -rf ./boot/ ./etc/modules-load.d/ rm -rf ./boot/ ./etc/modules-load.d/
if [ -n $old_version ] && [ -f ./etc/ld.so.conf.d/kernel-${old_version}.conf ]; then if [ -n $old_version ] && [ -f ./etc/ld.so.conf.d/kernel-${old_version}.conf ]; then
rm -rf ./etc/ld.so.conf.d/kernel-${old_version}.conf rm -rf ./etc/ld.so.conf.d/kernel-${old_version}.conf
rm -rf ./lib/modules/${old_version} rm -rf ./lib/modules/${old_version}
fi fi
if [ -d ./usr/lib64/python2.7/site-packages/pyanaconda/ ];then if [ -d ./usr/lib64/python2.7/site-packages/pyanaconda/ ];then
rm -rf usr/lib64/python2.7/site-packages/pyanaconda/ rm -rf usr/lib64/python2.7/site-packages/pyanaconda/
fi fi
if [ -d ./usr/lib64/python2.7/site-packages/rpm/ ];then if [ -d ./usr/lib64/python2.7/site-packages/rpm/ ];then
@ -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"
@ -99,12 +101,12 @@ if [ -f $new_kernel ];then
#copy out the new kernel #copy out the new kernel
if [ $mode == "std" ];then if [ $mode == "std" ];then
if [ -f $output_dir/new-vmlinuz ]; then if [ -f $output_dir/new-vmlinuz ]; then
mv -f $output_dir/new-vmlinuz $output_dir/vmlinuz-bakcup-$timestamp mv -f $output_dir/new-vmlinuz $output_dir/vmlinuz-bakcup-$timestamp
fi fi
cp -f $new_kernel $output_dir/new-vmlinuz cp -f $new_kernel $output_dir/new-vmlinuz
else else
if [ -f $output_dir/new-vmlinuz-rt ]; then if [ -f $output_dir/new-vmlinuz-rt ]; then
mv -f $output_dir/new-vmlinuz-rt $output_dir/vmlinuz-rt-bakcup-$timestamp mv -f $output_dir/new-vmlinuz-rt $output_dir/vmlinuz-rt-bakcup-$timestamp
fi fi
cp -f $new_kernel $output_dir/new-vmlinuz-rt cp -f $new_kernel $output_dir/new-vmlinuz-rt
fi fi
@ -165,7 +167,7 @@ if [ ! -d $rootfs_rpms_dir ];then
fi fi
# make squashfs.mnt and ready and umounted # make squashfs.mnt and ready and umounted
if [ ! -d $work_dir/squashfs.mnt ];then if [ ! -d $work_dir/squashfs.mnt ];then
mkdir -p $work_dir/squashfs.mnt mkdir -p $work_dir/squashfs.mnt
else else
# in case it was mounted previously # in case it was mounted previously
@ -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/.
@ -230,7 +234,7 @@ umount $squashfs_root
#rename the old version #rename the old version
if [ -f $output_dir/new-squashfs.img ]; then if [ -f $output_dir/new-squashfs.img ]; then
mv -f $output_dir/new-squashfs.img $output_dir/squashfs.img-backup-$timestamp mv -f $output_dir/new-squashfs.img $output_dir/squashfs.img-backup-$timestamp
fi fi
echo "--> make the new squashfs image" echo "--> make the new squashfs image"
mksquashfs LiveOS $output_dir/new-squashfs.img -keep-as-directory -comp xz -b 1M mksquashfs LiveOS $output_dir/new-squashfs.img -keep-as-directory -comp xz -b 1M

View File

@ -72,17 +72,17 @@ while true ; do
done done
if [ "x$JENKINSURL" == "x" ]; then if [ "x$JENKINSURL" == "x" ]; then
JENKINSURL=$@ JENKINSURL=$@
fi fi
if [ $HELP -eq 1 ]; then if [ $HELP -eq 1 ]; then
usage usage
exit 0 exit 0
fi fi
if [ "x$JENKINSURL" == "x" ]; then if [ "x$JENKINSURL" == "x" ]; then
usage usage
exit 1 exit 1
fi fi
mkdir -p $MY_WORKSPACE/export $MY_WORKSPACE/std/rpmbuild/RPMS $MY_WORKSPACE/std/rpmbuild/SRPMS $MY_WORKSPACE/rt/rpmbuild/RPMS $MY_WORKSPACE/rt/rpmbuild/SRPMS mkdir -p $MY_WORKSPACE/export $MY_WORKSPACE/std/rpmbuild/RPMS $MY_WORKSPACE/std/rpmbuild/SRPMS $MY_WORKSPACE/rt/rpmbuild/RPMS $MY_WORKSPACE/rt/rpmbuild/SRPMS
@ -98,13 +98,13 @@ pushd $MY_REPO > /dev/null
find . -type d -name ".git" | sed "s%/\.git$%%" > $TMPFILE find . -type d -name ".git" | sed "s%/\.git$%%" > $TMPFILE
while read hashfile; do while read hashfile; do
gitdir=`echo $hashfile | cut -d " " -f 1` gitdir=`echo $hashfile | cut -d " " -f 1`
gitcommit=`echo $hashfile | sed s/.*[[:space:]]//g` gitcommit=`echo $hashfile | sed s/.*[[:space:]]//g`
echo "doing dir $gitdir commit $gitcommit" echo "doing dir $gitdir commit $gitcommit"
pushd $gitdir >/dev/null pushd $gitdir >/dev/null
git checkout $gitcommit git checkout $gitcommit
popd popd
done < $MY_WORKSPACE/$GITHASHFILE done < $MY_WORKSPACE/$GITHASHFILE
popd popd
@ -113,32 +113,32 @@ pushd $MY_WORKSPACE
# clean stuff # clean stuff
for build_type in std rt; do for build_type in std rt; do
rm -rf $MY_WORKSPACE/$build_type/rpmbuild/SRPMS rm -rf $MY_WORKSPACE/$build_type/rpmbuild/SRPMS
rm -rf $MY_WORKSPACE/$build_type/rpmbuild/RPMS rm -rf $MY_WORKSPACE/$build_type/rpmbuild/RPMS
rm -rf $MY_WORKSPACE/$build_type/rpmbuild/inputs rm -rf $MY_WORKSPACE/$build_type/rpmbuild/inputs
rm -rf $MY_WORKSPACE/$build_type/rpmbuild/srpm_assemble rm -rf $MY_WORKSPACE/$build_type/rpmbuild/srpm_assemble
done done
# copy source rpms from jenkins # copy source rpms from jenkins
for build_type in std rt; do for build_type in std rt; do
mkdir -p $MY_WORKSPACE/$build_type/rpmbuild/RPMS mkdir -p $MY_WORKSPACE/$build_type/rpmbuild/RPMS
mkdir -p $MY_WORKSPACE/$build_type/rpmbuild/SRPMS mkdir -p $MY_WORKSPACE/$build_type/rpmbuild/SRPMS
rsync -r ${JENKINSURL}/$build_type/inputs $build_type/ rsync -r ${JENKINSURL}/$build_type/inputs $build_type/
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/srpm_assemble $build_type/ rsync -r ${JENKINSURL}/$build_type/srpm_assemble $build_type/
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS
sleep 1 sleep 1
for sub_repo in cgcs-centos-repo cgcs-tis-repo cgcs-3rd-party-repo; do for sub_repo in cgcs-centos-repo cgcs-tis-repo cgcs-3rd-party-repo; do
rsync ${JENKINSURL}/$build_type/$sub_repo.last_head $MY_WORKSPACE/$build_type rsync ${JENKINSURL}/$build_type/$sub_repo.last_head $MY_WORKSPACE/$build_type
if [ "$build_type" == "std" ]; then if [ "$build_type" == "std" ]; then
cp $MY_WORKSPACE/$build_type/$sub_repo.last_head $MY_REPO/$sub_repo/.last_head cp $MY_WORKSPACE/$build_type/$sub_repo.last_head $MY_REPO/$sub_repo/.last_head
fi fi
done done
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/results $build_type/ rsync -r ${JENKINSURL}/$build_type/results $build_type/
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/rpmbuild/RPMS/* $MY_WORKSPACE/$build_type/rpmbuild/RPMS rsync -r ${JENKINSURL}/$build_type/rpmbuild/RPMS/* $MY_WORKSPACE/$build_type/rpmbuild/RPMS
done done
popd popd

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 \) \