Skip to content

Instantly share code, notes, and snippets.

@maxim-belkin
Created May 22, 2018 16:07
Show Gist options
  • Select an option

  • Save maxim-belkin/e869dc42cb2c528f3efbcb58f21e6739 to your computer and use it in GitHub Desktop.

Select an option

Save maxim-belkin/e869dc42cb2c528f3efbcb58f21e6739 to your computer and use it in GitHub Desktop.
Test Linuxbrew bottles
#!/bin/bash
cleanup () {
brew remove --force $(brew list) &>/dev/null
brew cleanup &>/dev/null
}
cleanup_int () {
trap 'echo "CTRL + C is disabled during cleanup"' INT
echo "initiating cleanup"
cleanup
echo "Done"
trap - INT
exit 1
}
trap cleanup_int INT
echo -n "" > ~/bad.txt
echo -n "" > ~/suspicious.txt
for file in $(grep -l "sha256.*linux" /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/*.rb);
do
cleanup
formula=$(basename $file .rb)
echo -n $formula
if grep -w "|${formula}|" ~/bad.txt &>/dev/null; then
echo " ... found $formula in ~/bad.txt"
continue;
fi
echo ""
failed=0
faileddeps=""
for dep in $(brew deps $formula); do
echo " dep: $dep"
if grep -w "|${dep}|" ~/bad.txt &>/dev/null; then
echo " ... found $dep in ~/bad.txt"
failed=1
faileddeps="$faileddeps $dep"
continue
fi
if ! brew install $dep &>/dev/null; then
echo "|$dep| (inst)" >> ~/bad.txt
echo " ... adding $dep to ~/bad.txt"
failed=1
faileddeps="$faileddeps $dep"
fi
done
if (( failed == 1 )); then
echo "|$formula| (deps: $faileddeps)" >> ~/bad.txt
continue
fi
echo -n "" > ~/stderr-$formula.txt
if ! brew install $formula 1>/dev/null 2>~/stderr-$formula.txt; then
echo " ... adding $formula to ~/bad.txt"
echo "|$formula| (inst)" >> ~/bad.txt
fi
if test -s ~/stderr-$formula.txt; then
echo " ... check $formula!"
echo "|$formula|" >> ~/suspicious.txt
else
rm -f ~/stderr-$formula.txt
fi
done
trap - INT EXIT TERM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment