fix the failures that were failing quietly
This commit is contained in:
+39
-16
@@ -41,20 +41,31 @@ struct Source {
|
||||
release_api_url: &'static str,
|
||||
asset_name_suffix: &'static str,
|
||||
kind: ArchiveKind,
|
||||
/// Release download directory, used to fetch the sibling `.sha256`. None
|
||||
/// when the project publishes no checksums at all.
|
||||
download_base: Option<&'static str>,
|
||||
}
|
||||
|
||||
// `releases/latest` rather than `releases/tags/latest` for both: the latter
|
||||
// only resolves for a repo that happens to have a tag literally named "latest",
|
||||
// which GyanD does not - its tag is the version, so that URL 404s.
|
||||
//
|
||||
// BtbN is first because its zip is the path that actually installs today; the
|
||||
// 7z branch below is the fallback.
|
||||
const SOURCES: &[Source] = &[
|
||||
Source {
|
||||
name: "GyanD",
|
||||
release_api_url: "https://api.github.com/repos/GyanD/codexffmpeg/releases/tags/latest",
|
||||
asset_name_suffix: "full_build.7z",
|
||||
kind: ArchiveKind::SevenZ,
|
||||
},
|
||||
Source {
|
||||
name: "BtbN",
|
||||
release_api_url: "https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/tags/latest",
|
||||
release_api_url: "https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest",
|
||||
asset_name_suffix: "win64-gpl.zip",
|
||||
kind: ArchiveKind::Zip,
|
||||
download_base: None,
|
||||
},
|
||||
Source {
|
||||
name: "GyanD",
|
||||
release_api_url: "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest",
|
||||
asset_name_suffix: "full_build.7z",
|
||||
kind: ArchiveKind::SevenZ,
|
||||
download_base: Some("https://github.com/GyanD/codexffmpeg/releases/download"),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -104,17 +115,29 @@ where
|
||||
|
||||
let (asset, version) = pick_asset(&client, source).await?;
|
||||
|
||||
// GyanD publishes a .sha256 file alongside each release.
|
||||
// BtbN does not, so we skip verification for BtbN.
|
||||
let expected = if source.name == "GyanD" {
|
||||
let checksum_url = format!(
|
||||
"https://github.com/GyanD/codexffmpeg/releases/download/{}/{}.sha256",
|
||||
version,
|
||||
// Verify against the published checksum when there is one. GyanD used to
|
||||
// ship a .sha256 next to each asset and no longer does, so a missing
|
||||
// checksum downgrades to a logged warning rather than failing the source -
|
||||
// aborting on it would just push the user onto the unverified build anyway.
|
||||
let expected = if let Some(base) = source.download_base {
|
||||
let checksum_url = format!("{base}/{version}/{}.sha256", asset.name);
|
||||
match fetch_sha256(&client, &checksum_url).await {
|
||||
Ok(hash) => Some(hash),
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
"{} publishes no usable checksum for {} ({e:#}), continuing unverified",
|
||||
source.name,
|
||||
asset.name
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tracing::warn!(
|
||||
"{} publishes no checksums, downloading {} unverified",
|
||||
source.name,
|
||||
asset.name
|
||||
);
|
||||
Some(fetch_sha256(&client, &checksum_url).await?)
|
||||
} else {
|
||||
tracing::warn!("BtbN build: skipping SHA-256 verification (no checksum file)");
|
||||
None
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user