From 7dad4d39bdd9afde1f12ef56658a72d7c808bbcc Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 14 Feb 2013 19:43:21 +0900 Subject: [PATCH] move test-rebuild.sh here from haskell-sig.git --- tests/test-rebuild.sh | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 tests/test-rebuild.sh diff --git a/tests/test-rebuild.sh b/tests/test-rebuild.sh new file mode 100755 index 0000000..f7f475b --- /dev/null +++ b/tests/test-rebuild.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +# for testing updates to ghc-rpm-macros etc +# In a pkg dir run +# $ ./test-rebuild.sh +# or clone a pkg branch: +# $ ./test-rebuild.sh [pkg] [branch] + +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 + +if [ -n "$2" ]; then + fedpkg switch-branch $2 +fi + +sudo yum-builddep $PKG.spec + +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