Skip to content

Commit

Permalink
Merge pull request #23748 from joachifm/use-remove-references-to
Browse files Browse the repository at this point in the history
Use removeReferencesTo
  • Loading branch information
joachifm authored Mar 12, 2017
2 parents 90be8a7 + d082a29 commit 6fce6c9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 29 deletions.
11 changes: 3 additions & 8 deletions pkgs/applications/networking/cluster/kubernetes/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, which, go, go-bindata, makeWrapper, rsync
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, which, go, go-bindata, makeWrapper, rsync
, iptables, coreutils
, components ? [
"cmd/kubeadm"
Expand Down Expand Up @@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
sha256 = "1ps9bn5gqknyjv0b9jvp7xg3cyd4anq11j785p22347al0b8w81v";
};

buildInputs = [ makeWrapper which go rsync go-bindata ];
buildInputs = [ removeReferencesTo makeWrapper which go rsync go-bindata ];

outputs = ["out" "man" "pause"];

Expand Down Expand Up @@ -59,12 +59,7 @@ stdenv.mkDerivation rec {
'';

preFixup = ''
# Remove references to go compiler
while read file; do
cat $file | sed "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" > $file.tmp
mv $file.tmp $file
chmod +x $file
done < <(find $out/bin $pause/bin -type f 2>/dev/null)
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
'';

meta = {
Expand Down
9 changes: 3 additions & 6 deletions pkgs/applications/virtualization/containerd/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub
{ stdenv, lib, fetchFromGitHub, removeReferencesTo
, go, libapparmor, apparmor-parser, libseccomp }:

with lib;
Expand All @@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
sha256 = "16p8kixhzdx8afpciyf3fjx43xa3qrqpx06r5aqxdrqviw851zh8";
};

buildInputs = [ go ];
buildInputs = [ removeReferencesTo go ];

preBuild = ''
ln -s $(pwd) vendor/src/github.com/docker/containerd
Expand All @@ -26,10 +26,7 @@ stdenv.mkDerivation rec {
'';

preFixup = ''
# remove references to go compiler
while read file; do
sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
done < <(find $out/bin -type f 2>/dev/null)
find $out -type f -exec remove-references-to -t ${go} '{}' +
'';

meta = {
Expand Down
13 changes: 4 additions & 9 deletions pkgs/applications/virtualization/docker/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, lib, fetchFromGitHub, makeWrapper, pkgconfig, go-md2man
, go, containerd, runc, docker-proxy, tini
{ stdenv, lib, fetchFromGitHub, makeWrapper, removeReferencesTo, pkgconfig
, go-md2man, go, containerd, runc, docker-proxy, tini
, sqlite, iproute, bridge-utils, devicemapper, systemd
, btrfs-progs, iptables, e2fsprogs, xz, utillinux, xfsprogs
, procps
Expand Down Expand Up @@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
});

buildInputs = [
makeWrapper pkgconfig go-md2man go
makeWrapper removeReferencesTo pkgconfig go-md2man go
sqlite devicemapper btrfs-progs systemd
];

Expand Down Expand Up @@ -126,12 +126,7 @@ stdenv.mkDerivation rec {
'';

preFixup = ''
# remove references to go compiler, gcc and glibc
while read file; do
sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
sed -ri "s,${stdenv.cc.cc},$(echo "${stdenv.cc.cc}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
sed -ri "s,${stdenv.glibc.dev},$(echo "${stdenv.glibc.dev}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
done < <(find $out -type f 2>/dev/null)
find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} -t ${stdenv.glibc.dev} '{}' +
'';

meta = {
Expand Down
9 changes: 3 additions & 6 deletions pkgs/applications/virtualization/runc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, go-md2man
{ stdenv, lib, fetchFromGitHub, fetchpatch, removeReferencesTo, go-md2man
, go, pkgconfig, libapparmor, apparmor-parser, libseccomp }:

with lib;
Expand Down Expand Up @@ -33,7 +33,7 @@ stdenv.mkDerivation rec {

hardeningDisable = ["fortify"];

buildInputs = [ go-md2man go pkgconfig libseccomp libapparmor apparmor-parser ];
buildInputs = [ removeReferencesTo go-md2man go pkgconfig libseccomp libapparmor apparmor-parser ];

makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';

Expand Down Expand Up @@ -61,10 +61,7 @@ stdenv.mkDerivation rec {
'';

preFixup = ''
# remove references to go compiler
while read file; do
sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
done < <(find $out/bin -type f 2>/dev/null)
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
'';

meta = {
Expand Down

0 comments on commit 6fce6c9

Please sign in to comment.