summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrorka900 <rorka900@gmail.com>2026-03-30 18:32:47 +0000
committerrorka900 <rorka900@gmail.com>2026-03-30 18:32:47 +0000
commitd348081a48c0849e60bc2898c8ee215f896d1414 (patch)
tree0a42ae7dc81735f9e53cacb05a0501b120f51fde
parent700f13b3d404cd03db17f0bfc99c83941a907a76 (diff)
downloadror-d348081a48c0849e60bc2898c8ee215f896d1414.tar.gz
ror-d348081a48c0849e60bc2898c8ee215f896d1414.zip
feat: add musl support and dictionary-compressed ror package format
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/config.rs12
-rw-r--r--src/delete.rs2
-rw-r--r--src/group.rs17
-rw-r--r--src/install.rs89
-rw-r--r--src/main.rs22
-rw-r--r--src/repo.rs6
-rw-r--r--src/rootfs.rs51
-rw-r--r--src/update.rs125
10 files changed, 230 insertions, 98 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 6dbba83..fa7325b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1354,7 +1354,7 @@ dependencies = [
[[package]]
name = "ror"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
"ar",
"bzip2",
diff --git a/Cargo.toml b/Cargo.toml
index 6c2d3d6..24208e7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ror"
-version = "0.4.0"
+version = "0.5.0"
edition = "2024"
authors = ["rorka900"]
description = "RorkOS package manager"
diff --git a/src/config.rs b/src/config.rs
index 698d58e..0c6fc1b 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -21,6 +21,10 @@ pub struct GlobalConfig {
pub allow_external_binaries: bool,
#[serde(default = "default_parallel_downloads")]
pub parallel_downloads: usize,
+ #[serde(default = "default_arch")]
+ pub arch: String,
+ #[serde(default = "default_libc")]
+ pub libc: String,
}
impl Default for GlobalConfig {
@@ -30,6 +34,8 @@ impl Default for GlobalConfig {
strict_gpg: false,
allow_external_binaries: false,
parallel_downloads: default_parallel_downloads(),
+ arch: default_arch(),
+ libc: default_libc(),
}
}
}
@@ -37,6 +43,8 @@ impl Default for GlobalConfig {
fn default_ignore_speed() -> bool { false }
fn default_strict_gpg() -> bool { false }
fn default_parallel_downloads() -> usize { 4 }
+fn default_arch() -> String { std::env::consts::ARCH.to_string() }
+fn default_libc() -> String { "glibc".to_string() }
#[derive(Debug, Deserialize, Serialize, Default, Clone)]
pub struct Config {
@@ -69,6 +77,8 @@ impl Config {
lines.push(format!("ignore_speed = {}", self.global.ignore_speed));
lines.push(format!("strict_gpg = {}", self.global.strict_gpg));
lines.push(format!("parallel_downloads = {}", self.global.parallel_downloads));
+ lines.push(format!("arch = {}", self.global.arch));
+ lines.push(format!("libc = {}", self.global.libc));
lines.push(String::new());
for (name, repo) in &self.repositories {
lines.push(format!("[repositories.{}]", name));
@@ -94,6 +104,8 @@ impl Config {
"ignore_speed = false\n",
"strict_gpg = false\n",
"parallel_downloads = 4\n",
+ "arch = x86_64\n",
+ "libc = glibc\n",
"\n",
"[repositories.rorkos]\n",
"url = \"https://github.com/RorkOS/RorkOS_package\"\n",
diff --git a/src/delete.rs b/src/delete.rs
index b61d001..365867e 100644
--- a/src/delete.rs
+++ b/src/delete.rs
@@ -83,7 +83,7 @@ pub fn check_critical_install(pkg_name: &str, db: &InstalledDB) -> Result<(), St
Ok(())
}
-pub fn remove_package_files_only(pkg_name: &str, files: &[String]) -> bool {
+pub fn remove_package_files_only(_pkg_name: &str, files: &[String]) -> bool {
let mut failed = false;
for rel_path in files {
diff --git a/src/group.rs b/src/group.rs
index 7c6e7ef..edabcc6 100644
--- a/src/group.rs
+++ b/src/group.rs
@@ -10,6 +10,8 @@ pub struct Group {
#[allow(dead_code)]
pub name: String,
pub description: Option<String>,
+ pub libc: Option<String>,
+ pub version: Option<String>,
pub packages: Vec<String>,
}
@@ -73,14 +75,13 @@ pub fn list_groups() {
println!("{} Available package groups:", "[ror]".blue().bold());
if let Ok(entries) = std::fs::read_dir(groups_dir) {
- let mut groups: Vec<String> = entries.flatten()
- .filter_map(|e| e.file_name().to_str().map(|s| s.to_string()))
- .filter(|n| n.ends_with(".yaml"))
- .map(|n| n.trim_end_matches(".yaml").to_string())
- .collect();
- groups.sort();
- for (i, group_name) in groups.iter().enumerate() {
- println!(" {}. {}", i + 1, group_name.green());
+ for entry in entries.flatten() {
+ if let Some(name) = entry.file_name().to_str() {
+ if name.ends_with(".yaml") {
+ let group_name = name.trim_end_matches(".yaml");
+ println!(" {}", group_name.green());
+ }
+ }
}
}
}
diff --git a/src/install.rs b/src/install.rs
index 785746e..1801cc0 100644
--- a/src/install.rs
+++ b/src/install.rs
@@ -42,6 +42,8 @@ pub struct Package {
#[serde(default)]
pub install_steps: String,
#[serde(default)]
+ pub libc: Option<String>,
+ #[serde(default)]
pub depends: Vec<Dependency>,
#[serde(default)]
pub conflicts: Vec<String>,
@@ -64,6 +66,10 @@ pub struct BinaryPackage {
pub install_prefix: String,
#[serde(default)]
pub files: Vec<String>,
+ #[serde(default)]
+ pub libc: Option<String>,
+ #[serde(default)]
+ pub dict: Option<String>,
}
fn default_install_prefix() -> String {
@@ -74,6 +80,7 @@ fn default_install_prefix() -> String {
pub struct InstalledPackage {
pub name: String,
pub version: String,
+ pub libc: Option<String>,
pub files: Vec<String>,
pub installed_at: String,
}
@@ -173,19 +180,48 @@ pub fn extract_deb(archive_path: &Path, dest_root: &Path) -> Result<Vec<String>,
Ok(installed_files)
}
-pub fn select_binary_for_arch<'a>(pkg: &'a Package, arch: &str) -> Result<&'a BinaryPackage, String> {
- let target_arch = match arch {
+fn normalize_arch(arch: &str) -> &str {
+ match arch {
"native" => match std::env::consts::ARCH {
"x86_64" => "amd64",
"aarch64" => "arm64",
other => other,
},
+ "x86_64" | "x64" => "amd64",
+ "aarch64" | "arm64" => "arm64",
other => other,
- };
+ }
+}
+
+fn normalize_libc(libc: &str) -> &str {
+ match libc {
+ "glibc" | "g" => "g",
+ "musl" | "m" => "m",
+ "static" => "static",
+ other => other,
+ }
+}
+
+pub fn select_binary_for_arch<'a>(pkg: &'a Package, arch: &str, libc: &str) -> Result<&'a BinaryPackage, String> {
+ let target_arch = normalize_arch(arch);
+ let target_libc = normalize_libc(libc);
+
pkg.binaries
.iter()
- .find(|b| b.arch == target_arch || b.arch == "all" || b.arch == "x86_64")
- .ok_or_else(|| format!("No binary package for architecture {}", arch))
+ .find(|b| {
+ let arch_ok = b.arch == target_arch || b.arch == "all" || b.arch == "x86_64";
+ let libc_ok = match b.libc.as_deref() {
+ None => true,
+ Some("gm") => true,
+ Some("static") => true,
+ Some(l) => normalize_libc(l) == target_libc,
+ };
+ arch_ok && libc_ok
+ })
+ .ok_or_else(|| format!(
+ "No binary for arch='{}' libc='{}' in package '{}'",
+ arch, libc, pkg.name
+ ))
}
pub fn find_package_file(pkg_name: &str) -> Option<PathBuf> {
@@ -241,7 +277,7 @@ pub fn install_package_with_result(pkg_name: &str, cfg: &config::Config) -> Resu
return Err("No binary packages defined".to_string());
}
- let binary = select_binary_for_arch(&pkg, "native")?;
+ let binary = select_binary_for_arch(&pkg, &cfg.global.arch, &cfg.global.libc)?;
let db = InstalledDB::load();
for conflict in &pkg.conflicts {
@@ -300,6 +336,19 @@ pub fn install_package_with_result(pkg_name: &str, cfg: &config::Config) -> Resu
if pkg_type == "deb" {
let mut files = extract_deb(&archive_path, Path::new("/"))?;
all_installed_files.append(&mut files);
+ } else if pkg_type == "ror" {
+ let dict_url = binary.dict.as_ref()
+ .ok_or_else(|| format!("Package '{}' has type 'ror' but no dict URL", pkg_name))?;
+ sp2.tick(&format!("Downloading dictionary for {}...", pkg_name));
+ let dict_path = download_and_verify(dict_url, "", cfg)?;
+ let files = extract_ror(&archive_path, &dict_path, &work_dir)
+ .map_err(|e| format!("Extraction failed: {}", e))?;
+ let _ = fs::remove_file(&dict_path);
+ let file_list = if binary.files.is_empty() { files } else { binary.files.clone() };
+ sp2.tick(&format!("Installing files for {}...", pkg_name));
+ let mut installed = install_files(&work_dir, &binary.install_prefix, &file_list)
+ .map_err(|e| format!("Failed to install files: {}", e))?;
+ all_installed_files.append(&mut installed);
} else {
let files = extract_native(&archive_path, &work_dir)
.map_err(|e| format!("Extraction failed: {}", e))?;
@@ -332,6 +381,7 @@ pub fn install_package_with_result(pkg_name: &str, cfg: &config::Config) -> Resu
Ok(InstalledPackage {
name: pkg.name.clone(),
version: pkg.version.clone(),
+ libc: pkg.libc.clone(),
files: all_installed_files,
installed_at: Local::now().to_rfc3339(),
})
@@ -450,6 +500,33 @@ pub fn extract_native(archive_path: &Path, target_dir: &Path) -> Result<Vec<Stri
Ok(files)
}
+pub fn extract_ror(archive_path: &Path, dict_path: &Path, target_dir: &Path) -> Result<Vec<String>, String> {
+ let zstd_arg = format!("zstd -D {}", dict_path.display());
+
+ let status = Command::new("tar")
+ .arg("-I")
+ .arg(&zstd_arg)
+ .arg("-xf")
+ .arg(archive_path)
+ .arg("-C")
+ .arg(target_dir)
+ .status()
+ .map_err(|e| format!("Failed to execute tar for .ror: {}", e))?;
+
+ if !status.success() {
+ return Err(format!("tar .ror extraction failed with exit code {:?}", status.code()));
+ }
+
+ let mut files = Vec::new();
+ for entry in WalkDir::new(target_dir).into_iter().filter_map(|e| e.ok()) {
+ if entry.file_type().is_file() || entry.file_type().is_symlink() {
+ let rel_path = entry.path().strip_prefix(target_dir).unwrap();
+ files.push(rel_path.to_string_lossy().to_string());
+ }
+ }
+ Ok(files)
+}
+
fn install_files(source_dir: &Path, prefix: &str, files: &[String]) -> Result<Vec<String>, String> {
let prefix_path = Path::new(prefix);
let mut installed = Vec::new();
diff --git a/src/main.rs b/src/main.rs
index 8daccab..fc1df89 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,8 +52,8 @@ struct Args {
#[arg(long = "dry-run")]
dry_run: bool,
- #[arg(short = 'u', long = "upgrade")]
- upgrade: bool,
+ #[arg(short = 'u', long = "upgrade", value_name = "RECIPE")]
+ upgrade: Option<std::path::PathBuf>,
#[arg(long = "repo-add", value_names = ["NAME", "URL"])]
repo_add: Option<Vec<String>>,
@@ -92,7 +92,7 @@ fn main() {
}
if args.gen_config {
- let config_path = Path::new("/var/ror/ror.conf");
+ let config_path = Path::new("/etc/ror/ror.conf");
match config::Config::create_default_config(config_path) {
Ok(()) => println!(
"{} Default config created at {:?}",
@@ -274,20 +274,8 @@ fn main() {
return;
}
- if args.upgrade {
- if args.dry_run {
- let upgradable = update::list_upgradable();
- if upgradable.is_empty() {
- println!("{} No packages to upgrade.", "[ror]".green());
- } else {
- println!("{} Packages that would be upgraded:", ">>>".yellow());
- for pkg in upgradable {
- println!(" - {}", pkg);
- }
- }
- } else {
- update::upgrade_all(&cfg, false);
- }
+ if let Some(recipe_path) = args.upgrade {
+ update::rebuild_from_recipe(&recipe_path, &cfg);
return;
}
diff --git a/src/repo.rs b/src/repo.rs
index bd87ea5..0de55c5 100644
--- a/src/repo.rs
+++ b/src/repo.rs
@@ -1,4 +1,3 @@
-
use colored::Colorize;
use std::fs;
use std::path::Path;
@@ -46,11 +45,8 @@ pub fn list_repositories() {
}
fn save_config(cfg: &Config) -> Result<(), String> {
- let path = Path::new("/var/ror/ror.conf");
+ let path = Path::new("/etc/ror/ror.conf");
let ini = cfg.to_ini().map_err(|e| format!("Failed to serialize config: {}", e))?;
fs::write(path, ini).map_err(|e| format!("Failed to write config: {}", e))?;
Ok(())
}
-
-
-
diff --git a/src/rootfs.rs b/src/rootfs.rs
index 1ad0cc9..bd139de 100644
--- a/src/rootfs.rs
+++ b/src/rootfs.rs
@@ -14,7 +14,7 @@ use crate::progress::ProgressBar;
use chrono::Local;
use crate::install::{
Dependency, load_package, download_and_verify,
- extract_native, install_files_with_root, select_binary_for_arch,
+ extract_native, extract_ror, install_files_with_root, select_binary_for_arch,
InstalledDB, InstalledPackage,
};
@@ -35,7 +35,7 @@ struct ListInstalled {
packages: Vec<InstalledEntry>,
}
-fn collect_install_order(start_pkgs: &[String]) -> Result<Vec<String>, String> {
+pub fn collect_install_order(start_pkgs: &[String]) -> Result<Vec<String>, String> {
let mut order: Vec<String> = Vec::new();
let mut visited: HashSet<String> = HashSet::new();
@@ -74,13 +74,13 @@ fn collect_install_order(start_pkgs: &[String]) -> Result<Vec<String>, String> {
Ok(order)
}
-fn build_download_tasks(packages: &[String], target_arch: &str) -> Result<Vec<DownloadTask>, String> {
+fn build_download_tasks(packages: &[String], target_arch: &str, target_libc: &str) -> Result<Vec<DownloadTask>, String> {
let mut tasks = Vec::new();
for pkg_name in packages {
let pkg = load_package(pkg_name)
.ok_or_else(|| format!("Package '{}' not found", pkg_name))?;
- let binary = select_binary_for_arch(&pkg, target_arch)
+ let binary = select_binary_for_arch(&pkg, target_arch, target_libc)
.map_err(|e| format!("No binary for '{}': {}", pkg_name, e))?;
let urls: Vec<String> = if !binary.url.is_empty() {
@@ -205,6 +205,9 @@ fn install_from_archive(
archive_path: &std::path::Path,
root_dir: &Path,
binary_files: &[String],
+ pkg_type: &str,
+ dict_url: Option<&str>,
+ cfg: &config::Config,
) -> Result<Vec<String>, String> {
let work_dir = std::path::Path::new("/tmp/ror-rootfs").join(pkg_name);
if work_dir.exists() {
@@ -214,8 +217,18 @@ fn install_from_archive(
fs::create_dir_all(&work_dir)
.map_err(|e| format!("Failed to create temp dir for '{}': {}", pkg_name, e))?;
- let extracted = extract_native(archive_path, &work_dir)
- .map_err(|e| format!("Extraction failed for '{}': {}", pkg_name, e))?;
+ let extracted = if pkg_type == "ror" {
+ let url = dict_url.ok_or_else(|| format!("Package '{}' has type 'ror' but no dict URL", pkg_name))?;
+ let dict_path = download_and_verify(url, "", cfg)
+ .map_err(|e| format!("Failed to download dict for '{}': {}", pkg_name, e))?;
+ let files = extract_ror(archive_path, &dict_path, &work_dir)
+ .map_err(|e| format!("Extraction failed for '{}': {}", pkg_name, e))?;
+ let _ = fs::remove_file(&dict_path);
+ files
+ } else {
+ extract_native(archive_path, &work_dir)
+ .map_err(|e| format!("Extraction failed for '{}': {}", pkg_name, e))?
+ };
let file_list = if binary_files.is_empty() {
extracted
@@ -492,6 +505,7 @@ fn write_installed_json(
target_dir: &Path,
packages: &[String],
files_map: &HashMap<String, Vec<String>>,
+ group: &crate::group::Group,
) -> Result<(), String> {
let mut db = InstalledDB::default();
let now = Local::now().to_rfc3339();
@@ -501,11 +515,19 @@ fn write_installed_json(
db.packages.insert(name.clone(), InstalledPackage {
name: pkg.name,
version: pkg.version,
+ libc: pkg.libc.clone(),
files,
installed_at: now.clone(),
});
}
}
+ db.packages.insert(group.name.clone(), InstalledPackage {
+ name: group.name.clone(),
+ version: group.version.clone().unwrap_or_else(|| "0".to_string()),
+ libc: group.libc.clone(),
+ files: vec![],
+ installed_at: now.clone(),
+ });
let json = serde_json::to_string_pretty(&db)
.map_err(|e| format!("Failed to serialize installed.json: {}", e))?;
let out_dir = target_dir.join("etc/ror");
@@ -563,7 +585,7 @@ pub fn build_rootfs(
println!("{} {} packages to install (including dependencies)", ">>>".green(), all_packages.len());
println!("\n{} Phase 1b: Building download queue...", ">>>".cyan().bold());
- let tasks = build_download_tasks(&all_packages, target_arch)?;
+ let tasks = build_download_tasks(&all_packages, target_arch, &cfg.global.libc)?;
let n_parallel = cfg.global.parallel_downloads.max(1);
let cfg_arc = Arc::new(cfg.clone());
@@ -579,14 +601,23 @@ pub fn build_rootfs(
let pkg = load_package(pkg_name)
.ok_or_else(|| format!("Package '{}' not found", pkg_name))?;
- let binary = select_binary_for_arch(&pkg, target_arch)
+ let binary = select_binary_for_arch(&pkg, target_arch, &cfg.global.libc)
.map_err(|e| format!("Arch selection failed for '{}': {}", pkg_name, e))?;
let archive_path = downloaded.get(pkg_name)
.ok_or_else(|| format!("Archive for '{}' was not downloaded", pkg_name))?;
pb.inc(&format!("Installing {}", pkg_name));
- let files = install_from_archive(pkg_name, archive_path, target_dir, &binary.files)?;
+ let pkg_type = binary.pkg_type.as_deref().unwrap_or("tar.xz");
+ let files = install_from_archive(
+ pkg_name,
+ archive_path,
+ target_dir,
+ &binary.files,
+ pkg_type,
+ binary.dict.as_deref(),
+ cfg,
+ )?;
installed_files_map.insert(pkg_name.clone(), files);
installing.insert(pkg_name.clone());
}
@@ -597,7 +628,7 @@ pub fn build_rootfs(
println!("{} listinstalled.yaml written to var/ror/", ">>>".green());
println!("{} Writing installed.json...", ">>>".cyan());
- write_installed_json(target_dir, &all_packages, &installed_files_map)?;
+ write_installed_json(target_dir, &all_packages, &installed_files_map, &group)?;
println!("{} installed.json written to etc/ror/", ">>>".green());
if run_ldconfig {
diff --git a/src/update.rs b/src/update.rs
index 1d682c0..642da11 100644
--- a/src/update.rs
+++ b/src/update.rs
@@ -1,10 +1,14 @@
use colored::Colorize;
-use crate::install::{self, InstalledDB, get_package_info};
+use std::fs;
+use std::path::{Path, PathBuf};
+use crate::install::{self, InstalledDB, InstalledPackage, get_package_info};
use crate::delete;
use crate::config;
+use crate::group::Group;
+use crate::rootfs::collect_install_order;
use crate::progress::ProgressBar;
-use std::collections::HashSet;
use semver::Version;
+use chrono::Local;
fn is_newer(current: &str, available: &str) -> bool {
match (Version::parse(current), Version::parse(available)) {
@@ -49,66 +53,89 @@ pub fn update_package(pkg_name: &str, cfg: &config::Config, dry_run: bool) -> bo
true
}
-pub fn upgrade_all(cfg: &config::Config, dry_run: bool) {
- let db = InstalledDB::load();
- let installed: Vec<String> = db.packages.keys().cloned().collect();
- if installed.is_empty() {
- println!("{} No packages installed.", "[ror]".yellow());
- return;
+pub fn resolve_recipe_path(name_or_path: &Path) -> PathBuf {
+ if name_or_path.exists() {
+ return name_or_path.to_path_buf();
+ }
+ let as_str = name_or_path.to_string_lossy();
+ if !as_str.contains('/') && !as_str.ends_with(".yaml") {
+ return PathBuf::from(format!("/var/ror/packages/groups/{}.yaml", as_str));
+ }
+ if !as_str.ends_with(".yaml") {
+ return PathBuf::from(format!("{}.yaml", as_str));
}
+ name_or_path.to_path_buf()
+}
- let total = installed.len();
- let mut pb = ProgressBar::new(total, "Checking for upgrades...");
+pub fn rebuild_from_recipe(recipe_path: &Path, cfg: &config::Config) {
+ let resolved = resolve_recipe_path(recipe_path);
- let mut updated = HashSet::new();
- let failed: Vec<String> = Vec::new();
- let mut skipped = 0usize;
+ let content = match fs::read_to_string(&resolved) {
+ Ok(c) => c,
+ Err(e) => {
+ eprintln!("{} Failed to read recipe '{}': {}", "[ror]".red().bold(), resolved.display(), e);
+ return;
+ }
+ };
- for pkg in &installed {
- if updated.contains(pkg) {
- pb.inc(&format!("Skipping {} (already processed)", pkg));
- skipped += 1;
- continue;
+ let group: Group = match serde_yaml::from_str(&content) {
+ Ok(g) => g,
+ Err(e) => {
+ eprintln!("{} Recipe YAML error: {}", "[ror]".red().bold(), e);
+ return;
}
+ };
- pb.inc(&format!("Checking {}...", pkg));
+ println!(
+ "{} Rebuilding system from recipe '{}' ({} packages)",
+ "[ror]".blue().bold(),
+ group.name,
+ group.packages.len()
+ );
- if update_package(pkg, cfg, dry_run) {
- updated.insert(pkg.clone());
- } else {
- skipped += 1;
+ let order = match collect_install_order(&group.packages) {
+ Ok(o) => o,
+ Err(e) => {
+ eprintln!("{} {}", "[ror]".red().bold(), e);
+ return;
+ }
+ };
+
+ let mut db = InstalledDB::load();
+ let total = order.len();
+ let mut pb = ProgressBar::new(total, "Rebuilding...");
+ let now = Local::now().to_rfc3339();
+
+ for pkg_name in &order {
+ pb.inc(&format!("Reinstalling {}", pkg_name));
+ match install::install_package_with_result(pkg_name, cfg) {
+ Ok(mut installed_pkg) => {
+ installed_pkg.installed_at = now.clone();
+ db.add_package(installed_pkg);
+ }
+ Err(e) => {
+ eprintln!("{} Failed to reinstall '{}': {}", "[ror]".red().bold(), pkg_name, e);
+ }
}
}
- if dry_run {
- pb.finish(&format!("DRY RUN: {} packages would be updated, {} already up-to-date", updated.len(), skipped));
- println!("{} DRY RUN: {} packages would be updated.", ">>>".yellow(), updated.len());
+ db.add_package(InstalledPackage {
+ name: group.name.clone(),
+ version: group.version.clone().unwrap_or_else(|| "0".to_string()),
+ libc: group.libc.clone(),
+ files: vec![],
+ installed_at: now.clone(),
+ });
+
+ pb.finish(&format!("{} packages reinstalled", total));
+
+ if let Err(e) = db.save() {
+ eprintln!("{} Failed to save installed DB: {}", "[ror]".red().bold(), e);
} else {
- pb.finish(&format!("Upgrade done: {} updated, {} failed, {} up-to-date", updated.len(), failed.len(), skipped));
println!(
- "{} Upgrade completed. Updated: {}, failed: {}, up-to-date: {}.",
+ "{} Rebuild complete from recipe '{}'",
"[ror]".green().bold(),
- updated.len(),
- failed.len(),
- skipped
+ group.name
);
- if !failed.is_empty() {
- println!("{} Failed packages: {:?}", "[ror]".red(), failed);
- }
- }
-}
-
-pub fn list_upgradable() -> Vec<String> {
- let db = InstalledDB::load();
- let mut upgradable = Vec::new();
- for pkg_name in db.packages.keys() {
- let installed_version = &db.packages[pkg_name].version;
- if let Some(info) = get_package_info(pkg_name) {
- let available_version = info.1;
- if is_newer(installed_version, &available_version) {
- upgradable.push(pkg_name.clone());
- }
- }
}
- upgradable
}