diff --git a/.containernetworking-plugins.metadata b/.containernetworking-plugins.metadata index f012779..4e47661 100644 --- a/.containernetworking-plugins.metadata +++ b/.containernetworking-plugins.metadata @@ -1 +1 @@ -e7bb7f5c7d57e855e89c948e07a61d99cb087031 SOURCES/plugins-72b62ba.tar.gz +97ba3a594cae5771913218e3a4a9722ccc88e2e3 SOURCES/plugins-9ebe139.tar.gz diff --git a/.gitignore b/.gitignore index 7289128..a8ad5ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/plugins-72b62ba.tar.gz +SOURCES/plugins-9ebe139.tar.gz diff --git a/SPECS/containernetworking-plugins.spec b/SPECS/containernetworking-plugins.spec index 6c5caa1..1597a53 100644 --- a/SPECS/containernetworking-plugins.spec +++ b/SPECS/containernetworking-plugins.spec @@ -1,16 +1,5 @@ -%if 0%{?fedora} -%global with_devel 1 -%global with_bundled 1 -%global with_debug 0 +%global with_debug 1 %global with_check 0 -%global with_unit_test 1 -%else -%global with_devel 0 -%global with_bundled 1 -%global with_debug 0 -%global with_check 0 -%global with_unit_test 0 -%endif %if 0%{?with_debug} %global _dwz_low_mem_die_limit 0 @@ -19,7 +8,7 @@ %endif %if ! 0%{?gobuild:1} -%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; %endif %global provider github @@ -29,33 +18,26 @@ # https://github.com/containernetworking/plugins %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} -%global commit 72b62babeeb3d7b25c9809ea9eb9fc9c02cc0f71 +%global commit 9ebe139e77e82afb122e335328007bca86905ae4 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: containernetworking-plugins -Version: 0.7.1 +Version: 0.7.4 Release: 1%{?dist} Summary: Some CNI network plugins, maintained by the containernetworking team. License: ASL 2.0 URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz -ExcludeArch: ppc64 -# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} - -%if ! 0%{?with_bundled} -BuildRequires: go-md2man -BuildRequires: go-bindata -BuildRequires: golang(github.com/vishvananda/netlink) -BuildRequires: golang(github.com/coreos/go-systemd/activation) -BuildRequires: golang(github.com/d2g/dhcp4) -BuildRequires: golang(github.com/d2g/dhcp4client) -BuildRequires: golang(github.com/vishvananda/netlink) -BuildRequires: golang(golang.org/x/sys/unix) -BuildRequires: golang(github.com/coreos/go-iptables/iptables) -%endif +ExclusiveArch: aarch64 %{arm} ppc64le s390x x86_64 + +%if 0%{?fedora} || 0%{?centos} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +%else +BuildRequires: go-toolset-1.10 +BuildRequires: openssl-devel +%endif #fedora -Provides: containernetworking-plugins = %{version}-%{release} +Provides: containernetworking-cni = %{version}-%{release} %description The CNI (Container Network Interface) project consists of a specification @@ -64,145 +46,39 @@ containers, along with a number of supported plugins. CNI concerns itself only with network connectivity of containers and removing allocated resources when the container is deleted. -%if 0%{?with_devel} -%package devel -Summary: %{summary} -BuildArch: noarch - -%if 0%{?with_check} && ! 0%{?with_bundled} -BuildRequires: golang(github.com/coreos/go-iptables/iptables) -BuildRequires: golang(github.com/vishvananda/netlink) -BuildRequires: golang(golang.org/x/sys/unix) -%endif - -Requires: golang(github.com/coreos/go-iptables/iptables) -Requires: golang(github.com/vishvananda/netlink) -Requires: golang(golang.org/x/sys/unix) - -Provides: golang(%{import_path}/libcni) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/invoke) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/invoke/fakes) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/ip) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/ipam) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/ns) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/skel) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/testutils) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/types) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/types/020) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/types/current) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/utils) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/utils/hwaddr) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/utils/sysctl) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/version) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/version/legacy_examples) = %{version}-%{release} -Provides: golang(%{import_path}/pkg/version/testhelpers) = %{version}-%{release} -Provides: golang(%{import_path}/plugins/ipam/host-local/backend) = %{version}-%{release} -Provides: golang(%{import_path}/plugins/ipam/host-local/backend/allocator) = %{version}-%{release} -Provides: golang(%{import_path}/plugins/ipam/host-local/backend/disk) = %{version}-%{release} -Provides: golang(%{import_path}/plugins/ipam/host-local/backend/testing) = %{version}-%{release} -Provides: golang(%{import_path}/plugins/test/noop/debug) = %{version}-%{release} - -%description devel -This package contains library source intended for -building other packages which use import path with -%{import_path} prefix. -%endif - -%if 0%{?with_unit_test} && 0%{?with_devel} -%package unit-test-devel -Summary: Unit tests for %{name} package -%if 0%{?with_check} -%endif - -Requires: %{name}-devel = %{version}-%{release} - -%if 0%{?with_check} && ! 0%{?with_bundled} -BuildRequires: golang(github.com/d2g/dhcp4) -BuildRequires: golang(github.com/onsi/ginkgo) -BuildRequires: golang(github.com/onsi/ginkgo/config) -BuildRequires: golang(github.com/onsi/ginkgo/extensions/table) -BuildRequires: golang(github.com/onsi/gomega) -BuildRequires: golang(github.com/onsi/gomega/gbytes) -BuildRequires: golang(github.com/onsi/gomega/gexec) -BuildRequires: golang(github.com/vishvananda/netlink/nl) -%endif - -Requires: golang(github.com/d2g/dhcp4) -Requires: golang(github.com/onsi/ginkgo) -Requires: golang(github.com/onsi/ginkgo/config) -Requires: golang(github.com/onsi/ginkgo/extensions/table) -Requires: golang(github.com/onsi/gomega) -Requires: golang(github.com/onsi/gomega/gbytes) -Requires: golang(github.com/onsi/gomega/gexec) -Requires: golang(github.com/vishvananda/netlink/nl) - -%description unit-test-devel -This package contains unit tests for project -providing packages with %{import_path} prefix. -%endif +%{?enable_gotoolset110} %prep -%setup -q -n %{repo}-%{commit} +%autosetup -Sgit -n %{repo}-%{commit} %build -./build.sh +export ORG_PATH="%{provider}.%{provider_tld}/%{project}" +export REPO_PATH="$ORG_PATH/%{repo}" + +if [ ! -h gopath/src/${REPO_PATH} ]; then + mkdir -p gopath/src/${ORG_PATH} + ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 +fi + +export GOPATH=$(pwd)/gopath +mkdir -p $(pwd)/bin + +echo "Building plugins" +export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample" +for d in $PLUGINS; do + if [ -d "$d" ]; then + plugin="$(basename "$d")" + echo " $plugin" + %gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d + fi +done %install install -d -p %{buildroot}%{_libexecdir}/cni/ install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni -# source codes for building projects -%if 0%{?with_devel} -install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ -echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list -# find all *.go but no *_test.go files and generate devel.file-list -for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" | grep -v "vendor") ; do - dirprefix=$(dirname $file) - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list - - while [ "$dirprefix" != "." ]; do - echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list - dirprefix=$(dirname $dirprefix) - done -done -%endif - -# testing files for this project -%if 0%{?with_unit_test} && 0%{?with_devel} -install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ -# find all *_test.go files and generate unit-test-devel.file-list -for file in $(find . -iname "*_test.go" | grep -v "vendor") ; do - dirprefix=$(dirname $file) - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$dirprefix - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list - - while [ "$dirprefix" != "." ]; do - echo "%%dir %%{gopath}/src/%%{import_path}/$dirprefix" >> devel.file-list - dirprefix=$(dirname $dirprefix) - done -done -%endif - -%if 0%{?with_devel} -sort -u -o devel.file-list devel.file-list -%endif - %check -%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} -%if ! 0%{?with_bundled} -export GOPATH=%{buildroot}/%{gopath}:%{gopath} -%else -# Since we aren't packaging up the vendor directory we need to link -# back to it somehow. Hack it up so that we can add the vendor -# directory from BUILD dir as a gopath to be searched when executing -# tests from the BUILDROOT dir. -ln -s ./ ./vendor/src # ./vendor/src -> ./vendor - -export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} -%endif +%if 0%{?with_check} %if ! 0%{?gotest:1} %global gotest go test @@ -243,20 +119,21 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %dir %{_libexecdir}/cni %{_libexecdir}/cni/* -%if 0%{?with_devel} -%files devel -f devel.file-list -%license LICENSE -%doc *.md -%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} -%endif +%changelog +* Mon Jan 07 2019 Lokesh Mandvekar - 0.7.4-1 +- Resolves: #1664009 - bump to v0.7.4 +- remove unused devel and unit-test* packages +- update go build env -%if 0%{?with_unit_test} && 0%{?with_devel} -%files unit-test-devel -f unit-test-devel.file-list -%license LICENSE -%doc *.md -%endif +* Wed Nov 21 2018 Frantisek Kluknavsky - 0.7.3-3 +- buildrequires for centos + +* Wed Oct 03 2018 Frantisek Kluknavsky - 0.7.3-2 +- rebase + +* Wed Oct 03 2018 Frantisek Kluknavsky - 0.7.1-2 +- scl go toolset -%changelog * Mon Jul 23 2018 Frantisek Kluknavsky - 0.7.1-1 - rebase