已开启
[sync] PR-83: spec: 将k3s-cni-adaptation补丁声明为Patch0并应用于%prep专用树 #89
[sync] PR-83: spec: 将k3s-cni-adaptation补丁声明为Patch0并应用于%prep专用树 #89
已开启
openeuler-ci-bot创建于 8月10日
共 1 个文件变更+20-8
@@ -16,13 +16,13 @@
16 16
17Name: %{project}-%{repo}17Name: %{project}-%{repo}
18Version: 1.2.018Version: 1.2.0
19-Release: 719+Release: 8
20Summary: Libraries for use by writing CNI plugin20Summary: Libraries for use by writing CNI plugin
21License: ASL 2.021License: ASL 2.0
22URL: https://github.com/containernetworking/plugins22URL: https://github.com/containernetworking/plugins
23Source0: https://github.com/containernetworking/plugins/archive/%{built_tag}.tar.gz23Source0: https://github.com/containernetworking/plugins/archive/%{built_tag}.tar.gz
24-Source1: 0001-k3s-cni-adaptation.patch24+Source1: https://github.com/zchee/reexec/archive/refs/heads/master.zip
25-Source2: https://github.com/zchee/reexec/archive/refs/heads/master.zip25+Patch0: 0001-k3s-cni-adaptation.patch
26Patch1: 0002-containernetworking-plugins-add-sw64-support.patch26Patch1: 0002-containernetworking-plugins-add-sw64-support.patch
27 27 
28BuildRequires: golang >= 1.16.628BuildRequires: golang >= 1.16.6
@@ -96,7 +96,18 @@ providing packages with %{import_path} prefix.
96%endif96%endif
97 97
98%prep98%prep
99-%autosetup -Sgit -n %{repo}-%{built_tag_strip}99+%autosetup -Sgit -n %{repo}-%{built_tag_strip} -N
100+%patch1 -p1
101+# Patch0 (k3s reexec adaptation) must NOT be applied to the main source tree:
102+# it turns the plugin packages into importable libraries, which breaks the
103+# standalone plugin binaries installed to %{_libexecdir}/cni. Apply it here, in
104+# %prep, to a dedicated tree that is used to build the multi-call cni binary.
105+mkdir -p %{_builddir}/plugins-cni
106+tar xzf %{SOURCE0} -C %{_builddir}/plugins-cni
107+cd %{_builddir}/plugins-cni/plugins-%{built_tag_strip}
108+%patch0 -p1
109+%patch1 -p1
110+cd %{_builddir}/plugins-%{built_tag_strip}
100rm -rf plugins/main/windows111rm -rf plugins/main/windows
101 112
102# Use correct paths in cni-dhcp unitfiles113# Use correct paths in cni-dhcp unitfiles
@@ -133,14 +144,12 @@ TMPDIR=$(mktemp -d)
133WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins144WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins
134mkdir -p $WORKDIR145mkdir -p $WORKDIR
135cd ..146cd ..
136-cp -r plugins-%{version}/* $WORKDIR147+cp -r %{_builddir}/plugins-cni/plugins-%{version}/* $WORKDIR
137mkdir -p $WORKDIR/vendor/github.com/docker/docker/pkg148mkdir -p $WORKDIR/vendor/github.com/docker/docker/pkg
138-unzip -d $WORKDIR/vendor/github.com/docker/docker/pkg/ %{SOURCE2}149+unzip -d $WORKDIR/vendor/github.com/docker/docker/pkg/ %{SOURCE1}
139mv $WORKDIR/vendor/github.com/docker/docker/pkg/reexec-master $WORKDIR/vendor/github.com/docker/docker/pkg/reexec150mv $WORKDIR/vendor/github.com/docker/docker/pkg/reexec-master $WORKDIR/vendor/github.com/docker/docker/pkg/reexec
140 151 
141cd $WORKDIR152cd $WORKDIR
142-cp %{SOURCE1} ./
143-patch -p1 < 0001-k3s-cni-adaptation.patch
144cat > main.go << EOF153cat > main.go << EOF
145package main154package main
146 155 
@@ -323,6 +332,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
323 332 
324 333 
325%changelog334%changelog
335+* Thu Aug 06 2026 gaoyukun <gaoyukun@kylinos.cn> - 1.2.0-8
336+- Declare k3s-cni-adaptation patch as Patch0 and apply it in prep stage to a dedicated tree used for building the multi-call cni binary
337+ 
326* Mon Dec 29 2025 gaoyukun <gaoyukun@kylinos.cn> - 1.2.0-7338* Mon Dec 29 2025 gaoyukun <gaoyukun@kylinos.cn> - 1.2.0-7
327- Fix incorrect file types in/usr/libexec/cni/bridge339- Fix incorrect file types in/usr/libexec/cni/bridge
328 340