diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2018-04-29 22:09:25 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2018-04-30 10:20:38 +0200 |
commit | 6a32965e17910c18bd166a79502c0a3639854ea7 (patch) | |
tree | 5adedcc4f39854fac4d29d5b73904d695d3d1b7a | |
parent | 8d6d1363de90b8bfc3eb89ccfdcb47064ccdb43d (diff) | |
download | nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar.gz nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar.bz2 nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar.lz nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar.xz nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.tar.zst nixlib-6a32965e17910c18bd166a79502c0a3639854ea7.zip |
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.
-rw-r--r-- | pkgs/tools/security/notary/default.nix | 32 | ||||
-rw-r--r-- | pkgs/tools/security/notary/no-git-usage.patch | 15 |
2 files changed, 36 insertions, 11 deletions
diff --git a/pkgs/tools/security/notary/default.nix b/pkgs/tools/security/notary/default.nix index 4a42c9162e1b..071bfdaea005 100644 --- a/pkgs/tools/security/notary/default.nix +++ b/pkgs/tools/security/notary/default.nix @@ -1,32 +1,42 @@ -{ stdenv, fetchFromGitHub, buildGoPackage, git, libtool }: +{ stdenv, fetchFromGitHub, buildGoPackage, libtool }: buildGoPackage rec { name = "notary-${version}"; - version = "0.6.0"; - gitcommit = "34f53ad"; + version = "0.6.1"; + gitcommit = "d6e1431f"; src = fetchFromGitHub { owner = "theupdateframework"; repo = "notary"; rev = "v${version}"; - sha256 = "0lg7ab2agkk3rnladcvpdzk8cnf3m49qfm4sanh7yjvlvlv1wm4a"; + sha256 = "1ak9dk6vjny5069hp3w36dbjawcnaq82l3i2qvf7mn7zfglbsnf9"; }; - buildInputs = [ libtool ]; - - goPackagePath = "github.com/theupdateframework/notary"; + patches = [ ./no-git-usage.patch ]; + buildInputs = [ libtool ]; buildPhase = '' + runHook preBuild cd go/src/github.com/theupdateframework/notary - make GITCOMMIT=${gitcommit} GITUNTRACKEDCHANGES= client + make client GITCOMMIT=${gitcommit} + runHook postBuild ''; + goPackagePath = "github.com/theupdateframework/notary"; + installPhase = '' + runHook preInstall install -D bin/notary $bin/bin/notary + runHook postInstall + ''; + + doCheck = true; + checkPhase = '' + make test PKGS=github.com/theupdateframework/notary/cmd/notary ''; meta = with stdenv.lib; { - description = " Notary is a project that allows anyone to have trust over arbitrary collections of data"; + description = "Notary is a project that allows anyone to have trust over arbitrary collections of data"; longDescription = '' The Notary project comprises a server and a client for running and interacting with trusted collections. See the service architecture @@ -49,7 +59,7 @@ buildGoPackage rec { ''; license = licenses.asl20; homepage = https://github.com/theupdateframework/notary; - maintainers = with maintainers; [ vdemeester ]; - platforms = with platforms; unix; + maintainers = with maintainers; [ vdemeester ma27 ]; + platforms = platforms.unix; }; } diff --git a/pkgs/tools/security/notary/no-git-usage.patch b/pkgs/tools/security/notary/no-git-usage.patch new file mode 100644 index 000000000000..363eefe36921 --- /dev/null +++ b/pkgs/tools/security/notary/no-git-usage.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index ab794165..0cbd047f 100644 +--- a/Makefile ++++ b/Makefile +@@ -5,8 +5,8 @@ PREFIX?=$(shell pwd) + # Add to compile time flags + NOTARY_PKG := github.com/theupdateframework/notary + NOTARY_VERSION := $(shell cat NOTARY_VERSION) +-GITCOMMIT := $(shell git rev-parse --short HEAD) +-GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no) ++GITCOMMIT ?= $(shell git rev-parse --short HEAD) ++GITUNTRACKEDCHANGES := + ifneq ($(GITUNTRACKEDCHANGES),) + GITCOMMIT := $(GITCOMMIT)-dirty + endif |