x86 march check complete
This commit is contained in:
parent
62505286b2
commit
42d34c9c17
@ -1,11 +1,9 @@
|
|||||||
use std::{cell::RefCell, env, rc::Rc, sync::OnceLock};
|
use std::{cell::RefCell, env, rc::Rc, sync::OnceLock};
|
||||||
|
|
||||||
|
use adw::*;
|
||||||
use adw::{prelude::*, subclass::prelude::*, *};
|
use adw::{prelude::*, subclass::prelude::*, *};
|
||||||
use glib::{clone, subclass::Signal, Properties};
|
use glib::{clone, subclass::Signal, Properties};
|
||||||
use gtk::{glib, Orientation::Horizontal};
|
use gtk::{glib, Orientation::Horizontal};
|
||||||
use adw::*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ANCHOR: custom_button
|
// ANCHOR: custom_button
|
||||||
// Object holding the state
|
// Object holding the state
|
||||||
@ -40,8 +38,7 @@ impl ObjectImpl for KernelPackageRow {
|
|||||||
// `SYNC_CREATE` ensures that the label will be immediately set
|
// `SYNC_CREATE` ensures that the label will be immediately set
|
||||||
let obj = self.obj();
|
let obj = self.obj();
|
||||||
|
|
||||||
let basic_expander_row_package_label = gtk::Label::builder()
|
let basic_expander_row_package_label = gtk::Label::builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
obj.add_suffix(&basic_expander_row_package_label);
|
obj.add_suffix(&basic_expander_row_package_label);
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use std::process::Stdio;
|
|
||||||
use crate::content::get_running_kernel_info;
|
use crate::content::get_running_kernel_info;
|
||||||
use crate::{kernel_package_row, KernelBranch, RunningKernelInfo};
|
use crate::{kernel_package_row, KernelBranch, RunningKernelInfo};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
@ -13,6 +12,7 @@ use std::fs::*;
|
|||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::process::Stdio;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::*;
|
use std::time::*;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ pub fn kernel_pkg_page(
|
|||||||
&selected_kernel_branch_clone0.db,
|
&selected_kernel_branch_clone0.db,
|
||||||
&window,
|
&window,
|
||||||
&rows_size_group,
|
&rows_size_group,
|
||||||
&searchbar
|
&searchbar,
|
||||||
);
|
);
|
||||||
|
|
||||||
let packages_viewport = gtk::ScrolledWindow::builder()
|
let packages_viewport = gtk::ScrolledWindow::builder()
|
||||||
@ -136,13 +136,13 @@ fn add_package_rows(
|
|||||||
data: &str,
|
data: &str,
|
||||||
window: &adw::ApplicationWindow,
|
window: &adw::ApplicationWindow,
|
||||||
rows_size_group: >k::SizeGroup,
|
rows_size_group: >k::SizeGroup,
|
||||||
searchbar: >k::SearchEntry
|
searchbar: >k::SearchEntry,
|
||||||
) {
|
) {
|
||||||
let cpu_feature_level: u64 = match get_cpu_feature_level().as_str() {
|
let cpu_feature_level: u32 = match get_cpu_feature_level().as_str() {
|
||||||
"x86-64-v4" => 4,
|
"x86-64-v4" => 4,
|
||||||
"x86-64-v3" => 3,
|
"x86-64-v3" => 3,
|
||||||
"x86-64-v2" => 2,
|
"x86-64-v2" => 2,
|
||||||
_ => 1
|
_ => 1,
|
||||||
};
|
};
|
||||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||||
if let serde_json::Value::Array(kernels) = &res["kernels"] {
|
if let serde_json::Value::Array(kernels) = &res["kernels"] {
|
||||||
@ -155,14 +155,18 @@ fn add_package_rows(
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
let kernel_min_x86_march = kernel["min_x86_march"]
|
let kernel_min_x86_march = kernel["min_x86_march"]
|
||||||
.as_u64()
|
.as_str()
|
||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
let kernel_package_version = match Command::new("/usr/lib/fedora-kernel-manager/scripts/get_version.sh")
|
.parse::<u32>()
|
||||||
|
.unwrap();
|
||||||
|
let kernel_package_version =
|
||||||
|
match Command::new("/usr/lib/fedora-kernel-manager/scripts/get_version.sh")
|
||||||
.args([&kernel_package])
|
.args([&kernel_package])
|
||||||
.output() {
|
.output()
|
||||||
|
{
|
||||||
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
Ok(t) => String::from_utf8(t.stdout).unwrap(),
|
||||||
_ => "Error".to_owned()
|
_ => "Error".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
let (log_loop_sender, log_loop_receiver) = async_channel::unbounded();
|
||||||
@ -185,9 +189,13 @@ fn add_package_rows(
|
|||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if command_installed_status.status.success() {
|
if command_installed_status.status.success() {
|
||||||
kernel_status_loop_sender.send_blocking(true).expect("channel needs to be open")
|
kernel_status_loop_sender
|
||||||
|
.send_blocking(true)
|
||||||
|
.expect("channel needs to be open")
|
||||||
} else {
|
} else {
|
||||||
kernel_status_loop_sender.send_blocking(false).expect("channel needs to be open")
|
kernel_status_loop_sender
|
||||||
|
.send_blocking(false)
|
||||||
|
.expect("channel needs to be open")
|
||||||
}
|
}
|
||||||
std::thread::sleep(Duration::from_secs(6));
|
std::thread::sleep(Duration::from_secs(6));
|
||||||
});
|
});
|
||||||
@ -381,10 +389,10 @@ fn add_package_rows(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
//
|
if cpu_feature_level >= kernel_min_x86_march {
|
||||||
//if kernel_needs_v3 = false || kernel_needs_v3 = true && cpu_feature_level = "x86-64-v3"
|
|
||||||
boxedlist.append(&kernel_expander_row);
|
boxedlist.append(&kernel_expander_row);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
searchbar.connect_search_changed(clone!(@weak searchbar, @weak boxedlist => move |_| {
|
searchbar.connect_search_changed(clone!(@weak searchbar, @weak boxedlist => move |_| {
|
||||||
@ -446,9 +454,16 @@ fn get_cpu_feature_level() -> String {
|
|||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let output = grep_command.wait_with_output().expect("Output failed");
|
let output = grep_command.wait_with_output().expect("Output failed");
|
||||||
let result = match String::from_utf8(output.stdout).expect("stringing failed").lines().next() {
|
let result = match String::from_utf8(output.stdout)
|
||||||
Some(t) => t.trim_end_matches("(supported, searched)").trim().to_string(),
|
.expect("stringing failed")
|
||||||
_ => "x86_64-v1".to_string()
|
.lines()
|
||||||
|
.next()
|
||||||
|
{
|
||||||
|
Some(t) => t
|
||||||
|
.trim_end_matches("(supported, searched)")
|
||||||
|
.trim()
|
||||||
|
.to_string(),
|
||||||
|
_ => "x86_64-v1".to_string(),
|
||||||
};
|
};
|
||||||
result
|
result
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
mod build_ui;
|
mod build_ui;
|
||||||
mod content;
|
mod content;
|
||||||
|
mod kernel_package_row;
|
||||||
mod kernel_pkg;
|
mod kernel_pkg;
|
||||||
mod sched_ext;
|
mod sched_ext;
|
||||||
mod kernel_package_row;
|
|
||||||
|
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
|
@ -193,7 +193,7 @@ fn scx_sched_expandable(expander_row: &adw::ExpanderRow) -> gtk::ListBox {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if format!("scx_{}",get_current_scx_scheduler()).as_str() == sched_clone0 {
|
if format!("scx_{}", get_current_scx_scheduler()).as_str() == sched_clone0 {
|
||||||
sched_checkbutton.set_active(true)
|
sched_checkbutton.set_active(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user