diff --git a/src/ghcup/packages.rs b/src/ghcup/packages.rs index 1ec68f7..c1b2480 100644 --- a/src/ghcup/packages.rs +++ b/src/ghcup/packages.rs @@ -34,6 +34,7 @@ impl SnapshotStorage 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")))?; diff --git a/src/ghcup/parser.rs b/src/ghcup/parser.rs index 9055862..663a781 100644 --- a/src/ghcup/parser.rs +++ b/src/ghcup/parser.rs @@ -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")] diff --git a/src/ghcup/utils.rs b/src/ghcup/utils.rs index 20023d1..e070d42 100644 --- a/src/ghcup/utils.rs +++ b/src/ghcup/utils.rs @@ -13,7 +13,7 @@ use super::GhcupRepoConfig; lazy_static! { static ref YAML_CONFIG_PATTERN: regex::Regex = - regex::Regex::new(r"ghcup-(?P\d.\d.\d).yaml$").unwrap(); + regex::Regex::new(r"ghcup-(?P\d.\d.\d).yaml(?P.sig)?$").unwrap(); } // order is reverted to derive Ord ;) @@ -81,6 +81,7 @@ enum NodeType { pub struct ObjectInfo { pub name: String, pub path: String, + pub is_sig: bool, pub version: Version, } @@ -88,6 +89,7 @@ pub struct ObjectInfo { pub struct ObjectInfoWithUrl { pub name: String, pub path: String, + pub is_sig: bool, pub version: Version, pub url: String, } @@ -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()?, }) @@ -137,6 +140,7 @@ pub async fn get_raw_blob_url( config: &GhcupRepoConfig, object: ObjectInfo, ) -> Result { + println!("decoding https://api.github.com/repos/{}/contents/{}", config.repo, object.path); let content: ContentMeta = client .get(format!( "https://api.github.com/repos/{}/contents/{}", @@ -150,6 +154,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, }) }