mod source_fetch¶
- module source_fetch¶
Fill the source checksum a version bump invalidates, the way
eb --inject-checksumsdoes: download eachsourcesentry from the recipe’s ownsource_urls, in order, and hash the bytes.A bump that changes the version clears the old digest because it is not a claim about the new tarball. EasyBuild’s answer is
--inject-checksums, which fetches the artifact the recipe names and writes its SHA-256. This module does the same before emission, so the bumped recipe carries a real digest and the SBOM’s source component carries the same hash. Nothing here invents a URL. An entry with no URL, a git checkout, or a failed download stays unresolved and is reported as a residual with the reason, never filled. The one URL EasyBuild itself supplies is kept:PythonPackage(and an easyblock that takes itsextra_options, such asCargoPythonPackageorPythonBundle) defaultssource_urlsto[PYPI_SOURCE]when the recipe leaves the list unset. That default is used only for the download. It is not written back into the recipe.Functions
- fn bump_release_commits(bundle: &mut PackageBundle, client: &dyn RegistryClient, old_version: &str, new_version: &str)¶
Move a
local_*variable that pins the old release’s commit to the new release’s commit.RStudio-Server writes the commit of its release tag into the build (
local_git_rev, passed asRSTUDIO_GIT_REVISION_HASH); a version bump that keeps it names the old release’s commit in the new build. A 40-hexlocal_*value is moved only when it is the commit of the old release’s tag, the tag being the first source’s archive name (as the GitHubarchive/URL names it) with the new version replaced by the old one. Anything else is reported, never guessed.
- fn bump_secondary_sources(bundle: &mut PackageBundle, client: &dyn RegistryClient, overrides: &std::collections::BTreeMap<String, crate::upstream::Override>, fetched: &mut Vec<SourceFetch>)¶
Move each later source whose version a
local_*variable holds to its newest stable upstream release.A source after the first counts when its file name holds the value of a version-valued
local_*assignment and thesourceslist names that variable: gc’s'libatomic_ops-%s.tar.gz' % local_libatomic_version. The component is the file name before the version (libatomic_ops), and its releases are read with the backends ofcrate::upstreamfrom thesource_urlsthat carry the version, keyed by the component inoverrides. A newer release rewrites the variable, downloads the new file, and writes its digest where the old one was. Each source gets asecondary-sourcerecord: the move, that it is current, or why no version could be decided.
- fn fetch_sources(recipe: &ResolvedEasyconfig, client: &dyn RegistryClient) -> Vec<SourceFetch>¶
Download and hash every
sourcesentry ofrecipe.
- fn plan_package_bump_fetching(request: &BumpPackageRequest, options: &PackageEmitOptions, client: &dyn RegistryClient) -> Result<(PackageBundle, Vec<SourceFetch>), PackageWorkflowError>¶
Plan a bump, then fill the source checksum the version change cleared.
The first pass emits the recipe at the new version, so its
sourcesandsource_urlsresolve with the new templates. The first source’s digest is then passed assource_checksumand the bump is planned again, which is the existing, tested path for a stated checksum. Entries that could not be fetched, and sources after the first, becomesource:fetchresiduals; the bump never invents a digest. A request that already states a checksum, or keeps the version, is planned once and unchanged.With the new source in hand, every patch the tree could not decide is tried against it (see
crate::patch_apply): a patch that applies is carried, one the release already contains or whose files are gone is dropped from the recipe, and only a patch that does neither stays undecided.strict_patchesfails on those that remain.
- fn plan_package_bump_fetching_with(request: &BumpPackageRequest, options: &PackageEmitOptions, client: &dyn RegistryClient, decisions: &BumpDecisions) -> Result<(PackageBundle, Vec<SourceFetch>), PackageWorkflowError>¶
plan_package_bump_fetchingwith the operator’s decisions.A patch the source leaves undecided is replaced by a rebased file named for the new release (<Name>-<version>_<description>.patch, or the old name with its version replaced) when one sits beside the source recipe or under <letter>/<Name> of an easyconfigs root and applies to the new source.
decisions.drop_patchesthen drop what the operator decided, with the reason in the plan, anddecisions.latest_secondarymoves version-pinned later sources (seebump_secondary_sources).
- fn source_download_urls(recipe: &ResolvedEasyconfig, file: &SourceFile) -> Vec<String>¶
The URLs EasyBuild would try for
file, in order: the entry’s ownsource_urlswhen the dict sets them, else the recipe’s, else the easyblock default frompypi_default_bases.
Structs and Unions
- struct BumpDecisions¶
What a fetching bump takes from its operator rather than from evidence.
- drop_patches: Vec<(String, String)>¶
Patches to drop, by file name, each with the reason the plan records. A name the recipe does not list fails the bump.
- latest_secondary: bool¶
Move every later source whose version a
local_*variable holds to its newest stable upstream release, read the waypackage latestreads the package’s own.
- struct Respelling¶
A source download name the archive host served under the other spelling of the release tag.
- from: String¶
Name the recipe asked for, which the host does not serve.
- to: String¶
Name that served the archive.
- struct SourceFetch¶
What happened to one
sourcesentry.- filename: String¶
Name the artifact is saved under.
- url: Option<String>¶
URL that served it, when one did.
- sha256: Option<String>¶
SHA-256 of the downloaded bytes, when the download succeeded.
- errors: Vec<String>¶
Every URL tried and why it failed, or why none could be tried.
- bytes: Option<Vec<u8>>¶
Body of a successful download. Not part of
sources.fetch.json; the index rewrite readsCargo.lockout of it and then drops it.
- respelled: Option<Respelling>¶
The recipe’s download name and the one that served the archive, when the release tag is spelled the other way: a project that moved from
1.0.8tov1.0.10tags serves/archive/v1.0.10.tar.gzand 404s on/archive/1.0.10.tar.gz. The recipe’ssourcesentry is rewritten to the name that served it.