<commit_before>#!/bin/bash
set -x
set -e

BUILD_VCS_NUMBER=$(bzr revision-info | sed "s/\([0-9]*\) .*/\1/")
TEAMCITY=${TEAMCITY:-0}
PUBLISH=${PUBLISH:-0}
rev=${BUILD_VCS_NUMBER:-1000}

rpm_env()
{
	sudo /usr/sbin/groupadd --force mockbuild
	sudo /usr/sbin/useradd -g mockbuild mockbuild || echo "Could not create user mockbuild, user may already exist"
}


# prepare source tarballs for rpm build to consume
tarball()
{
	local name=cserver
	local randir=/tmp/${RANDOM}
	local cdir=${randir}/${name}
	rm -rf ${cdir} rpmbuild ../target ${name}.tar.gz
	mkdir -p ${cdir}
	cp -r ../*        ${cdir}
	find ${cdir} -name .svn | xargs rm -rf
	tar -C ${randir} -cf ${name}.tar . 
	gzip ${name}.tar
	mkdir -p rpmbuild/{BUILD,SOURCES,SRPMS,RPMS/noarch}
	mv ${name}.tar.gz rpmbuild/SOURCES
	rm -rf ${randir}
	cat akiban-server.spec        | sed "s/REVISION/${rev}/g" > akiban-server-${rev}.spec 
}


# create chunkserver rpm
chunkserver_rpm()
{
	rpmbuild --target=noarch --define "_topdir ${PWD}/rpmbuild"   -ba akiban-server-${rev}.spec 
}

#update the yum repository
publish()
{
if [ ${PUBLISH} -gt 0 ];then
	ssh skeswani@172.16.20.117  " mkdir -p /var/www/rpms/${rev}"
	scp -r rpmbuild/RPMS/noarch/*.rpm   skeswani@172.16.20.117:/var/www/rpms/${rev}
	ssh skeswani@172.16.20.117 "rm -f /var/www/latest/* && ln -sf /var/www/rpms/${rev}/* /var/www/latest/"
	ssh skeswani@172.16.20.117 /var/www/rpms/createrepo.sh
fi
}

rpm_env
tarball<commit_msg>Update publish script to push to cserver directory.<commit_after>#!/bin/bash
set -x
set -e

BUILD_VCS_NUMBER=$(bzr revision-info | sed "s/\([0-9]*\) .*/\1/")
TEAMCITY=${TEAMCITY:-0}
PUBLISH=${PUBLISH:-0}
rev=${BUILD_VCS_NUMBER:-1000}

rpm_env()
{
	sudo /usr/sbin/groupadd --force mockbuild
	sudo /usr/sbin/useradd -g mockbuild mockbuild || echo "Could not create user mockbuild, user may already exist"
}


# prepare source tarballs for rpm build to consume
tarball()
{
	local name=cserver
	local randir=/tmp/${RANDOM}
	local cdir=${randir}/${name}
	rm -rf ${cdir} rpmbuild ../target ${name}.tar.gz
	mkdir -p ${cdir}
	cp -r ../*        ${cdir}
	find ${cdir} -name .svn | xargs rm -rf
	tar -C ${randir} -cf ${name}.tar . 
	gzip ${name}.tar
	mkdir -p rpmbuild/{BUILD,SOURCES,SRPMS,RPMS/noarch}
	mv ${name}.tar.gz rpmbuild/SOURCES
	rm -rf ${randir}
	cat akiban-server.spec        | sed "s/REVISION/${rev}/g" > akiban-server-${rev}.spec 
}


# create chunkserver rpm
chunkserver_rpm()
{
	rpmbuild --target=noarch --define "_topdir ${PWD}/rpmbuild"   -ba akiban-server-${rev}.spec 
}

#update the yum repository
publish()
{
if [ ${PUBLISH} -gt 0 ];then
	ssh skeswani@172.16.20.117  " mkdir -p /var/www/rpms/akiban-server/${rev}"
	scp -r rpmbuild/RPMS/noarch/*.rpm   skeswani@172.16.20.117:/var/www/rpms/akiban-server/${rev}
	ssh skeswani@172.16.20.117 "rm -f /var/www/latest/* && ln -sf /var/www/rpms/akiban-server/${rev}/* /var/www/latest/"
	ssh skeswani@172.16.20.117 /var/www/rpms/createrepo.sh
fi
}

rpm_env
tarball
{'fraction_non_alphanumeric': 0.18690637720488468, 'fraction_numerical': 0.033921302578018994, 'mean_word_length': 3.502290076335878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3555379', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1227, 'n_words': 272}