git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #24544 from NeQuissimus/skopeo_policy

skopeo: default policy

commit184e3238c7b65f18187d14a0388bacdee3829487 authorTim Steinbach <NeQuissimus@users.noreply.github.com> dateSat 8 Apr 2017, 08:36 (10 years ago) parente0b12884ceeac7
2 files changed+34
pkgs/development/tools/skopeo/default.nix+9 pkgs/development/tools/skopeo/path.patch+25
pkgs/development/tools/skopeo/default.nix+9
@@ -19,11 +19,20 @@ buildGoPackage rec {
1919 sha256 = "13k29i5hx909hvddl2xkyw4qzxq2q20ay9bkal3xi063s6l0sh0z";
2020 };
2121
22+ patches = [
23+ ./path.patch
24+ ];
25+
2226 preBuild = ''
2327 export CGO_CFLAGS="-I${getDev gpgme}/include -I${getDev libgpgerror}/include -I${getDev devicemapper}/include -I${getDev btrfs-progs}/include"
2428 export CGO_LDFLAGS="-L${getLib gpgme}/lib -L${getLib libgpgerror}/lib -L${getLib devicemapper}/lib"
2529 '';
2630
31+ postInstall = ''
32+ mkdir $bin/etc
33+ cp -v ./go/src/github.com/projectatomic/skopeo/default-policy.json $bin/etc/default-policy.json
34+ '';
35+
2736 meta = {
2837 description = "A command line utility for various operations on container images and image repositories";
2938 homepage = "https://github.com/projectatomic/skopeo";
pkgs/development/tools/skopeo/path.patchnew file+25
@@ -0,0 +1,25 @@
1+diff --git a/cmd/skopeo/main.go b/cmd/skopeo/main.go
2+index 51f918d..6681d73 100644
3+--- a/cmd/skopeo/main.go
4++++ b/cmd/skopeo/main.go
5+@@ -3,6 +3,7 @@ package main
6+ import (
7+ "fmt"
8+ "os"
9++ "path/filepath"
10+
11+ "github.com/Sirupsen/logrus"
12+ "github.com/containers/image/signature"
13+@@ -84,6 +85,12 @@ func getPolicyContext(c *cli.Context) (*signature.PolicyContext, error) {
14+ policyPath := c.GlobalString("policy")
15+ var policy *signature.Policy // This could be cached across calls, if we had an application context.
16+ var err error
17++ var dir string
18++ if policyPath == "" {
19++ dir, err = filepath.Abs(filepath.Dir(os.Args[0]))
20++ policyPath = dir + "/../etc/default-policy.json"
21++ }
22++
23+ if policyPath == "" {
24+ policy, err = signature.DefaultPolicy(nil)
25+ } else {