git.iko.soy/typeable/nixpkgs
on master help sign in
notary: fix build

The package is broken on master for some time now: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.notary.x86_64-linux/all The main reason for the breackage is that the `Makefile` script attempts to retrieve the latest git commit by using `git rev-parse` which breaks as `git` is not in the build environment. This could be fixed by using `?=` rather than `:=` for the `GITCOMMIT` variable in the `make` script to easily override `GITCOMMIT` in the `buildPhase`. See the Hydra logs for reference: https://nix-cache.s3.amazonaws.com/log/ib4qp8h4r8d830ra4fah38l7ybb82gp7-notary-0.6.0.drv Furthermore some refactoring was applied: * Activated the test suite for `cmd/notary` to confirm the basic functionality when building for NixOS. * Added {pre,post} hooks for `{build,install}Phase` * Added myself as maintainer to have more people available in case of further breakage.

commit6a32965e17910c18bd166a79502c0a3639854ea7 authorMaximilian Bosch <maximilian@mbosch.me> dateSun 29 Apr 2018, 22:09 (9 years ago) parent8d6d136
2 files changed+36−11
pkgs/tools/security/notary/default.nix+21−11 pkgs/tools/security/notary/no-git-usage.patch+15
pkgs/tools/security/notary/default.nix+21−11
@@ -1,32 +1,42 @@
1−{ stdenv, fetchFromGitHub, buildGoPackage, git, libtool }:
1+{ stdenv, fetchFromGitHub, buildGoPackage, libtool }:
22
33buildGoPackage rec {
44 name = "notary-${version}";
5− version = "0.6.0";
6− gitcommit = "34f53ad";
5+ version = "0.6.1";
6+ gitcommit = "d6e1431f";
77
88 src = fetchFromGitHub {
99 owner = "theupdateframework";
1010 repo = "notary";
1111 rev = "v${version}";
12− sha256 = "0lg7ab2agkk3rnladcvpdzk8cnf3m49qfm4sanh7yjvlvlv1wm4a";
12+ sha256 = "1ak9dk6vjny5069hp3w36dbjawcnaq82l3i2qvf7mn7zfglbsnf9";
1313 };
1414
15− buildInputs = [ libtool ];
16−
17− goPackagePath = "github.com/theupdateframework/notary";
15+ patches = [ ./no-git-usage.patch ];
1816
17+ buildInputs = [ libtool ];
1918 buildPhase = ''
19+ runHook preBuild
2020 cd go/src/github.com/theupdateframework/notary
21− make GITCOMMIT=${gitcommit} GITUNTRACKEDCHANGES= client
21+ make client GITCOMMIT=${gitcommit}
22+ runHook postBuild
2223 '';
2324
25+ goPackagePath = "github.com/theupdateframework/notary";
26+
2427 installPhase = ''
28+ runHook preInstall
2529 install -D bin/notary $bin/bin/notary
30+ runHook postInstall
31+ '';
32+
33+ doCheck = true;
34+ checkPhase = ''
35+ make test PKGS=github.com/theupdateframework/notary/cmd/notary
2636 '';
2737
2838 meta = with stdenv.lib; {
29− description = " Notary is a project that allows anyone to have trust over arbitrary collections of data";
39+ description = "Notary is a project that allows anyone to have trust over arbitrary collections of data";
3040 longDescription = ''
3141 The Notary project comprises a server and a client for running and
3242 interacting with trusted collections. See the service architecture
@@ -49,7 +59,7 @@ buildGoPackage rec {
4959 '';
5060 license = licenses.asl20;
5161 homepage = https://github.com/theupdateframework/notary;
52− maintainers = with maintainers; [ vdemeester ];
53− platforms = with platforms; unix;
62+ maintainers = with maintainers; [ vdemeester ma27 ];
63+ platforms = platforms.unix;
5464 };
5565}
pkgs/tools/security/notary/no-git-usage.patchnew file+15
@@ -0,0 +1,15 @@
1+diff --git a/Makefile b/Makefile
2+index ab794165..0cbd047f 100644
3+--- a/Makefile
4++++ b/Makefile
5+@@ -5,8 +5,8 @@ PREFIX?=$(shell pwd)
6+ # Add to compile time flags
7+ NOTARY_PKG := github.com/theupdateframework/notary
8+ NOTARY_VERSION := $(shell cat NOTARY_VERSION)
9+-GITCOMMIT := $(shell git rev-parse --short HEAD)
10+-GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
11++GITCOMMIT ?= $(shell git rev-parse --short HEAD)
12++GITUNTRACKEDCHANGES :=
13+ ifneq ($(GITUNTRACKEDCHANGES),)
14+ GITCOMMIT := $(GITCOMMIT)-dirty
15+ endif