Skip to content

Commit c808001

Browse files
authored
fix golang post install and post uninstall sriptlets (#12026)
1 parent cb6ac00 commit c808001

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

SPECS/golang/golang-1.22.spec

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
%global gopath %{_datadir}/gocode
33
%global ms_go_filename go1.22.10-20241203.4.src.tar.gz
44
%global ms_go_revision 1
5-
%global go_priority %(echo %{version}.%{ms_go_revision} | tr -d .)
65
%ifarch aarch64
76
%global gohostarch arm64
87
%else
@@ -16,7 +15,7 @@
1615
Summary: Go
1716
Name: golang
1817
Version: 1.22.10
19-
Release: 1%{?dist}
18+
Release: 2%{?dist}
2019
License: BSD-3-Clause
2120
Vendor: Microsoft Corporation
2221
Distribution: Azure Linux
@@ -134,17 +133,10 @@ EOF
134133

135134
%post -p /sbin/ldconfig
136135

137-
alternatives --install %{_bindir}/go go %{goroot}/bin/go %{go_priority}
138-
alternatives --install %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt %{go_priority}
139-
140136
%postun
141137
/sbin/ldconfig
142138
if [ $1 -eq 0 ]; then
143139
# This is uninstall
144-
alternatives --remove go %{goroot}/bin/go
145-
alternatives --remove gofmt %{goroot}/bin/gofmt
146-
147-
rm %{_sysconfdir}/profile.d/go-exports.sh
148140
rm -rf /opt/go
149141
exit 0
150142
fi
@@ -162,6 +154,11 @@ fi
162154
%{_bindir}/*
163155

164156
%changelog
157+
* Tue Feb 04 2025 Tobias Brick <tobiasb@microsoft.com> - 1.22.10-2
158+
- Fix post scriptlet
159+
- Remove calls to alternatives
160+
- Don't manually delete go-exports.sh
161+
165162
* Wed Dec 04 2024 Microsoft Golang Bot <microsoft-golang-bot@users.noreply.github.com> - 1.22.10-1
166163
- Bump version to 1.22.10-1
167164

@@ -186,7 +183,7 @@ fi
186183
* Tue Jun 04 2024 Davis Goodin <dagood@microsoft.com> - 1.22.4-1
187184
- Bump version to 1.22.4-1
188185

189-
* Tue May 07 2024 Davis Goodin <dagood@microsoft.com> - 1.22.3-1
186+
* Mon May 27 2024 Davis Goodin <dagood@microsoft.com> - 1.22.3-1
190187
- Bump version to 1.22.3-1
191188

192189
* Wed May 08 2024 Davis Goodin <dagood@microsoft.com> - 1.21.9-2

SPECS/golang/golang.spec

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
%global gopath %{_datadir}/gocode
33
%global ms_go_filename go1.23.3-20241202.3.src.tar.gz
44
%global ms_go_revision 2
5-
%global go_priority %(echo %{version}.%{ms_go_revision} | tr -d .)
65
%ifarch aarch64
76
%global gohostarch arm64
87
%else
@@ -16,7 +15,7 @@
1615
Summary: Go
1716
Name: golang
1817
Version: 1.23.3
19-
Release: 2%{?dist}
18+
Release: 3%{?dist}
2019
License: BSD-3-Clause
2120
Vendor: Microsoft Corporation
2221
Distribution: Azure Linux
@@ -134,17 +133,10 @@ EOF
134133

135134
%post -p /sbin/ldconfig
136135

137-
alternatives --install %{_bindir}/go go %{goroot}/bin/go %{go_priority}
138-
alternatives --install %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt %{go_priority}
139-
140136
%postun
141137
/sbin/ldconfig
142138
if [ $1 -eq 0 ]; then
143139
# This is uninstall
144-
alternatives --remove go %{goroot}/bin/go
145-
alternatives --remove gofmt %{goroot}/bin/gofmt
146-
147-
rm %{_sysconfdir}/profile.d/go-exports.sh
148140
rm -rf /opt/go
149141
exit 0
150142
fi
@@ -162,6 +154,11 @@ fi
162154
%{_bindir}/*
163155

164156
%changelog
157+
* Tue Feb 04 2025 Tobias Brick <tobiasb@microsoft.com> - 1.23.3-3
158+
- Fix post scriptlet
159+
- Remove calls to alternatives
160+
- Don't manually delete go-exports.sh
161+
165162
* Tue Dec 03 2024 Microsoft Golang Bot <microsoft-golang-bot@users.noreply.github.com> - 1.23.3-2
166163
- Bump version to 1.23.3-2
167164

@@ -186,7 +183,7 @@ fi
186183
* Tue Jun 04 2024 Davis Goodin <dagood@microsoft.com> - 1.22.4-1
187184
- Bump version to 1.22.4-1
188185

189-
* Tue May 07 2024 Davis Goodin <dagood@microsoft.com> - 1.22.3-1
186+
* Mon May 27 2024 Davis Goodin <dagood@microsoft.com> - 1.22.3-1
190187
- Bump version to 1.22.3-1
191188

192189
* Wed May 08 2024 Davis Goodin <dagood@microsoft.com> - 1.21.9-2

0 commit comments

Comments
 (0)