-
Notifications
You must be signed in to change notification settings - Fork 569
/
Copy pathgolang.spec
296 lines (227 loc) · 10.2 KB
/
golang.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
%global bootstrap_compiler_version 1.19.12
%global goroot %{_libdir}/golang
%global gopath %{_datadir}/gocode
%ifarch aarch64
%global gohostarch arm64
%else
%global gohostarch amd64
%endif
%define debug_package %{nil}
%define __strip /bin/true
# rpmbuild magic to keep from having meta dependency on libc.so.6
%define _use_internal_dependency_generator 0
%define __find_requires %{nil}
Summary: Go
Name: golang
Version: 1.20.7
Release: 1%{?dist}
License: BSD-3-Clause
Vendor: Microsoft Corporation
Distribution: Mariner
Group: System Environment/Security
URL: https://golang.org
Source0: https://golang.org/dl/go%{version}.src.tar.gz
Source1: https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
Source2: https://dl.google.com/go/go%{bootstrap_compiler_version}.src.tar.gz
Patch0: go14_bootstrap_aarch64.patch
Patch1: permit-requests-with-invalid-header.patch
Obsoletes: %{name} < %{version}
Provides: %{name} = %{version}
Provides: go = %{version}-%{release}
%description
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
%prep
# Setup go 1.4 bootstrap source
tar xf %{SOURCE1} --no-same-owner
patch -Np1 --ignore-whitespace < %{PATCH0}
mv -v go go-bootstrap
%setup -q -n go
%patch1 -p1
%build
# (go >= 1.20 bootstraps with go >= 1.17)
# This condition makes go compiler >= 1.20 build a 3 step process:
# - Build the bootstrap compiler 1.4 (bootstrap bits in c)
# - Use the 1.4 compiler to build %{bootstrap_compiler_version}
# - Use the %{bootstrap_compiler_version} compiler to build go >= 1.20 compiler
# PS: Since go compiles fairly quickly, the extra overhead is arounnd 2-3 minutes
# on a reasonable machine.
# Build go 1.4 bootstrap
pushd %{_topdir}/BUILD/go-bootstrap/src
CGO_ENABLED=0 ./make.bash
popd
mv -v %{_topdir}/BUILD/go-bootstrap %{_libdir}/golang
export GOROOT=%{_libdir}/golang
# Use go1.4 bootstrap to compile go%{bootstrap_compiler_version} (bootstrap)
export GOROOT_BOOTSTRAP=%{_libdir}/golang
mkdir -p %{_topdir}/BUILD/go%{bootstrap_compiler_version}
tar xf %{SOURCE2} -C %{_topdir}/BUILD/go%{bootstrap_compiler_version} --strip-components=1
pushd %{_topdir}/BUILD/go%{bootstrap_compiler_version}/src
CGO_ENABLED=0 ./make.bash
popd
# Nuke the older go1.4 bootstrap
rm -rf %{_libdir}/golang
# Make go%{bootstrap_compiler_version} as the new bootstrapper
mv -v %{_topdir}/BUILD/go1.19.12 %{_libdir}/golang
# Build current go version
export GOHOSTOS=linux
export GOHOSTARCH=%{gohostarch}
export GOROOT_BOOTSTRAP=%{goroot}
export GOROOT="`pwd`"
export GOPATH=%{gopath}
export GOROOT_FINAL=%{_bindir}/go
rm -f %{gopath}/src/runtime/*.c
pushd src
./make.bash --no-clean
popd
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{goroot}
cp -R api bin doc lib pkg src misc VERSION %{buildroot}%{goroot}
# remove the unnecessary zoneinfo file (Go will always use the system one first)
rm -rfv %{buildroot}%{goroot}/lib/time
# remove the doc Makefile
rm -rfv %{buildroot}%{goroot}/doc/Makefile
# put binaries to bindir, linked to the arch we're building,
# leave the arch independent pieces in %{goroot}
mkdir -p %{buildroot}%{goroot}/bin/linux_%{gohostarch}
ln -sfv ../go %{buildroot}%{goroot}/bin/linux_%{gohostarch}/go
ln -sfv ../gofmt %{buildroot}%{goroot}/bin/linux_%{gohostarch}/gofmt
ln -sfv %{goroot}/bin/gofmt %{buildroot}%{_bindir}/gofmt
ln -sfv %{goroot}/bin/go %{buildroot}%{_bindir}/go
# ensure these exist and are owned
mkdir -p %{buildroot}%{gopath}/src/github.com/
mkdir -p %{buildroot}%{gopath}/src/bitbucket.org/
mkdir -p %{buildroot}%{gopath}/src/code.google.com/p/
install -vdm755 %{buildroot}%{_sysconfdir}/profile.d
cat >> %{buildroot}%{_sysconfdir}/profile.d/go-exports.sh <<- "EOF"
export GOROOT=%{goroot}
export GOPATH=%{_datadir}/gocode
export GOHOSTOS=linux
export GOHOSTARCH=%{gohostarch}
export GOOS=linux
EOF
%post -p /sbin/ldconfig
%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
#This is uninstall
rm %{_sysconfdir}/profile.d/go-exports.sh
rm -rf /opt/go
exit 0
fi
%files
%defattr(-,root,root)
%license LICENSE
%exclude %{goroot}/src/*.rc
%exclude %{goroot}/include/plan9
%{_sysconfdir}/profile.d/go-exports.sh
%{goroot}/*
%{gopath}/src
%exclude %{goroot}/src/pkg/debug/dwarf/testdata
%exclude %{goroot}/src/pkg/debug/elf/testdata
%{_bindir}/*
%changelog
* Tue Aug 15 2023 Muhammad Falak <[email protected]> - 1.20.7-1
- Bump version to 1.20.7
- Introduce patch to permit requests with invalid host header
* Tue Aug 15 2023 Muhammad Falak <[email protected]> - 1.19.12-1
- Auto-upgrade to 1.19.12 to address CVE-2023-29409
- Introduce patch to permit requests with invalid header
* Thu Jul 13 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.11-1
- Auto-upgrade to 1.19.11 - Fix CVE-2023-29406
* Thu Jun 15 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.10-1
- Auto-upgrade to 1.19.10 - address CVE-2023-24540, CVE-2023-29402, CVE-2023-29403, CVE-2023-29404, CVE-2023-29405
* Wed Apr 05 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.8-1
- Auto-upgrade to 1.19.8 - address CVE-2023-24534, CVE-2023-24536, CVE-2023-24537, CVE-2023-24538
* Tue Mar 28 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.7-1
- Auto-upgrade to 1.19.7 - address CVE-2023-24532
* Wed Mar 15 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.6-1
- Auto-upgrade to 1.19.6 - Address CVE-2022-41722, CVE-2022-41724, CVE-2022-41725, CVE-2022-41723
* Fri Feb 03 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.5-1
- Auto-upgrade to 1.19.5 - upgrade to latest
* Wed Jan 18 2023 CBL-Mariner Servicing Account <[email protected]> - 1.19.4-1
- Auto-upgrade to 1.19.4
* Thu Dec 15 2022 Daniel McIlvaney <[email protected]> - 1.18.8-2
- Patch CVE-2022-41717
* Tue Nov 01 2022 Olivia Crain <[email protected]> - 1.18.8-1
- Upgrade to version 1.18.8 (fixes CVE-2022-41716, which only applies to Windows environments)
- Also fixes CVE-2022-2879, CVE-2022-2880, CVE-2022-41715 (fixed in 1.18.7)
- Also fixes CVE-2022-27664, CVE-2022-32190 (fixed in 1.18.6)
- Use SPDX short identifier for license tag
* Fri Aug 19 2022 Olivia Crain <[email protected]> - 1.18.5-1
- Upgrade to version to fix CVE-2022-1705, CVE-2022-1962, CVE-2022-28131,
CVE-2022-30630, CVE-2022-30631, CVE-2022-30632, CVE-2022-30633, CVE-2022-30635,
CVE-2022-32148, and CVE-2022-32189
* Tue Jun 14 2022 Muhammad Falak <[email protected]> - 1.18.3-1
- Bump version to 1.18.3 to address CVE-2022-24675 & CVE-2022-28327
* Tue Apr 12 2022 Muhammad Falak <[email protected]> - 1.17.8-1
- Bump version to 1.17.8 to address CVE-2021-44716
* Thu Feb 17 2022 Andrew Phelps <[email protected]> - 1.17.1-2
- Use _topdir instead of hard-coded value /usr/src/mariner
- License verified
* Wed Sep 15 2021 Andrew Phelps <[email protected]> - 1.17.1-1
- Updated to version 1.17.1
* Tue Jun 08 2021 Henry Beberman <[email protected]> - 1.15.13-1
- Updated to version 1.15.13 to fix CVE-2021-33194 and CVE-2021-31525
* Mon Apr 26 2021 Nicolas Guibourge <[email protected]> - 1.15.11-1
- Updated to version 1.15.11 to fix CVE-2021-27918
* Wed Feb 03 2021 Andrew Phelps <[email protected]> - 1.15.7-1
- Updated to version 1.15.7 to fix CVE-2021-3114
* Mon Nov 23 2020 Henry Beberman <[email protected]> - 1.15.5-1
- Updated to version 1.15.5
* Fri Oct 30 2020 Thomas Crain <[email protected]> - 1.13.15-2
- Patch CVE-2020-24553
* Tue Sep 08 2020 Nicolas Ontiveros <[email protected]> - 1.13.15-1
- Updated to version 1.13.15, which fixes CVE-2020-14039 and CVE-2020-16845.
* Sun May 24 2020 Mateusz Malisz <[email protected]> - 1.13.11-1
- Updated to version 1.13.11
* Sat May 09 2020 Nick Samson <[email protected]> - 1.12.5-7
- Added %%license line automatically
* Thu Apr 30 2020 Emre Girgin <[email protected]> - 1.12.5-6
- Renaming go to golang
* Thu Apr 23 2020 Nicolas Ontiveros <[email protected]> - 1.12.5-5
- Fix CVE-2019-14809.
* Fri Mar 27 2020 Andrew Phelps <[email protected]> - 1.12.5-4
- Support building standalone by adding go 1.4 bootstrap.
* Thu Feb 27 2020 Henry Beberman <[email protected]> - 1.12.5-3
- Remove meta dependency on libc.so.6
* Thu Feb 6 2020 Andrew Phelps <[email protected]> - 1.12.5-2
- Remove ExtraBuildRequires
* Tue Sep 03 2019 Mateusz Malisz <[email protected]> - 1.12.5-1
- Initial CBL-Mariner import from Photon (license: Apache2).
* Mon Jan 21 2019 Bo Gan <[email protected]> - 1.9.7-1
- Update to 1.9.7
* Wed Oct 24 2018 Alexey Makhalov <[email protected]> - 1.9.4-3
- Use extra build requires
* Mon Apr 02 2018 Dheeraj Shetty <[email protected]> - 1.9.4-2
- Fix for CVE-2018-7187
* Thu Mar 15 2018 Xiaolin Li <[email protected]> - 1.9.4-1
- Update to golang release v1.9.4
* Tue Nov 14 2017 Alexey Makhalov <[email protected]> - 1.9.1-2
- Aarch64 support
* Wed Nov 01 2017 Vinay Kulkarni <[email protected]> - 1.9.1-1
- Update to golang release v1.9.1
* Wed May 31 2017 Xiaolin Li <[email protected]> - 1.8.1-2
- Remove mercurial from buildrequires and requires.
* Tue Apr 11 2017 Danut Moraru <[email protected]> - 1.8.1-1
- Update Golang to version 1.8.1, updated patch0
* Wed Dec 28 2016 Xiaolin Li <[email protected]> - 1.7.4-1
- Updated Golang to 1.7.4.
* Thu Oct 06 2016 ChangLee <[email protected]> - 1.6.3-2
- Modified %check
* Wed Jul 27 2016 Anish Swaminathan <[email protected]> - 1.6.3-1
- Update Golang to version 1.6.3 - fixes CVE 2016-5386
* Fri Jul 8 2016 Harish Udaiya Kumar <[email protected]> - 1.6.2-1
- Updated the Golang to version 1.6.2
* Thu Jun 2 2016 Priyesh Padmavilasom <[email protected]> - 1.4.2-5
- Fix script syntax
* Tue May 24 2016 Priyesh Padmavilasom <[email protected]> - 1.4.2-4
- GA - Bump release of all rpms
* Thu May 05 2016 Kumar Kaushik <[email protected]> - 1.4.2-3
- Handling upgrade scenario pre/post/un scripts.
* Wed Dec 09 2015 Anish Swaminathan <[email protected]> - 1.4.2-2
- Edit post script.
* Mon Aug 03 2015 Vinay Kulkarni <[email protected]> - 1.4.2-1
- Update to golang release version 1.4.2
* Fri Oct 17 2014 Divya Thaluru <[email protected]> - 1.3.3-1
- Initial build. First version