已开启
[sync] PR-83: spec: 将k3s-cni-adaptation补丁声明为Patch0并应用于%prep专用树 #89
openeuler-ci-bot创建于 8月10日
[sync] PR-83: spec: 将k3s-cni-adaptation补丁声明为Patch0并应用于%prep专用树 #89
已开启
共 1 个文件变更+20-8
| @@ -16,13 +16,13 @@ | |||
| 16 | 16 | ||
| 17 | Name: %{project}-%{repo} | 17 | Name: %{project}-%{repo} |
| 18 | Version: 1.2.0 | 18 | Version: 1.2.0 |
| 19 | -Release: 7 | 19 | +Release: 8 |
| 20 | Summary: Libraries for use by writing CNI plugin | 20 | Summary: Libraries for use by writing CNI plugin |
| 21 | License: ASL 2.0 | 21 | License: ASL 2.0 |
| 22 | URL: https://github.com/containernetworking/plugins | 22 | URL: https://github.com/containernetworking/plugins |
| 23 | Source0: https://github.com/containernetworking/plugins/archive/%{built_tag}.tar.gz | 23 | Source0: https://github.com/containernetworking/plugins/archive/%{built_tag}.tar.gz |
| 24 | -Source1: 0001-k3s-cni-adaptation.patch | 24 | +Source1: https://github.com/zchee/reexec/archive/refs/heads/master.zip |
| 25 | -Source2: https://github.com/zchee/reexec/archive/refs/heads/master.zip | 25 | +Patch0: 0001-k3s-cni-adaptation.patch |
| 26 | Patch1: 0002-containernetworking-plugins-add-sw64-support.patch | 26 | Patch1: 0002-containernetworking-plugins-add-sw64-support.patch |
| 27 | 27 | ||
| 28 | BuildRequires: golang >= 1.16.6 | 28 | BuildRequires: golang >= 1.16.6 |
| @@ -96,7 +96,18 @@ providing packages with %{import_path} prefix. | |||
| 96 | %endif | 96 | %endif |
| 97 | 97 | ||
| 98 | %prep | 98 | %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} | ||
| 100 | rm -rf plugins/main/windows | 111 | rm -rf plugins/main/windows |
| 101 | 112 | ||
| 102 | # Use correct paths in cni-dhcp unitfiles | 113 | # Use correct paths in cni-dhcp unitfiles |
| @@ -133,14 +144,12 @@ TMPDIR=$(mktemp -d) | |||
| 133 | WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins | 144 | WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins |
| 134 | mkdir -p $WORKDIR | 145 | mkdir -p $WORKDIR |
| 135 | cd .. | 146 | cd .. |
| 136 | -cp -r plugins-%{version}/* $WORKDIR | 147 | +cp -r %{_builddir}/plugins-cni/plugins-%{version}/* $WORKDIR |
| 137 | mkdir -p $WORKDIR/vendor/github.com/docker/docker/pkg | 148 | mkdir -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} |
| 139 | mv $WORKDIR/vendor/github.com/docker/docker/pkg/reexec-master $WORKDIR/vendor/github.com/docker/docker/pkg/reexec | 150 | mv $WORKDIR/vendor/github.com/docker/docker/pkg/reexec-master $WORKDIR/vendor/github.com/docker/docker/pkg/reexec |
| 140 | 151 | ||
| 141 | cd $WORKDIR | 152 | cd $WORKDIR |
| 142 | -cp %{SOURCE1} ./ | ||
| 143 | -patch -p1 < 0001-k3s-cni-adaptation.patch | ||
| 144 | cat > main.go << EOF | 153 | cat > main.go << EOF |
| 145 | package main | 154 | package main |
| 146 | 155 | ||
| @@ -323,6 +332,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} | |||
| 323 | 332 | ||
| 324 | 333 | ||
| 325 | %changelog | 334 | %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-7 | 338 | * Mon Dec 29 2025 gaoyukun <gaoyukun@kylinos.cn> - 1.2.0-7 |
| 327 | - Fix incorrect file types in/usr/libexec/cni/bridge | 339 | - Fix incorrect file types in/usr/libexec/cni/bridge |
| 328 | 340 | ||