Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerd: migrate to using buildGoPackage #52563

Merged
merged 1 commit into from Jan 11, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,9 +1,8 @@
{ stdenv, lib, fetchFromGitHub, removeReferencesTo
, go, btrfs-progs }:
{ stdenv, lib, fetchFromGitHub, buildGoPackage, btrfs-progs, go-md2man, utillinux }:

with lib;

stdenv.mkDerivation rec {
buildGoPackage rec {
name = "containerd-${version}";
version = "1.2.1";

@@ -14,34 +13,37 @@ stdenv.mkDerivation rec {
sha256 = "16zn6p1ky3yrgn53z8h9wza53ch91fj47wj5xgz6w4c57j30f66p";
};

goPackagePath = "github.com/containerd/containerd";
outputs = [ "bin" "out" "man" ];

hardeningDisable = [ "fortify" ];

buildInputs = [ removeReferencesTo go btrfs-progs ];
buildInputs = [ btrfs-progs go-md2man utillinux ];
buildFlags = "VERSION=v${version}";

BUILDTAGS = []
++ optional (btrfs-progs == null) "no_btrfs";

preConfigure = ''
# Extract the source
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
buildPhase = ''
cd go/src/${goPackagePath}
patchShebangs .
make binaries
'';

installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin
'';

preFixup = ''
find $out -type f -exec remove-references-to -t ${go} '{}' +
for b in bin/*; do
install -Dm555 $b $bin/$b
done
make man
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"

This comment has been minimized.

Copy link
@Mic92

Mic92 Dec 20, 2018

Contributor

I think we automatically compress manpages.

This comment has been minimized.

Copy link
@vdemeester

vdemeester Dec 20, 2018

Author Contributor

oh 🤔 then there is some other packages that should change too

done
'';

meta = {
@@ -28,7 +28,7 @@ rec {
patches = [];
});

docker-containerd = (containerd.override { inherit go; }).overrideAttrs (oldAttrs: rec {
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
name = "docker-containerd-${version}";
inherit version;
src = fetchFromGitHub {
@@ -39,8 +39,6 @@ rec {
};

hardeningDisable = [ "fortify" ];

buildInputs = [ removeReferencesTo go btrfs-progs ];
});

docker-tini = tini.overrideAttrs (oldAttrs: rec {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.