Source: scaphandre
Version: 1.0.0-8
Severity: normal
Tags: patch
X-Debbugs-Cc: noisyc...@tutanota.com

Hi!

procfs v0.17 was just uploaded to experimental and we intend to downlift it
to unstable in the near future. scaphandre builds with v0.17 using the
(non-trivial) patch in attachment. Since there are no tests in the package,
I didn't do checks other than a test build.

Cheers!
>From d541c8f2f83b5f1a0a995d9a9110f6db5f03f106 Mon Sep 17 00:00:00 2001
From: NoisyCoil <noisyc...@tutanota.com>
Date: Sat, 18 Jan 2025 21:18:17 +0100
Subject: [PATCH] bump build-dependency for crate procfs

---
 debian/control                       |  2 +-
 debian/patches/2002_procfs.patch     | 91 +++++++++++++++++++++++++++-
 debian/patches/2003_no_windows.patch |  2 +-
 3 files changed, 90 insertions(+), 5 deletions(-)

diff --git a/debian/control b/debian/control
index af598ca..c9a23fb 100644
--- a/debian/control
+++ b/debian/control
@@ -23,7 +23,7 @@ Build-Depends:
  librust-log-0.4+default-dev,
  librust-loggerv-0.7+default-dev,
  librust-ordered-float-4+default-dev,
- librust-procfs-dev (<< 0.16),
+ librust-procfs-dev (<< 0.18),
  librust-protobuf-2+default-dev,
  librust-rand-0.8+default-dev,
  librust-regex-1+default-dev,
diff --git a/debian/patches/2002_procfs.patch b/debian/patches/2002_procfs.patch
index 0faecc3..b2e4282 100644
--- a/debian/patches/2002_procfs.patch
+++ b/debian/patches/2002_procfs.patch
@@ -1,7 +1,7 @@
-Description: accept older branch of crate procfs
+Description: accept different branch of crate procfs
 Author: Jonas Smedegaard <d...@jones.dk>
 Forwarded: not-needed
-Last-Update: 2024-08-27
+Last-Update: 2025-02-10
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/Cargo.toml
@@ -11,7 +11,92 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
  
  [target.'cfg(target_os="linux")'.dependencies]
 -procfs = { version = "0.15.0" }
-+procfs = { version = ">= 0.14.2, <= 0.15" }
++procfs = { version = ">= 0.14.2, <= 0.17" }
  
  [target.'cfg(target_os="windows")'.dependencies]
  windows = { version = "0.27.0", features = 
["alloc","Win32_Storage_FileSystem","Win32_Foundation","Win32_Security","Win32_System_IO","Win32_System_Ioctl","Win32_System_Threading",
 "Win32_System_SystemInformation"]}
+--- a/src/sensors/utils.rs
++++ b/src/sensors/utils.rs
+@@ -185,7 +185,7 @@
+     let res;
+     #[cfg(target_os = "linux")]
+     {
+-        res = Ok(procfs::page_size().unwrap() as u64)
++        res = Ok(procfs::page_size())
+     }
+     #[cfg(target_os = "windows")]
+     {
+--- a/src/sensors/mod.rs
++++ b/src/sensors/mod.rs
+@@ -12,7 +12,7 @@
+ pub mod units;
+ pub mod utils;
+ #[cfg(target_os = "linux")]
+-use procfs::{CpuInfo, CpuTime, KernelStats};
++use procfs::{CpuInfo, CpuTime, Current, CurrentSI, KernelStats};
+ use std::{collections::HashMap, error::Error, fmt, fs, mem::size_of_val, str, 
time::Duration};
+ #[allow(unused_imports)]
+ use sysinfo::{Pid, System};
+@@ -173,7 +173,7 @@
+         let sysinfo_cores = sysinfo_system.cpus();
+         debug!("Sysinfo sees {}", sysinfo_cores.len());
+         #[cfg(target_os = "linux")]
+-        let cpuinfo = CpuInfo::new().unwrap();
++        let cpuinfo = CpuInfo::current().unwrap();
+         for (id, c) in (0_u16..).zip(sysinfo_cores.iter()) {
+             let mut info = HashMap::<String, String>::new();
+             #[cfg(target_os = "linux")]
+@@ -535,7 +535,7 @@
+     pub fn read_stats(&self) -> Option<CPUStat> {
+         #[cfg(target_os = "linux")]
+         {
+-            let kernelstats_or_not = KernelStats::new();
++            let kernelstats_or_not = KernelStats::current();
+             if let Ok(res_cputime) = kernelstats_or_not {
+                 return Some(CPUStat {
+                     user: res_cputime.total.user,
+@@ -558,7 +558,7 @@
+     pub fn read_nb_process_total_count(&self) -> Option<u64> {
+         #[cfg(target_os = "linux")]
+         {
+-            if let Ok(result) = KernelStats::new() {
++            if let Ok(result) = KernelStats::current() {
+                 return Some(result.processes);
+             }
+         }
+@@ -569,7 +569,7 @@
+     pub fn read_nb_process_running_current(&self) -> Option<u32> {
+         #[cfg(target_os = "linux")]
+         {
+-            if let Ok(result) = KernelStats::new() {
++            if let Ok(result) = KernelStats::current() {
+                 if let Some(procs_running) = result.procs_running {
+                     return Some(procs_running);
+                 }
+@@ -581,7 +581,7 @@
+     pub fn read_nb_process_blocked_current(&self) -> Option<u32> {
+         #[cfg(target_os = "linux")]
+         {
+-            if let Ok(result) = KernelStats::new() {
++            if let Ok(result) = KernelStats::current() {
+                 if let Some(procs_blocked) = result.procs_blocked {
+                     return Some(procs_blocked);
+                 }
+@@ -593,7 +593,7 @@
+     pub fn read_nb_context_switches_total_count(&self) -> Option<u64> {
+         #[cfg(target_os = "linux")]
+         {
+-            if let Ok(result) = KernelStats::new() {
++            if let Ok(result) = KernelStats::current() {
+                 return Some(result.ctxt);
+             }
+         }
+@@ -1326,7 +1326,7 @@
+     fn read_stats(&self) -> Option<CPUStat> {
+         #[cfg(target_os = "linux")]
+         {
+-            if let Ok(mut kernelstats) = KernelStats::new() {
++            if let Ok(mut kernelstats) = KernelStats::current() {
+                 return Some(CPUStat::from_procfs_cputime(
+                     kernelstats.cpu_time.remove(self.id as usize),
+                 ));
diff --git a/debian/patches/2003_no_windows.patch 
b/debian/patches/2003_no_windows.patch
index 9de435d..c5f61b8 100644
--- a/debian/patches/2003_no_windows.patch
+++ b/debian/patches/2003_no_windows.patch
@@ -8,7 +8,7 @@ This patch header follows DEP-3: 
http://dep.debian.net/deps/dep3/
 +++ b/Cargo.toml
 @@ -33,13 +33,6 @@
  [target.'cfg(target_os="linux")'.dependencies]
- procfs = { version = ">= 0.14.2, <= 0.15" }
+ procfs = { version = ">= 0.14.2, <= 0.17" }
  
 -[target.'cfg(target_os="windows")'.dependencies]
 -windows = { version = "0.27.0", features = 
["alloc","Win32_Storage_FileSystem","Win32_Foundation","Win32_Security","Win32_System_IO","Win32_System_Ioctl","Win32_System_Threading",
 "Win32_System_SystemInformation"]}
-- 
2.47.2

Reply via email to