* Automatically build Debian packages using checkinstall, as suggested

by Pjotr Prins a while back.  This could also be used to generate
  RPMs for packages that don't have a spec-file.

* Added checkinstall to Nixpkgs.  However we don't use our own build
  yet because with it "make install" segfaults in a Debian VM, while
  the pre-built binary does work.

svn path=/nixpkgs/trunk/; revision=13400
This commit is contained in:
Eelco Dolstra 2008-11-25 02:20:41 +00:00
parent da8bcbd9a5
commit c90bd0756c
5 changed files with 64 additions and 5 deletions

View file

@ -3,7 +3,7 @@
# just for portability testing: it doesn't produce any Debian
# packages.
vmTools: args: with args;
{vmTools, fetchurl}: args: with args;
vmTools.runInLinuxImage (stdenv.mkDerivation (
@ -12,10 +12,9 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
doCheck = true;
# Don't install the result in the Nix store.
useTempPrefix = true;
prefix = "/usr";
phases = "sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
phases = "installExtraDebsPhase sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
}
// args //
@ -37,6 +36,19 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
fi
''; # */
extraDebs = [
(fetchurl {
url = http://checkinstall.izto.org/files/deb/checkinstall_1.6.1-1_i386.deb;
sha256 = "0c9wwk1m0w677gr37zd4lhvkskkcrwa0bk7csh7b3qy94pnab618";
})
];
installExtraDebsPhase = ''
for i in $extraDebs; do
dpkg --install $i
done
'';
sysInfoPhase = ''
echo "System/kernel: $(uname -a)"
if test -e /etc/debian_version; then echo "Debian release: $(cat /etc/debian_version)"; fi
@ -45,6 +57,21 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
stopNest
'';
installCommand = ''
/usr/local/sbin/checkinstall -y -D make install
ensureDir $out/debs
find . -name "*.deb" -exec cp {} $out/debs \;
shopt -s nullglob
for i in $out/debs/*.deb; do
header "Generated DEB package: $i"
dpkg-deb --info $i
echo "file deb $i" >> $out/nix-support/hydra-build-products
stopNest
done
''; # */
meta = {
description = "Test build on ${args.diskImage.fullName} (${args.diskImage.name})";
};

View file

@ -19,7 +19,7 @@ rec {
rpmBuild = args: import ./rpm-build.nix vmTools args;
debBuild = args: import ./debian-build.nix vmTools (
debBuild = args: import ./debian-build.nix {inherit vmTools fetchurl;} (
{ inherit stdenv;
} // args);

View file

@ -863,6 +863,10 @@ rec {
"patch"
"diff"
"locales"
# Needed by checkinstall:
"util-linux"
"file"
"dpkg-dev"
];

View file

@ -0,0 +1,24 @@
{stdenv, fetchurl, gettext}:
stdenv.mkDerivation {
name = "checkinstall-1.6.1";
src = fetchurl {
url = http://checkinstall.izto.org/files/source/checkinstall-1.6.1.tgz;
sha256 = "0p6gbbnk4hjwkmv8dr7c4v5wpdnanczavi7yiiivvf45zyfl8lil";
};
buildInputs = [gettext];
preBuild = ''
makeFlagsArray=(PREFIX=$out)
substituteInPlace checkinstall --replace /usr/local/lib/checkinstall $out/lib/checkinstall
substituteInPlace checkinstallrc-dist --replace /usr/local $out
'';
meta = {
homepage = http://checkinstall.izto.org/;
description = "A tool for automatically generating Slackware, RPM or Debian packages when doing `make install'";
};
}

View file

@ -572,6 +572,10 @@ let
inherit fetchurl stdenv cmake libcap zlib bzip2;
};
checkinstall = import ../tools/package-management/checkinstall {
inherit fetchurl stdenv gettext;
};
cheetahTemplate = builderDefsPackage (selectVersion ../tools/text/cheetah-template "2.0.1") {
inherit makeWrapper python;
};