summary refs log tree commit diff
path: root/pkgs/build-support/release
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-11-25 00:20:51 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-11-25 00:20:51 +0000
commitda8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c (patch)
tree9a9f053f4b0c78fc4f040c93caf7b8d7c0d532a8 /pkgs/build-support/release
parent044c4dfe9ff78fed5dd5ea50a0b1167e61c834e7 (diff)
downloadnixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar.gz
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar.bz2
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar.lz
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar.xz
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.tar.zst
nixpkgs-da8bcbd9a589a3b7ab4b36551337b68ff4f4ca0c.zip
* Moved more stuff from the release tree.
svn path=/nixpkgs/trunk/; revision=13395
Diffstat (limited to 'pkgs/build-support/release')
-rw-r--r--pkgs/build-support/release/debian-build.nix53
-rw-r--r--pkgs/build-support/release/default.nix8
-rw-r--r--pkgs/build-support/release/rpm-build.nix41
3 files changed, 101 insertions, 1 deletions
diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix
new file mode 100644
index 00000000000..96efd1913cc
--- /dev/null
+++ b/pkgs/build-support/release/debian-build.nix
@@ -0,0 +1,53 @@
+# This function compiles a source tarball in a virtual machine image
+# that contains a Debian-like (i.e. dpkg-based) OS.  Currently this is
+# just for portability testing: it doesn't produce any Debian
+# packages.
+
+vmTools: args: with args;
+
+vmTools.runInLinuxImage (stdenv.mkDerivation (
+
+  {
+    name = "debian-build";
+
+    doCheck = true;
+
+    # Don't install the result in the Nix store.
+    useTempPrefix = true;
+
+    phases = "sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
+  }
+
+  // args //
+
+  {
+    src = src.path;
+  
+    # !!! 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
+    ''; # */
+
+    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
+    '';
+
+    meta = {
+      description = "Test build on ${args.diskImage.fullName} (${args.diskImage.name})";
+    };
+  }
+
+))
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 6156dd2933a..dd46164d9f2 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -17,4 +17,10 @@ rec {
       doCoverageAnalysis = true;
     } // args);
 
-}
\ No newline at end of file
+  rpmBuild = args: import ./rpm-build.nix vmTools args;
+
+  debBuild = args: import ./debian-build.nix vmTools (
+    { inherit stdenv;
+    } // args);
+
+}
diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix
new file mode 100644
index 00000000000..b9e0d7c508c
--- /dev/null
+++ b/pkgs/build-support/release/rpm-build.nix
@@ -0,0 +1,41 @@
+# 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;
+
+vmTools.buildRPM (
+
+  {
+    name = "rpm-build";
+  }
+
+  // args //
+
+  {
+    src = src.path;
+
+    preBuild = ''
+      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.
+      if test -d $src/tarballs; then
+          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
+      fi
+    ''; # */
+
+    postInstall = ''
+      shopt -s nullglob
+      for i in $out/rpms/*/*.rpm; do
+        echo "file rpm $i" >> $out/nix-support/hydra-build-products
+      done
+    ''; # */
+
+    meta = {
+      description = "Build of an RPM package on ${args.diskImage.fullName} (${args.diskImage.name})";
+    };
+  }
+
+)