]> git.proxmox.com Git - pve-installer.git/commitdiff
debian: bump cursive to 0.21 master
authorChristoph Heiss <c.heiss@proxmox.com>
Fri, 9 Aug 2024 12:08:36 +0000 (14:08 +0200)
committerChristoph Heiss <c.heiss@proxmox.com>
Tue, 13 Aug 2024 11:07:44 +0000 (13:07 +0200)
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
debian/control
proxmox-tui-installer/Cargo.toml
proxmox-tui-installer/src/main.rs
proxmox-tui-installer/src/views/bootdisk.rs
proxmox-tui-installer/src/views/install_progress.rs
proxmox-tui-installer/src/views/mod.rs
proxmox-tui-installer/src/views/table_view.rs

index d808701979d3bbb48b3aaa6ec111e436748a1df6..04b0c6ef3970f6a9473ab080fbbaa16c4c222d16 100644 (file)
@@ -11,7 +11,7 @@ Build-Depends: cargo:native,
                librsvg2-bin,
                librust-anyhow-1-dev,
                librust-clap-4+derive-dev,
-               librust-cursive+crossterm-backend-dev (>= 0.20.0),
+               librust-cursive-0.21+crossterm-backend-dev,
                librust-glob-0.3-dev,
                librust-hex-0.4-dev,
                librust-native-tls-dev,
index 7bf2c23b97828803af69d7429f7a508be1f76974..25164688bfcead42fc2f58f71ea89fe194bff72e 100644 (file)
@@ -8,7 +8,7 @@ exclude = [ "build", "debian" ]
 homepage = "https://www.proxmox.com"
 
 [dependencies]
