=head1 NAME

SettingUpBuildSystem - How to set-up a chrooted build system

=head1 create lenny base

	debootstrap lenny /var/tmp/let64 http://ftp.at.debian.org/debian/
	mount -o bind /proc /var/tmp/let64/proc
	chroot /var/tmp/let64 su -
	echo let64 > /etc/debian_chroot
	adduser b &&echo 'b ALL=(ALL)NOPASSWD: ALL' >> /etc/sudoers
	exit
	chroot /var/tmp/let64 su - b
	sudo apt-get install build-essential cowdancer dpkg-dev libapt-pkg-perl
	sudo apt-get install libyaml-perl libyaml-syck-perl libtext-diff-perl liblist-moreutils-perl
	sudo apt-get install libfile-slurp-perl libtest-exception-perl libtest-differences-perl
	sudo apt-get install libjson-xs-perl libmoose-perl libfile-chdir-perl
	sudo apt-get install libpath-class-perl libtest-deep-perl libreadonly-perl
	sudo apt-get install libfile-find-rule-perl libfile-homedir-perl libio-compress-bzip2-perl
	sudo apt-get install xvfb
	
	sudo cpan -i CPAN::Patches::Plugin::Debian Debian::Apt::PM
	
	sudo apt-get install debootstrap

	sudo chown b /var/cache/apt/apt-pm/*
	apt-pm update

	sudo chown b /var/lib/dh-make-pm
	
	cd /var/lib/cpan-patches/
	sudo rmdir set
	sudo git clone git://github.com/jozef/CPAN-Patches-Debian-Set.git set

	sudo bash -c 'echo "deb-src http://ftp.at.debian.org/debian testing main" >> /etc/apt/sources.list'
	sudo apt-get update
	
	cd /tmp
	svn co svn://cvs.alioth.debian.org/svn/pkg-perl/trunk/dh-make-perl
	cd dh-make-perl
	perl Build.PL && ./Build manifest && ./Build distmeta
	mkdir tmp
	git clone git://github.com/jozef/CPAN-Patches-Example-Set.git tmp/set
	cpan-patches --patch-set tmp/set/ patch
	sudo apt-get install libmodule-depends-perl libwww-mechanize-perl libfile-touch-perl
	sudo cpan -i Array::Unique Email::Date::Format autodie Module::CoreList File::DirCompare Text::Diff
	perl Build.PL && ./Build test && sudo ./Build install

=head2 create cowbuilder for sid

	sudo debootstrap squeeze /var/cache/pbuilder/base.cow
	sudo bash -c 'echo "deb file:///var/cache/pbuilder/result/ unstable/" >> /var/cache/pbuilder/base.cow/etc/apt/sources.list'
	sudo bash -c 'echo "deb file:///var/cache/pbuilder/result/ unstable/" >> /etc/apt/sources.list'
	cd /var/cache/pbuilder/result/
	sudo chown b .
	wget http://github.com/jozef/Debian-Apt-PM/raw/master/examples/repo/Makefile
	wget http://github.com/jozef/Debian-Apt-PM/raw/master/examples/repo/Release.conf
	mkdir unstable
	# generate a key without passphrase
	gpg --gen-key
	gpg --export --armor | sudo apt-key add -
	gpg --export --armor | sudo chroot /var/cache/pbuilder/base.cow/ apt-key add -
	make
	sudo apt-get update
	
	sudo chroot /var/cache/pbuilder/base.cow su -
	echo build > /etc/debian_choot
	echo "deb http://ftp.cz.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
	echo "deb http://ftp.cz.debian.org/debian/ sid main non-free contrib" >> /etc/apt/sources.list
	apt-get update
	apt-get install cowdancer
	exit
	
	sudo bash -c 'echo "BINDMOUNTS=/var/cache/pbuilder/result" >> /etc/pbuilderrc'
	sudo bash -c 'echo "PDEBUILD_PBUILDER=cowbuilder" >> /etc/pbuilderrc'
	sudo cowbuilder --update	

=cut
