Blame SPECS/containernetworking-plugins.spec

95181b
%if 0%{?fedora}
95181b
%global with_devel 1
95181b
%global with_bundled 1
95181b
%global with_debug 0
95181b
%global with_check 0
95181b
%global with_unit_test 1
95181b
%else 
95181b
%global with_devel 0
95181b
%global with_bundled 1
95181b
%global with_debug 0
95181b
%global with_check 0
95181b
%global with_unit_test 0
95181b
%endif
95181b
95181b
%if 0%{?with_debug}
95181b
%global _dwz_low_mem_die_limit 0
95181b
%else
95181b
%global debug_package   %{nil}
95181b
%endif
95181b
95181b
%if ! 0%{?gobuild:1}
95181b
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
95181b
%endif
95181b
95181b
%global provider        github
95181b
%global provider_tld    com
95181b
%global project         containernetworking
95181b
%global repo            plugins
95181b
# https://github.com/containernetworking/plugins
95181b
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
95181b
%global import_path     %{provider_prefix}
ba6a76
%global commit          72b62babeeb3d7b25c9809ea9eb9fc9c02cc0f71
95181b
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
95181b
95181b
Name:           containernetworking-plugins
ba6a76
Version:        0.7.1
ba6a76
Release:        1%{?dist}
95181b
Summary:        Some CNI network plugins, maintained by the containernetworking team.
95181b
License:        ASL 2.0
95181b
URL:            https://%{provider_prefix}
95181b
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
95181b
ExcludeArch:    ppc64
95181b
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
95181b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
95181b
95181b
%if ! 0%{?with_bundled}
95181b
BuildRequires: go-md2man
95181b
BuildRequires: go-bindata
95181b
BuildRequires: golang(github.com/vishvananda/netlink)
95181b
BuildRequires: golang(github.com/coreos/go-systemd/activation)
95181b
BuildRequires: golang(github.com/d2g/dhcp4)
95181b
BuildRequires: golang(github.com/d2g/dhcp4client)
95181b
BuildRequires: golang(github.com/vishvananda/netlink)
95181b
BuildRequires: golang(golang.org/x/sys/unix)
95181b
BuildRequires: golang(github.com/coreos/go-iptables/iptables)
95181b
%endif
95181b
95181b
Provides: containernetworking-plugins = %{version}-%{release}
95181b
95181b
%description
95181b
The CNI (Container Network Interface) project consists of a specification
95181b
and libraries for writing plugins to configure network interfaces in Linux
95181b
containers, along with a number of supported plugins. CNI concerns itself
95181b
only with network connectivity of containers and removing allocated resources
95181b
when the container is deleted.
95181b
95181b
%if 0%{?with_devel}
95181b
%package devel
95181b
Summary:       %{summary}
95181b
BuildArch:     noarch
95181b
95181b
%if 0%{?with_check} && ! 0%{?with_bundled}
95181b
BuildRequires: golang(github.com/coreos/go-iptables/iptables)
95181b
BuildRequires: golang(github.com/vishvananda/netlink)
95181b
BuildRequires: golang(golang.org/x/sys/unix)
95181b
%endif
95181b
95181b
Requires:      golang(github.com/coreos/go-iptables/iptables)
95181b
Requires:      golang(github.com/vishvananda/netlink)
95181b
Requires:      golang(golang.org/x/sys/unix)
95181b
95181b
Provides:      golang(%{import_path}/libcni) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/invoke) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/invoke/fakes) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/ip) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/ipam) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/ns) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/skel) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/testutils) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/types) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/types/020) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/types/current) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/utils) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/utils/hwaddr) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/utils/sysctl) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/version) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/version/legacy_examples) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/pkg/version/testhelpers) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/plugins/ipam/host-local/backend) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/plugins/ipam/host-local/backend/allocator) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/plugins/ipam/host-local/backend/disk) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/plugins/ipam/host-local/backend/testing) = %{version}-%{release}
95181b
Provides:      golang(%{import_path}/plugins/test/noop/debug) = %{version}-%{release}
95181b
95181b
%description devel
95181b
This package contains library source intended for
95181b
building other packages which use import path with
95181b
%{import_path} prefix.
95181b
%endif
95181b
95181b
%if 0%{?with_unit_test} && 0%{?with_devel}
95181b
%package unit-test-devel
95181b
Summary:         Unit tests for %{name} package
95181b
%if 0%{?with_check}
95181b
%endif
95181b
95181b
Requires:        %{name}-devel = %{version}-%{release}
95181b
95181b
%if 0%{?with_check} && ! 0%{?with_bundled}
95181b
BuildRequires: golang(github.com/d2g/dhcp4)
95181b
BuildRequires: golang(github.com/onsi/ginkgo)
95181b
BuildRequires: golang(github.com/onsi/ginkgo/config)
95181b
BuildRequires: golang(github.com/onsi/ginkgo/extensions/table)
95181b
BuildRequires: golang(github.com/onsi/gomega)
95181b
BuildRequires: golang(github.com/onsi/gomega/gbytes)
95181b
BuildRequires: golang(github.com/onsi/gomega/gexec)
95181b
BuildRequires: golang(github.com/vishvananda/netlink/nl)
95181b
%endif
95181b
95181b
Requires:      golang(github.com/d2g/dhcp4)
95181b
Requires:      golang(github.com/onsi/ginkgo)
95181b
Requires:      golang(github.com/onsi/ginkgo/config)
95181b
Requires:      golang(github.com/onsi/ginkgo/extensions/table)
95181b
Requires:      golang(github.com/onsi/gomega)
95181b
Requires:      golang(github.com/onsi/gomega/gbytes)
95181b
Requires:      golang(github.com/onsi/gomega/gexec)
95181b
Requires:      golang(github.com/vishvananda/netlink/nl)
95181b
95181b
%description unit-test-devel
95181b
This package contains unit tests for project
95181b
providing packages with %{import_path} prefix.
95181b
%endif
95181b
95181b
%prep
95181b
%setup -q -n %{repo}-%{commit}
95181b
95181b
%build
95181b
./build.sh
95181b
95181b
%install
95181b
install -d -p %{buildroot}%{_libexecdir}/cni/
95181b
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
95181b
95181b
# source codes for building projects
95181b
%if 0%{?with_devel}
95181b
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
95181b
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
95181b
# find all *.go but no *_test.go files and generate devel.file-list
95181b
for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" | grep -v "vendor") ; do
95181b
    dirprefix=$(dirname $file)
