diff --git a/Cargo.lock b/Cargo.lock index 25b83304..14bd07fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3257,6 +3257,7 @@ dependencies = [ "dashmap", "futures", "indicatif", + "oma-apt", "oma-apt-sources-lists", "oma-console", "oma-debcontrol", diff --git a/data/config/oma.toml b/data/config/oma.toml index 1f769ca8..97c72f6a 100644 --- a/data/config/oma.toml +++ b/data/config/oma.toml @@ -1,8 +1,6 @@ [general] # Set to false to allow removal of "Essential" packages. protect_essentials = true -# Set to true to force refresh uncompress package database file. -refresh_pure_database = false # Set to true to no check dbus with install pacakge no_check_dbus = false # set to true to do not refresh topic manifest data diff --git a/oma-pm/examples/download_pkgs.rs b/oma-pm/examples/download_pkgs.rs index 14663d6e..409747fe 100644 --- a/oma-pm/examples/download_pkgs.rs +++ b/oma-pm/examples/download_pkgs.rs @@ -13,11 +13,11 @@ use oma_console::{ writer::Writer, }; use oma_fetch::{reqwest::ClientBuilder, DownloadEvent}; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder, OmaAptError}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder, OmaAptError}; fn main() -> Result<(), OmaAptError> { let oma_apt_args = OmaAptArgsBuilder::default().build().unwrap(); - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let pkgs = apt.select_pkg(&vec!["vscodium", "go"], false, true, true)?; std::fs::create_dir_all("./test").unwrap(); diff --git a/oma-pm/examples/install_fish.rs b/oma-pm/examples/install_fish.rs index e72b9c87..52ee3116 100644 --- a/oma-pm/examples/install_fish.rs +++ b/oma-pm/examples/install_fish.rs @@ -10,11 +10,11 @@ use oma_console::{ writer::Writer, }; use oma_fetch::{reqwest::ClientBuilder, DownloadEvent}; -use oma_pm::apt::{AptArgs, OmaApt, OmaAptArgsBuilder, OmaAptError}; +use oma_pm::apt::{AptArgs, AptConfig, OmaApt, OmaAptArgsBuilder, OmaAptError}; fn main() -> Result<(), OmaAptError> { let oma_apt_args = OmaAptArgsBuilder::default().build().unwrap(); - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let pkgs = apt.select_pkg(&vec!["fish"], false, true, true)?; let mb = Arc::new(MultiProgress::new()); diff --git a/oma-pm/src/apt.rs b/oma-pm/src/apt.rs index 27979e82..9003a4ad 100644 --- a/oma-pm/src/apt.rs +++ b/oma-pm/src/apt.rs @@ -174,8 +174,13 @@ pub enum FilterMode { impl OmaApt { /// Create a new apt manager - pub fn new(local_debs: Vec, args: OmaAptArgs, dry_run: bool) -> OmaAptResult { - let config = Self::init_config(args)?; + pub fn new( + local_debs: Vec, + args: OmaAptArgs, + dry_run: bool, + config: AptConfig, + ) -> OmaAptResult { + let config = Self::init_config(config, args)?; let bus = OmaBus { status: Status::Configing, @@ -214,9 +219,7 @@ impl OmaApt { } /// Init apt config (before create new apt manager) - fn init_config(args: OmaAptArgs) -> OmaAptResult { - let config = AptConfig::new(); - + fn init_config(config: AptConfig, args: OmaAptArgs) -> OmaAptResult { let sysroot = Path::new(&args.sysroot); let sysroot = sysroot .canonicalize() diff --git a/oma-refresh/Cargo.toml b/oma-refresh/Cargo.toml index 4ccdf236..86f4e749 100644 --- a/oma-refresh/Cargo.toml +++ b/oma-refresh/Cargo.toml @@ -3,7 +3,7 @@ name = "oma-refresh" version = "0.25.0" edition = "2021" description = "APT repository refresh handler library" -license = "MIT" +license = "GPL-3.0-or-later" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -25,6 +25,7 @@ smallvec = "1.1" small-map = "0.1" oma-repo-verify = { version = "^0.1.0", path = "../oma-repo-verify", default-features = false } ahash = "0.8.11" +oma-apt = "0.7.0" aho-corasick = "1.1.3" [features] diff --git a/oma-refresh/examples/update.rs b/oma-refresh/examples/update.rs index 3c47d6f1..6b732cf1 100644 --- a/oma-refresh/examples/update.rs +++ b/oma-refresh/examples/update.rs @@ -9,6 +9,7 @@ use std::{ use dashmap::DashMap; use indicatif::{MultiProgress, ProgressBar}; +use oma_apt::config::Config; use oma_console::{ pb::{global_progress_bar_style, progress_bar_style, spinner_style}, writer::Writer, @@ -23,14 +24,16 @@ async fn main() -> Result<(), RefreshError> { tokio::fs::create_dir_all(p).await.unwrap(); let client = ClientBuilder::new().user_agent("oma").build().unwrap(); + let apt_config = Config::new(); + let refresher: OmaRefresh = OmaRefreshBuilder { client: &client, source: PathBuf::from("/"), limit: Some(4), arch: dpkg_arch("/").unwrap(), download_dir: p.to_path_buf(), - download_compress: true, - refresh_topics: true, + refresh_topics: false, + apt_config: &apt_config, } .into(); diff --git a/oma-refresh/src/config.rs b/oma-refresh/src/config.rs new file mode 100644 index 00000000..c6da0426 --- /dev/null +++ b/oma-refresh/src/config.rs @@ -0,0 +1,250 @@ +use std::{cmp::Ordering, collections::VecDeque, env, path::Path}; + +use ahash::AHashMap; +use oma_apt::config::Config; +use oma_fetch::CompressFile; +use smallvec::{smallvec, SmallVec}; +use tracing::debug; + +use crate::inrelease::ChecksumItem; + +fn get_config(config: &Config) -> Vec<(String, String)> { + let Some(tree) = config.root_tree() else { + return vec![]; + }; + + let mut list = vec![]; + + let mut stack = VecDeque::new(); + stack.push_back((tree, 0)); + + let mut depth = 0; + let mut name = "".to_string(); + + while let Some((node, indent)) = stack.pop_back() { + let mut k = None; + let mut v = None; + + if let Some(item) = node.sibling() { + stack.push_back((item, indent)); + } + + if let Some(item) = node.child() { + stack.push_back((item, indent + 2)); + } + + if let Some(tag) = node.tag() { + match indent.cmp(&depth) { + Ordering::Less => { + let mut tmp = name.split("::").collect::>(); + for _ in 0..=1 { + tmp.pop(); + } + name = tmp.join("::"); + name.push_str("::"); + name.push_str(&tag); + } + Ordering::Equal => { + let mut tmp = name.split("::").collect::>(); + tmp.pop(); + name = tmp.join("::"); + name.push_str("::"); + name.push_str(&tag); + } + Ordering::Greater => { + name.push_str("::"); + name.push_str(&tag); + } + } + + depth = indent; + k = Some(name.strip_prefix("::").unwrap().to_string()); + } + + if let Some(value) = node.value() { + v = Some(value); + } + + if let Some(v) = k.zip(v) { + list.push((v.0, v.1)); + } + } + + list +} + +#[derive(Debug)] +pub struct ChecksumDownloadEntry { + pub item: ChecksumItem, + pub keep_compress: bool, + pub msg: String, +} + +pub fn fiilter_download_list( + checksums: &SmallVec<[ChecksumItem; 32]>, + config: &Config, + archs: &[String], + components: &[String], + native_arch: &str, +) -> SmallVec<[ChecksumDownloadEntry; 32]> { + let mut v = smallvec![]; + let config_tree = get_config(config); + + let mut filter_entry = vec![]; + + let mut archs_contains_all = vec![]; + archs_contains_all.extend_from_slice(archs); + archs_contains_all.push("all".to_string()); + + for (k, v) in config_tree { + if (k.starts_with("APT::Acquire::IndexTargets::deb::")) + || (k.starts_with("Acquire::IndexTargets::deb::")) && k.ends_with("::MetaKey") + { + for a in &archs_contains_all { + for c in components { + let s = replace_arch_and_component(&v, c, a, native_arch); + let e = k + .strip_prefix("APT::") + .unwrap_or(&k) + .strip_suffix("::MetaKey") + .unwrap(); + + let keep_compress = config.bool(&format!("{e}::KeepCompressed"), false); + + debug!("{e} keep compress: {}", keep_compress); + + let msg = if let Some(match_msg) = config.get(&format!("{e}::ShortDescription")) + { + let mut s = replace_arch_and_component(&match_msg, c, a, native_arch); + + if let Ok(env_lang) = env::var("LANG") { + let langs = get_matches_language(&env_lang); + + if !langs.is_empty() { + s = s.replace("$(LANGUAGE)", langs[0]); + } + } + + s + } else { + "Other".to_string() + }; + + let mut list = vec![]; + + if v.contains("$(LANGUAGE)") { + if let Ok(env_lang) = env::var("LANG") { + let langs = get_matches_language(&env_lang); + + for i in langs { + list.push(( + s.replace("$(LANGUAGE)", i), + keep_compress, + msg.clone(), + )); + } + } + } + + if list.is_empty() { + filter_entry.push((s, keep_compress, msg.clone())); + } else { + filter_entry.extend(list); + } + } + } + } + } + + debug!("{:?}", filter_entry); + + let mut map: AHashMap<&str, ChecksumDownloadEntry> = AHashMap::new(); + + for i in checksums { + if let Some(x) = filter_entry.iter().find(|x| { + let path = Path::new(&i.name); + let path = path.with_extension(""); + let path = path.to_string_lossy(); + path == x.0 + }) { + if let Some(y) = map.get_mut(x.0.as_str()) { + if compress_file(&y.item.name) > compress_file(&i.name) { + continue; + } else { + *y = ChecksumDownloadEntry { + item: i.clone(), + keep_compress: x.1, + msg: x.2.clone(), + } + } + } else { + map.insert( + &x.0, + ChecksumDownloadEntry { + item: i.clone(), + keep_compress: x.1, + msg: x.2.clone(), + }, + ); + } + } + } + + for (_, i) in map { + v.push(i); + } + + debug!("{:?}", v); + + v +} + +fn get_matches_language(env_lang: &str) -> Vec<&str> { + let mut langs = vec![]; + let env_lang = env_lang.split_once('.').map(|x| x.0).unwrap_or(env_lang); + + let lang = if env_lang == "C" { "en" } else { env_lang }; + + langs.push(lang); + + // en_US.UTF-8 => en + if let Some((a, _)) = lang.split_once('_') { + langs.push(a); + } + + langs +} + +fn replace_arch_and_component( + input: &str, + component: &str, + arch: &str, + native_arch: &str, +) -> String { + let mut output = input + .replace("$(COMPONENT)", component) + .replace("$(ARCHITECTURE)", arch); + + if arch == native_arch { + output = output.replace("$(NATIVE_ARCHITECTURE)", arch); + } + + output +} + +fn compress_file(name: &str) -> CompressFile { + CompressFile::from( + Path::new(name) + .extension() + .map(|x| x.to_string_lossy()) + .unwrap_or_default() + .to_string() + .as_str(), + ) +} + +#[test] +fn test() { + let map = get_config(&Config::new()); + dbg!(map); +} diff --git a/oma-refresh/src/db.rs b/oma-refresh/src/db.rs index 6ccd7a22..8a4d9f89 100644 --- a/oma-refresh/src/db.rs +++ b/oma-refresh/src/db.rs @@ -1,4 +1,7 @@ -use std::path::{Path, PathBuf}; +use std::{ + borrow::Cow, + path::{Path, PathBuf}, +}; use ahash::AHashMap; use aho_corasick::BuildError; @@ -6,6 +9,7 @@ use futures::{ future::{join_all, BoxFuture}, FutureExt, StreamExt, }; +use oma_apt::config::Config; use oma_apt_sources_lists::SourceError; use oma_fetch::{ checksum::{Checksum, ChecksumError}, @@ -23,8 +27,10 @@ use tokio::fs; use tracing::debug; use crate::{ + config::{fiilter_download_list, ChecksumDownloadEntry}, inrelease::{ - ChecksumItem, ChecksumType, DistFileType, InRelease, InReleaseParser, InReleaseParserError, + file_is_compress, split_ext_and_filename, ChecksumType, InRelease, InReleaseParser, + InReleaseParserError, }, util::{ get_sources, human_download_url, DatabaseFilenameReplacer, OmaSourceEntry, @@ -115,10 +121,10 @@ pub struct OmaRefreshBuilder<'a> { pub limit: Option, pub arch: String, pub download_dir: PathBuf, - pub download_compress: bool, pub client: &'a Client, #[cfg(feature = "aosc")] pub refresh_topics: bool, + pub apt_config: &'a Config, } pub struct OmaRefresh<'a> { @@ -126,11 +132,11 @@ pub struct OmaRefresh<'a> { limit: Option, arch: String, download_dir: PathBuf, - download_compress: bool, client: &'a Client, flat_repo_no_release: Vec, #[cfg(feature = "aosc")] refresh_topics: bool, + apt_config: &'a Config, } impl<'a> From> for OmaRefresh<'a> { @@ -140,11 +146,11 @@ impl<'a> From> for OmaRefresh<'a> { limit: builder.limit, arch: builder.arch, download_dir: builder.download_dir, - download_compress: builder.download_compress, client: builder.client, flat_repo_no_release: vec![], #[cfg(feature = "aosc")] refresh_topics: builder.refresh_topics, + apt_config: builder.apt_config, } } } @@ -541,11 +547,9 @@ impl<'a> OmaRefresh<'a> { inrelease: &inrelease, signed_by: ose.signed_by.as_deref(), mirror: urlc, - archs: &archs, is_flat: ose.is_flat, p: &inrelease_path, rootfs: &self.source, - components: &ose.components, trusted: ose.trusted, }; @@ -553,102 +557,41 @@ impl<'a> OmaRefresh<'a> { RefreshError::InReleaseParseError(inrelease_path.display().to_string(), err) })?; - let checksums = inrelease - .checksums - .iter() - .filter(|x| { - ose.components - .iter() - .any(|y| y.contains(x.name.split('/').next().unwrap_or(&x.name))) - }) - .map(|x| x.to_owned()) - .collect::>(); - - let handle = if ose.is_flat { - debug!("{} is flat repo", ose.url); - // Flat repo - let mut handle = vec![]; - for i in &inrelease.checksums { - if i.file_type == DistFileType::PackageList { - debug!("oma will download package list: {}", i.name); - handle.push(i); - total += i.size; - } - } - - handle - } else { - let mut handle = vec![]; - let mut compress_file_map = AHashMap::new(); - for i in &checksums { - match &i.file_type { - DistFileType::BinaryContents => { - debug!("oma will download Binary Contents: {}", i.name); - handle.push(i); - total += i.size; - } - DistFileType::Contents | DistFileType::PackageList - if !self.download_compress => - { - debug!("oma will download Package List/Contents: {}", i.name); - handle.push(i); - total += i.size; - } - DistFileType::CompressContents(name, compress_type) => { - if self.download_compress { - debug!( - "oma will download compress Package List/compress Contetns: {}", - i.name - ); - - compress_file_map - .entry(name) - .and_modify(|x: &mut Vec<(&str, u64, &ChecksumItem)>| { - x.push((compress_type, i.size, i)) - }) - .or_insert(vec![(compress_type, i.size, i)]); - } - } - DistFileType::CompressPackageList(name, compress_type) => { - if self.download_compress { - debug!( - "oma will download compress Package List/compress Contetns: {}", - i.name - ); - - let size = checksums - .iter() - .find_map(|x| if x.name == *name { Some(x.size) } else { None }) - .unwrap_or(i.size); - - compress_file_map - .entry(name) - .and_modify(|x: &mut Vec<(&str, u64, &ChecksumItem)>| { - x.push((compress_type, size, i)) - }) - .or_insert(vec![(compress_type, size, i)]); - } - } - _ => continue, - } - } - - for (_, mut v) in compress_file_map { - if v.is_empty() { - continue; - } + let filter_checksums = fiilter_download_list( + &inrelease.checksums, + self.apt_config, + &archs, + &ose.components, + &ose.native_arch, + ); - v.sort_unstable_by(|a, b| { - CompressFile::from(b.0).cmp(&CompressFile::from(a.0)) - }); + let mut handle = vec![]; + for i in &filter_checksums { + if i.keep_compress { + total += i.item.size; + } else { + let size = if file_is_compress(&i.item.name) { + let (_, name_without_compress) = split_ext_and_filename(&i.item.name); + + inrelease + .checksums + .iter() + .find_map(|x| { + if x.name == name_without_compress { + Some(x.size) + } else { + None + } + }) + .unwrap_or(i.item.size) + } else { + i.item.size + }; - let (_, size, i) = v.first().unwrap(); - handle.push(i); total += size; } - - handle - }; + handle.push(i); + } for i in &self.flat_repo_no_release { download_flat_repo_no_release( @@ -663,7 +606,6 @@ impl<'a> OmaRefresh<'a> { collect_download_task( c, sourcelist.get(inrelease_summary.count).unwrap(), - &checksums, &self.download_dir, &mut tasks, &inrelease, @@ -747,22 +689,14 @@ fn download_flat_repo_no_release( } fn collect_download_task( - c: &ChecksumItem, + c: &ChecksumDownloadEntry, source_index: &OmaSourceEntry, - checksums: &[ChecksumItem], download_dir: &Path, tasks: &mut Vec, inrelease: &InReleaseParser, replacer: &DatabaseFilenameReplacer, ) -> Result<()> { - let (typ, not_compress_filename_before) = match &c.file_type { - DistFileType::CompressContents(s, _) => ("Contents", s), - DistFileType::Contents => ("Contents", &c.name), - DistFileType::CompressPackageList(s, _) => ("Package List", s), - DistFileType::PackageList => ("Package List", &c.name), - DistFileType::BinaryContents => ("BinContents", &c.name), - _ => unreachable!(), - }; + let typ = &c.msg; let msg = human_download_url(source_index, Some(typ))?; @@ -775,18 +709,25 @@ fn collect_download_task( }, }; - let checksum = if matches!(c.file_type, DistFileType::CompressContents(_, _)) { - Some(&c.checksum) + let not_compress_filename_before = if file_is_compress(&c.item.name) { + Cow::Owned(split_ext_and_filename(&c.item.name).1) } else { - checksums + Cow::Borrowed(&c.item.name) + }; + + let checksum = if c.keep_compress { + Some(&c.item.checksum) + } else { + inrelease + .checksums .iter() - .find(|x| &x.name == not_compress_filename_before) + .find(|x| x.name == *not_compress_filename_before) .as_ref() .map(|c| &c.checksum) }; let download_url = if inrelease.acquire_by_hash { - let path = Path::new(&c.name); + let path = Path::new(&c.item.name); let parent = path.parent().unwrap_or(path); let dir = match inrelease.checksum_type { ChecksumType::Sha256 => "SHA256", @@ -794,17 +735,21 @@ fn collect_download_task( ChecksumType::Md5 => "MD5Sum", }; - let path = parent.join("by-hash").join(dir).join(&c.checksum); + let path = parent.join("by-hash").join(dir).join(&c.item.checksum); format!("{}/{}", dist_url, path.display()) } else { - format!("{}/{}", dist_url, c.name) + format!("{}/{}", dist_url, c.item.name) }; let sources = vec![DownloadSource::new(download_url.clone(), from)]; - let file_path = if let DistFileType::CompressContents(_, _) = c.file_type { - download_url.clone() + let file_path = if c.keep_compress { + if inrelease.acquire_by_hash { + format!("{}/{}", dist_url, c.item.name) + } else { + download_url.clone() + } } else if dist_url.ends_with('/') { format!("{}{}", dist_url, not_compress_filename_before) } else { @@ -817,25 +762,18 @@ fn collect_download_task( task.dir(download_dir.to_path_buf()); task.allow_resume(false); task.msg(msg); - task.file_type(match c.file_type { - DistFileType::BinaryContents => CompressFile::Nothing, - DistFileType::Contents => CompressFile::Nothing, - // 不解压 Contents - DistFileType::CompressContents(_, _) => CompressFile::Nothing, - DistFileType::PackageList => CompressFile::Nothing, - DistFileType::CompressPackageList(_, _) => { - match Path::new(&c.name).extension().and_then(|x| x.to_str()) { + task.file_type({ + if c.keep_compress { + CompressFile::Nothing + } else { + match Path::new(&c.item.name).extension().and_then(|x| x.to_str()) { Some("gz") => CompressFile::Gzip, Some("xz") => CompressFile::Xz, Some("bz2") => CompressFile::Bz2, - Some(x) => { - debug!("unsupport file type: {x}"); - return Ok(()); - } - None => unreachable!(), + Some("zst") => CompressFile::Zstd, + _ => CompressFile::Nothing, } } - DistFileType::Release => CompressFile::Nothing, }); if let Some(checksum) = checksum { diff --git a/oma-refresh/src/inrelease.rs b/oma-refresh/src/inrelease.rs index 4eac0c29..66ef320f 100644 --- a/oma-refresh/src/inrelease.rs +++ b/oma-refresh/src/inrelease.rs @@ -17,17 +17,6 @@ pub struct ChecksumItem { pub name: String, pub size: u64, pub checksum: String, - pub file_type: DistFileType, -} - -#[derive(Debug, PartialEq, Clone, Eq)] -pub enum DistFileType { - BinaryContents, - Contents, - CompressContents(String, String), - PackageList, - CompressPackageList(String, String), - Release, } #[derive(Debug, thiserror::Error)] @@ -62,11 +51,9 @@ pub struct InRelease<'a> { pub inrelease: &'a str, pub signed_by: Option<&'a str>, pub mirror: &'a str, - pub archs: &'a [String], pub is_flat: bool, pub p: &'a Path, pub rootfs: &'a Path, - pub components: &'a [String], pub trusted: bool, } @@ -85,11 +72,9 @@ impl InReleaseParser { inrelease: s, signed_by, mirror, - archs, is_flat, p, rootfs, - components, trusted, } = in_release; @@ -106,8 +91,6 @@ impl InReleaseParser { let source_first = source.first(); - debug!("InRelease is: {source:#?}"); - if !is_flat { let date = source_first .and_then(|x| x.get("Date")) @@ -189,54 +172,7 @@ impl InReleaseParser { let mut res: SmallVec<[_; 32]> = smallvec![]; - let c_res_clone = checksums_res.clone(); - - let c = checksums_res - .into_iter() - .filter(|(name, _, _)| { - let mut name_split = name.split('/'); - let component = name_split.next(); - let component_type = name_split.next(); - - // debian-installer 是为 Debian 安装器专门准备的源,应该没有人把 oma 用在这种场景上面 - let is_debian_installer = component_type.is_some_and(|x| x == "debian-installer"); - - if let Some(c) = component { - if c != *name { - return components.contains(&c.to_string()) - && ((name.contains("all") || archs.iter().any(|x| name.contains(x))) - && !is_debian_installer); - } - } - - name.contains("all") || archs.iter().any(|x| name.contains(x)) - }) - .collect::>(); - - let c = if c.is_empty() { c_res_clone } else { c }; - - for i in c { - let t = match i.0 { - x if x.contains("BinContents") => DistFileType::BinaryContents, - x if x.contains("Contents-") && file_is_compress(x) && !x.contains("udeb") => { - let s = x.split_once('.').unwrap(); - DistFileType::CompressContents(s.0.to_string(), s.1.to_string()) - } - x if x.contains("Contents-") && !x.contains('.') && !x.contains("udeb") => { - DistFileType::Contents - } - x if x.contains("Packages") && !x.contains('.') => DistFileType::PackageList, - x if x.contains("Packages") && file_is_compress(x) => { - let s = x.split_once('.').unwrap(); - DistFileType::CompressPackageList(s.0.to_string(), s.1.to_string()) - } - x if x.contains("Release") => DistFileType::Release, - x => { - debug!("Unknown file type: {x:?}"); - continue; - } - }; - + for i in checksums_res { res.push(ChecksumItem { name: i.0.to_owned(), size: i @@ -244,8 +180,7 @@ impl InReleaseParser { .parse::() .map_err(InReleaseParserError::ParseIntError)?, checksum: i.2.to_owned(), - file_type: t, - }) + }); } Ok(Self { @@ -257,7 +192,20 @@ impl InReleaseParser { } } -fn file_is_compress(name: &str) -> bool { +pub(crate) fn split_ext_and_filename(x: &str) -> (String, String) { + let path = Path::new(x); + let ext = path + .extension() + .unwrap_or_default() + .to_string_lossy() + .to_string(); + let name = path.with_extension(""); + let name = name.to_string_lossy().to_string(); + + (ext, name) +} + +pub(crate) fn file_is_compress(name: &str) -> bool { for i in COMPRESS { if name.ends_with(i) { return true; @@ -370,3 +318,27 @@ fn test_date_hack() { let b = DateTime::parse_from_rfc2822(&hack); assert!(b.is_ok()); } + +#[test] +fn test_split_name_and_ext() { + let example1 = "main/dep11/icons-128x128.tar.gz"; + let res = split_ext_and_filename(&example1); + assert_eq!( + res, + ("gz".to_string(), "main/dep11/icons-128x128.tar".to_string()) + ); + + let example2 = "main/i18n/Translation-bg.xz"; + let res = split_ext_and_filename(&example2); + assert_eq!( + res, + ("xz".to_string(), "main/i18n/Translation-bg".to_string()) + ); + + let example2 = "main/i18n/Translation-bg"; + let res = split_ext_and_filename(&example2); + assert_eq!( + res, + ("".to_string(), "main/i18n/Translation-bg".to_string()) + ); +} diff --git a/oma-refresh/src/lib.rs b/oma-refresh/src/lib.rs index 9d04ee06..8e482231 100644 --- a/oma-refresh/src/lib.rs +++ b/oma-refresh/src/lib.rs @@ -1,3 +1,4 @@ +mod config; pub mod db; pub mod inrelease; mod util; diff --git a/oma-refresh/src/util.rs b/oma-refresh/src/util.rs index 4537c631..5e9ad711 100644 --- a/oma-refresh/src/util.rs +++ b/oma-refresh/src/util.rs @@ -115,6 +115,7 @@ pub(crate) struct OmaSourceEntry { pub signed_by: Option, pub archs: Vec, pub trusted: bool, + pub native_arch: String, } #[derive(PartialEq, Eq, Debug, Clone)] @@ -184,6 +185,7 @@ impl OmaSourceEntry { signed_by, archs, trusted, + native_arch: arch.to_string(), }) } } diff --git a/src/config.rs b/src/config.rs index aa1cb542..b118d8d0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,8 +15,6 @@ pub struct Config { pub struct GeneralConfig { #[serde(default = "GeneralConfig::default_protect_essentials")] pub protect_essentials: bool, - #[serde(default = "GeneralConfig::default_refresh_pure_database")] - pub refresh_pure_database: bool, #[serde(default = "GeneralConfig::default_no_check_dbus")] pub no_check_dbus: bool, #[serde(default = "GeneralConfig::default_no_refresh_topics")] @@ -44,10 +42,6 @@ impl GeneralConfig { true } - pub const fn default_refresh_pure_database() -> bool { - false - } - pub const fn default_no_check_dbus() -> bool { false } @@ -85,13 +79,6 @@ impl Config { .unwrap_or_else(NetworkConfig::default_network_thread) } - pub fn pure_db(&self) -> bool { - self.general - .as_ref() - .map(|x| x.refresh_pure_database) - .unwrap_or_else(GeneralConfig::default_refresh_pure_database) - } - pub fn no_check_dbus(&self) -> bool { self.general .as_ref() diff --git a/src/main.rs b/src/main.rs index 6eeade17..3c177083 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,7 +107,6 @@ pub struct OmaArgs { dry_run: bool, network_thread: usize, no_progress: bool, - download_pure_db: bool, no_check_dbus: bool, protect_essentials: bool, } @@ -359,7 +358,6 @@ fn run_subcmd(matches: ArgMatches, dry_run: bool, no_progress: bool) -> Result Result Result Result { root()?; + let apt_config = AptConfig::new(); let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let apt = OmaApt::new(vec![], oma_apt_args, false)?; + let apt = OmaApt::new(vec![], oma_apt_args, false, apt_config)?; let download_dir = apt.get_archive_dir(); let dir = std::fs::read_dir(&download_dir).map_err(|e| OutputError { description: format!("Failed to read dir: {}", download_dir.display()), diff --git a/src/subcommand/command_not_found.rs b/src/subcommand/command_not_found.rs index 3df2301b..23736d24 100644 --- a/src/subcommand/command_not_found.rs +++ b/src/subcommand/command_not_found.rs @@ -5,7 +5,7 @@ use oma_console::due_to; use oma_console::print::Action; use oma_contents::searcher::{pure_search, ripgrep_search, Mode}; use oma_contents::OmaContentsError; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use oma_pm::format_description; use tracing::error; @@ -38,8 +38,9 @@ pub fn execute(query: &str) -> Result { error!("{}", fl!("command-not-found", kw = query)); } Ok(()) => { + let apt_config = AptConfig::new(); let oma_apt_args = OmaAptArgsBuilder::default().build()?; - let apt = OmaApt::new(vec![], oma_apt_args, false)?; + let apt = OmaApt::new(vec![], oma_apt_args, false, apt_config)?; let mut jaro = jaro_nums(res, query); diff --git a/src/subcommand/depends.rs b/src/subcommand/depends.rs index 7d5e7d2f..6577bc8c 100644 --- a/src/subcommand/depends.rs +++ b/src/subcommand/depends.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use crate::error::OutputError; @@ -11,8 +11,9 @@ pub fn execute(pkgs: Vec, sysroot: String) -> Result { check_unsupport_stmt(pkg); } + let apt_config = AptConfig::new(); let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, apt_config)?; let (pkgs, no_result) = apt.select_pkg( &pkgs.iter().map(|x| x.as_str()).collect::>(), diff --git a/src/subcommand/download.rs b/src/subcommand/download.rs index 8bb5fe57..d459425e 100644 --- a/src/subcommand/download.rs +++ b/src/subcommand/download.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; use oma_console::{due_to, success}; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use reqwest::Client; use tracing::error; @@ -29,8 +29,9 @@ pub fn execute( source: Some(Box::new(e)), })?; + let apt_config = AptConfig::new(); let oma_apt_args = OmaAptArgsBuilder::default().build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run, apt_config)?; let (pkgs, no_result) = apt.select_pkg(&keyword, false, true, true)?; handle_no_result(no_result)?; diff --git a/src/subcommand/fix_broken.rs b/src/subcommand/fix_broken.rs index 5c35ac1f..e9464de3 100644 --- a/src/subcommand/fix_broken.rs +++ b/src/subcommand/fix_broken.rs @@ -1,5 +1,5 @@ use oma_history::SummaryType; -use oma_pm::apt::{AptArgsBuilder, OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptArgsBuilder, AptConfig, OmaApt, OmaAptArgsBuilder}; use reqwest::Client; use crate::{ @@ -18,7 +18,6 @@ pub fn execute(oma_args: OmaArgs, sysroot: String, client: Client) -> Result Result, @@ -34,7 +36,6 @@ pub fn execute( dry_run, network_thread, no_progress, - download_pure_db, no_check_dbus, protect_essentials: protect_essential, .. @@ -48,16 +49,20 @@ pub fn execute( None }; + let apt_config = AptConfig::new(); + + let req = RefreshRequest { + client: &client, + dry_run, + no_progress, + limit: network_thread, + sysroot: &args.sysroot, + _refresh_topics: !args.no_refresh_topic, + config: &apt_config, + }; + if !args.no_refresh { - refresh( - &client, - dry_run, - no_progress, - download_pure_db, - network_thread, - &args.sysroot, - !args.no_refresh_topic, - )?; + refresh(req)?; } if args.yes { @@ -80,7 +85,7 @@ pub fn execute( .no_install_suggests(args.no_install_suggests) .build()?; - let mut apt = OmaApt::new(local_debs, oma_apt_args, dry_run)?; + let mut apt = OmaApt::new(local_debs, oma_apt_args, dry_run, apt_config)?; let (pkgs, no_result) = apt.select_pkg(&pkgs_unparse, args.install_dbg, true, false)?; handle_no_result(no_result)?; diff --git a/src/subcommand/list.rs b/src/subcommand/list.rs index 37461ac2..b33d9e1b 100644 --- a/src/subcommand/list.rs +++ b/src/subcommand/list.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, io::stdout, sync::atomic::Ordering}; use oma_console::print::Action; use oma_pm::{ - apt::{FilterMode, OmaApt, OmaAptArgsBuilder}, + apt::{AptConfig, FilterMode, OmaApt, OmaAptArgsBuilder}, PkgCurrentState, }; use tracing::info; @@ -30,7 +30,7 @@ pub fn execute(flags: ListFlags, pkgs: Vec, sysroot: String) -> Result = smallvec![FilterMode::Names]; diff --git a/src/subcommand/mark.rs b/src/subcommand/mark.rs index 223bd5b0..53ddb547 100644 --- a/src/subcommand/mark.rs +++ b/src/subcommand/mark.rs @@ -1,7 +1,7 @@ use std::borrow::Cow; use oma_console::success; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use tracing::info; use crate::{error::OutputError, utils::root}; @@ -18,7 +18,7 @@ pub fn execute( root()?; let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let set = match op { "hold" | "unhold" => apt diff --git a/src/subcommand/pick.rs b/src/subcommand/pick.rs index bff6b0d0..308c79ef 100644 --- a/src/subcommand/pick.rs +++ b/src/subcommand/pick.rs @@ -1,7 +1,7 @@ use dialoguer::{theme::ColorfulTheme, Select}; use oma_history::SummaryType; use oma_pm::{ - apt::{AptArgsBuilder, OmaApt, OmaAptArgsBuilder}, + apt::{AptArgsBuilder, AptConfig, OmaApt, OmaAptArgsBuilder}, pkginfo::PkgInfo, }; use reqwest::Client; @@ -13,7 +13,9 @@ use crate::{ use crate::{fl, OmaArgs}; use anyhow::anyhow; -use super::utils::{lock_oma, no_check_dbus_warn, normal_commit, refresh, NormalCommitArgs}; +use super::utils::{ + lock_oma, no_check_dbus_warn, normal_commit, refresh, NormalCommitArgs, RefreshRequest, +}; pub fn execute( pkg_str: &str, @@ -30,7 +32,6 @@ pub fn execute( dry_run, network_thread, no_progress, - download_pure_db, no_check_dbus, protect_essentials: protect_essential, .. @@ -44,22 +45,26 @@ pub fn execute( None }; + let apt_config = AptConfig::new(); + if !no_refresh { - refresh( - &client, + let req = RefreshRequest { + client: &client, dry_run, no_progress, - download_pure_db, - network_thread, - &sysroot, - !no_refresh_topic, - )?; + limit: network_thread, + sysroot: &sysroot, + _refresh_topics: !no_refresh_topic, + config: &apt_config, + }; + + refresh(req)?; } let oma_apt_args = OmaAptArgsBuilder::default() .sysroot(sysroot.clone()) .build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run, apt_config)?; let pkg = apt .cache .get(pkg_str) diff --git a/src/subcommand/pkgnames.rs b/src/subcommand/pkgnames.rs index 042e46ff..9186e760 100644 --- a/src/subcommand/pkgnames.rs +++ b/src/subcommand/pkgnames.rs @@ -1,10 +1,10 @@ -use oma_pm::apt::{FilterMode, OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, FilterMode, OmaApt, OmaAptArgsBuilder}; use crate::error::OutputError; pub fn execute(keyword: Option<&str>, sysroot: String) -> Result { let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let apt = OmaApt::new(vec![], oma_apt_args, false)?; + let apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let mut pkgs: Box> = Box::new(apt.filter_pkgs(&[FilterMode::Names])?); if let Some(keyword) = keyword { diff --git a/src/subcommand/rdepends.rs b/src/subcommand/rdepends.rs index 61a4f40d..814edf5e 100644 --- a/src/subcommand/rdepends.rs +++ b/src/subcommand/rdepends.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use crate::error::OutputError; @@ -12,7 +12,7 @@ pub fn execute(pkgs: Vec, sysroot: String) -> Result { } let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let (pkgs, no_result) = apt.select_pkg( &pkgs.iter().map(|x| x.as_str()).collect::>(), diff --git a/src/subcommand/refresh.rs b/src/subcommand/refresh.rs index e928f75f..aeb69c17 100644 --- a/src/subcommand/refresh.rs +++ b/src/subcommand/refresh.rs @@ -1,13 +1,13 @@ use oma_console::indicatif::ProgressBar; use oma_console::pb::spinner_style; use oma_console::success; -use oma_pm::apt::{OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptConfig, OmaApt, OmaAptArgsBuilder}; use reqwest::Client; use crate::{error::OutputError, utils::root}; use crate::{fl, OmaArgs}; -use super::utils::refresh; +use super::utils::{refresh, RefreshRequest}; pub fn execute( oma_args: OmaArgs, @@ -21,22 +21,25 @@ pub fn execute( dry_run: _, network_thread, no_progress, - download_pure_db, .. } = oma_args; - refresh( - &client, - false, + let apt_config = AptConfig::new(); + + let req = RefreshRequest { + client: &client, + dry_run: false, no_progress, - download_pure_db, - network_thread, - &sysroot, - !no_refresh_topics, - )?; + limit: network_thread, + sysroot: &sysroot, + _refresh_topics: !no_refresh_topics, + config: &apt_config, + }; + + refresh(req)?; let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let apt = OmaApt::new(vec![], oma_apt_args, false)?; + let apt = OmaApt::new(vec![], oma_apt_args, false, apt_config)?; let (style, inv) = spinner_style(); diff --git a/src/subcommand/remove.rs b/src/subcommand/remove.rs index fdccf039..3e2b89b5 100644 --- a/src/subcommand/remove.rs +++ b/src/subcommand/remove.rs @@ -3,7 +3,7 @@ use dialoguer::console::style; use dialoguer::theme::ColorfulTheme; use dialoguer::{Confirm, Input}; use oma_history::SummaryType; -use oma_pm::apt::{AptArgsBuilder, OmaApt, OmaAptArgsBuilder}; +use oma_pm::apt::{AptArgsBuilder, AptConfig, OmaApt, OmaAptArgsBuilder}; use reqwest::Client; use tracing::{info, warn}; @@ -31,7 +31,6 @@ pub fn execute( dry_run, network_thread, no_progress, - download_pure_db: _, no_check_dbus, protect_essentials: protect, } = oma_args; @@ -51,7 +50,7 @@ pub fn execute( let oma_apt_args = OmaAptArgsBuilder::default() .sysroot(args.sysroot.clone()) .build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, dry_run, AptConfig::new())?; let (pkgs, no_result) = apt.select_pkg(&pkgs, false, true, false)?; handle_no_result(no_result)?; diff --git a/src/subcommand/search.rs b/src/subcommand/search.rs index 65df22ca..60ebe582 100644 --- a/src/subcommand/search.rs +++ b/src/subcommand/search.rs @@ -7,7 +7,7 @@ use oma_console::{ WRITER, }; use oma_pm::{ - apt::{OmaApt, OmaAptArgsBuilder}, + apt::{AptConfig, OmaApt, OmaAptArgsBuilder}, query::OmaDatabase, PackageStatus, }; @@ -23,7 +23,7 @@ pub fn execute(args: &[String], no_progress: bool, sysroot: String) -> Result, sysroot: String) -> Result { let oma_apt_args = OmaAptArgsBuilder::default().sysroot(sysroot).build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, AptConfig::new())?; let (pkgs, no_result) = apt.select_pkg(&input, false, false, false)?; handle_no_result(no_result)?; diff --git a/src/subcommand/topics.rs b/src/subcommand/topics.rs index c502bddd..fdd16f4e 100644 --- a/src/subcommand/topics.rs +++ b/src/subcommand/topics.rs @@ -9,7 +9,7 @@ use inquire::{ use oma_console::{indicatif::ProgressBar, pb::spinner_style, writer::bar_writeln, WRITER}; use oma_history::SummaryType; use oma_pm::{ - apt::{AptArgsBuilder, FilterMode, OmaApt, OmaAptArgsBuilder}, + apt::{AptArgsBuilder, AptConfig, FilterMode, OmaApt, OmaAptArgsBuilder}, query::OmaDatabase, }; use oma_utils::dpkg::dpkg_arch; @@ -22,7 +22,9 @@ use crate::{ OmaArgs, }; -use super::utils::{lock_oma, no_check_dbus_warn, normal_commit, refresh, NormalCommitArgs}; +use super::utils::{ + lock_oma, no_check_dbus_warn, normal_commit, refresh, NormalCommitArgs, RefreshRequest, +}; use crate::fl; use anyhow::anyhow; use oma_topics::{scan_closed_topic, TopicManager}; @@ -40,7 +42,6 @@ pub struct TopicArgs { pub dry_run: bool, pub network_thread: usize, pub no_progress: bool, - pub download_pure_db: bool, pub no_check_dbus: bool, pub sysroot: String, } @@ -55,7 +56,6 @@ pub fn execute(args: TopicArgs, client: Client, oma_args: OmaArgs) -> Result Result Result { let Tui { sysroot, no_progress, - download_pure_db, dry_run, network_thread, client, @@ -223,15 +223,19 @@ pub fn execute(tui: Tui) -> Result { None }; - refresh( - &client, + let apt_config = AptConfig::new(); + + let req = RefreshRequest { + client: &client, dry_run, no_progress, - download_pure_db, - network_thread, - &sysroot, - true, - )?; + limit: network_thread, + sysroot: &sysroot, + _refresh_topics: true, + config: &apt_config, + }; + + refresh(req)?; stdout() .execute(EnterAlternateScreen) @@ -259,7 +263,7 @@ pub fn execute(tui: Tui) -> Result { .sysroot(sysroot.clone()) .build()?; - let mut apt = OmaApt::new(vec![], oma_apt_args, false)?; + let mut apt = OmaApt::new(vec![], oma_apt_args, false, apt_config)?; let a = apt.available_action()?; let installed = apt.installed_packages()?; diff --git a/src/subcommand/upgrade.rs b/src/subcommand/upgrade.rs index b7604687..af20543c 100644 --- a/src/subcommand/upgrade.rs +++ b/src/subcommand/upgrade.rs @@ -5,6 +5,7 @@ use oma_history::create_db_file; use oma_history::write_history_entry; use oma_history::SummaryType; use oma_pm::apt::AptArgsBuilder; +use oma_pm::apt::AptConfig; use oma_pm::apt::OmaApt; use oma_pm::apt::OmaAptArgsBuilder; use oma_pm::apt::OmaAptError; @@ -31,6 +32,7 @@ use super::utils::handle_no_result; use super::utils::lock_oma; use super::utils::no_check_dbus_warn; use super::utils::refresh; +use super::utils::RefreshRequest; pub fn execute( pkgs_unparse: Vec, @@ -41,13 +43,10 @@ pub fn execute( root()?; lock_oma()?; - let no_refresh_topics = args.no_refresh_topcs; - let OmaArgs { dry_run, network_thread, no_progress, - download_pure_db, no_check_dbus, protect_essentials, } = oma_args; @@ -60,15 +59,19 @@ pub fn execute( None }; - refresh( - &client, + let apt_config = AptConfig::new(); + + let req = RefreshRequest { + client: &client, dry_run, no_progress, - download_pure_db, - network_thread, - &args.sysroot, - !no_refresh_topics, - )?; + limit: network_thread, + sysroot: &args.sysroot, + _refresh_topics: !args.no_refresh_topcs, + config: &apt_config, + }; + + refresh(req)?; if args.yes { warn!("{}", fl!("automatic-mode-warn")); @@ -96,7 +99,12 @@ pub fn execute( .build()?; loop { - let mut apt = OmaApt::new(local_debs.clone(), oma_apt_args.clone(), dry_run)?; + let mut apt = OmaApt::new( + local_debs.clone(), + oma_apt_args.clone(), + dry_run, + AptConfig::new(), + )?; apt.upgrade()?; let (pkgs, no_result) = apt.select_pkg(&pkgs_unparse, false, true, false)?; diff --git a/src/subcommand/utils.rs b/src/subcommand/utils.rs index ce808e19..c5913ab3 100644 --- a/src/subcommand/utils.rs +++ b/src/subcommand/utils.rs @@ -22,6 +22,7 @@ use oma_history::create_db_file; use oma_history::write_history_entry; use oma_history::SummaryType; use oma_pm::apt::AptArgs; +use oma_pm::apt::AptConfig; use oma_pm::apt::OmaApt; use oma_pm::apt::{InstallEntry, RemoveEntry}; use oma_refresh::db::OmaRefresh; @@ -89,30 +90,33 @@ pub(crate) fn lock_oma() -> Result<(), LockError> { Ok(()) } -pub(crate) fn refresh( - client: &Client, - dry_run: bool, - no_progress: bool, - download_pure_db: bool, - limit: usize, - sysroot: &str, - _refresh_topics: bool, -) -> Result<(), OutputError> { +pub struct RefreshRequest<'a> { + pub client: &'a Client, + pub dry_run: bool, + pub no_progress: bool, + pub limit: usize, + pub sysroot: &'a str, + pub _refresh_topics: bool, + pub config: &'a AptConfig, +} + +pub(crate) fn refresh(refresh_req: RefreshRequest) -> Result<(), OutputError> { + let RefreshRequest { + client, + dry_run, + no_progress, + limit, + sysroot, + _refresh_topics, + config, + } = refresh_req; + if dry_run { return Ok(()); } info!("{}", fl!("refreshing-repo-metadata")); - let download_pure_db = if dpkg_arch(sysroot) - .map(|x| x == "mips64r6el") - .unwrap_or(false) - { - false - } else { - download_pure_db - }; - let sysroot = PathBuf::from(sysroot); let refresh: OmaRefresh = OmaRefreshBuilder { @@ -120,10 +124,10 @@ pub(crate) fn refresh( limit: Some(limit), arch: dpkg_arch(&sysroot)?, download_dir: sysroot.join("var/lib/apt/lists"), - download_compress: !download_pure_db, client, #[cfg(feature = "aosc")] refresh_topics: _refresh_topics, + apt_config: config, } .into();