Paul Tagliamonte Code Dump M4

cis-main

#!/bin/bash

SPOOL="`pwd`/buildlog"

function log_ok {
echo "$1 OK"
echo -e "$1\t\t[ OK ]" » $SPOOL
}

function log_fail {
echo "$1 Failure"
echo -e "$1\t\t[FAIL]" » $SPOOL
}

function log_ut {
echo "$1 Untested"
echo -e "$1\t\t[ UT ]" » $SPOOL
}

function cisaction {
if [ "x$FAIL" != "x" ]; then
log_ut $1
else
./cisfile $1
if [ $? -ne 0 ]; then
log_fail $1
FAIL="true"
else
log_ok $1
fi
fi
}

function dot_cisaction {
if [ "x$FAIL" != "x" ]; then
log_ut $1
else
../cisfile $1
if [ $? -ne 0 ]; then
log_fail $1
FAIL="true"
else
log_ok $1
fi
fi
}

if [ "x$1" == "x" ]; then
echo "No CIS File"
exit -1
fi

ROOT=/tmp/cis-build

if [ -d $ROOT ]; then
echo "Build in progress(?) — try purging it:"
echo "rm -rf $ROOT"
exit -1
fi

mkdir $ROOT
cp $1 $ROOT
cd $ROOT
echo "" > $SPOOL

cisaction "clone"
cd `./cisfile echo-root`

WHOSTOBLAME=`git log | head -n 2 | grep Author:\ | sed s/Author:\ //g`

dot_cisaction "build"
dot_cisaction "dirty-integrate"

cd ..
rm -rf `./cisfile echo-root`

cisaction "clone"
cisaction "clone-clean-integrate"
cisaction "clean-integrate"

cisaction "test-final-integration"
cisaction "migrate-integrations"

if [ "x$FAIL" != "x" ]; then
echo "We had a failure in the chain."
echo "Someone needs to nofity the hacker."
echo "X-Failure-To: $WHOSTOBLAME"
fi

rm -rf $ROOT

if [ "x$FAIL" != "x" ]; then
exit -2
fi

cis-rundown

#!/bin/bash

RUNLOG="./cis-runlog"
CIS=`./cis-main.sh ./example/cisfile`

if [ $? -ne 0 ]; then
echo "Run failure!"
echo "cat $RUNLOG"
else
echo "Run was OK"
fi

echo "$CIS" > $RUNLOG

BLAME=`echo "$CIS" | grep X-Failure-To:\ | sed s/X-Failure-To:\ //g`

if [ "x$BLAME" != "x" ]; then
echo "Bastard!"
echo $BLAME
fi

example CIS file

#!/usr/bin/make -f

  1. CIS Makefile

ROOT=fluxbox

BUILD=`date +%y%m%d`
FULL_ID=1.3.1+nightly+

EMAIL=ga.tluap.nortatem|soluod#ga.tluap.nortatem|soluod
DEBFULLNAME=Paul's Doulos
DEBEMAIL=$(EMAIL)
GPG_KEY=70DB41EB

#EMAIL=moc.utnubu|gatluap#moc.utnubu|gatluap
#DEBFULLNAME=Paul Tagliamonte
#DEBEMAIL=$(EMAIL)
#GPG_KEY=B7982329

DEB_DIST=maverick
DEB_PPA=ppa:paultag/testing

clone:
git clone git://git.fluxbox.org/fluxbox.git

clone-clean-integrate:
git clone git://pault.ag/nightly/fluxbox.git debian
mv debian $(ROOT)

echo-root:
@echo $(ROOT)

test:
make test

build:
./autogen.sh
./configure
make

dirty-integrate:
@echo "No dirty integration"

clean-integrate:
echo $(BUILD)
mv $(ROOT) $(ROOT)-$(FULL_ID)$(BUILD)
tar -zcvf $(ROOT)_$(FULL_ID)$(BUILD).orig.tar.gz $(ROOT)-$(FULL_ID)$(BUILD) —exclude=.git —exclude=.gitignore

cd $(ROOT)-$(FULL_ID)$(BUILD) && echo | dch —distribution $(DEB_DIST) —newversion $(FULL_ID)$(BUILD)-1 -b -m "Autobuild."

cd $(ROOT)-$(FULL_ID)$(BUILD) && dpkg-buildpackage -S -d -k$(GPG_KEY)

test-final-integration:
#You need a sudo exception like:
# tag ALL= NOPASSWD: /usr/sbin/pbuilder
# in the sudoers
sudo pbuilder build $(ROOT)_$(FULL_ID)$(BUILD)-1.dsc

migrate-integrations:
dput $(DEB_PPA) $(ROOT)_$(FULL_ID)$(BUILD)-1_source.changes