about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-03-01 09:22:21 +0100
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-03-01 09:22:21 +0100
commit205e0fc5bd49dcd21c14083246610f608e7b50c6 (patch)
treeb3c621ab8ea0f89f5dc4ea8c4bae5b8e7fbc90cf /pkgs/build-support
parent6d61a0b312f9277debf88a9f85feef5fd313f3d4 (diff)
parent3c77acbcd50156d300011e7a826dfcd41403e3f3 (diff)
downloadnixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar.gz
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar.bz2
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar.lz
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar.xz
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.tar.zst
nixlib-205e0fc5bd49dcd21c14083246610f608e7b50c6.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/docker/default.nix7
-rw-r--r--pkgs/build-support/nix-prefetch-github/default.nix4
-rw-r--r--pkgs/build-support/release/ant-build.nix2
-rw-r--r--pkgs/build-support/rust/build-rust-crate/configure-crate.nix2
-rw-r--r--pkgs/build-support/rust/build-rust-crate/default.nix3
-rw-r--r--pkgs/build-support/singularity-tools/default.nix3
-rw-r--r--pkgs/build-support/skaware/build-skaware-package.nix36
-rw-r--r--pkgs/build-support/skaware/clean-packaging.nix53
-rw-r--r--pkgs/build-support/trivial-builders.nix14
-rw-r--r--pkgs/build-support/vm/windows/controller/default.nix3
10 files changed, 81 insertions, 46 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index 4b20c5624607..011ff3685093 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -23,7 +23,8 @@
   writeScript,
   writeText,
   closureInfo,
-  substituteAll
+  substituteAll,
+  runtimeShell
 }:
 
 # WARNING: this API is unstable and may be subject to backwards-incompatible changes in the future.
