feat(ms-golang): add Microsoft build of Go as a golang-providing package - #18256
feat(ms-golang): add Microsoft build of Go as a golang-providing package#18256liunan-ms wants to merge 1 commit into
Conversation
Introduce ms-golang for Azure Linux 4.0 using a local spec ported from the
3.0-dev golang.spec (the Microsoft build of Go). It Provides golang and
Conflicts with the Fedora upstream golang package so the two cannot be
co-installed.
Spec adjustments for AzL 4.0:
- Reference bootstrap trees via %{_builddir} (RPM >= 4.20 per-package build subdir).
- Build the go1.4 C bootstrap with -std=gnu17 (C23 'bool' keyword breaks -Werror).
- Stage the rolling bootstrap under %{_builddir} (unprivileged mock cannot write /usr/lib64).
- Add BuildRequires: gcc, glibc-devel (minimal buildroot).
- Disable auto find-provides to drop spurious test-data SONAMEs (e.g. libtiffxx.so.6).
There was a problem hiding this comment.
Pull request overview
Adds Microsoft’s Go build as an alternative golang provider for Azure Linux 4.0.
Changes:
- Adds the local
ms-golangcomponent and six source archives. - Builds a rolling bootstrap toolchain for x86_64 and AArch64.
- Provides
golangwhile conflicting with Fedora’s package.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
base/comps/ms-golang/ms-golang.comp.toml |
Defines the component and sources. |
base/comps/ms-golang/ms-golang.spec |
Packages and builds Microsoft Go. |
base/comps/ms-golang/go14_bootstrap_aarch64.patch |
Enables AArch64 bootstrap detection. |
locks/ms-golang.lock |
Records the component fingerprint. |
specs/m/ms-golang/ms-golang.spec |
Contains the rendered RPM spec. |
specs/m/ms-golang/go14_bootstrap_aarch64.patch |
Contains the rendered bootstrap patch. |
specs/m/ms-golang/sources |
Records rendered source checksums. |
| # and a hand-written %changelog, so release.calculation is "manual". | ||
| [components.ms-golang] | ||
| spec = { type = "local", path = "ms-golang.spec" } | ||
| release = { calculation = "manual" } |
| %postun | ||
| /sbin/ldconfig | ||
| if [ $1 -eq 0 ]; then | ||
| # This is uninstall | ||
| rm -rf /opt/go | ||
| exit 0 | ||
| fi |
|
|
||
| export GOROOT="`pwd`" | ||
| export GOPATH=%{gopath} | ||
| export GOROOT_FINAL=%{_bindir}/go |
| rm -f %{gopath}/src/runtime/*.c | ||
| ( | ||
| cd src | ||
| ./make.bash --no-clean |
| BuildRequires: gcc | ||
| BuildRequires: glibc-devel |
| Name: ms-golang | ||
| Version: 1.26.5 | ||
| Release: 3%{?dist} | ||
| License: BSD-3-Clause |
| # - build as `ms-golang` (instead of `golang`), | ||
| # - keep `Provides: golang` so it can satisfy golang dependencies, and | ||
| # - `Conflicts: golang` so it cannot be installed alongside the Fedora golang package. | ||
| # Maintained as a local spec (not available upstream in Fedora); uses a static Release |
There was a problem hiding this comment.
@liunan-ms What's the trade-off you see of maintaining it locally vs. trying to adapt the upstream Feodora spec to build the MSFT sources/config? (Are they that different that it necessitates diverging?)
There was a problem hiding this comment.
Does this mean using the Fedora spec and adding overlays to point to MS sources/config? If yes, we'll add a large set of overlays to rewrite Source*, %prep, the crypto config, and the bootstrap model (ms-golang uses 5-stage C bootstrap), also since Fedora spec defines a lot more macros it may break whenever Fedora refactors its Go macros, so a clean local spec might be easier to maintain.
One heavy part in the local spec that I think we can drop but not sure is the staged bootstrap from C which come from the ms-golang spec on 3.0-dev, since Fedora Go already exists on 4.0, adding BuildRequires: golang >= 1.24 would pull Fedora's golang into the buildroot instead. It built successfully and has the same crypto behavior.
trying to adapt the upstream Feodora spec to build the MSFT sources/config?
Description
Adds
ms-golangto the Azure Linux 4.0 branch: the Microsoft build of Go, packaged from a local spec ported from the 3.0-devgolang.spec.Azure Linux 4.0 already ships Fedora's upstream
golang. This introduces the Microsoft build alongside it as a distinct package that:ms-golang(rather thangolang),Provides: golangso it can satisfygolangdependencies, andConflicts: golangso it cannot be co-installed with the Fedoragolangpackage.It is maintained as a local spec (not available in Fedora) with
release.calculation = "manual"(staticRelease:+ hand-written%changelog). The six Go source tarballs are referenced directly from the publicgithub.com/microsoft/goreleases.Spec adjustments for AzL 4.0
The 3.0-dev spec assumed an older RPM and a root build environment; the following changes make it build under AzL 4.0's RPM 4.20 + unprivileged mock:
%{_builddir}instead of%{_topdir}/BUILD, since RPM ≥ 4.20 builds inside a per-package subdirectory.-std=gnu17; modern gcc defaults to-std=gnu23whereboolis a keyword, which breaks go1.4'stypedef int bool;under-Werror.%{_builddir}instead of%{_libdir}/golang; unprivileged mock builds cannot write to/usr/lib64.gccandglibc-devel, which the minimal AzL 4.0 buildroot does not provide implicitly.libtiffxx.so.6) are not exposed as package SONAME Provides; the real interfaces are declared explicitly.Validation
Build succeeds and produces
ms-golang-1.26.5-3.azl4.x86_64.rpm.Package metadata:
Functional smoke test in a mock chroot: