begin add apt repo mgmt

This commit is contained in:
Ward from fusion-voyager-3 2024-09-07 13:20:56 +03:00
parent c72f917c03
commit 2ab9308ec9
6 changed files with 223 additions and 14 deletions

172
Cargo.lock generated
View File

@ -41,6 +41,14 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "apt-sources-lists"
version = "0.1.0"
source = "git+https://github.com/CosmicFusion/apt-sources-lists-snapshot#d15cbccf8329db0e530bbe910c5b7a49c697e547"
dependencies = [
"err-derive",
]
[[package]] [[package]]
name = "arc-swap" name = "arc-swap"
version = "1.7.1" version = "1.7.1"
@ -67,7 +75,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -252,6 +260,12 @@ version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "countme"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-deque"
version = "0.8.5" version = "0.8.5"
@ -312,7 +326,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"scratch", "scratch",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -329,7 +343,26 @@ checksum = "4b2c1c1776b986979be68bb2285da855f8d8a35851a769fca8740df7c3d07877"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
]
[[package]]
name = "deb822-lossless"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "286f48b96d8b0b1430db71c92b8a641f5edf0d926d44f51bf2159aabcf526a2a"
dependencies = [
"regex",
"rowan",
"serde",
]
[[package]]
name = "deb822-tools"
version = "0.1.0"
source = "git+https://github.com/CosmicFusion/deb822-tools#9bcf4f74dd2fe345488d31c192f2d7cb3e1f1706"
dependencies = [
"deb822-lossless",
] ]
[[package]] [[package]]
@ -338,6 +371,20 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "err-derive"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22deed3a8124cff5fa835713fa105621e43bbdc46690c3a6b68328a012d350d4"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"rustversion",
"syn 1.0.109",
"synstructure",
]
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.9" version = "0.3.9"
@ -463,7 +510,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -684,7 +731,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -697,7 +744,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -856,7 +903,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -1010,6 +1057,14 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "legacy-apt-list-tools-rs"
version = "0.1.0"
source = "git+https://github.com/CosmicFusion/legacy-apt-list-tools-rs#0606e8431239a45a14cddc9934ad3eab46e4bb99"
dependencies = [
"apt-sources-lists",
]
[[package]] [[package]]
name = "libadwaita" name = "libadwaita"
version = "0.7.0" version = "0.7.0"
@ -1349,8 +1404,10 @@ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
"crossbeam-utils 0.8.20", "crossbeam-utils 0.8.20",
"deb822-tools",
"futures 0.3.30", "futures 0.3.30",
"gtk4", "gtk4",
"legacy-apt-list-tools-rs",
"libadwaita", "libadwaita",
"libflatpak", "libflatpak",
"lock_api 0.4.12", "lock_api 0.4.12",
@ -1400,6 +1457,30 @@ dependencies = [
"toml_edit 0.21.1", "toml_edit 0.21.1",
] ]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.86" version = "1.0.86"
@ -1462,6 +1543,18 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "rowan"
version = "0.15.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a542b0253fa46e632d27a1dc5cf7b930de4df8659dc6e720b647fc72147ae3d"
dependencies = [
"countme",
"hashbrown 0.14.5",
"rustc-hash",
"text-size",
]
[[package]] [[package]]
name = "rust-apt" name = "rust-apt"
version = "0.7.0" version = "0.7.0"
@ -1501,7 +1594,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_yaml", "serde_yaml",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -1530,6 +1623,12 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"
@ -1561,6 +1660,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "rustversion"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.18" version = "1.0.18"
@ -1626,7 +1731,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -1710,6 +1815,17 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.70" version = "2.0.70"
@ -1721,6 +1837,18 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"unicode-xid",
]
[[package]] [[package]]
name = "system-deps" name = "system-deps"
version = "6.2.2" version = "6.2.2"
@ -1772,6 +1900,12 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "text-size"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.61" version = "1.0.61"
@ -1789,7 +1923,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -1851,7 +1985,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
] ]
[[package]] [[package]]
@ -1994,12 +2128,24 @@ version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
[[package]]
name = "unicode-xid"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.5.0" version = "2.5.0"
@ -2037,7 +2183,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -2059,7 +2205,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.70",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]

