Merge pull request #52563 from vdemeester/52469-containerd-to-buildgopackage

containerd: migrate to using buildGoPackage
This commit is contained in:
Jörg Thalheim 2019-01-11 12:29:35 +00:00 committed by GitHub
commit 15ec5d03e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -1,9 +1,8 @@
{ stdenv, lib, fetchFromGitHub, removeReferencesTo { stdenv, lib, fetchFromGitHub, buildGoPackage, btrfs-progs, go-md2man, utillinux }:
, go, btrfs-progs }:
with lib; with lib;
stdenv.mkDerivation rec { buildGoPackage rec {
name = "containerd-${version}"; name = "containerd-${version}";
version = "1.2.1"; version = "1.2.1";
@ -14,34 +13,37 @@ stdenv.mkDerivation rec {
sha256 = "16zn6p1ky3yrgn53z8h9wza53ch91fj47wj5xgz6w4c57j30f66p"; sha256 = "16zn6p1ky3yrgn53z8h9wza53ch91fj47wj5xgz6w4c57j30f66p";
}; };
goPackagePath = "github.com/containerd/containerd";
outputs = [ "bin" "out" "man" ];
hardeningDisable = [ "fortify" ]; hardeningDisable = [ "fortify" ];
buildInputs = [ removeReferencesTo go btrfs-progs ]; buildInputs = [ btrfs-progs go-md2man utillinux ];
buildFlags = "VERSION=v${version}"; buildFlags = "VERSION=v${version}";
BUILDTAGS = [] BUILDTAGS = []
++ optional (btrfs-progs == null) "no_btrfs"; ++ optional (btrfs-progs == null) "no_btrfs";
preConfigure = '' buildPhase = ''
# Extract the source cd go/src/${goPackagePath}
cd "$NIX_BUILD_TOP"
mkdir -p "go/src/github.com/containerd"
mv "$sourceRoot" "go/src/github.com/containerd/containerd"
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
'';
preBuild = ''
cd go/src/github.com/containerd/containerd
patchShebangs . patchShebangs .
make binaries
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/bin for b in bin/*; do
cp bin/* $out/bin install -Dm555 $b $bin/$b
''; done
preFixup = '' make man
find $out -type f -exec remove-references-to -t ${go} '{}' + manRoot="$man/share/man"
mkdir -p "$manRoot"
for manFile in man/*; do
manName="$(basename "$manFile")" # "docker-build.1"
number="$(echo $manName | rev | cut -d'.' -f1 | rev)"
mkdir -p "$manRoot/man$number"
gzip -c "$manFile" > "$manRoot/man$number/$manName.gz"
done
''; '';
meta = { meta = {

View File

@ -28,7 +28,7 @@ rec {
patches = []; patches = [];
}); });
docker-containerd = (containerd.override { inherit go; }).overrideAttrs (oldAttrs: rec { docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
name = "docker-containerd-${version}"; name = "docker-containerd-${version}";
inherit version; inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
@ -39,8 +39,6 @@ rec {
}; };
hardeningDisable = [ "fortify" ]; hardeningDisable = [ "fortify" ];
buildInputs = [ removeReferencesTo go btrfs-progs ];
}); });
docker-tini = tini.overrideAttrs (oldAttrs: rec { docker-tini = tini.overrideAttrs (oldAttrs: rec {