1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-05-11 15:07:03 +00:00

* Append the version to the "name" attribute to make the store paths

of Hydra builds more distinct (e.g. "patchelf-build-0.5pre1234"
  instead of just "patchelf-build").  If the version isn't known,
  append at least the revision.

* Propagate the release name of the source tarball to Nix builds.
  Useful to provide sensible package names in channels.

svn path=/nixpkgs/trunk/; revision=14294
This commit is contained in:
Eelco Dolstra 2009-03-02 13:45:48 +00:00
parent f19aea6d5a
commit 45081f330d
5 changed files with 48 additions and 27 deletions

View file

@ -1,13 +1,14 @@
# This function compiles a source tarball in a virtual machine image # This function compiles a source tarball in a virtual machine image
# that contains a Debian-like (i.e. dpkg-based) OS. # that contains a Debian-like (i.e. dpkg-based) OS.
{vmTools, fetchurl}: args: with args; { name ? "debian-build"
, diskImage
, src, stdenv, vmTools, checkinstall
, ... } @ args:
vmTools.runInLinuxImage (stdenv.mkDerivation ( vmTools.runInLinuxImage (stdenv.mkDerivation (
{ {
name = "debian-build";
doCheck = true; doCheck = true;
prefix = "/usr"; prefix = "/usr";
@ -15,10 +16,12 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
phases = "installExtraDebsPhase sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase"; phases = "installExtraDebsPhase sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
} }
// args // // removeAttrs args ["vmTools"] //
{ {
src = src.path; name = name + "-" + diskImage.name + "-" + src.version;
src = if src ? outPath then src.outPath else src.path;
# !!! cut&paste from rpm-build.nix # !!! cut&paste from rpm-build.nix
postHook = '' postHook = ''
@ -50,7 +53,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
installCommand = '' installCommand = ''
export LOGNAME=root export LOGNAME=root
${checkinstall}/sbin/checkinstall -y -D make install ${checkinstall}/sbin/checkinstall -y -D make install
ensureDir $out/debs ensureDir $out/debs
@ -66,7 +69,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
''; # */ ''; # */
meta = (if args ? meta then args.meta else {}) // { meta = (if args ? meta then args.meta else {}) // {
description = "Build of a Deb package on ${args.diskImage.fullName} (${args.diskImage.name})"; description = "Build of a Deb package on ${diskImage.fullName} (${diskImage.name})";
}; };
} }

View file

@ -18,10 +18,12 @@ rec {
doCoverageAnalysis = true; doCoverageAnalysis = true;
} // args); } // args);
rpmBuild = args: import ./rpm-build.nix vmTools args; rpmBuild = args: import ./rpm-build.nix (
{ inherit vmTools;
} // args);
debBuild = args: import ./debian-build.nix {inherit vmTools fetchurl;} ( debBuild = args: import ./debian-build.nix (
{ inherit stdenv checkinstall; { inherit stdenv vmTools checkinstall;
} // args); } // args);
} }

View file

@ -4,6 +4,8 @@
{ officialRelease ? false { officialRelease ? false
, buildInputs ? [] , buildInputs ? []
, name ? "source-tarball"
, version ? "0"
, src, stdenv, autoconf, automake, libtool , src, stdenv, autoconf, automake, libtool
, ... } @ args: , ... } @ args:
@ -20,8 +22,6 @@ stdenv.mkDerivation (
# First, attributes that can be overriden by the caller (via args): # First, attributes that can be overriden by the caller (via args):
{ {
name = "source-tarball";
# By default, only configure and build a source distribution. # By default, only configure and build a source distribution.
# Some packages can only build a distribution after a general # Some packages can only build a distribution after a general
# `make' (or even `make install'). # `make' (or even `make install').
@ -43,6 +43,8 @@ stdenv.mkDerivation (
# And finally, our own stuff. # And finally, our own stuff.
{ {
name = name + "-" + version + versionSuffix;
src = src.path; src = src.path;
buildInputs = buildInputs ++ [autoconf automake libtool]; buildInputs = buildInputs ++ [autoconf automake libtool];
@ -96,12 +98,14 @@ stdenv.mkDerivation (
test -n "$releaseName" && (echo "$releaseName" >> $out/nix-support/hydra-release-name) test -n "$releaseName" && (echo "$releaseName" >> $out/nix-support/hydra-release-name)
''; # */ ''; # */
passthru = {inherit src;}; passthru = {
inherit src;
version = version + versionSuffix;
};
meta = (if args ? meta then args.meta else {}) // { meta = (if args ? meta then args.meta else {}) // {
description = "Build of a source distribution from a checkout"; description = "Build of a source distribution from a checkout";
}; };
} }
) )

View file

@ -8,13 +8,12 @@
{ doCoverageAnalysis ? false { doCoverageAnalysis ? false
, lcovFilter ? [] , lcovFilter ? []
, src, stdenv , src, stdenv
, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
, ... } @ args: , ... } @ args:
stdenv.mkDerivation ( stdenv.mkDerivation (
{ {
name = "nix-build";
# Also run a `make check'. # Also run a `make check'.
doCheck = true; doCheck = true;
@ -24,13 +23,15 @@ stdenv.mkDerivation (
showBuildStats = true; showBuildStats = true;
# Hack - swap checkPhase and installPhase (otherwise Stratego barfs). # Hack - swap checkPhase and installPhase (otherwise Stratego barfs).
phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase ${if doCoverageAnalysis then "coverageReportPhase" else ""}"; phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase ${if doCoverageAnalysis then "coverageReportPhase" else ""} finalPhase";
} }
// args // // args //
{ {
src = src.path; name = name + "-" + src.version;
src = if src ? outPath then src.outPath else src.path;
postHook = '' postHook = ''
ensureDir $out/nix-support ensureDir $out/nix-support
@ -43,7 +44,7 @@ stdenv.mkDerivation (
# If `src' is the result of a call to `makeSourceTarball', then it # If `src' is the result of a call to `makeSourceTarball', then it
# has a subdirectory containing the actual tarball(s). If there are # has a subdirectory containing the actual tarball(s). If there are
# multiple tarballs, just pick the first one. # multiple tarballs, just pick the first one.
echo $src origSrc=$src
if test -d $src/tarballs; then if test -d $src/tarballs; then
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1) src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
fi fi
@ -85,6 +86,16 @@ stdenv.mkDerivation (
lcovFilter = ["/nix/store/*"] ++ lcovFilter; lcovFilter = ["/nix/store/*"] ++ lcovFilter;
finalPhase =
''
# Propagate the release name of the source tarball. This is
# to get nice package names in channels.
if test -e $origSrc/nix-support/hydra-release-name; then
cp $origSrc/nix-support/hydra-release-name $out/nix-support/hydra-release-name
fi
'';
meta = (if args ? meta then args.meta else {}) // { meta = (if args ? meta then args.meta else {}) // {

View file

@ -1,18 +1,19 @@
# This function builds an RPM from a source tarball that contains a # This function builds an RPM from a source tarball that contains a
# RPM spec file (i.e., one that can be built using `rpmbuild -ta'). # RPM spec file (i.e., one that can be built using `rpmbuild -ta').
vmTools: args: with args; { name ? "rpm-build"
, diskImage
, src, vmTools
, ... } @ args:
vmTools.buildRPM ( vmTools.buildRPM (
{ removeAttrs args ["vmTools"] //
name = "rpm-build";
}
// args //
{ {
src = src.path; name = name + "-" + diskImage.name + "-" + src.version;
src = if src ? outPath then src.outPath else src.path;
preBuild = '' preBuild = ''
ensureDir $out/nix-support ensureDir $out/nix-support
@ -34,7 +35,7 @@ vmTools.buildRPM (
''; # */ ''; # */
meta = (if args ? meta then args.meta else {}) // { meta = (if args ? meta then args.meta else {}) // {
description = "Build of an RPM package on ${args.diskImage.fullName} (${args.diskImage.name})"; description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
}; };
} }