diff --git a/.gitignore b/.gitignore index f6a3a77..48c30c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,38 @@ -/*.tar.gz +/19f2f28178aa88772f69c4eeb3793d4a63c244b0.tar.gz +/9ebe139e77e82afb122e335328007bca86905ae4.tar.gz +/a62711a5da7a2dc2eb93eac47e103738ad923fd6.tar.gz +/fe60fcddb897079746ec1523fd1837ab05b1e689.tar.gz +/966bbcb8a572aa4c253ea9650888ad2306e3c8f2.tar.gz +/7ba2bcfeab482eaaa7d6e7e4ec9fbd493c54d4fa.tar.gz +/ded2f1757770e8e2aa41f65687f8fc876f83048b.tar.gz +/ccd683e1a3109adf19919291642a514f0dff0c6f.tar.gz +/2d6d4b260a98973a206fde18bdde4f2511c72c60.tar.gz +/c9e1c0c1edecfa407069a01059dab958ede6b709.tar.gz +/485be65581341430f9106a194a98f0f2412245fb.tar.gz +/7e6843008129e5b8283beee2f81ee71d7834ab7c.tar.gz +/4bb288193ce68c35ca2cb3a7d06ce1dd05fe18f6.tar.gz +/23d5525ec3745a5b6f937fdc7e5fd1f95ea876ae.tar.gz +/291ab6cc849c83882cbe5988c483b334ad1aee36.tar.gz +/f5c3d1b1bab6ee72a32702c22ebb0f008580ef2d.tar.gz +/47a9fd80c8258a288db0bb39f68516a4770012a4.tar.gz +/117e30ff2151e8ae8b3c49fcdcc77def3fae6c9d.tar.gz +/f4332fec59a8f1e3a23cc75eec7f817c93483387.tar.gz +/a78853f29fa73cb211bb05698e6b313cd4404fa1.tar.gz +/5af9ff493e60ddda7b6d75a26ff3ba635c7debfb.tar.gz +/f7a2fc97e4282bdf82754bd758d0a5f9d4d99525.tar.gz +/ad10b6fa91aacd720f1f9ab94341a97a82a24965.tar.gz +/b76fdd7c03f434a3a481bfaee0a0e48e70979486.tar.gz +/1fb9793607361bc8ae032a12964c67e7f2b92079.tar.gz +/e1f8f9bee5e8e9b6406d6060bd0cb41cdc76d1b0.tar.gz +/28773dc92574b0546da25f6b777f9ff99f11815a.tar.gz +/c90b165c6e6bd7ee6c32188092d9a9442f1aba22.tar.gz +/6eb8e31d215c254a58aab527c94313e8d147242b.tar.gz +/d713ec692c8d2da2bc567690846738a567d72f33.tar.gz +/8a88f90f9413dbbb058f62c1735eca4e08e988dd.tar.gz +/bd589992fbe0740418fcc7df7572bd98f4d759c0.tar.gz +/9b8de6a613657df14a3a5958642872fa9855d570.tar.gz +/e78e6aa5b9fd7e3e66f0cb997152c44c2a4e43df.tar.gz +/6df03d79376a4b0d5af10948886fdd98a1aca9ec.tar.gz +/a9abbaf19b305e45ff174694ebb5e8d6a21c892e.tar.gz +/440dcc331b692e64bcf0893a22ceda1826ee9f61.tar.gz +/ccd872bd7a834e0948758cc039a90721d817a8ed.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef21634 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# containernetworking-plugins + +The containernetworking-plugins package \ No newline at end of file diff --git a/containernetworking-plugins.spec b/containernetworking-plugins.spec index a9f14e7..7de838b 100644 --- a/containernetworking-plugins.spec +++ b/containernetworking-plugins.spec @@ -1,5 +1,13 @@ -%global with_debug 1 +%global with_devel 1 +%global with_bundled 1 %global with_check 0 +%global with_unit_test 1 + +%if 0%{?fedora} +%global with_debug 1 +%else +%global with_debug 0 +%endif %if 0%{?with_debug} %global _find_debuginfo_dwz_opts %{nil} @@ -9,31 +17,48 @@ %endif %if ! 0%{?gobuild:1} -%define gobuild(o:) \ -go build -buildmode pie -compiler gc -tags="rpm_crashtraceback no_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; -%define gotest(o:) go test +%define gobuild(o:) GO111MODULE=off 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 %global provider_tld com %global project containernetworking %global repo plugins -# https://github.com/containernetworking/plugins -%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} -%global import_path %{provider_prefix} +%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} +%global git0 https://%{import_path} +%global commit0 ccd872bd7a834e0948758cc039a90721d817a8ed +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) -Name: containernetworking-plugins +# Used for comparing with latest upstream tag +# to decide whether to autobuild (non-rawhide only) +%global built_tag v0.8.6 + +Name: %{project}-%{repo} Version: 0.8.7 -Release: 18%{?dist} -Summary: CNI network plugins +Release: 17.1.git%{shortcommit0}%{?dist} +Summary: Libraries for writing CNI plugin License: ASL 2.0 -URL: https://%{provider_prefix} -Source0: https://%{provider_prefix}/archive/v%{version}.tar.gz -ExcludeArch: ppc64 i686 -BuildRequires: golang >= 1.12.12-4 +URL: %{git0} +Source0: %{git0}/archive/%{commit0}.tar.gz +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: golang BuildRequires: git BuildRequires: go-md2man -Provides: containernetworking-cni = %{version}-%{release} + +%if ! 0%{?with_bundled} +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 + +Obsoletes: %{project}-cni < 0.7.1-2 +Provides: %{project}-cni = %{version}-%{release} +Provides: kubernetes-cni %description The CNI (Container Network Interface) project consists of a specification @@ -42,8 +67,85 @@ 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 + %prep -%autosetup -Sgit -n %{repo}-%{version} +%autosetup -Sgit -n %{repo}-%{commit0} rm -rf plugins/main/windows %build @@ -51,31 +153,71 @@ 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 + mkdir -p gopath/src/${ORG_PATH} + ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 fi export GOPATH=$(pwd)/gopath -export GO111MODULE=off -export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" 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 + 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} +%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 @@ -83,6 +225,11 @@ install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni ln -s ./ ./vendor/src # ./vendor/src -> ./vendor export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} +%endif + +%if ! 0%{?gotest:1} +%global gotest go test +%endif %gotest %{import_path}/libcni %gotest %{import_path}/pkg/invoke @@ -119,9 +266,22 @@ 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 + +%if 0%{?with_unit_test} && 0%{?with_devel} +%files unit-test-devel -f unit-test-devel.file-list +%license LICENSE +%doc *.md +%endif + %changelog -* Thu Oct 29 2020 Jindrich Novy - 0.8.7-18 -- synchronize with stream-container-tools-rhel8 +* Thu Nov 5 2020 RH Container Bot - 0.8.7-17.1.gitccd872b +- autobuilt ccd872b * Fri Oct 23 2020 RH Container Bot - 0.8.7-16.1.git440dcc3 - autobuilt 440dcc3 diff --git a/sources b/sources index 651a132..69195df 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -624772d0233c3c391d0cd254e24b02c6 v0.8.7.tar.gz +SHA512 (ccd872bd7a834e0948758cc039a90721d817a8ed.tar.gz) = abea54e3acbbac5a4ce6cbd0cc392ce2b06b3b6de89f339cd2ddcaa962d02483ab8192e4cb4e4ca00d59f4f4abd4785ccf751ffe2ba1c6dc80fceb9c7cc0979c