Compare commits
No commits in common. "acbdf2d99284b69a48601f3aeb0a56f295872a4c" and "723d697e9085a575c1f6d59baf1e79819452d747" have entirely different histories.
acbdf2d992
...
723d697e90
@ -1,12 +1,13 @@
|
|||||||
|
pub mod tar;
|
||||||
mod package;
|
mod package;
|
||||||
mod plist;
|
mod plist;
|
||||||
pub mod tar;
|
|
||||||
mod version;
|
mod version;
|
||||||
|
|
||||||
pub use {
|
pub use {
|
||||||
deku,
|
deku,
|
||||||
package::{Arch, Dependency, Group, Package, Specs, User},
|
package::{Arch, Dependency, Package, Specs},
|
||||||
plist::*,
|
plist::*,
|
||||||
ron, sha2,
|
ron,
|
||||||
|
sha2,
|
||||||
version::*,
|
version::*,
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{error::Error, fmt, str::FromStr};
|
use std::{fmt, str::FromStr, error::Error};
|
||||||
|
|
||||||
#[cfg(target_arch = "arm")]
|
#[cfg(target_arch = "arm")]
|
||||||
pub const HOST_ARCH: Arch = Arch::armv7l;
|
pub const HOST_ARCH: Arch = Arch::armv7l;
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub const HOST_ARCH: Arch = Arch::aarch64;
|
pub const HOST_ARCH: Arch = Arch::aarch64;
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
pub const HOST_ARCH: Arch = Arch::i486;
|
pub const HOST_ARCH: Arch = Arch::i486;
|
||||||
#[cfg(target_arch = "riscv64")]
|
#[cfg(target_arch = "riscv64")]
|
||||||
@ -33,20 +33,16 @@ impl Default for Arch {
|
|||||||
|
|
||||||
impl fmt::Display for Arch {
|
impl fmt::Display for Arch {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(
|
write!(f, "{}", match self {
|
||||||
f,
|
Self::armv7l => "armv7l",
|
||||||
"{}",
|
Self::aarch64 => "aarch64",
|
||||||
match self {
|
Self::i486 => "i486",
|
||||||
Self::armv7l => "armv7l",
|
Self::i586 => "i586",
|
||||||
Self::aarch64 => "aarch64",
|
Self::i686 => "i686",
|
||||||
Self::i486 => "i486",
|
Self::riscv64 => "riscv64",
|
||||||
Self::i586 => "i586",
|
Self::x86_64 => "x86_64",
|
||||||
Self::i686 => "i686",
|
Self::any => "any",
|
||||||
Self::riscv64 => "riscv64",
|
})
|
||||||
Self::x86_64 => "x86_64",
|
|
||||||
Self::any => "any",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +69,7 @@ impl FromStr for Arch {
|
|||||||
"arm64" | "aarch64" | "armv8" => Ok(Self::aarch64),
|
"arm64" | "aarch64" | "armv8" => Ok(Self::aarch64),
|
||||||
"riscv" | "riscv64" => Ok(Self::riscv64),
|
"riscv" | "riscv64" => Ok(Self::riscv64),
|
||||||
"any" => Ok(Self::any),
|
"any" => Ok(Self::any),
|
||||||
_ => Err(ParseArchError),
|
_ => Err(ParseArchError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ mod dependency;
|
|||||||
mod specs;
|
mod specs;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::tar::{Node, Owner},
|
|
||||||
crate::{Plist, Version},
|
crate::{Plist, Version},
|
||||||
ron::ser::{to_string_pretty, PrettyConfig},
|
ron::ser::{to_string_pretty, PrettyConfig},
|
||||||
serde::{Deserialize, Serialize},
|
serde::{Deserialize, Serialize},
|
||||||
@ -14,6 +13,7 @@ use {
|
|||||||
io::{BufWriter, Write},
|
io::{BufWriter, Write},
|
||||||
path::Path,
|
path::Path,
|
||||||
},
|
},
|
||||||
|
crate::tar::{Node, Owner},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use {arch::Arch, dependency::Dependency, specs::Specs};
|
pub use {arch::Arch, dependency::Dependency, specs::Specs};
|
||||||
@ -88,7 +88,10 @@ impl Package {
|
|||||||
to_string_pretty(self, cfg)
|
to_string_pretty(self, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_ron_and_create_tar_node(&self, outdir: &Path) -> Result<Node, Box<dyn Error>> {
|
pub fn save_ron_and_create_tar_node(
|
||||||
|
&self,
|
||||||
|
outdir: &Path,
|
||||||
|
) -> Result<Node, Box<dyn Error>> {
|
||||||
if !outdir.exists() {
|
if !outdir.exists() {
|
||||||
fs::create_dir_all(outdir)?;
|
fs::create_dir_all(outdir)?;
|
||||||
}
|
}
|
||||||
@ -110,18 +113,12 @@ impl Package {
|
|||||||
|
|
||||||
/// Returns the formatted full package name including version and release strings
|
/// Returns the formatted full package name including version and release strings
|
||||||
pub fn fullname(&self) -> String {
|
pub fn fullname(&self) -> String {
|
||||||
format!(
|
format!("{}-{}_{}_{}", self.name, self.version, self.release, self.arch)
|
||||||
"{}-{}_{}_{}",
|
|
||||||
self.name, self.version, self.release, self.arch
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the name of the package archive
|
/// Returns the name of the package archive
|
||||||
pub fn archive_name(&self) -> String {
|
pub fn archive_name(&self) -> String {
|
||||||
format!(
|
format!("{}-{}_{}_{}.tar.zstd", self.name, self.version, self.release, self.arch)
|
||||||
"{}-{}_{}_{}.tar.zstd",
|
|
||||||
self.name, self.version, self.release, self.arch
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tests whether this package is an update for another
|
/// Tests whether this package is an update for another
|
||||||
|
Loading…
Reference in New Issue
Block a user