Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ghcup): sig #130

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ghcup/packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl SnapshotStorage<SnapshotMeta> for GhcupPackages {
let latest_yaml_obj = filter_map_file_objs(
list_files(&client, repo_config, &self.ghcup_repo_config.branch).await?,
)
.filter(|obj| !obj.is_sig)
.max_by(|x, y| x.version.cmp(&y.version))
.ok_or_else(|| Error::ProcessError(String::from("no config file found")))?;

Expand Down
2 changes: 1 addition & 1 deletion src/ghcup/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::Deserialize;

use super::utils::Version;

pub const EXPECTED_CONFIG_VERSION: Version = Version::new(0, 0, 7);
pub const EXPECTED_CONFIG_VERSION: Version = Version::new(0, 0, 8);

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
6 changes: 5 additions & 1 deletion src/ghcup/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use super::GhcupRepoConfig;

lazy_static! {
static ref YAML_CONFIG_PATTERN: regex::Regex =
regex::Regex::new(r"ghcup-(?P<ver>\d.\d.\d).yaml$").unwrap();
regex::Regex::new(r"ghcup-(?P<ver>\d.\d.\d).yaml(?P<sig>.sig)?$").unwrap();
}

// order is reverted to derive Ord ;)
Expand Down Expand Up @@ -81,13 +81,15 @@ enum NodeType {
pub struct ObjectInfo {
pub name: String,
pub path: String,
pub is_sig: bool,
pub version: Version,
}

#[derive(Debug, Clone)]
pub struct ObjectInfoWithUrl {
pub name: String,
pub path: String,
pub is_sig: bool,
pub version: Version,
pub url: String,
}
Expand Down Expand Up @@ -124,6 +126,7 @@ pub fn filter_map_file_objs(
let name = f.path.split('/').last().unwrap().to_string();
Some(ObjectInfo {
name,
is_sig: c.name("sig").is_some(),
path: f.path.clone(),
version: Version::from_str(m.as_str()).ok()?,
})
Expand All @@ -150,6 +153,7 @@ pub async fn get_raw_blob_url(
name: object.name,
path: object.path,
version: object.version,
is_sig: object.is_sig,
url: content.download_url,
})
}
Loading