95181b
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
95181b
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
95181b
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
95181b
95181b
    while [ "$dirprefix" != "." ]; do
95181b
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
95181b
        dirprefix=$(dirname $dirprefix)
95181b
    done
95181b
done
95181b
%endif
95181b
95181b
# testing files for this project
95181b
%if 0%{?with_unit_test} && 0%{?with_devel}
95181b
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
95181b
# find all *_test.go files and generate unit-test-devel.file-list
95181b
for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do
95181b
    dirprefix=$(dirname $file)
95181b
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix
95181b
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
95181b
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
95181b
95181b
    while [ "$dirprefix" != "." ]; do
95181b
        echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list
95181b
        dirprefix=$(dirname $dirprefix)
95181b
    done
95181b
done
95181b
%endif
95181b
95181b
%if 0%{?with_devel}
95181b
sort -u -o devel.file-list devel.file-list
95181b
%endif
95181b
95181b
%check
95181b
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
95181b
%if ! 0%{?with_bundled}
95181b
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
95181b
%else
95181b
# Since we aren't packaging up the vendor directory we need to link
95181b
# back to it somehow. Hack it up so that we can add the vendor
95181b
# directory from BUILD dir as a gopath to be searched when executing
95181b
# tests from the BUILDROOT dir.
95181b
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
95181b
95181b
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
95181b
%endif
95181b
95181b
%if ! 0%{?gotest:1}
95181b
%global gotest go test
95181b
%endif
95181b
95181b
%gotest %{import_path}/libcni
95181b
%gotest %{import_path}/pkg/invoke
95181b
%gotest %{import_path}/pkg/ip
95181b
%gotest %{import_path}/pkg/ipam
95181b
%gotest %{import_path}/pkg/ns
95181b
%gotest %{import_path}/pkg/skel
95181b
%gotest %{import_path}/pkg/types
95181b
%gotest %{import_path}/pkg/types/020
95181b
%gotest %{import_path}/pkg/types/current
95181b
%gotest %{import_path}/pkg/utils
95181b
%gotest %{import_path}/pkg/utils/hwaddr
95181b
%gotest %{import_path}/pkg/version
95181b
%gotest %{import_path}/pkg/version/legacy_examples
95181b
%gotest %{import_path}/pkg/version/testhelpers
95181b
%gotest %{import_path}/plugins/ipam/dhcp
95181b
%gotest %{import_path}/plugins/ipam/host-local
95181b
%gotest %{import_path}/plugins/ipam/host-local/backend/allocator
95181b
%gotest %{import_path}/plugins/main/bridge
95181b
%gotest %{import_path}/plugins/main/ipvlan
95181b
%gotest %{import_path}/plugins/main/loopback
95181b
%gotest %{import_path}/plugins/main/macvlan
95181b
%gotest %{import_path}/plugins/main/ptp
95181b
%gotest %{import_path}/plugins/meta/flannel
95181b
%gotest %{import_path}/plugins/test/noop
95181b
%endif
95181b
95181b
#define license tag if not already defined
95181b
%{!?_licensedir:%global license %doc}
95181b
95181b
%files
95181b
%license LICENSE
95181b
%doc *.md
95181b
%dir %{_libexecdir}/cni
95181b
%{_libexecdir}/cni/*
95181b
95181b
%if 0%{?with_devel}
95181b
%files devel -f devel.file-list
95181b
%license LICENSE
95181b
%doc *.md
95181b
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
95181b
%endif
95181b
95181b
%if 0%{?with_unit_test} && 0%{?with_devel}
95181b
%files unit-test-devel -f unit-test-devel.file-list
95181b
%license LICENSE
95181b
%doc *.md
95181b
%endif
95181b
95181b
%changelog
ba6a76
* Mon Jul 23 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.1-1
ba6a76
- rebase
ba6a76
95181b
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
95181b
- rebase
95181b
- patches already upstream, removed
95181b
95181b
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
95181b
- Imported from Fedora
95181b
- Renamed CNI -> plugins
95181b
95181b
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
95181b
- Own the libexec cni directory
95181b
95181b
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
95181b
95181b
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
95181b
- skip settling IPv4 addresses
95181b
95181b
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
95181b
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
95181b
95181b
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
95181b
- do not install to /opt (against Fedora Guidelines)
95181b
95181b
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
95181b
- Enable devel subpackage
95181b
95181b
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
95181b
95181b
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
95181b
95181b
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
95181b
- excludearch: ppc64 as it's not in goarches anymore
95181b
- re-enable s390x
95181b
95181b
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
95181b
- upstream moved to github.com/containernetworking/plugins
95181b
- built commit dcf7368
95181b
- provides: containernetworking-plugins
95181b
- use vendored deps because they're a lot less of a PITA
95181b
- excludearch: s390x for now (rhbz#1466865)
95181b
95181b
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
95181b
- Update to 0.5.2 
95181b
- Softlink to default /opt/cni/bin directories
95181b
95181b
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
95181b
- Initial package
95181b