File skopeo.spec of Package skopeo

#
# spec file for package skopeo
#
# Copyright (c) 2018 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


%define project        github.com/containers/skopeo

%if 0%{?is_opensuse} && 0%{?suse_version} >= 1500
# Build with libostree-devel for openSUSE Tumbleweed and Leap 15
%define with_libostree 1
%endif
Name:           skopeo
Version:        0.1.32
Release:        0
Summary:        Container image repository tool
License:        Apache-2.0
Group:          System/Management
URL:            https://github.com/containers/skopeo
Source:         %{name}-%{version}.tar.xz
# SUSE-FEATURE: Implement the skopeo sync command
#               (https://github.com/containers/skopeo/pull/524)
Patch000:       bsc1115165-0001-Introduce-the-sync-command.patch
BuildRequires:  device-mapper-devel >= 1.2.68
BuildRequires:  glib2-devel
BuildRequires:  go >= 1.5
BuildRequires:  go-go-md2man
BuildRequires:  libbtrfs-devel >= 3.8
BuildRequires:  libcontainers-common
BuildRequires:  libgpgme-devel
Requires:       libcontainers-common
ExcludeArch:    s390
%if 0%{?with_libostree}
BuildRequires:  libostree-devel
%endif

%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
# bsc#1115165
%patch000 -p1

%build
mkdir -p .gopath/src/github.com/containers
ln -s $PWD .gopath/src/%{project}
export GOPATH=$PWD/.gopath

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

# Build.
go build -buildmode=pie -ldflags "-X main.gitCommit=" -gcflags "" -tags "$BUILDTAGS" -o skopeo %{project}/cmd/skopeo
make %{?_smp_mflags} docs

%install
# Install the binary.
install -D -m 0755 %{name} "%{buildroot}/%{_bindir}/%{name}"
make INSTALLDIR="%{buildroot}/%{_bindir}" install-binary

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

%files
%doc README.md
%license LICENSE
%{_bindir}/%{name}
%{_mandir}/man1/skopeo.1*

%changelog
openSUSE Build Service is sponsored by