File skopeo.spec of Package skopeo

#
# spec file for package skopeo
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# nodebuginfo

# By the time this project is mature, all interesting architectures will have
# full ports of the gc compiler -- meaning there's no point in handling gcc-go.
%define go_arches %ix86 x86_64 aarch64

# Remove stripping of Go binaries.
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true

Name:           skopeo
Version:        0.1.19
Release:        0
Summary:        Container image repository tool
License:        Apache-2.0
Group:          System/Management
Url:            https://github.com/projectatomic/skopeo
Source:         %{name}-%{version}.tar.xz
BuildRequires:  go >= 1.5
BuildRequires:  go-go-md2man
BuildRequires:  libgpgme-devel
# Required for containers/storage integration.
BuildRequires:  device-mapper-devel >= 1.2.68
BuildRequires:  libbtrfs-devel >= 3.8
BuildRoot:      %{_tmppath}/%{name}-%{raw_version}-build

%description
skopeo is a command line utility for various operations on container images and
image repositories. skopeo is able to inspect a repository on a Docker registry
and fetch images layers. skopeo can copy container images between various
storage mechanisms.

%prep
%setup -q

%build
mkdir -p .gopath/src/github.com/projectatomic
ln -s $PWD .gopath/src/github.com/projectatomic/skopeo
export GOPATH=$PWD/.gopath

export BUILDTAGS="exclude_graphdriver_aufs"
%if 0%{?suse_version} <= 1320
	BUILDTAGS+=" libdm_no_deferred_remove"
%endif

# Build.
go build -ldflags "-X main.gitCommit=" -gcflags "" -tags "$BUILDTAGS" -o skopeo github.com/projectatomic/skopeo/cmd/skopeo
make docs

%install
# Install the binary.
%{__install} -D -m 0755 %{name} "%{buildroot}/%{_bindir}/%{name}"
%{__install} -D -m 0644 default-policy.json "%{buildroot}/etc/containers/policy.json"
make INSTALLDIR="%{buildroot}/%{_bindir}" install-binary

# Install the docs.
make MANINSTALLDIR="%{buildroot}/%{_mandir}" install-docs

%files
%defattr(-,root,root)
%doc LICENSE README.md
%{_bindir}/%{name}
%dir /etc/containers
%config /etc/containers/policy.json
%{_mandir}/man1/skopeo.1*

%changelog

openSUSE Build Service is sponsored by