Blob Blame History Raw
%global with_debug 1
%global with_check 0

%if 0%{?with_debug}
%global _find_debuginfo_dwz_opts %{nil}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package %{nil}
%endif

%if 0%{?rhel} > 7 && ! 0%{?fedora}
%define gobuild(o:) \
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
%endif

%global provider github
%global provider_tld com
%global project containers
%global repo skopeo
# https://github.com/containers/skopeo
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global git0 https://%{import_path}
%global branch master

Epoch: 1
Name: %{repo}
Version: 1.0.0
Release: 1%{?dist}
Summary: Inspect container images and repositories on registries
License: ASL 2.0
URL: %{git0}
Source0: %{git0}/archive/v%{version}.tar.gz
#Source1: https://raw.githubusercontent.com/containers/storage/%%{branch}/storage.conf
Source1: https://src.fedoraproject.org/rpms/skopeo/raw/master/f/storage.conf
Source2: https://raw.githubusercontent.com/containers/storage/%{branch}/docs/containers-storage.conf.5.md
Source3: mounts.conf
Source4: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-registries.conf.5.md
Source5: registries.conf
Source6: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-policy.json.5.md
#Source7: https://raw.githubusercontent.com/containers/libpod/%%{branch}/seccomp.json
Source7: https://src.fedoraproject.org/rpms/skopeo/raw/master/f/seccomp.json
Source8: https://raw.githubusercontent.com/containers/libpod/%{branch}/docs/source/markdown/containers-mounts.conf.5.md
Source9: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-signature.5.md
Source10: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-transports.5.md
Source11: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-certs.d.5.md
Source12: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-registries.d.5.md
Source13: https://raw.githubusercontent.com/containers/common/%{branch}/pkg/config/containers.conf
Source14: https://raw.githubusercontent.com/containers/common/%{branch}/docs/containers.conf.5.md
Source15: https://raw.githubusercontent.com/containers/image/%{branch}/docs/containers-auth.json.5.md
BuildRequires: git
BuildRequires: golang >= 1.12.12-4
BuildRequires: go-md2man
BuildRequires: gpgme-devel
BuildRequires: libassuan-devel
BuildRequires: pkgconfig(devmapper)
BuildRequires: ostree-devel
BuildRequires: glib2-devel
BuildRequires: make
Requires: containers-common = %{epoch}:%{version}-%{release}

%description
Command line utility to inspect images and repositories directly on Docker
registries without the need to pull them

%package -n containers-common
Summary: Configuration files for working with image signatures
Obsoletes: atomic <= 1:1.13.1-2
Conflicts: atomic-registries <= 1:1.22.1-1
Obsoletes: docker-rhsubscription <= 2:1.13.1-31
Provides: %{name}-containers = %{epoch}:%{version}-%{release}
Obsoletes: %{name}-containers <= 1:0.1.31-3
Recommends: fuse-overlayfs
Recommends: slirp4netns
Recommends: subscription-manager

%description -n containers-common
This package installs a default signature store configuration and a default
policy under `/etc/containers/`.

%package tests
Summary:         Tests for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
#Requires: bats  (which RHEL8 doesn't have. If it ever does, un-comment this)
Requires: gnupg
Requires: jq
Requires: podman

%description tests
%{summary}

This package contains system tests for %{name}

%prep
%autosetup -Sgit

%build
mkdir -p src/github.com/containers
ln -s ../../../ src/%{import_path}

