Skip to content

Instantly share code, notes, and snippets.

@unxmaal
Last active May 5, 2021 00:46
Show Gist options
  • Save unxmaal/db0791152f1ceae5fbaa986e804d7319 to your computer and use it in GitHub Desktop.
Save unxmaal/db0791152f1ceae5fbaa986e804d7319 to your computer and use it in GitHub Desktop.
#!/usr/sgug/bin/bash -e
set -o pipefail
_list=list.txt
_repodir=/usr/people/edodd/sgug-rse.git
_builddir=/usr/people/edodd/rpmbuild
_rpmlist=logs/rpmlist.txt
_buildlog=logs/build.log
_installed=logs/install.log
#_fcurl="https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/31/Everything/SRPMS/Packages/"
_fcurl="https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/source/tree/Packages/"
#_fcupdates_url="https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/31/Everything/SRPMS/Packages/"
_fcupdates_url="https://archives.fedoraproject.org/pub/archive/fedora/linux/updates/31/Everything/SRPMS/Packages/"
SRPMDIR=/opt/fc31/srpms
randomrpm(){
find $SRPMDIR -type f | shuf > randomlist.txt
}
#getdeps(){
# deps=($(grep needed logs/$_pkg.stderr.log | awk '{print $1}'))
#
# for d in "${deps[@]}" ; do
# [[ $d == *[{}\(\)\[\]]* ]] && echo $d | awk -F"[()]" '{print $2}' - || echo $d | sed "s/([^)]*)//g" -
# done
#}
setup(){
mkdir -p logs
#rpm -qa | sort > logs/rpmlist.txt
rm -rf "${_builddir:?}/BUILD/"*
rm -rf "${_builddir:?}/BUILDROOT/"*
}
main(){
# pick random package
randomrpm
#if(build()==failed) {
# if(getdeps()==somestuff) {
# for each deps {
# build deps()
# }
#}
for r in $(cat randomlist.txt) ; do
echo "Trying $r"
_bnr=$(rpm --queryformat "%{NAME}" -qp $r)
if [[ ! -d "${_repodir}/packages/$_bnr" ]] ; then
echo "Outer build"
if ! ./autobuilder.sh "${r}" ; then
echo "build for $r failed"
# if [[ -e logs/$_bnr.deps ]] ; then
# _dc=0
# _maxc=$(cat logs/$_bnr.deps|wc -l)
# while [[ $_dc -ge $_maxc ]] ; do
# for d in $(cat logs/$_bnr.deps) ; do
# _depfullname=$(find /opt/fc31/srpms/. -name $d* | sort | tail -n1)
# if ! ./autobuilder.sh $_depfullname ; then
# echo "$_bnr dep $d failed"
# else
# echo "$_bnr and deps built" >> success.log
# fi
# done
# _dc=$((_dc+1))
# done
# fi
fi
else
echo "$_bnr already in RSE" >> sucess.log
fi
#read -p "Press key to continue.. " -n1 -s
done
}
main
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment