Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/skopeo/, app-emulation/skopeo/files/
Date: Fri, 23 Jun 2017 21:58:21
Message-Id: 1498254985.ea3aa51b57d560e10bc951aebb7c23f55073c695.williamh@gentoo
1 commit: ea3aa51b57d560e10bc951aebb7c23f55073c695
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 23 21:55:44 2017 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 23 21:56:25 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea3aa51b
7
8 app-emulation/skopeo: new package
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.1
11
12 app-emulation/skopeo/Manifest | 1 +
13 .../files/skopeo-0.1.22-make-ostree-optional.patch | 158 +++++++++++++++++++++
14 app-emulation/skopeo/metadata.xml | 8 ++
15 app-emulation/skopeo/skopeo-0.1.22.ebuild | 57 ++++++++
16 4 files changed, 224 insertions(+)
17
18 diff --git a/app-emulation/skopeo/Manifest b/app-emulation/skopeo/Manifest
19 new file mode 100644
20 index 00000000000..cdca793499a
21 --- /dev/null
22 +++ b/app-emulation/skopeo/Manifest
23 @@ -0,0 +1 @@
24 +DIST skopeo-0.1.22.tar.gz 1921286 SHA256 a2090f84e5318752bf506fd7aa6d8420285726c32dcbac3ab735ec5762104692 SHA512 10ed4e577b07f672540ff86774b5c5b6b7531765fd36313b9e4e6bf974840fee98ede193014977c381b96875cb9147307ee690f4fc8dd4f97d87681d7fa2f4f2 WHIRLPOOL 94c88b784c8a7186ff6abd5d4a1f2c2307fb9c29c98f256a28a5d066546afc7cbb0c848aec77c8835c63f5c62628a8e983d25f4e63e3c6bfa5f4322dd9420522
25
26 diff --git a/app-emulation/skopeo/files/skopeo-0.1.22-make-ostree-optional.patch b/app-emulation/skopeo/files/skopeo-0.1.22-make-ostree-optional.patch
27 new file mode 100644
28 index 00000000000..1e81d8bff34
29 --- /dev/null
30 +++ b/app-emulation/skopeo/files/skopeo-0.1.22-make-ostree-optional.patch
31 @@ -0,0 +1,158 @@
32 +From a49f22efd84d1cc656242319cca27cbdf8852e05 Mon Sep 17 00:00:00 2001
33 +From: William Hubbs <whubbs@××××××.com>
34 +Date: Fri, 23 Jun 2017 12:34:25 -0500
35 +Subject: [PATCH] make ostree optional
36 +
37 +---
38 + vendor/github.com/containers/image/README.md | 14 ++++++---
39 + .../transports/alltransports/alltransports.go | 2 +-
40 + .../image/transports/alltransports/ostree.go | 8 +++++
41 + .../image/transports/alltransports/ostree_stub.go | 9 ++++++
42 + .../github.com/containers/image/transports/stub.go | 36 ++++++++++++++++++++++
43 + .../containers/image/transports/stub_test.go | 18 +++++++++++
44 + 6 files changed, 82 insertions(+), 5 deletions(-)
45 + create mode 100644 vendor/github.com/containers/image/transports/alltransports/ostree.go
46 + create mode 100644 vendor/github.com/containers/image/transports/alltransports/ostree_stub.go
47 + create mode 100644 vendor/github.com/containers/image/transports/stub.go
48 + create mode 100644 vendor/github.com/containers/image/transports/stub_test.go
49 +
50 +diff --git a/vendor/github.com/containers/image/README.md b/vendor/github.com/containers/image/README.md
51 +index ca8afd4..8e812bb 100644
52 +--- a/vendor/github.com/containers/image/README.md
53 ++++ b/vendor/github.com/containers/image/README.md
54 +@@ -51,14 +51,20 @@ Ensure that the dependencies documented [in vendor.conf](https://github.com/cont
55 + are also available
56 + (using those exact versions or different versions of your choosing).
57 +
58 +-This library, by default, also depends on the GpgME C library. Either install it:
59 ++This library, by default, also depends on the GpgME and libostree C libraries. Either install them:
60 + ```sh
61 +-Fedora$ dnf install gpgme-devel libassuan-devel
62 ++Fedora$ dnf install gpgme-devel libassuan-devel libostree-devel
63 + macOS$ brew install gpgme
64 + ```
65 +-or use the `containers_image_openpgp` build tag (e.g. using `go build -tags …`)
66 +-This will use a Golang-only OpenPGP implementation for signature verification instead of the default cgo/gpgme-based implementation;
67 ++or use the build tags described below to avoid the dependencies (e.g. using `go build -tags …`)
68 ++
69 ++### Supported build tags
70 ++
71 ++- `containers_image_openpgp`: Use a Golang-only OpenPGP implementation for signature verification instead of the default cgo/gpgme-based implementation;
72 + the primary downside is that creating new signatures with the Golang-only implementation is not supported.
73 ++- `containers_image_ostree_stub`: Instead of importing `ostree:` transport in `github.com/containers/image/transports/alltransports`, use a stub which reports that the transport is not supported. This allows building the library without requiring the `libostree` development libraries.
74 ++
75 ++ (Note that explicitly importing `github.com/containers/image/ostree` will still depend on the `libostree` library, this build tag only affects generic users of …`/alltransports`.)
76 +
77 + ## Contributing
78 +
79 +diff --git a/vendor/github.com/containers/image/transports/alltransports/alltransports.go b/vendor/github.com/containers/image/transports/alltransports/alltransports.go
80 +index dc70fad..dd80b7f 100644
81 +--- a/vendor/github.com/containers/image/transports/alltransports/alltransports.go
82 ++++ b/vendor/github.com/containers/image/transports/alltransports/alltransports.go
83 +@@ -12,7 +12,7 @@ import (
84 + _ "github.com/containers/image/docker/daemon"
85 + _ "github.com/containers/image/oci/layout"
86 + _ "github.com/containers/image/openshift"
87 +- _ "github.com/containers/image/ostree"
88 ++ // The ostree transport is registered by ostree*.go
89 + _ "github.com/containers/image/storage"
90 + "github.com/containers/image/transports"
91 + "github.com/containers/image/types"
92 +diff --git a/vendor/github.com/containers/image/transports/alltransports/ostree.go b/vendor/github.com/containers/image/transports/alltransports/ostree.go
93 +new file mode 100644
94 +index 0000000..0fc5d7e
95 +--- /dev/null
96 ++++ b/vendor/github.com/containers/image/transports/alltransports/ostree.go
97 +@@ -0,0 +1,8 @@
98 ++// +build !containers_image_ostree_stub
99 ++
100 ++package alltransports
101 ++
102 ++import (
103 ++ // Register the ostree transport
104 ++ _ "github.com/containers/image/ostree"
105 ++)
106 +diff --git a/vendor/github.com/containers/image/transports/alltransports/ostree_stub.go b/vendor/github.com/containers/image/transports/alltransports/ostree_stub.go
107 +new file mode 100644
108 +index 0000000..8b01afe
109 +--- /dev/null
110 ++++ b/vendor/github.com/containers/image/transports/alltransports/ostree_stub.go
111 +@@ -0,0 +1,9 @@
112 ++// +build containers_image_ostree_stub
113 ++
114 ++package alltransports
115 ++
116 ++import "github.com/containers/image/transports"
117 ++
118 ++func init() {
119 ++ transports.Register(transports.NewStubTransport("ostree"))
120 ++}
121 +diff --git a/vendor/github.com/containers/image/transports/stub.go b/vendor/github.com/containers/image/transports/stub.go
122 +new file mode 100644
123 +index 0000000..087f69b
124 +--- /dev/null
125 ++++ b/vendor/github.com/containers/image/transports/stub.go
126 +@@ -0,0 +1,36 @@
127 ++package transports
128 ++
129 ++import (
130 ++ "fmt"
131 ++
132 ++ "github.com/containers/image/types"
133 ++)
134 ++
135 ++// stubTransport is an implementation of types.ImageTransport which has a name, but rejects any references with “the transport $name: is not supported in this build”.
136 ++type stubTransport string
137 ++
138 ++// NewStubTransport returns an implementation of types.ImageTransport which has a name, but rejects any references with “the transport $name: is not supported in this build”.
139 ++func NewStubTransport(name string) types.ImageTransport {
140 ++ return stubTransport(name)
141 ++}
142 ++
143 ++// Name returns the name of the transport, which must be unique among other transports.
144 ++func (s stubTransport) Name() string {
145 ++ return string(s)
146 ++}
147 ++
148 ++// ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an ImageReference.
149 ++func (s stubTransport) ParseReference(reference string) (types.ImageReference, error) {
150 ++ return nil, fmt.Errorf(`The transport "%s:" is not supported in this build`, string(s))
151 ++}
152 ++
153 ++// ValidatePolicyConfigurationScope checks that scope is a valid name for a signature.PolicyTransportScopes keys
154 ++// (i.e. a valid PolicyConfigurationIdentity() or PolicyConfigurationNamespaces() return value).
155 ++// It is acceptable to allow an invalid value which will never be matched, it can "only" cause user confusion.
156 ++// scope passed to this function will not be "", that value is always allowed.
157 ++func (s stubTransport) ValidatePolicyConfigurationScope(scope string) error {
158 ++ // Allowing any reference in here allows tools with some transports stubbed-out to still
159 ++ // use signature verification policies which refer to these stubbed-out transports.
160 ++ // See also the treatment of unknown transports in policyTransportScopesWithTransport.UnmarshalJSON .
161 ++ return nil
162 ++}
163 +diff --git a/vendor/github.com/containers/image/transports/stub_test.go b/vendor/github.com/containers/image/transports/stub_test.go
164 +new file mode 100644
165 +index 0000000..f181a1a
166 +--- /dev/null
167 ++++ b/vendor/github.com/containers/image/transports/stub_test.go
168 +@@ -0,0 +1,18 @@
169 ++package transports
170 ++
171 ++import (
172 ++ "testing"
173 ++
174 ++ "github.com/stretchr/testify/assert"
175 ++)
176 ++
177 ++func TestStubTransport(t *testing.T) {
178 ++ const name = "whatever"
179 ++
180 ++ s := NewStubTransport(name)
181 ++ assert.Equal(t, name, s.Name())
182 ++ _, err := s.ParseReference("this is rejected regardless of content")
183 ++ assert.Error(t, err)
184 ++ err = s.ValidatePolicyConfigurationScope("this is accepted regardless of content")
185 ++ assert.NoError(t, err)
186 ++}
187 +--
188 +2.13.0
189 +
190
191 diff --git a/app-emulation/skopeo/metadata.xml b/app-emulation/skopeo/metadata.xml
192 new file mode 100644
193 index 00000000000..c36c37139fa
194 --- /dev/null
195 +++ b/app-emulation/skopeo/metadata.xml
196 @@ -0,0 +1,8 @@
197 +<?xml version="1.0" encoding="UTF-8"?>
198 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
199 +<pkgmetadata>
200 + <maintainer type="person">
201 + <email>williamh@g.o</email>
202 + <name>William Hubbs</name>
203 + </maintainer>
204 +</pkgmetadata>
205
206 diff --git a/app-emulation/skopeo/skopeo-0.1.22.ebuild b/app-emulation/skopeo/skopeo-0.1.22.ebuild
207 new file mode 100644
208 index 00000000000..21ccca2bc45
209 --- /dev/null
210 +++ b/app-emulation/skopeo/skopeo-0.1.22.ebuild
211 @@ -0,0 +1,57 @@
212 +# Copyright 1999-2017 Gentoo Foundation
213 +# Distributed under the terms of the GNU General Public License v2
214 +
215 +EAPI=6
216 +EGO_PN=github.com/projectatomic/skopeo
217 +COMMIT=5d24b67
218 +inherit golang-vcs-snapshot
219 +
220 +DESCRIPTION="Command line utility foroperations on container images and image repositories"
221 +HOMEPAGE="http://github.com/projectatomic/skopeo"
222 +SRC_URI="https://github.com/projectatomic/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
223 +
224 +LICENSE="Apache-2.0"
225 +SLOT="0"
226 +KEYWORDS="~amd64"
227 +IUSE=""
228 +
229 +COMMON_DEPEND=">=app-crypt/gpgme-1.5.5:=
230 + >=dev-libs/libassuan-2.4.3
231 + >=sys-fs/btrfs-progs-4.0.1
232 + >=sys-fs/lvm2-2.02.145"
233 +DEPEND="${COMMON_DEPEND}
234 +dev-go/go-md2man"
235 +RDEPEND="${COMMON_DEPEND}"
236 +
237 +PATCHES=(
238 + "${FILESDIR}"/${P}-make-ostree-optional.patch
239 +)
240 +
241 +S="${WORKDIR}/${P}/src/${EGO_PN}"
242 +
243 +RESTRICT="test"
244 +
245 +src_compile() {
246 + local BUILDTAGS="containers_image_ostree_stub"
247 + set -- env GOPATH="${WORKDIR}/${P}" \
248 + go build -ldflags "-X main.gitCommit=${COMMIT}" \
249 + -gcflags "${GOGCFLAGS}" -tags "${BUILDTAGS}" \
250 + -o skopeo ./cmd/skopeo
251 + echo "$@"
252 + "$@" || die
253 + cd docs
254 + for f in *.1.md; do
255 + go-md2man -in ${f} -out ${f%%.md} || die
256 + done
257 +}
258 +
259 +src_install() {
260 + dobin skopeo
261 +doman docs/*.1
262 + insinto /etc/containers
263 + newins default-policy.json policy.json
264 + insinto /etc/containers/registries.d
265 + doins default.yaml
266 + dodir /var/lib/atomic/sigstore
267 + einstalldocs
268 +}