fix cargo struture

This commit is contained in:
Ward from fusion-voyager-3 2024-07-10 11:39:56 +03:00
parent b7681f9af1
commit b6bdb4ca96
15 changed files with 91 additions and 42 deletions

View File

@ -8,17 +8,35 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="df2ca9e1-e07d-43f4-bc68-0a6113fc1fa2" name="Changes" comment=""> <list default="true" id="df2ca9e1-e07d-43f4-bc68-0a6113fc1fa2" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/bin/apt/apt_full_upgrade/main.rs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/bin/apt/apt_update/main.rs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/lib/apt_update_progress_socket/mod.rs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/lib/lib.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/apt_update_page/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/apt_update_page/mod.rs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/apt_package_row/imp.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_package_row/imp.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/apt_update_page/process.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/apt_update_page/process.rs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/apt_package_row/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_package_row/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/apt_update/main.rs" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/apt_update_page/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_update_page/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/apt_update_page/process.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/apt_update_page/process.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/build_ui/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/build_ui/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/config.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/config.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/main.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pika_unixsocket_tools/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/pika_unixsocket_tools/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/bin/gui/style.css" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Rust File" />
</list>
</option>
</component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -29,30 +47,40 @@
&quot;associatedIndex&quot;: 8 &quot;associatedIndex&quot;: 8
}</component> }</component>
<component name="ProjectId" id="2iTBzsng9KVBd9K88mZWsKzuiQ1" /> <component name="ProjectId" id="2iTBzsng9KVBd9K88mZWsKzuiQ1" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"Cargo.Run apt_update.executor": "Run", "Cargo.Run apt_update.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.rust.reset.selective.auto.import": "true", "RunOnceActivity.rust.reset.selective.auto.import": "true",
"git-widget-placeholder": "master", "git-widget-placeholder": "master",
"last_opened_file_path": "/home/ward/RustroverProjects/pika-idk-manager", "last_opened_file_path": "/home/ward/RustroverProjects/pika-idk-manager/src",
"node.js.detected.package.eslint": "true", "node.js.detected.package.eslint": "true",
"node.js.selected.package.eslint": "(autodetect)", "node.js.selected.package.eslint": "(autodetect)",
"nodejs_package_manager_path": "npm", "nodejs_package_manager_path": "npm",
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true", "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "", "org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
"org.rust.disableDetachedFileInspection/home/ward/RustroverProjects/pika-idk-manager/src/apt_update_progress_socket/lib.rs": "true",
"org.rust.first.attach.projects": "true" "org.rust.first.attach.projects": "true"
} }
}]]></component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/src" /> <recent name="$PROJECT_DIR$/src" />
<recent name="$PROJECT_DIR$/data" /> </key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/lib" />
<recent name="$PROJECT_DIR$/src/bin/apt" />
<recent name="$PROJECT_DIR$/src/bin/gui" />
<recent name="$PROJECT_DIR$/src" />
<recent name="$PROJECT_DIR$" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Cargo.Run apt_update"> <component name="RunManager" selected="Cargo.Run apt_update">
@ -117,10 +145,15 @@
<workItem from="1720476457389" duration="7123000" /> <workItem from="1720476457389" duration="7123000" />
<workItem from="1720502207843" duration="3142000" /> <workItem from="1720502207843" duration="3142000" />
<workItem from="1720556059466" duration="12649000" /> <workItem from="1720556059466" duration="12649000" />
<workItem from="1720594302708" duration="52000" />
<workItem from="1720597532937" duration="2752000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component>
</project> </project>

View File

@ -6,11 +6,19 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib] [lib]
name = "pika_unixsocket_tools" name = "pika_unixsocket_tools"
path = "src/pika_unixsocket_tools/lib.rs" path = "src/lib/lib.rs"
[[bin]]
name = "pika-idk-manager"
path = "src/bin/gui/main.rs"
[[bin]] [[bin]]
name = "apt_update" name = "apt_update"
path = "src/apt_update/main.rs" path = "src/bin/apt/apt_update/main.rs"
[[bin]]
name = "apt_full_upgrade"
path = "src/bin/apt/apt_full_upgrade/main.rs"
[dependencies] [dependencies]
adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] } adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] }