View File

@ -26,6 +26,8 @@ gtk = { version = "0.9.0", package = "gtk4", features = ["v4_12"] }
async-channel = "2.1.1" async-channel = "2.1.1"
rust-i18n = "3.0.1" rust-i18n = "3.0.1"
rust-apt = { git = "https://gitlab.com/volian/rust-apt" } rust-apt = { git = "https://gitlab.com/volian/rust-apt" }
apt-deb822-tools = { package = "deb822-tools", git = "https://github.com/CosmicFusion/deb822-tools" }
apt-legacy-tools = { package = "legacy-apt-list-tools-rs", git = "https://github.com/CosmicFusion/legacy-apt-list-tools-rs" }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
tokio-uds = "0.2" tokio-uds = "0.2"
serde = { version = "1.0.203", features = ["derive"] } serde = { version = "1.0.203", features = ["derive"] }

View File

@ -84,5 +84,6 @@
"apt_update_dialog_ignore_label": "Ignore APT Updates", "apt_update_dialog_ignore_label": "Ignore APT Updates",
"apt_ignored_viewport_page_title": "APT Updates Were Failed & Ignored", "apt_ignored_viewport_page_title": "APT Updates Were Failed & Ignored",
"flatpak_update_dialog_ignore_label": "Ignore Flatpak Updates", "flatpak_update_dialog_ignore_label": "Ignore Flatpak Updates",
"flatpak_ignored_viewport_page_title": "Flatpak Updates Were Failed & Ignored" "flatpak_ignored_viewport_page_title": "Flatpak Updates Were Failed & Ignored",
"apt_manage_page_title": "APT Settings"
} }

View File

@ -0,0 +1,52 @@
use crate::apt_package_row::AptPackageRow;
use adw::gio::SimpleAction;
use adw::prelude::*;
use apt_deb822_tools::Deb822Repository;
use gtk::glib::*;
use gtk::*;
use pika_unixsocket_tools::pika_unixsocket_tools::*;
use rust_apt::cache::*;
use rust_apt::new_cache;
use rust_apt::records::RecordField;
use std::cell::RefCell;
use std::process::Command;
use std::rc::Rc;
use std::thread;
use tokio::runtime::Runtime;
pub fn apt_manage_page(
window: adw::ApplicationWindow,
retry_signal_action: &SimpleAction,
) -> gtk::Box {
let deb822_sources = Deb822Repository::get_deb822_sources().unwrap();
let system_source = deb822_sources.iter().filter(|x| {
match &x.repolib_id {
Some(t) => {
if t == "system" {
true
} else {
false
}
}
None => false
}
}).next().unwrap();
let main_box = Box::builder()
.hexpand(true)
.vexpand(true)
.orientation(Orientation::Vertical)
.build();
let system_mirror_entry = gtk::Entry::builder()
.placeholder_text(system_source.repolib_default_mirror.as_deref().unwrap())
.text(system_source.uris.as_deref().unwrap())
.build();
main_box.append(&system_mirror_entry);
main_box
}

View File

@ -1,3 +1,4 @@
use crate::apt_manage_page::apt_manage_page;
use crate::apt_update_page; use crate::apt_update_page;
use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION}; use crate::config::{APP_GITHUB, APP_ICON, APP_ID, VERSION};
use crate::flatpak_update_page; use crate::flatpak_update_page;
@ -275,6 +276,12 @@ pub fn build_ui(app: &Application) {
&t!("flatpak_update_page_title"), &t!("flatpak_update_page_title"),
); );
window_adw_stack.add_titled(
&apt_manage_page(window, &apt_retry_signal_action),
Some("apt_manage_page"),
&t!("apt_manage_page_title"),
);
// Refresh button // Refresh button
refresh_button.connect_clicked(clone!( refresh_button.connect_clicked(clone!(

View File

@ -1,5 +1,6 @@
mod apt_package_row; mod apt_package_row;
mod apt_update_page; mod apt_update_page;
mod apt_manage_page;
mod build_ui; mod build_ui;
mod config; mod config;
mod flatpak_ref_row; mod flatpak_ref_row;