2013-02-14 10:43:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# for testing updates to ghc-rpm-macros etc
|
|
|
|
# In a pkg dir run
|
|
|
|
# $ ./test-rebuild.sh
|
|
|
|
# or clone a pkg branch:
|
2013-11-20 10:50:50 +00:00
|
|
|
# $ ./test-rebuild.sh [pkg]
|
2013-02-14 10:43:21 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
PKG=${1:-$(fedpkg gimmespec | sed -e "s/.spec//")}
|
|
|
|
|
|
|
|
[ -d "$PKG" -o -f "$PKG.spec" ] || fedpkg clone -a $PKG
|
|
|
|
|
|
|
|
[ -d "$PKG" ] && cd $PKG
|
|
|
|
|
|
|
|
ARCH=$(arch)
|
|
|
|
|
|
|
|
#if [ -d $ARCH ]; then
|
|
|
|
# echo Please move existing $ARCH/
|
|
|
|
# exit 1
|
|
|
|
#fi
|
|
|
|
|
2013-11-28 10:16:42 +00:00
|
|
|
if [ -f /etc/os-release ]; then
|
|
|
|
eval $(grep VERSION_ID /etc/os-release)
|
2017-05-10 02:15:55 +00:00
|
|
|
if git branch -a | grep -q f$VERSION_ID; then
|
|
|
|
BRANCH=f$VERSION_ID
|
|
|
|
else
|
|
|
|
case $VERSION_ID in
|
|
|
|
7.*) BRANCH=epel7 ;;
|
|
|
|
*) BRANCH=master ;;
|
|
|
|
esac
|
|
|
|
fi
|
2013-11-28 10:16:42 +00:00
|
|
|
else
|
|
|
|
# assume RHEL6
|
|
|
|
BRANCH=el6
|
|
|
|
fi
|
2013-11-20 10:44:54 +00:00
|
|
|
|
2016-10-12 10:22:40 +00:00
|
|
|
if [ "* $BRANCH" != "$(git branch | grep '^*')" ]; then
|
|
|
|
fedpkg switch-branch $BRANCH
|
|
|
|
fi
|
2013-02-14 10:43:21 +00:00
|
|
|
|
2013-11-28 10:21:31 +00:00
|
|
|
if [ "* $BRANCH" != "$(git branch | grep '^*')" ]; then
|
2013-11-20 10:44:54 +00:00
|
|
|
echo "Git branch does not match Fedora installation!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-11-28 10:16:42 +00:00
|
|
|
git pull
|
|
|
|
|
2016-10-12 10:22:40 +00:00
|
|
|
echo Running dnf builddep:
|
|
|
|
sudo dnf builddep $PKG.spec
|
2013-02-14 10:43:21 +00:00
|
|
|
|
|
|
|
fedpkg local
|
|
|
|
|
|
|
|
VERREL=$(fedpkg verrel | sed -e "s/^$PKG-//")
|
|
|
|
|
|
|
|
TMP=test-tmp
|
|
|
|
|
|
|
|
mkdir -p $TMP/
|
|
|
|
|
|
|
|
PKGS=$(cd $ARCH; rpm -qp $(ls *-$VERREL*.rpm))
|
|
|
|
|
|
|
|
for i in $PKGS; do
|
|
|
|
# FIXME: should check NVR is same before building
|
|
|
|
rpm -q --quiet $i || sudo yum install -q $i
|
|
|
|
for k in list requires provides scripts; do
|
|
|
|
rpm -qp --$k $ARCH/$i.rpm | grep -v rpmlib > $TMP/$i.$k.test || :
|
|
|
|
rpm -q --$k $i | grep -v rpmlib > $TMP/$i.$k.installed || :
|
|
|
|
diff -u $TMP/$i.$k.installed $TMP/$i.$k.test || :
|
|
|
|
done
|
|
|
|
done
|