NewToolchain 013: Add new toolchain tool prototype #6981
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./SPECS/LICENSES-AND-NOTICES/data/licenses.json,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
Part of #6892, related to #6788
This is part of a series of PRs for the new toolchain prototype. Some PRs are fundamental bug fixes for 2.0, some are new features better targeted at 3.0, and some are early prototypes/RFCs.
Destination
2.0 - Maybe
3.0 - Yes
RFC - Yes
Specific PR summary:
Copied from #6788:
Main tool (toolchain.go)
toolchain.gois the main command line tool that takes responsibility for managing the toolchain. It takes as input the same set of arguments that are passed to both existing toolchain scripts. The tool behaves as follows:REBUILD_TOOLCHAIN. One ofalways,fast,auto,never. This translates into a set of configurations:Currently
doUpdateManifest*is unsupported, but in theory might update the manifest files to match some external source of truth.doArchiveextracts toolchain packages from a.tar.gzfile, passed viaTOOLCHAIN_ARCHIVE=.The generall flow is as follows (generally after each step it will check if the toolchain rpms are ready and bail out early if so).
doArchiveis set, skip to enddoDownloadis set (yes unlessneveroralwaysis used), the toolchain will attempt to download everything it can from PMC.tar.gzusing the existing script. Ideally this is pulled from cache (see later).tar.gz. Again, ideally from cache (see later)doDeltaBuildis set, copy all the matching rpms from./build/toolchain_rpmsinto the build environment../out/RPMS./build/toolchain_rpmsif they are missing, either from the official.tar.gzor if provided theTOOLCHAIN_ARCHIVE. Validate them against the manifest files.archive.go
Handles
.tar.gz(or .gz) archives. Can check the contents, or extract the contents. This package needs a bit of cleanup still, there is a lot of overlap.bootstrap.go
A 1:1 wrapper around the existing raw bootstrap script.
cache.go
A rudimentary cache is included in the PR. It likely isn't truly fit for purpose but shows a possible implementation. It can vastly improve build speed for repeated local builds, especially for the raw bootstrap toolchain. Ideally this should be shared amongst all mariner builds on a system, but in the short term it can still provide benefits even if operating locally to a single checkout.
It has a simple mode of operation: for a give set of input files (order matters), measure those files and generate a hash. Use the hash as a key to store the output file. For example, the offical toolchain rpms take the scripts, manifest files, and raw toolchain archive as inputs. If those are all the same, the cache can provide a pre-built version of the toolchain archive.
A real implementation will need to handle errors better, likely track total size and eviction, etc.
downloader.go
Responsible for taking the manifest file and trying to download a copy of each rpm from the provides base URLs.
@SeanDougherty New xml repoquery goes here.
manifest.go
TODO, this is a stub implementation of a possible manifest update functionality
official.go
Wraps the official build script. It moves the rpms needed for incremental builds and the final build rpms to
./out/RPMS. Also responsible for cleaning up the toolchain chroot in the event of a failure.Change Log
Does this affect the toolchain?
YES
Associated issues
Test Methodology