View File

@ -0,0 +1 @@
fn main() {}

View File

@ -0,0 +1,34 @@
use rust_apt::new_cache;
use rust_apt::progress::{AcquireProgress, DynAcquireProgress};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::runtime::Runtime;
use pika_unixsocket_tools::apt_update_progress_socket::AptUpdateProgressSocket;
use pika_unixsocket_tools::pika_unixsocket_tools::*;
fn main() {
let update_cache = new_cache!().unwrap();
let percent_socket_path = "/tmp/pika_apt_update_percent.sock";
let status_socket_path = "/tmp/pika_apt_update_status.sock";
match update_cache.update(&mut AcquireProgress::new(AptUpdateProgressSocket::new(
percent_socket_path,
status_socket_path,
))) {
Ok(_) => {
Runtime::new()
.unwrap()
.block_on(send_successful_to_socket(percent_socket_path));
Runtime::new()
.unwrap()
.block_on(send_successful_to_socket(status_socket_path));
}
Err(e) => {
Runtime::new()
.unwrap()
.block_on(send_failed_to_socket(percent_socket_path));
Runtime::new()
.unwrap()
.block_on(send_failed_to_socket(status_socket_path));
panic!("{}", e.to_string())
}
};
}

View File

@ -1,12 +1,12 @@
mod process; mod process;
use pika_unixsocket_tools::pika_unixsocket_tools::*;
use crate::apt_package_row::AptPackageRow; use crate::apt_package_row::AptPackageRow;
use adw::gio::{Action, SimpleAction}; use adw::gio::{Action, SimpleAction};
use adw::prelude::*; use adw::prelude::*;
use adw::ActionRow; use adw::ActionRow;
use gtk::glib::*; use gtk::glib::*;
use gtk::*; use gtk::*;
use pika_unixsocket_tools::*;
use rust_apt::cache::*; use rust_apt::cache::*;
use rust_apt::new_cache; use rust_apt::new_cache;
use rust_apt::records::RecordField; use rust_apt::records::RecordField;

View File

@ -1,9 +1,8 @@
use pika_unixsocket_tools::*; use crate::pika_unixsocket_tools::*;
use rust_apt::new_cache; use rust_apt::progress::{DynAcquireProgress};
use rust_apt::progress::{AcquireProgress, DynAcquireProgress};
use rust_apt::raw::{AcqTextStatus, ItemDesc, PkgAcquire}; use rust_apt::raw::{AcqTextStatus, ItemDesc, PkgAcquire};
use std::process::exit; use std::process::exit;
use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::io::{AsyncWriteExt};
use tokio::net::UnixStream; use tokio::net::UnixStream;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
@ -129,34 +128,6 @@ impl<'a> DynAcquireProgress for AptUpdateProgressSocket<'a> {
} }
} }
fn main() {
let update_cache = new_cache!().unwrap();
let percent_socket_path = "/tmp/pika_apt_update_percent.sock";
let status_socket_path = "/tmp/pika_apt_update_status.sock";
match update_cache.update(&mut AcquireProgress::new(AptUpdateProgressSocket::new(
percent_socket_path,
status_socket_path,
))) {
Ok(_) => {
Runtime::new()
.unwrap()
.block_on(send_successful_to_socket(percent_socket_path));
Runtime::new()
.unwrap()
.block_on(send_successful_to_socket(status_socket_path));
}
Err(e) => {
Runtime::new()
.unwrap()
.block_on(send_failed_to_socket(percent_socket_path));
Runtime::new()
.unwrap()
.block_on(send_failed_to_socket(status_socket_path));
panic!("{}", e.to_string())
}
};
}
async fn send_progress_percent(progress_f32: f32, socket_path: &str) { async fn send_progress_percent(progress_f32: f32, socket_path: &str) {
// Connect to the Unix socket // Connect to the Unix socket
let mut stream = UnixStream::connect(socket_path) let mut stream = UnixStream::connect(socket_path)

2
src/lib/lib.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod pika_unixsocket_tools;
pub mod apt_update_progress_socket;