@@ -13,6 +13,9 @@ URL: https://github.com/awslabs/soci-snapshotter
1313Source0: https://github.com/awslabs/soci-snapshotter/archive/v%{gover }/soci-snapshotter-%{gover }.tar.gz
1414Source1: bundled-soci-snapshotter-%{gover }.tar.gz
1515Source2: bundled-cmd.tar.gz
16+ Source3: soci-config-toml
17+ Source4: k8s-snapshotter-conf
18+ Source100: etc-soci-snapshotter.mount.in
1619Source101: soci-snapshotter.service
1720Source102: soci-snapshotter.socket
1821Source1000: clarify.toml
@@ -24,12 +27,14 @@ Patch1003: 1003-hard-fail-on-config-parsing-errors.patch
2427BuildRequires: %{_cross_os }glibc-devel
2528BuildRequires: %{_cross_os }libz-devel
2629Requires: %{name }(binaries)
30+ Requires: (%{name }-k8s if %{_cross_os }variant-runtime(k8s))
31+ Requires: %{name }(optimized-gunzip)
2732
2833%description
2934%{summary }.
3035
3136%package bin
32- Summary: Remote management agent binaries
37+ Summary: A remote snapshotter for containerd
3338Provides: %{name }(binaries)
3439Requires: (%{_cross_os }image-feature(no-fips) and %{name })
3540Conflicts: (%{_cross_os }image-feature(fips) or %{name }-fips-bin)
@@ -38,14 +43,45 @@ Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin)
3843%{summary }.
3944
4045%package fips-bin
41- Summary: Remote management agent binaries , FIPS edition
46+ Summary: A remote snapshotter for containerd , FIPS edition
4247Provides: %{name }(binaries)
4348Requires: (%{_cross_os }image-feature(fips) and %{name })
4449Conflicts: (%{_cross_os }image-feature(no-fips) or %{name }-bin)
4550
4651%description fips-bin
4752%{summary }.
4853
54+ %package pigz
55+ Summary: Prefer pigz for gzip decompression
56+ Requires: %{_cross_os }pigz
57+ Requires: %{name }
58+ Provides: %{name }(optimized-gunzip) = 1:
59+ Conflicts: %{name }-igzip
60+
61+ %description pigz
62+ %{summary }.
63+
64+ %package igzip
65+ Summary: Prefer igzip for gzip decompression
66+ Requires: %{_cross_os }igzip
67+ Requires: %{name }
68+ Conflicts: %{name }-pigz
69+ %if "%{_cross_arch }" == "x86_64 "
70+ Provides: %{name }(optimized-gunzip) = 2:
71+ %else
72+ Provides: %{name }(optimized-gunzip) = 0:
73+ %endif
74+
75+ %description igzip
76+ %{summary }.
77+
78+ %package k8s
79+ Summary: Drop-ins to override the kubelet's configuration
80+ Provides: %{name }(k8s)
81+
82+ %description k8s
83+ %{summary }.
84+
4985%prep
5086%autosetup -n %{gorepo }-%{gover } -p1
5187%setup -T -D -n %{gorepo }-%{gover } -b 1 -q
@@ -58,37 +94,56 @@ export LD_VERSION="-X github.com/awslabs/soci-snapshotter/version.Version=v%{gov
5894export LD_REVISION= "-X github.com/awslabs/soci-snapshotter/version.Revision= %{gitrev }"
5995
6096go build -C cmd -ldflags= "${GOLDFLAGS} ${LD_VERSION} ${LD_REVISION}" -o "../out/soci-snapshotter-grpc" ./soci-snapshotter-grpc
61- go build -C cmd -ldflags= "${GOLDFLAGS} ${LD_VERSION} ${LD_REVISION}" -o "../out/soci" ./soci
6297
6398gofips build -C cmd -ldflags= "${GOLDFLAGS} ${LD_VERSION} ${LD_REVISION}" -o "../out/fips/soci-snapshotter-grpc" ./soci-snapshotter-grpc
64- gofips build -C cmd -ldflags= "${GOLDFLAGS} ${LD_VERSION} ${LD_REVISION}" -o "../out/fips/soci" ./soci
6599
66100%install
67101install -d %{buildroot }%{_cross_bindir }
68102install -d %{buildroot }%{_cross_fips_bindir }
69103install -d %{buildroot }%{_cross_unitdir }
70104install -p -m 0755 out/soci-snapshotter-grpc %{buildroot }%{_cross_bindir }
71- install -p -m 0755 out/soci %{buildroot }%{_cross_bindir }
72105install -p -m 0755 out/fips/soci-snapshotter-grpc %{buildroot }%{_cross_fips_bindir }
73- install -p -m 0755 out/fips/soci %{buildroot }%{_cross_fips_bindir }
106+
107+ SOCIMOUNTPATH= $(systemd-escape --path /etc/soci-snapshotter)
108+ install -p -m 0644 %{S:100 } %{buildroot }%{_cross_unitdir }/${SOCIMOUNTPATH}.mount
109+
74110install -D -p -m 0644 %{S:101 } %{buildroot }%{_cross_unitdir }
75111install -D -p -m 0644 %{S:102 } %{buildroot }%{_cross_unitdir }
76112
113+ install -d %{buildroot }%{_cross_templatedir }
114+ install -p -m 0644 %{S:3 } %{buildroot }%{_cross_templatedir }/soci-config-toml
115+ install -p -m 0644 %{S:4 } %{buildroot }%{_cross_templatedir }/k8s-snapshotter-conf
116+
77117%cross_scan_attribution --clarify %{S:1000 } go-vendor vendor
78118
119+ %post igzip -p < lua>
120+ posix.symlink(" %{_cross_bindir}/igzip" , " %{_cross_bindir}/soci-gunzip" )
121+
122+ %post pigz -p < lua>
123+ posix.symlink(" %{_cross_bindir}/unpigz" , " %{_cross_bindir}/soci-gunzip" )
124+
79125%files
80126%license LICENSE NOTICE.md
81127%{_cross_unitdir }/soci-snapshotter.service
82128%{_cross_unitdir }/soci-snapshotter.socket
129+ %{_cross_unitdir }/etc-soci\x 2dsnapshotter.mount
83130%{_cross_attribution_vendor_dir }
84131%{_cross_attribution_file }
132+ %{_cross_templatedir }/soci-config-toml
85133
86134%files bin
87135%{_cross_bindir }/soci-snapshotter-grpc
88- %{_cross_bindir }/soci
89136
90137%files fips-bin
91138%{_cross_fips_bindir }/soci-snapshotter-grpc
92- %{_cross_fips_bindir }/soci
139+
140+ %files pigz
141+ # No files provided by pigz but required for packaging.
142+
143+ %files igzip
144+ # No files provided by igzip but required for packaging.
145+
146+ %files k8s
147+ %{_cross_templatedir }/k8s-snapshotter-conf
93148
94149%changelog
0 commit comments