Add Arch
to Update
struct
This commit is contained in:
parent
8a06b3c628
commit
a07166375a
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -392,7 +392,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "hpk-package"
|
name = "hpk-package"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.hitchhiker-linux.org/jeang3nie/hpk-package.git#9cf9d469f644c43ee2c2d9ca3b16e669c2def944"
|
source = "git+https://git.hitchhiker-linux.org/jeang3nie/hpk-package.git#723d697e9085a575c1f6d59baf1e79819452d747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"deku",
|
"deku",
|
||||||
@ -1263,9 +1263,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-safe"
|
name = "zstd-safe"
|
||||||
version = "6.0.4+zstd.1.5.4"
|
version = "6.0.5+zstd.1.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7afb4b54b8910cf5447638cb54bf4e8a65cbedd783af98b98c62ffe91f185543"
|
checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"zstd-sys",
|
"zstd-sys",
|
||||||
@ -1273,9 +1273,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-sys"
|
name = "zstd-sys"
|
||||||
version = "2.0.7+zstd.1.5.4"
|
version = "2.0.8+zstd.1.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5"
|
checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use {
|
use {
|
||||||
crate::{Package, Repository, Version},
|
crate::{Arch, Package, Repository, Version},
|
||||||
hpk_package::ron::{self, ser::PrettyConfig},
|
hpk_package::ron::{self, ser::PrettyConfig},
|
||||||
rayon::prelude::*,
|
rayon::prelude::*,
|
||||||
serde::{Deserialize, Serialize},
|
serde::{Deserialize, Serialize},
|
||||||
@ -19,13 +19,14 @@ use {
|
|||||||
pub struct Update {
|
pub struct Update {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
pub arch: Arch,
|
||||||
pub release: u8,
|
pub release: u8,
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Update {
|
impl fmt::Display for Update {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}-{}_{}", self.name, self.version, self.release)
|
write!(f, "{}-{}_{}_{}", self.name, self.version, self.arch, self.release)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ impl Database {
|
|||||||
let update = Update {
|
let update = Update {
|
||||||
name: key.to_string(),
|
name: key.to_string(),
|
||||||
version: remote_package.version.clone(),
|
version: remote_package.version.clone(),
|
||||||
|
arch: remote_package.arch,
|
||||||
release: remote_package.release,
|
release: remote_package.release,
|
||||||
url: repo.base_url.clone(),
|
url: repo.base_url.clone(),
|
||||||
};
|
};
|
||||||
@ -87,6 +89,7 @@ impl Database {
|
|||||||
// into our hashmap
|
// into our hashmap
|
||||||
let update = Update {
|
let update = Update {
|
||||||
name: key.to_string(),
|
name: key.to_string(),
|
||||||
|
arch: remote_package.arch,
|
||||||
version: remote_package.version.clone(),
|
version: remote_package.version.clone(),
|
||||||
release: remote_package.release,
|
release: remote_package.release,
|
||||||
url: repo.base_url.clone(),
|
url: repo.base_url.clone(),
|
||||||
@ -144,11 +147,12 @@ mod test {
|
|||||||
let up = Update {
|
let up = Update {
|
||||||
name: "hpk".to_string(),
|
name: "hpk".to_string(),
|
||||||
version: Version::Number(42),
|
version: Version::Number(42),
|
||||||
|
arch: Arch::aarch64,
|
||||||
release: 1,
|
release: 1,
|
||||||
url: Url::parse("https://hitchhiker-linux.org/pub/packages/").unwrap(),
|
url: Url::parse("https://hitchhiker-linux.org/pub/packages/").unwrap(),
|
||||||
}
|
}
|
||||||
.to_string();
|
.to_string();
|
||||||
assert_eq!("hpk-42_1".to_string(), up);
|
assert_eq!("hpk-42_aarch64_1".to_string(), up);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -156,12 +160,13 @@ mod test {
|
|||||||
let up = Update {
|
let up = Update {
|
||||||
name: "hpk".to_string(),
|
name: "hpk".to_string(),
|
||||||
version: Version::Number(42),
|
version: Version::Number(42),
|
||||||
|
arch: Arch::aarch64,
|
||||||
release: 1,
|
release: 1,
|
||||||
url: Url::parse("https://hitchhiker-linux.org/pub/packages/").unwrap(),
|
url: Url::parse("https://hitchhiker-linux.org/pub/packages/").unwrap(),
|
||||||
};
|
};
|
||||||
let full_url = up.full_url().unwrap().to_string();
|
let full_url = up.full_url().unwrap().to_string();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"https://hitchhiker-linux.org/pub/packages/hpk-42_1.tar.zstd".to_string(),
|
"https://hitchhiker-linux.org/pub/packages/hpk-42_aarch64_1.tar.zstd".to_string(),
|
||||||
full_url
|
full_url
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ pub use {
|
|||||||
creator::{Creator, Message},
|
creator::{Creator, Message},
|
||||||
db::Database,
|
db::Database,
|
||||||
hooks::Hooks,
|
hooks::Hooks,
|
||||||
hpk_package::{tar, Dependency, GitRev, Package, Plist, Rapid, SemVer, Specs, Version},
|
hpk_package::{tar, Arch, Dependency, GitRev, Package, Plist, Rapid, SemVer, Specs, Version},
|
||||||
item::Item,
|
item::Item,
|
||||||
repository::Repository,
|
repository::Repository,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user