making linters happy
Some checks failed
CI / Rust Blocking Checks (push) Failing after 22s
CI / Web Blocking Checks (push) Failing after 26s
CI / Security Blocking Checks (push) Successful in 9s
CI / Web Advisory Checks (push) Successful in 32s
CI / Security Advisory Checks (push) Has been cancelled
Some checks failed
CI / Rust Blocking Checks (push) Failing after 22s
CI / Web Blocking Checks (push) Failing after 26s
CI / Security Blocking Checks (push) Successful in 9s
CI / Web Advisory Checks (push) Successful in 32s
CI / Security Advisory Checks (push) Has been cancelled
This commit is contained in:
@@ -151,17 +151,15 @@ impl DependencyValidator {
|
||||
};
|
||||
|
||||
let error = if !satisfied {
|
||||
if detected_version.is_none() {
|
||||
Some(format!("Runtime '{}' not found on system", runtime))
|
||||
} else if let Some(ref constraint) = version_constraint {
|
||||
Some(format!(
|
||||
"Runtime '{}' version {} does not satisfy constraint '{}'",
|
||||
runtime,
|
||||
detected_version.as_ref().unwrap(),
|
||||
constraint
|
||||
))
|
||||
if let Some(ref detected) = detected_version {
|
||||
version_constraint.as_ref().map(|constraint| {
|
||||
format!(
|
||||
"Runtime '{}' version {} does not satisfy constraint '{}'",
|
||||
runtime, detected, constraint
|
||||
)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
Some(format!("Runtime '{}' not found on system", runtime))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@@ -192,15 +190,13 @@ impl DependencyValidator {
|
||||
};
|
||||
|
||||
let error = if !satisfied {
|
||||
if installed_version.is_none() {
|
||||
Some(format!("Required pack '{}' is not installed", pack_ref))
|
||||
} else {
|
||||
if let Some(ref installed) = installed_version {
|
||||
Some(format!(
|
||||
"Pack '{}' version {} does not satisfy constraint '{}'",
|
||||
pack_ref,
|
||||
installed_version.as_ref().unwrap(),
|
||||
version_constraint
|
||||
pack_ref, installed, version_constraint
|
||||
))
|
||||
} else {
|
||||
Some(format!("Required pack '{}' is not installed", pack_ref))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@@ -335,30 +331,30 @@ fn match_version_constraint(version: &str, constraint: &str) -> Result<bool> {
|
||||
}
|
||||
|
||||
// Parse constraint
|
||||
if constraint.starts_with(">=") {
|
||||
let required = constraint[2..].trim();
|
||||
if let Some(stripped) = constraint.strip_prefix(">=") {
|
||||
let required = stripped.trim();
|
||||
Ok(compare_versions(version, required)? >= 0)
|
||||
} else if constraint.starts_with("<=") {
|
||||
let required = constraint[2..].trim();
|
||||
} else if let Some(stripped) = constraint.strip_prefix("<=") {
|
||||
let required = stripped.trim();
|
||||
Ok(compare_versions(version, required)? <= 0)
|
||||
} else if constraint.starts_with('>') {
|
||||
let required = constraint[1..].trim();
|
||||
} else if let Some(stripped) = constraint.strip_prefix('>') {
|
||||
let required = stripped.trim();
|
||||
Ok(compare_versions(version, required)? > 0)
|
||||
} else if constraint.starts_with('<') {
|
||||
let required = constraint[1..].trim();
|
||||
} else if let Some(stripped) = constraint.strip_prefix('<') {
|
||||
let required = stripped.trim();
|
||||
Ok(compare_versions(version, required)? < 0)
|
||||
} else if constraint.starts_with('=') {
|
||||
let required = constraint[1..].trim();
|
||||
} else if let Some(stripped) = constraint.strip_prefix('=') {
|
||||
let required = stripped.trim();
|
||||
Ok(compare_versions(version, required)? == 0)
|
||||
} else if constraint.starts_with('^') {
|
||||
} else if let Some(stripped) = constraint.strip_prefix('^') {
|
||||
// Caret: Compatible with version (major.minor.patch)
|
||||
// ^1.2.3 := >=1.2.3 <2.0.0
|
||||
let required = constraint[1..].trim();
|
||||
let required = stripped.trim();
|
||||
match_caret_constraint(version, required)
|
||||
} else if constraint.starts_with('~') {
|
||||
} else if let Some(stripped) = constraint.strip_prefix('~') {
|
||||
// Tilde: Approximately equivalent to version
|
||||
// ~1.2.3 := >=1.2.3 <1.3.0
|
||||
let required = constraint[1..].trim();
|
||||
let required = stripped.trim();
|
||||
match_tilde_constraint(version, required)
|
||||
} else {
|
||||
// Exact match
|
||||
|
||||
@@ -171,7 +171,7 @@ impl PackInstaller {
|
||||
clone_cmd.arg("--depth").arg("1");
|
||||
}
|
||||
|
||||
clone_cmd.arg(&url).arg(&install_dir);
|
||||
clone_cmd.arg(url).arg(&install_dir);
|
||||
|
||||
let output = clone_cmd
|
||||
.output()
|
||||
@@ -421,7 +421,11 @@ impl PackInstaller {
|
||||
}
|
||||
|
||||
// Determine filename from URL
|
||||
let filename = url.split('/').last().unwrap_or("archive.zip").to_string();
|
||||
let filename = url
|
||||
.split('/')
|
||||
.next_back()
|
||||
.unwrap_or("archive.zip")
|
||||
.to_string();
|
||||
|
||||
let archive_path = self.temp_dir.join(&filename);
|
||||
|
||||
|
||||
@@ -288,17 +288,15 @@ impl<'a> PackComponentLoader<'a> {
|
||||
}
|
||||
Err(e) => {
|
||||
// Check for unique constraint violation (race condition)
|
||||
if let Error::Database(ref db_err) = e {
|
||||
if let sqlx::Error::Database(ref inner) = db_err {
|
||||
if inner.is_unique_violation() {
|
||||
info!(
|
||||
"Runtime '{}' already exists (concurrent creation), treating as update",
|
||||
runtime_ref
|
||||
);
|
||||
loaded_refs.push(runtime_ref);
|
||||
result.runtimes_updated += 1;
|
||||
continue;
|
||||
}
|
||||
if let Error::Database(sqlx::Error::Database(ref inner)) = e {
|
||||
if inner.is_unique_violation() {
|
||||
info!(
|
||||
"Runtime '{}' already exists (concurrent creation), treating as update",
|
||||
runtime_ref
|
||||
);
|
||||
loaded_refs.push(runtime_ref);
|
||||
result.runtimes_updated += 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let msg = format!("Failed to create runtime '{}': {}", runtime_ref, e);
|
||||
@@ -438,16 +436,14 @@ impl<'a> PackComponentLoader<'a> {
|
||||
}
|
||||
Err(e) => {
|
||||
// Check for unique constraint violation (race condition)
|
||||
if let Error::Database(ref db_err) = e {
|
||||
if let sqlx::Error::Database(ref inner) = db_err {
|
||||
if inner.is_unique_violation() {
|
||||
info!(
|
||||
"Version '{}' for runtime '{}' already exists (concurrent), skipping",
|
||||
version_str, runtime_ref
|
||||
);
|
||||
loaded_versions.push(version_str);
|
||||
continue;
|
||||
}
|
||||
if let Error::Database(sqlx::Error::Database(ref inner)) = e {
|
||||
if inner.is_unique_violation() {
|
||||
info!(
|
||||
"Version '{}' for runtime '{}' already exists (concurrent), skipping",
|
||||
version_str, runtime_ref
|
||||
);
|
||||
loaded_versions.push(version_str);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let msg = format!(
|
||||
|
||||
@@ -272,11 +272,6 @@ impl Checksum {
|
||||
|
||||
Ok(Self { algorithm, hash })
|
||||
}
|
||||
|
||||
/// Format as "algorithm:hash"
|
||||
pub fn to_string(&self) -> String {
|
||||
format!("{}:{}", self.algorithm, self.hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Checksum {
|
||||
|
||||
Reference in New Issue
Block a user