mkdir -p vendor/src
for v in vendor/*; do
    if test ${v} = vendor/src; then continue; fi
    if test -d ${v}; then
      mv ${v} vendor/src/
    fi
done

export GOPATH=$(pwd):$(pwd)/vendor:%{gopath}
export GO111MODULE=off
export BUILDTAGS="exclude_graphdriver_btrfs btrfs_noversion $(hack/libdm_tag.sh) $(hack/ostree_tag.sh)"
%gobuild -o %{name} ./cmd/%{name}
%{__make} docs

%install
make \
   DESTDIR=%{buildroot} \
   SIGSTOREDIR=%{buildroot}%{_sharedstatedir}/containers/sigstore \
   install
mkdir -p %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}%{_sysconfdir}/containers/{certs.d,oci/hooks.d}
mkdir -p %{buildroot}%{_mandir}/man5
install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/containers/storage.conf
install -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/containers/
go-md2man -in %{SOURCE2} -out %{buildroot}%{_mandir}/man5/containers-storage.conf.5
go-md2man -in %{SOURCE4} -out %{buildroot}%{_mandir}/man5/containers-registries.conf.5
go-md2man -in %{SOURCE6} -out %{buildroot}%{_mandir}/man5/containers-policy.json.5
go-md2man -in %{SOURCE8} -out %{buildroot}%{_mandir}/man5/containers-mounts.conf.5
go-md2man -in %{SOURCE9} -out %{buildroot}%{_mandir}/man5/containers-signature.5
go-md2man -in %{SOURCE10} -out %{buildroot}%{_mandir}/man5/containers-transports.5
go-md2man -in %{SOURCE11} -out %{buildroot}%{_mandir}/man5/containers-certs.d.5
go-md2man -in %{SOURCE12} -out %{buildroot}%{_mandir}/man5/containers-registries.d.5
go-md2man -in %{SOURCE14} -out %{buildroot}%{_mandir}/man5/containers.conf.5
go-md2man -in %{SOURCE15} -out %{buildroot}%{_mandir}/man5/containers-auth.json.5

mkdir -p %{buildroot}%{_datadir}/containers
install -m0644 %{SOURCE3} %{buildroot}%{_datadir}/containers/mounts.conf
install -m0644 %{SOURCE7} %{buildroot}%{_datadir}/containers/seccomp.json
install -m0644 %{SOURCE13} %{buildroot}%{_datadir}/containers/containers.conf

# install secrets patch directory
install -d -p -m 755 %{buildroot}/%{_datadir}/rhel/secrets
# rhbz#1110876 - update symlinks for subscription management
ln -s %{_sysconfdir}/pki/entitlement %{buildroot}%{_datadir}/rhel/secrets/etc-pki-entitlement
ln -s %{_sysconfdir}/rhsm %{buildroot}%{_datadir}/rhel/secrets/rhsm
ln -s %{_sysconfdir}/yum.repos.d/redhat.repo %{buildroot}%{_datadir}/rhel/secrets/redhat.repo

# system tests
install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
cp -pav systemtest/* %{buildroot}/%{_datadir}/%{name}/test/system/

%check
%if 0%{?with_check}
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}

%gotest %{import_path}/integration
%endif

#define license tag if not already defined
%{!?_licensedir:%global license %doc}

%files -n containers-common
%dir %{_sysconfdir}/containers
%dir %{_sysconfdir}/containers/certs.d
%dir %{_sysconfdir}/containers/registries.d
%dir %{_sysconfdir}/containers/oci
%dir %{_sysconfdir}/containers/oci/hooks.d
%config(noreplace) %{_sysconfdir}/containers/policy.json
%config(noreplace) %{_sysconfdir}/containers/registries.d/default.yaml
%config(noreplace) %{_sysconfdir}/containers/storage.conf
%config(noreplace) %{_sysconfdir}/containers/registries.conf
%ghost %{_sysconfdir}/containers/containers.conf
%dir %{_sharedstatedir}/containers/sigstore
%{_mandir}/man5/*
%dir %{_datadir}/containers
%{_datadir}/containers/mounts.conf
%{_datadir}/containers/seccomp.json
%{_datadir}/containers/containers.conf
%dir %{_datadir}/rhel/secrets
%{_datadir}/rhel/secrets/*

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}*
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/%{name}

%files tests
%license LICENSE
%{_datadir}/%{name}/test

%changelog
* Tue May 19 2020 Jindrich Novy <jnovy@redhat.com> - 1:1.0.0-1
- update to https://github.com/containers/skopeo/releases/tag/v1.0.0
- Related: RHELPLAN-39206

* Fri Apr 24 2020 Jindrich Novy <jnovy@redhat.com> - 1:0.2.0-5
- follow Dan's suggestion to deliver seccomp.json and storage.conf
  from Fedora and not directly from upstream yet
- Related: RHELPLAN-39206

* Fri Apr 24 2020 Jindrich Novy <jnovy@redhat.com> - 1:0.2.0-4
- re-include ppc64 arch, golang doesn't seem broken there any more
- synchronize man pages and config files with upstream
- Related: RHELPLAN-39206

* Thu Apr 23 2020 Jindrich Novy <jnovy@redhat.com> - 1:0.2.0-3
- include and ship containers.conf
- Resolves: #1826486

* Tue Apr 21 2020 Jindrich Novy <jnovy@redhat.com> - 1:0.2.0-2
- add docker.io into the default registry list
- Related: RHELPLAN-39206

* Fri Apr 10 2020 Jindrich Novy <jnovy@redhat.com> - 1:0.2.0-1
- update to https://github.com/containers/skopeo/releases/tag/v0.2.0
- initial rhel8-8.2.1 build
- Related: RHELPLAN-39206