1f2fd3
%if 0%{?fedora} || 0%{?rhel} == 6
1f2fd3
%global with_devel 0
1f2fd3
%global with_bundled 1
1f2fd3
%global with_debug 1
1f2fd3
%global with_check 0
1f2fd3
%global with_unit_test 0
1f2fd3
%else
1f2fd3
%global with_devel 0
1f2fd3
%global with_bundled 1
1f2fd3
%global with_debug 1
1f2fd3
%global with_check 0
1f2fd3
%global with_unit_test 0
1f2fd3
%endif
1f2fd3
1f2fd3
#%if 0%{?with_debug}
1f2fd3
#%global _dwz_low_mem_die_limit 0
1f2fd3
#%else
1f2fd3
%global debug_package   %{nil}
1f2fd3
#%endif
1f2fd3
1f2fd3
%global provider        github
1f2fd3
%global provider_tld    com
1f2fd3
%global project         projectatomic
1f2fd3
%global repo            skopeo
1f2fd3
# https://github.com/projectatomic/skopeo
1f2fd3
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
1f2fd3
%global import_path     %{provider_prefix}
1f2fd3
%global commit          9e971b4937d176aa7ac3af6377b69e58bfd789eb
1f2fd3
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
1f2fd3
1f2fd3
Name:           skopeo
1f2fd3
Epoch:          1
1f2fd3
Version:        0.1.13
1f2fd3
Release:        8%{?dist}
1f2fd3
Summary:        Inspect Docker images and repositories on registries
1f2fd3
License:        ASL 2.0
1f2fd3
URL:            https://%{provider_prefix}
1f2fd3
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
1f2fd3
1f2fd3
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
1f2fd3
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
1f2fd3
BuildRequires:  git
1f2fd3
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
1f2fd3
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} >= 1.6.2
1f2fd3
BuildRequires:  go-md2man
1f2fd3
BuildRequires:  gpgme-devel
1f2fd3
BuildRequires:  libassuan-devel
1f2fd3
1f2fd3
%description
1f2fd3
Command line utility to inspect images and repositories directly on Docker
1f2fd3
registries without the need to pull them
1f2fd3
1f2fd3
%if 0%{?with_devel}
1f2fd3
%package devel
1f2fd3
Summary:       %{summary}
1f2fd3
BuildArch:     noarch
1f2fd3
1f2fd3
%if 0%{?with_check} && ! 0%{?with_bundled}
1f2fd3
BuildRequires: golang(github.com/Azure/go-ansiterm/winterm)
1f2fd3
BuildRequires: golang(github.com/Sirupsen/logrus)
1f2fd3
BuildRequires: golang(github.com/docker/distribution)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/context)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/digest)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/manifest)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/manifest/manifestlist)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/manifest/schema1)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/manifest/schema2)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/reference)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/api/errcode)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/api/v2)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/client)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/client/auth)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/client/transport)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/storage/cache)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/registry/storage/cache/memory)
1f2fd3
BuildRequires: golang(github.com/docker/distribution/uuid)
1f2fd3
BuildRequires: golang(github.com/docker/docker/api)
1f2fd3
BuildRequires: golang(github.com/docker/docker/daemon/graphdriver)
1f2fd3
BuildRequires: golang(github.com/docker/docker/distribution/metadata)
1f2fd3
BuildRequires: golang(github.com/docker/docker/distribution/xfer)
1f2fd3
BuildRequires: golang(github.com/docker/docker/dockerversion)
1f2fd3
BuildRequires: golang(github.com/docker/docker/image)
1f2fd3
BuildRequires: golang(github.com/docker/docker/image/v1)
1f2fd3
BuildRequires: golang(github.com/docker/docker/layer)
1f2fd3
BuildRequires: golang(github.com/docker/docker/opts)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/archive)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/chrootarchive)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/fileutils)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/homedir)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/httputils)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/idtools)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/ioutils)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/jsonlog)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/jsonmessage)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/longpath)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/mflag)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/parsers/kernel)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/plugins)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/pools)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/progress)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/promise)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/random)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/reexec)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/stringid)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/system)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/tarsum)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/term)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/term/windows)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/useragent)
1f2fd3
BuildRequires: golang(github.com/docker/docker/pkg/version)
1f2fd3
BuildRequires: golang(github.com/docker/docker/reference)
1f2fd3
BuildRequires: golang(github.com/docker/docker/registry)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/blkiodev)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/container)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/filters)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/image)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/network)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/registry)
1f2fd3
BuildRequires: golang(github.com/docker/engine-api/types/strslice)
1f2fd3
BuildRequires: golang(github.com/docker/go-connections/nat)
1f2fd3
BuildRequires: golang(github.com/docker/go-connections/tlsconfig)
1f2fd3
BuildRequires: golang(github.com/docker/go-units)
1f2fd3
BuildRequires: golang(github.com/docker/libtrust)
1f2fd3
BuildRequires: golang(github.com/gorilla/context)
1f2fd3
BuildRequires: golang(github.com/gorilla/mux)
1f2fd3
BuildRequires: golang(github.com/opencontainers/runc/libcontainer/user)
1f2fd3
BuildRequires: golang(github.com/vbatts/tar-split/archive/tar)
1f2fd3
BuildRequires: golang(github.com/vbatts/tar-split/tar/asm)
1f2fd3
BuildRequires: golang(github.com/vbatts/tar-split/tar/storage)
1f2fd3
BuildRequires: golang(golang.org/x/net/context)
1f2fd3
%endif
1f2fd3
1f2fd3
%description devel
1f2fd3
%{summary}
1f2fd3
1f2fd3
This package contains library source intended for
1f2fd3
building other packages which use import path with
1f2fd3
%{import_path} prefix.
1f2fd3
%endif
1f2fd3
1f2fd3
%if 0%{?with_unit_test} && 0%{?with_devel}
1f2fd3
%package unit-test-devel
1f2fd3
Summary:         Unit tests for %{name} package
1f2fd3
%if 0%{?with_check}
1f2fd3
#Here comes all BuildRequires: PACKAGE the unit tests
1f2fd3
#in %%check section need for running
1f2fd3
%endif
1f2fd3
1f2fd3
# test subpackage tests code from devel subpackage
1f2fd3
Requires:        %{name}-devel = %{version}-%{release}
1f2fd3
1f2fd3
%description unit-test-devel
1f2fd3
%{summary}
1f2fd3
1f2fd3
This package contains unit tests for project
1f2fd3
providing packages with %{import_path} prefix.
1f2fd3
%endif
1f2fd3
1f2fd3
%prep
1f2fd3
%autosetup -Sgit -n %{repo}-%{commit}
1f2fd3
1f2fd3
%build
1f2fd3
mkdir -p src/github.com/projectatomic
1f2fd3
ln -s ../../../ src/github.com/projectatomic/skopeo
1f2fd3
1f2fd3
mkdir -p vendor/src
1f2fd3
for v in vendor/*; do
1f2fd3
    if test ${v} = vendor/src; then continue; fi
1f2fd3
    if test -d ${v}; then
1f2fd3
	mv ${v} vendor/src/
1f2fd3
    fi
1f2fd3
done
1f2fd3
1f2fd3
%if ! 0%{?with_bundled}
1f2fd3
rm -rf vendor/
1f2fd3
export GOPATH=$(pwd):%{gopath}
1f2fd3
%else
1f2fd3
export GOPATH=$(pwd):$(pwd)/vendor:%{gopath}
1f2fd3
%endif
1f2fd3
1f2fd3
export GO15VENDOREXPERIMENT=1
1f2fd3
1f2fd3
%if ! 0%{?gobuild:1}
1f2fd3
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
1f2fd3
%endif
1f2fd3
1f2fd3
%gobuild -o skopeo ./cmd/skopeo
1f2fd3
1f2fd3
if test -f man/skopeo.1.md; then
1f2fd3
    go-md2man -in man/skopeo.1.md -out skopeo.1
1f2fd3
fi
1f2fd3
1f2fd3
%install
1f2fd3
mkdir -p %{buildroot}/%{_mandir}/man1
1f2fd3
make DESTDIR=%{buildroot} install
1f2fd3
1f2fd3
# source codes for building projects
1f2fd3
%if 0%{?with_devel}
1f2fd3
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
1f2fd3
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
1f2fd3
# find all *.go but no *_test.go files and generate devel.file-list
1f2fd3
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep -v "./vendor") ; do
1f2fd3
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
1f2fd3
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
1f2fd3
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
1f2fd3
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
1f2fd3
done
1f2fd3
%endif
1f2fd3
1f2fd3
# testing files for this project
1f2fd3
%if 0%{?with_unit_test} && 0%{?with_devel}
1f2fd3
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
1f2fd3
# find all *_test.go files and generate unit-test.file-list
1f2fd3
for file in $(find . -iname "*_test.go" | grep -v "./vendor"); do
1f2fd3
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
1f2fd3
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
1f2fd3
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
1f2fd3
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
1f2fd3
done
1f2fd3
%endif
1f2fd3
1f2fd3
%if 0%{?with_devel}
1f2fd3
sort -u -o devel.file-list devel.file-list
1f2fd3
%endif
1f2fd3
1f2fd3
%check
1f2fd3
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
1f2fd3
%if ! 0%{?with_bundled}
1f2fd3
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
1f2fd3
%else
1f2fd3
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
1f2fd3
%endif
1f2fd3
1f2fd3
%gotest %{import_path}/integration
1f2fd3
%endif
1f2fd3
1f2fd3
#define license tag if not already defined
1f2fd3
%{!?_licensedir:%global license %doc}
1f2fd3
1f2fd3
%if 0%{?with_devel}
1f2fd3
%files devel -f devel.file-list
1f2fd3
%license LICENSE
1f2fd3
%doc README.md
1f2fd3
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
1f2fd3
%endif
1f2fd3
1f2fd3
%if 0%{?with_unit_test} && 0%{?with_devel}
1f2fd3
%files unit-test-devel -f unit-test-devel.file-list
1f2fd3
%license LICENSE
1f2fd3
%doc README.md
1f2fd3
%endif
1f2fd3
1f2fd3
%files
1f2fd3
%{_bindir}/skopeo
1f2fd3
%{_mandir}/man1/skopeo.1*
1f2fd3
%license LICENSE
1f2fd3
%doc README.md
1f2fd3
1f2fd3
%changelog
1f2fd3
* Tue Jul 25 2016 Lokesh Mandvekar <lsm5@redhat.com> - 1:0.1.13-8
1f2fd3
- bump release, srpm issues in previous build
1f2fd3
1f2fd3
* Tue Jul 12 2016 Lokesh Mandvekar <lsm5@redhat.com> - 1:0.1.13-7
1f2fd3
- build with golang >= 1.6.2
1f2fd3
1f2fd3
* Fri Jun 24 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1:0.1.13-6
1f2fd3
- Bump Epoch to 1 since that's what skopeo had when it was an atomic
1f2fd3
subpackage
1f2fd3
1f2fd3
* Tue Jun 21 2016 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.1.13-5
1f2fd3
- include go-srpm-macros and compiler(go-compiler) in fedora conditionals
1f2fd3
- define %%gobuild if not already
1f2fd3
- add patch to build with older version of golang
1f2fd3
1f2fd3
* Thu Jun 02 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.13-4
1f2fd3
- update to v0.1.12
1f2fd3
1f2fd3
* Tue May 31 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.12-3
1f2fd3
- fix go build source path
1f2fd3
1f2fd3
* Fri May 27 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.12-2
1f2fd3
- update to v0.1.12
1f2fd3
1f2fd3
* Tue Mar 08 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.11-1
1f2fd3
- update to v0.1.11
1f2fd3
1f2fd3
* Tue Mar 08 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.10-1
1f2fd3
- update to v0.1.10
1f2fd3
- change runcom -> projectatomic
1f2fd3
1f2fd3
* Mon Feb 29 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.9-1
1f2fd3
- update to v0.1.9
1f2fd3
1f2fd3
* Mon Feb 29 2016 Antonio Murdaca <runcom@fedoraproject.org> - 0.1.8-1
1f2fd3
- update to v0.1.8
1f2fd3
1f2fd3
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.4-2
1f2fd3
- https://fedoraproject.org/wiki/Changes/golang1.6
1f2fd3
1f2fd3
* Fri Jan 29 2016 Antonio Murdaca <runcom@redhat.com> - 0.1.4
1f2fd3
- First package for Fedora