mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
eos-version-compat
This commit is contained in:
committed by
Aiden McClelland
parent
5cb6aebada
commit
e3f7e857e3
@@ -39,13 +39,7 @@ impl Database {
|
||||
id,
|
||||
version: Current::new().semver().into(),
|
||||
last_backup: None,
|
||||
eos_version_compat: VersionRange::Conj(
|
||||
Box::new(VersionRange::Anchor(
|
||||
emver::GTE,
|
||||
emver::Version::new(0, 3, 0, 0),
|
||||
)),
|
||||
Box::new(VersionRange::Anchor(emver::LTE, Current::new().semver())),
|
||||
),
|
||||
eos_version_compat: Current::new().compat().clone(),
|
||||
lan_address: format!("https://{}.local", hostname).parse().unwrap(),
|
||||
tor_address: format!("http://{}", tor_key.public().get_onion_address())
|
||||
.parse()
|
||||
|
||||
@@ -84,19 +84,19 @@ pub async fn install(
|
||||
let reg_url = ctx.package_registry_url().await?;
|
||||
let (man_res, s9pk) = tokio::try_join!(
|
||||
reqwest::get(format!(
|
||||
"{}/package/manifest/{}?version={}&eos-version={}&arch={}",
|
||||
"{}/package/manifest/{}?version={}&eos-version-compat={}&arch={}",
|
||||
reg_url,
|
||||
pkg_id,
|
||||
version,
|
||||
Current::new().semver(),
|
||||
Current::new().compat(),
|
||||
platforms::TARGET_ARCH,
|
||||
)),
|
||||
reqwest::get(format!(
|
||||
"{}/package/{}.s9pk?version={}&eos-version={}&arch={}",
|
||||
"{}/package/{}.s9pk?version={}&eos-version-compat={}&arch={}",
|
||||
reg_url,
|
||||
pkg_id,
|
||||
version,
|
||||
Current::new().semver(),
|
||||
Current::new().compat(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
)
|
||||
@@ -395,11 +395,11 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
let reg_url = ctx.package_registry_url().await?;
|
||||
for (dep, info) in &manifest.dependencies.0 {
|
||||
let manifest: Option<Manifest> = match reqwest::get(format!(
|
||||
"{}/package/manifest/{}?version={}&eos-version={}&arch={}",
|
||||
"{}/package/manifest/{}?version={}&eos-version-compat={}&arch={}",
|
||||
reg_url,
|
||||
dep,
|
||||
info.version,
|
||||
Current::new().semver(),
|
||||
Current::new().compat(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
.await
|
||||
@@ -425,11 +425,11 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
if tokio::fs::metadata(&icon_path).await.is_err() {
|
||||
tokio::fs::create_dir_all(&dir).await?;
|
||||
let icon = reqwest::get(format!(
|
||||
"{}/package/icon/{}?version={}&eos-version={}&arch={}",
|
||||
"{}/package/icon/{}?version={}&eos-version-compat={}&arch={}",
|
||||
reg_url,
|
||||
dep,
|
||||
info.version,
|
||||
Current::new().semver(),
|
||||
Current::new().compat(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
.await
|
||||
|
||||
@@ -15,6 +15,7 @@ use crate::migration::Migrations;
|
||||
use crate::net::interface::Interfaces;
|
||||
use crate::status::health_check::HealthChecks;
|
||||
use crate::util::Version;
|
||||
use crate::version::{Current, VersionT};
|
||||
use crate::volume::Volumes;
|
||||
|
||||
pub const SYSTEM_PACKAGE_ID: PackageId<&'static str> = PackageId(SYSTEM_ID);
|
||||
@@ -97,9 +98,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn current_version() -> Version {
|
||||
Current::new().semver().into()
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, HasModel)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Manifest {
|
||||
#[serde(default = "current_version")]
|
||||
pub eos_version: Version,
|
||||
pub id: PackageId,
|
||||
pub title: String,
|
||||
#[model]
|
||||
@@ -127,8 +134,6 @@ pub struct Manifest {
|
||||
pub properties: Option<ActionImplementation>,
|
||||
#[model]
|
||||
pub volumes: Volumes,
|
||||
// #[serde(default = "current_version")]
|
||||
pub min_os_version: Version,
|
||||
// #[serde(default)]
|
||||
pub interfaces: Interfaces,
|
||||
// #[serde(default)]
|
||||
|
||||
@@ -27,6 +27,7 @@ where
|
||||
type Previous: VersionT;
|
||||
fn new() -> Self;
|
||||
fn semver(&self) -> emver::Version;
|
||||
fn compat(&self) -> &'static emver::VersionRange;
|
||||
async fn up<Db: DbHandle>(&self, db: &mut Db) -> Result<(), Error>;
|
||||
async fn down<Db: DbHandle>(&self, db: &mut Db) -> Result<(), Error>;
|
||||
async fn commit<Db: DbHandle>(&self, db: &mut Db) -> Result<(), Error> {
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
use emver::VersionRange;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use super::*;
|
||||
|
||||
const V0_3_0: emver::Version = emver::Version::new(0, 3, 0, 0);
|
||||
lazy_static! {
|
||||
static ref V0_3_0_COMPAT: VersionRange = VersionRange::Conj(
|
||||
Box::new(VersionRange::Anchor(
|
||||
emver::GTE,
|
||||
emver::Version::new(0, 3, 0, 0),
|
||||
)),
|
||||
Box::new(VersionRange::Anchor(emver::LTE, Current::new().semver())),
|
||||
);
|
||||
}
|
||||
|
||||
pub struct Version;
|
||||
#[async_trait]
|
||||
@@ -12,6 +24,9 @@ impl VersionT for Version {
|
||||
fn semver(&self) -> emver::Version {
|
||||
V0_3_0
|
||||
}
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&*V0_3_0_COMPAT
|
||||
}
|
||||
async fn up<Db: DbHandle>(&self, _db: &mut Db) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user