2008-11-25 01:20:51 +01:00
|
|
|
# This function compiles a source tarball in a virtual machine image
|
2008-11-25 03:26:54 +01:00
|
|
|
# that contains a Debian-like (i.e. dpkg-based) OS.
|
2008-11-25 01:20:51 +01:00
|
|
|
|
2009-03-02 14:45:48 +01:00
|
|
|
{ name ? "debian-build"
|
|
|
|
, diskImage
|
|
|
|
, src, stdenv, vmTools, checkinstall
|
|
|
|
, ... } @ args:
|
2008-11-25 01:20:51 +01:00
|
|
|
|
|
|
|
vmTools.runInLinuxImage (stdenv.mkDerivation (
|
|
|
|
|
|
|
|
{
|
|
|
|
doCheck = true;
|
|
|
|
|
2008-11-25 03:20:41 +01:00
|
|
|
prefix = "/usr";
|
2008-11-25 01:20:51 +01:00
|
|
|
|
2009-03-26 15:11:59 +01:00
|
|
|
prePhases = "installExtraDebsPhase sysInfoPhase";
|
2008-11-25 01:20:51 +01:00
|
|
|
}
|
|
|
|
|
2009-03-02 14:45:48 +01:00
|
|
|
// removeAttrs args ["vmTools"] //
|
2008-11-25 01:20:51 +01:00
|
|
|
|
|
|
|
{
|
2009-03-02 15:33:33 +01:00
|
|
|
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
2009-03-02 14:45:48 +01:00
|
|
|
|
2008-11-25 01:20:51 +01:00
|
|
|
# !!! cut&paste from rpm-build.nix
|
|
|
|
postHook = ''
|
|
|
|
ensureDir $out/nix-support
|
|
|
|
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
|
|
|
|
|
|
|
|
# If `src' is the result of a call to `makeSourceTarball', then it
|
|
|
|
# has a subdirectory containing the actual tarball(s). If there are
|
|
|
|
# multiple tarballs, just pick the first one.
|
|
|
|
echo $src
|
|
|
|
if test -d $src/tarballs; then
|
|
|
|
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
|
|
|
fi
|
|
|
|
''; # */
|
|
|
|
|
2008-11-25 03:20:41 +01:00
|
|
|
installExtraDebsPhase = ''
|
|
|
|
for i in $extraDebs; do
|
|
|
|
dpkg --install $i
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2008-11-25 01:20:51 +01:00
|
|
|
sysInfoPhase = ''
|
|
|
|
echo "System/kernel: $(uname -a)"
|
|
|
|
if test -e /etc/debian_version; then echo "Debian release: $(cat /etc/debian_version)"; fi
|
|
|
|
header "installed Debian packages"
|
|
|
|
dpkg-query --list
|
|
|
|
stopNest
|
|
|
|
'';
|
|
|
|
|
2008-11-25 03:20:41 +01:00
|
|
|
installCommand = ''
|
2008-12-10 18:12:19 +01:00
|
|
|
export LOGNAME=root
|
2009-03-02 14:45:48 +01:00
|
|
|
|
2009-03-27 15:13:49 +01:00
|
|
|
${checkinstall}/sbin/checkinstall --nodoc -y -D make install
|
2008-11-25 03:20:41 +01:00
|
|
|
|
|
|
|
ensureDir $out/debs
|
|
|
|
find . -name "*.deb" -exec cp {} $out/debs \;
|
|
|
|
|
|
|
|
for i in $out/debs/*.deb; do
|
|
|
|
header "Generated DEB package: $i"
|
2009-03-26 16:45:37 +01:00
|
|
|
dpkg-deb --info "$i"
|
|
|
|
pkgName=$(dpkg-deb -W "$i" | awk '{print $1}')
|
|
|
|
dpkg -i "$i"
|
|
|
|
dpkg -r "$pkgName"
|
2008-11-25 03:20:41 +01:00
|
|
|
echo "file deb $i" >> $out/nix-support/hydra-build-products
|
|
|
|
stopNest
|
|
|
|
done
|
|
|
|
''; # */
|
|
|
|
|
2008-11-26 15:34:29 +01:00
|
|
|
meta = (if args ? meta then args.meta else {}) // {
|
2009-03-02 14:45:48 +01:00
|
|
|
description = "Build of a Deb package on ${diskImage.fullName} (${diskImage.name})";
|
2008-11-25 01:20:51 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
))
|