@@ -119,7 +120,7 @@ rec {
     export PATH=${shadow}/bin:$PATH
     mkdir -p /etc/pam.d
     if [[ ! -f /etc/passwd ]]; then
-      echo "root:x:0:0::/root:${stdenv.shell}" > /etc/passwd
+      echo "root:x:0:0::/root:${runtimeShell}" > /etc/passwd
       echo "root:!x:::::::" > /etc/shadow
     fi
     if [[ ! -f /etc/group ]]; then
@@ -261,7 +262,7 @@ rec {
   # things like `ls` or `echo` will be missing.
   shellScript = name: text:
     writeScript name ''
-      #!${stdenv.shell}
+      #!${runtimeShell}
       set -e
       export PATH=${coreutils}/bin:/bin
       ${text}
diff --git a/pkgs/build-support/nix-prefetch-github/default.nix b/pkgs/build-support/nix-prefetch-github/default.nix
index 0c9722bb0b66..acc95eaf993f 100644
--- a/pkgs/build-support/nix-prefetch-github/default.nix
+++ b/pkgs/build-support/nix-prefetch-github/default.nix
@@ -5,13 +5,13 @@
 
 python3.pkgs.buildPythonApplication rec {
   pname = "nix-prefetch-github";
-  version = "2.1";
+  version = "2.2";
 
   src = fetchFromGitHub {
     owner = "seppeljordan";
     repo = "nix-prefetch-github";
     rev = "v${version}";
-    sha256 = "1v4w7xs8wxgl36vb2cnyj219mqvximkvvw46h4fp25vi2g3f9h8d";
+    sha256 = "1m1d1fzacvwprfvhxih1hzr1m0y1jjxiznf8p8b3bi5a41yzvrrl";
   };
 
   propagatedBuildInputs = with python3.pkgs; [
diff --git a/pkgs/build-support/release/ant-build.nix b/pkgs/build-support/release/ant-build.nix
index 5ab24132290a..2d24d5bd7041 100644
--- a/pkgs/build-support/release/ant-build.nix
+++ b/pkgs/build-support/release/ant-build.nix
@@ -69,7 +69,7 @@ stdenv.mkDerivation (
 
       mkdir -p $out/bin
       cat >> $out/bin/${w.name} <<EOF
-      #!${stdenv.shell}
+      #!${pkgs.runtimeShell}
       export JAVA_HOME=$jre
       $jre/bin/java ${cp w} ${if w ? mainClass then w.mainClass else "-jar ${w.jar}"} \$@
       EOF
diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
index 700dff8499f9..9f499e4f5e72 100644
--- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
+++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
@@ -5,6 +5,7 @@
 , completeBuildDeps
 , completeDeps
 , crateAuthors
+, crateDescription
 , crateFeatures
 , crateName
 , crateVersion
@@ -69,6 +70,7 @@ in ''
   export CARGO_PKG_NAME=${crateName}
   export CARGO_PKG_VERSION=${crateVersion}
   export CARGO_PKG_AUTHORS="${authors}"
+  export CARGO_PKG_DESCRIPTION="${crateDescription}"
 
   export CARGO_CFG_TARGET_ARCH=${stdenv.hostPlatform.parsed.cpu.name}
   export CARGO_CFG_TARGET_OS=${target_os}
diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix
index fd7b6ec7ddaf..81e8a7ca0afa 100644
--- a/pkgs/build-support/rust/build-rust-crate/default.nix
+++ b/pkgs/build-support/rust/build-rust-crate/default.nix
@@ -129,6 +129,7 @@ stdenv.mkDerivation (rec {
     build = crate.build or "";
     workspace_member = crate.workspace_member or ".";
     crateVersion = crate.version;
+    crateDescription = crate.description or "";
     crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [];
     crateType =
       if lib.attrByPath ["procMacro"] false crate then ["proc-macro"] else
@@ -140,7 +141,7 @@ stdenv.mkDerivation (rec {
     extraRustcOpts = (if crate ? extraRustcOpts then crate.extraRustcOpts else []) ++ extraRustcOpts_ ++ (lib.optional (edition != null) "--edition ${edition}");
 
     configurePhase = configureCrate {
-      inherit crateName buildDependencies completeDeps completeBuildDeps
+      inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription
               crateFeatures libName build workspace_member release libPath crateVersion
               extraLinkFlags extraRustcOpts
               crateAuthors verbose colors target_os;
diff --git a/pkgs/build-support/singularity-tools/default.nix b/pkgs/build-support/singularity-tools/default.nix
index 4206b0f33ff9..3fc10c8b0b4b 100644
--- a/pkgs/build-support/singularity-tools/default.nix
+++ b/pkgs/build-support/singularity-tools/default.nix
@@ -8,12 +8,13 @@
 , vmTools
 , gawk
 , utillinux
+, runtimeShell
 , e2fsprogs }:
 
 rec {
   shellScript = name: text:
     writeScript name ''
-      #!${stdenv.shell}
+      #!${runtimeShell}
       set -e
       ${text}
     '';
diff --git a/pkgs/build-support/skaware/build-skaware-package.nix b/pkgs/build-support/skaware/build-skaware-package.nix
index 5ae8985e3abe..e4712a5ef22c 100644
--- a/pkgs/build-support/skaware/build-skaware-package.nix
+++ b/pkgs/build-support/skaware/build-skaware-package.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, writeScript, file }:
+{ stdenv, callPackage, cleanPackaging, fetchurl, writeScript, file }:
 let lib = stdenv.lib;
 in {
   # : string
@@ -54,25 +54,6 @@ let
     "README.*"
   ];
 
-  globWith = stdenv.lib.concatMapStringsSep "\n";
-  rmNoise = globWith (f:
-    ''rm -rf ${f}'') commonNoiseFiles;
-  mvMeta = globWith
-    (f: ''mv ${f} "$DOCDIR" 2>/dev/null || true'')
-    commonMetaFiles;
-
-  # Move & remove actions, taking the package doc directory
-  commonFileActions = writeScript "common-file-actions.sh" ''
-    #!${stdenv.shell}
-    set -e
-    DOCDIR="$1"
-    shopt -s globstar extglob nullglob
-    ${rmNoise}
-    mkdir -p "$DOCDIR"
-    ${mvMeta}
-  '';
-
-
 in stdenv.mkDerivation {
   name = "${pname}-${version}";
 
@@ -105,21 +86,16 @@ in stdenv.mkDerivation {
   # TODO(Profpatsch): ensure that there is always a $doc output!
   postInstall = ''
     echo "Cleaning & moving common files"
-    mkdir -p $doc/share/doc/${pname}
-    ${commonFileActions} $doc/share/doc/${pname}
+    ${cleanPackaging.commonFileActions {
+       noiseFiles = commonNoiseFiles;
+       docFiles = commonMetaFiles;
+     }} $doc/share/doc/${pname}
 
     ${postInstall}
   '';
 
   postFixup = ''
-    echo "Checking for remaining source files"
-    rem=$(find -mindepth 1 -xtype f -print0 \
-           | tee $TMP/remaining-files)
-    if [[ "$rem" != "" ]]; then
-      echo "ERROR: These files should be either moved or deleted:"
-      cat $TMP/remaining-files | xargs -0 ${file}/bin/file
-      exit 1
-    fi
+    ${cleanPackaging.checkForRemainingFiles}
   '';
 
   meta = {
diff --git a/pkgs/build-support/skaware/clean-packaging.nix b/pkgs/build-support/skaware/clean-packaging.nix
new file mode 100644
index 000000000000..16bae04b21e2
--- /dev/null
+++ b/pkgs/build-support/skaware/clean-packaging.nix
@@ -0,0 +1,53 @@
+# set of utilities that assure the cwd of a build
+# is completely clean after the build, meaning all
+# files were either discarded or moved to outputs.
+# This ensures nothing is forgotten and new files
+# are correctly handled on update.
+{ stdenv, file, writeScript }:
+
+let
+  globWith = stdenv.lib.concatMapStringsSep "\n";
+  rmNoise = noiseGlobs: globWith (f:
+    ''rm -rf ${f}'') noiseGlobs;
+  mvDoc = docGlobs: globWith
+    (f: ''mv ${f} "$DOCDIR" 2>/dev/null || true'')
+    docGlobs;
+
+  # Shell script that implements common move & remove actions
+  # $1 is the doc directory (will be created).
+  # Best used in conjunction with checkForRemainingFiles
+  commonFileActions =
+    { # list of fileglobs that are removed from the source dir
+      noiseFiles
+      # files that are moved to the doc directory ($1)
+      # TODO(Profpatsch): allow to set target dir with
+      # { glob = …; to = "html" } (relative to docdir)
+    , docFiles }:
+    writeScript "common-file-actions.sh" ''
+      #!${stdenv.shell}
+      set -e
+      DOCDIR="$1"
+      shopt -s globstar extglob nullglob
+      ${rmNoise noiseFiles}
+      mkdir -p "$DOCDIR"
+      ${mvDoc docFiles}
+    '';
+
+  # Shell script to check whether the build directory is empty.
+  # If there are still files remaining, exit 1 with a helpful
+  # listing of all remaining files and their types.
+  checkForRemainingFiles = writeScript "check-for-remaining-files.sh" ''
+    #!${stdenv.shell}
+    echo "Checking for remaining source files"
+    rem=$(find -mindepth 1 -xtype f -print0 \
+           | tee $TMP/remaining-files)
+    if [[ "$rem" != "" ]]; then
+      echo "ERROR: These files should be either moved or deleted:"
+      cat $TMP/remaining-files | xargs -0 ${file}/bin/file
+      exit 1
+    fi
+  '';
+
+in {
+  inherit commonFileActions checkForRemainingFiles;
+}
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix
index 454ef8912b3b..58bc7147ede4 100644
--- a/pkgs/build-support/trivial-builders.nix
+++ b/pkgs/build-support/trivial-builders.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, stdenvNoCC, lndir }:
+{ lib, stdenv, stdenvNoCC, lndir, runtimeShell }:
 
 let
 
@@ -15,12 +15,12 @@ rec {
   /* Run the shell command `buildCommand' to produce a store path named
   * `name'.  The attributes in `env' are added to the environment
   * prior to running the command. By default `runCommand' runs using
-  * stdenv with no compiler environment. `runCommandCC` 
+  * stdenv with no compiler environment. `runCommandCC`
   *
   * Examples:
   * runCommand "name" {envVariable = true;} ''echo hello''
   * runCommandNoCC "name" {envVariable = true;} ''echo hello'' # equivalent to prior
-  * runCommandCC "name" {} ''gcc -o myfile myfile.c; cp myfile $out''; 
+  * runCommandCC "name" {} ''gcc -o myfile myfile.c; cp myfile $out'';
   */
   runCommand = runCommandNoCC;
   runCommandNoCC = runCommand' stdenvNoCC;
@@ -145,11 +145,11 @@ rec {
       executable = true;
       destination = "/bin/${name}";
       text = ''
-        #!${stdenv.shell}
+        #!${runtimeShell}
         ${text}
         '';
       checkPhase = ''
-        ${stdenv.shell} -n $out/bin/${name}
+        ${runtimeShell} -n $out/bin/${name}
       '';
     };
 
@@ -215,7 +215,7 @@ rec {
    * myhellohook = makeSetupHook { deps = [ hello ]; } ./myscript.sh;
    *
    * # wrotes a setup hook where @bash@ myscript.sh is substituted for the
-   * # bash interpreter. 
+   * # bash interpreter.
    * myhellohookSub = makeSetupHook {
    *                 deps = [ hello ];
    *                 substitutions = { bash = "${pkgs.bash}/bin/bash"; };
@@ -278,7 +278,7 @@ rec {
    * packages that cannot be built automatically.
    *
    * Examples:
-   * 
+   *
    * requireFile {
    *   name = "my-file";
    *   url = "http://example.com/download/";
diff --git a/pkgs/build-support/vm/windows/controller/default.nix b/pkgs/build-support/vm/windows/controller/default.nix
index e000308bed8f..08b93aaf1174 100644
--- a/pkgs/build-support/vm/windows/controller/default.nix
+++ b/pkgs/build-support/vm/windows/controller/default.nix
@@ -1,5 +1,6 @@
 { stdenv, writeScript, vmTools, makeInitrd
 , samba, vde2, openssh, socat, netcat-gnu, coreutils, gnugrep, gzip
+, runtimeShell
 }:
 
 { sshKey
@@ -74,7 +75,7 @@ let
   loopForever = "while :; do ${coreutils}/bin/sleep 1; done";
 
   initScript = writeScript "init.sh" (''
-    #!${stdenv.shell}
+    #!${runtimeShell}
     ${coreutils}/bin/cp -L "${sshKey}" /ssh.key
     ${coreutils}/bin/chmod 600 /ssh.key
   '' + (if installMode then ''