view package @ 199:d1ef12ab18b6

check for uncommitted changes, and for pending push changesets
author Carl Byington <carl@five-ten-sg.com>
date Sat, 02 Feb 2008 12:09:12 -0800
parents fbcf2733fe79
children
line wrap: on
line source

#!/bin/bash

find . -name '*~' | while read a; do rm -f "$a"; done

# check for uncommitted changes
a=$(hg status)
if [ -n "$a" ]; then
    hg status
    echo "fix those first with 'hg commit'"
    exit 0
fi

# check for changesets pending push to global repository
hg outgoing /usr/hg*/dnsbl | grep 'no changes found' >/dev/null
if [ $? -ne 0 ]; then
    hg outgoing /usr/hg*/dnsbl
    echo "fix those first with 'hg push /usr/hg*/dnsbl'"
    exit 0
fi

# get a new clean copy from source control
orig=$(pwd)
pack=$orig/../dnsbl-package
[ -d "$pack" ] && rm -rf "$pack"
mkdir "$pack"
cd "$pack"
hg clone /usr/hg-repository/dnsbl
cd dnsbl

# build the dnsbl package
T=`grep AC_INIT configure.in | cut -d'(' -f2`
NAME=`echo $T | cut -d, -f1`
VER=`echo $T | cut -d, -f2`
BALL=$NAME-$VER.tar.gz
web=/home/httpd/html/510sg/$NAME
distlog=/tmp/distcheck

mkdir -p $web
chown --recursive root:root *
make -f *cvs
./configure >/dev/null
(cd xml; make; make distclean)
cp -a html/*html $web
make distcheck >$distlog 2>&1
if [ $? -eq 0 ]; then
    if [ -f $BALL ]; then
        # expand locally to see the tarball
        rm -rf junk
        mkdir junk
        cd junk
            tar xfz ../$BALL
            cd $NAME-$VER
                ./configure >/dev/null
                make >/dev/null
     ##         make install >/dev/null
     ##         if [ -f /etc/rc.d/init.d/$NAME ]; then
     ##             /etc/rc.d/init.d/$NAME stop
     ##         fi
     ##         make chkconfig
     ##         if [ -f /etc/rc.d/init.d/$NAME ]; then
     ##             chkconfig $NAME on
     ##             /etc/rc.d/init.d/$NAME start
     ##         fi
            cd ..
        cd ..

        # build rpm on target
        target5=pmg2
        scp $BALL $target5:/tmp
        ssh $target5 "cd /tmp; rpmbuild -ta $BALL"

        # build rpm on target
        target4=host62
        scp $BALL $target4:/tmp
        ssh $target4 "cd /tmp; rpmbuild -ta $BALL"

        # add packages to the web site
        wp=$web/packages
        wp4=$wp/centos4
        wp5=$wp/centos5
        mkdir -p $wp4 $wp5
        rp=/usr/src/redhat
        mv -f $BALL $wp
        scp $target4:$rp/SRPMS/$NAME-$VER*rpm $wp
        scp $target4:$rp/RPMS/i386/$NAME-$VER*rpm $wp4
        scp $target5:$rp/RPMS/i386/$NAME-$VER*rpm $wp5
        (cd $web; chown --recursive web:web *; ls -alR)
        rpm -ql -p $wp4/$NAME-$VER*6.rpm
        rpm -ql -p $wp5/$NAME-$VER*6.rpm
    fi
else
    tail -10 $distlog
fi
chown --recursive carl:carl *

# throw away the packaging directory
cd "$pack/.."
rm -rf dnsbl-package
cd "$orig"