summary refs log tree commit diff
path: root/pkgs/build-support/release
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-03-02 13:45:48 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-03-02 13:45:48 +0000
commit45081f330db56891e6e4f47bad295a371aac8651 (patch)
tree4f19ba528e7fbc504e68264db7315be31a702d44 /pkgs/build-support/release
parentf19aea6d5a94f930120894aefbe886d379c430eb (diff)
downloadnixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar.gz
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar.bz2
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar.lz
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar.xz
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.tar.zst
nixpkgs-45081f330db56891e6e4f47bad295a371aac8651.zip
* 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
Diffstat (limited to 'pkgs/build-support/release')
-rw-r--r--pkgs/build-support/release/debian-build.nix17
-rw-r--r--pkgs/build-support/release/default.nix8
-rw-r--r--pkgs/build-support/release/make-source-tarball.nix12
-rw-r--r--pkgs/build-support/release/nix-build.nix21
-rw-r--r--pkgs/build-support/release/rpm-build.nix17
5 files changed, 48 insertions, 27 deletions
diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix
index fad88a98f17..5144e3169e5 100644
--- a/pkgs/build-support/release/debian-build.nix
+++ b/pkgs/build-support/release/debian-build.nix
@@ -1,13 +1,14 @@
 # This function compiles a source tarball in a virtual machine image
 # 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 (
 
   {
-    name = "debian-build";
-
     doCheck = true;
 
     prefix = "/usr";
@@ -15,10 +16,12 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
     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
     postHook = ''
@@ -50,7 +53,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
 
     installCommand = ''
       export LOGNAME=root
-    
+
       ${checkinstall}/sbin/checkinstall -y -D make install
 
       ensureDir $out/debs
@@ -66,7 +69,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
     ''; # */
 
     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})";
     };
   }
 
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 58368bddf6b..130fae6e4bb 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -18,10 +18,12 @@ rec {
       doCoverageAnalysis = true;
     } // 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;} (
-    { inherit stdenv checkinstall;
+  debBuild = args: import ./debian-build.nix (
+    { inherit stdenv vmTools checkinstall;
     } // args);
 
 }
diff --git a/pkgs/build-support/release/make-source-tarball.nix b/pkgs/build-support/release/make-source-tarball.nix
index 806246db794..ccae6d612ab 100644
--- a/pkgs/build-support/release/make-source-tarball.nix
+++ b/pkgs/build-support/release/make-source-tarball.nix
@@ -4,6 +4,8 @@
 
 { officialRelease ? false
 , buildInputs ? []
+, name ? "source-tarball"
+, version ? "0"
 , src, stdenv, autoconf, automake, libtool
 , ... } @ args:
 
@@ -20,8 +22,6 @@ stdenv.mkDerivation (
 
   # First, attributes that can be overriden by the caller (via args):
   {
-    name = "source-tarball";
-
     # By default, only configure and build a source distribution.
     # Some packages can only build a distribution after a general
     # `make' (or even `make install').
@@ -43,6 +43,8 @@ stdenv.mkDerivation (
 
   # And finally, our own stuff.
   {
+    name = name + "-" + version + versionSuffix;
+
     src = src.path;
 
     buildInputs = buildInputs ++ [autoconf automake libtool];
@@ -96,12 +98,14 @@ stdenv.mkDerivation (
       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 {}) // {
       description = "Build of a source distribution from a checkout";
     };
-  
   }
 
 )
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index 5f127265d4a..142bd7bc362 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -8,13 +8,12 @@
 { doCoverageAnalysis ? false
 , lcovFilter ? []
 , src, stdenv
+, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
 , ... } @ args:
 
 stdenv.mkDerivation (
 
   {
-    name = "nix-build";
-
     # Also run a `make check'.
     doCheck = true;
 
@@ -24,13 +23,15 @@ stdenv.mkDerivation (
     showBuildStats = true;
 
     # 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 // 
 
   {
-    src = src.path;
+    name = name + "-" + src.version;
+  
+    src = if src ? outPath then src.outPath else src.path;
 
     postHook = ''
       ensureDir $out/nix-support
@@ -43,7 +44,7 @@ stdenv.mkDerivation (
       # 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
+      origSrc=$src
       if test -d $src/tarballs; then
           src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
       fi
@@ -85,6 +86,16 @@ stdenv.mkDerivation (
 
 
     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 {}) // {
diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix
index 88273b5958c..b094732f9b7 100644
--- a/pkgs/build-support/release/rpm-build.nix
+++ b/pkgs/build-support/release/rpm-build.nix
@@ -1,18 +1,19 @@
 # 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').
 
-vmTools: args: with args;
+{ name ? "rpm-build"
+, diskImage
+, src, vmTools
+, ... } @ args:
 
 vmTools.buildRPM (
 
-  {
-    name = "rpm-build";
-  }
-
-  // args //
+  removeAttrs args ["vmTools"] //
 
   {
-    src = src.path;
+    name = name + "-" + diskImage.name + "-" + src.version;
+
+    src = if src ? outPath then src.outPath else src.path;
 
     preBuild = ''
       ensureDir $out/nix-support
@@ -34,7 +35,7 @@ vmTools.buildRPM (
     ''; # */
 
     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})";
     };
   }