-cursive = { version = "0.20.0", default-features = false, features = ["crossterm-backend"] }
+cursive = { version = "0.21", default-features = false, features = ["crossterm-backend"] }
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 regex = "1.7"
index 8b92a8d3acaccb84bcd8f13f8993813868239d6b..3fb87a79806586eec61b42c26ab30ceb8cdb33ba 100644 (file)
@@ -4,7 +4,7 @@ use std::{collections::HashMap, env, net::IpAddr};
 
 use cursive::{
     event::Event,
-    theme::{ColorStyle, Effect, PaletteColor, Style},
+    theme::{ColorStyle, Effect, Effects, PaletteColor, Style},
     view::{Nameable, Offset, Resizable, ViewWrapper},
     views::{
         Button, Checkbox, Dialog, DummyView, EditView, Layer, LinearLayout, PaddedView, Panel,
@@ -50,7 +50,7 @@ impl InstallerView {
     pub fn new<T: View>(
         state: &InstallerState,
         view: T,
-        next_cb: Box<dyn Fn(&mut Cursive)>,
+        next_cb: Box<dyn Fn(&mut Cursive) + Send + Sync>,
         focus_next: bool,
     ) -> Self {
         let mut bbar = LinearLayout::horizontal()
@@ -290,9 +290,9 @@ fn prompt_dialog(
     title: &str,
     text: &str,
     yes_text: &str,
-    callback_yes: Box<dyn Fn(&mut Cursive)>,
+    callback_yes: Box<dyn Fn(&mut Cursive) + Send + Sync>,
     no_text: &str,
-    callback_no: Box<dyn Fn(&mut Cursive)>,
+    callback_no: Box<dyn Fn(&mut Cursive) + Send + Sync>,
 ) {
     siv.add_layer(
         Dialog::around(TextView::new(text))
index 1e2210573de52b0a2b6c477f7e700ccfcbb4a96c..440d4a5b49b73975d80128a81e1429f0ddd01e39 100644 (file)
@@ -1,4 +1,7 @@
-use std::{cell::RefCell, marker::PhantomData, rc::Rc};
+use std::{
+    marker::PhantomData,
+    sync::{Arc, Mutex},
+};
 
 use cursive::{
     view::{Nameable, Resizable, ViewWrapper},
@@ -30,8 +33,7 @@ use proxmox_installer_common::{
 const ZFS_ARC_MIN_SIZE_MIB: usize = 64; // MiB
 
 /// Convenience wrapper when needing to take a (interior-mutable) reference to `BootdiskOptions`.
-/// Interior mutability is safe for this case, as it is completely single-threaded.
-pub type BootdiskOptionsRef = Rc<RefCell<BootdiskOptions>>;
+pub type BootdiskOptionsRef = Arc<Mutex<BootdiskOptions>>;
 
 pub struct BootdiskOptionsView {
     view: LinearLayout,
@@ -41,7 +43,7 @@ pub struct BootdiskOptionsView {
 
 impl BootdiskOptionsView {
     pub fn new(siv: &mut Cursive, runinfo: &RuntimeInfo, options: &BootdiskOptions) -> Self {
-        let advanced_options = Rc::new(RefCell::new(options.clone()));
+        let advanced_options = Arc::new(Mutex::new(options.clone()));
 
         let bootdisk_form = FormView::new()
             .child(
@@ -100,7 +102,7 @@ impl BootdiskOptionsView {
         // The simple disk selector, as well as the advanced bootdisk dialog save their
         // info on submit directly to the shared `BootdiskOptionsRef` - so just clone() + return
         // it.
-        let options = (*self.advanced_options).clone().into_inner();
+        let options = self.advanced_options.lock().unwrap().clone();
         check_disks_4kn_legacy_boot(self.boot_type, &options.disks)?;
         Ok(options)
     }
@@ -122,7 +124,7 @@ impl AdvancedBootdiskOptionsView {
     ) -> Self {
         let filter_btrfs =
             |fstype: &&FsType| -> bool { product_conf.enable_btrfs || !fstype.is_btrfs() };
-        let options = (*options_ref).borrow();
+        let options = options_ref.lock().unwrap();
 
         let fstype_select = SelectView::new()
             .popup()
@@ -758,7 +760,7 @@ fn advanced_options_view(
             }
 
             siv.pop_layer();
-            *(*options_ref).borrow_mut() = options;
+            *options_ref.lock().unwrap() = options;
         }
     })
     .with_name("advanced-bootdisk-options-dialog")
@@ -787,8 +789,9 @@ fn target_bootdisk_selectview(
         .with_all(avail_disks.iter().map(|d| (d.to_string(), d.clone())))
         .selected(selected_disk_pos)
         .on_submit(move |_, disk| {
-            options_ref.borrow_mut().disks = vec![disk.clone()];
-            options_ref.borrow_mut().advanced =
+            let mut options = options_ref.lock().unwrap();
+            options.disks = vec![disk.clone()];
+            options.advanced =
                 AdvancedBootdiskOptions::Lvm(LvmBootdiskOptions::defaults_from(disk));
         })
 }
index f47ddc658e44df2bb92d94d6dfad4da9abe9bb5c..6c8df5868d390b34bbcb8383fcd9163786716885 100644 (file)
@@ -204,7 +204,11 @@ impl InstallProgressView {
         }
     }
 
-    fn show_prompt<W: Write + 'static>(siv: &mut Cursive, text: &str, writer: Arc<Mutex<W>>) {
+    fn show_prompt<W: Write + 'static + Send>(
+        siv: &mut Cursive,
+        text: &str,
+        writer: Arc<Mutex<W>>,
+    ) {
         let send_answer = |writer: Arc<Mutex<W>>, answer| {
             if let Ok(mut writer) = writer.lock() {
                 let _ = writeln!(
index a098d1f0f6436e43f895642e007baccd99aff883..0d98f09d3b5ae76f08707ee4b09426ad933db3c3 100644 (file)
@@ -1,4 +1,4 @@
-use std::{net::IpAddr, rc::Rc, str::FromStr};
+use std::{net::IpAddr, str::FromStr, sync::Arc};
 
 use cursive::{
     event::{Event, EventResult},
@@ -105,7 +105,7 @@ impl<T: Copy + ToString + FromStr + PartialOrd> NumericEditView<T> {
         self.max_value = Some(max);
     }
 
-    fn check_bounds(&mut self, original: Rc<String>, result: EventResult) -> EventResult {
+    fn check_bounds(&mut self, original: Arc<String>, result: EventResult) -> EventResult {
         // Check if the new value is actually valid according to the max value, if set
         if let Some(max) = self.max_value {
             if let Ok(val) = self.get_content() {
@@ -314,7 +314,7 @@ impl FormViewGetValue<String> for EditView {
     }
 }
 
-impl<T: 'static + Clone> FormViewGetValue<T> for SelectView<T> {
+impl<T: 'static + Clone + Send + Sync> FormViewGetValue<T> for SelectView<T> {
     fn get_value(&self) -> Option<T> {
         self.selection().map(|v| (*v).clone())
     }
index 2340eeb185d910de99e9e5559f7fec2ca81742c9..f1a88c710583874f32683d2628ab04381b1fbad7 100644 (file)
@@ -87,7 +87,7 @@ impl<T: TableViewItem> TableView<T> {
     }
 }
 
-impl<T: TableViewItem + 'static> View for TableView<T> {
+impl<T: TableViewItem + 'static + Send + Sync> View for TableView<T> {
     fn draw(&self, p: &Printer) {
         // Equally split up the columns width, taking into account the scrollbar size and column
         // separator.