Skip to content

Commit 73f5b30

Browse files
fix(ghcup): sig (#130)
1 parent 3c88a09 commit 73f5b30

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/ghcup/packages.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl SnapshotStorage<SnapshotMeta> for GhcupPackages {
3434
let latest_yaml_obj = filter_map_file_objs(
3535
list_files(&client, repo_config, &self.ghcup_repo_config.branch).await?,
3636
)
37+
.filter(|obj| !obj.is_sig)
3738
.max_by(|x, y| x.version.cmp(&y.version))
3839
.ok_or_else(|| Error::ProcessError(String::from("no config file found")))?;
3940

src/ghcup/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use serde::Deserialize;
44

55
use super::utils::Version;
66

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

99
#[derive(Debug, Deserialize)]
1010
#[serde(rename_all = "camelCase")]

src/ghcup/utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::GhcupRepoConfig;
1313

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

1919
// order is reverted to derive Ord ;)
@@ -81,13 +81,15 @@ enum NodeType {
8181
pub struct ObjectInfo {
8282
pub name: String,
8383
pub path: String,
84+
pub is_sig: bool,
8485
pub version: Version,
8586
}
8687

8788
#[derive(Debug, Clone)]
8889
pub struct ObjectInfoWithUrl {
8990
pub name: String,
9091
pub path: String,
92+
pub is_sig: bool,
9193
pub version: Version,
9294
pub url: String,
9395
}
@@ -124,6 +126,7 @@ pub fn filter_map_file_objs(
124126
let name = f.path.split('/').last().unwrap().to_string();
125127
Some(ObjectInfo {
126128
name,
129+
is_sig: c.name("sig").is_some(),
127130
path: f.path.clone(),
128131
version: Version::from_str(m.as_str()).ok()?,
129132
})
@@ -150,6 +153,7 @@ pub async fn get_raw_blob_url(
150153
name: object.name,
151154
path: object.path,
152155
version: object.version,
156+
is_sig: object.is_sig,
153157
url: content.download_url,
154158
})
155159
}

0 commit comments

Comments
 (0)