summaryrefslogtreecommitdiff
path: root/sysutils/rsfetch
diff options
context:
space:
mode:
authorMikael Urankar <mikael@FreeBSD.org>2020-03-18 08:34:36 +0000
committerMikael Urankar <mikael@FreeBSD.org>2020-03-18 08:34:36 +0000
commit865ff6c1033a5613a11e788c64879ddf28d5becf (patch)
tree1f491dce4291939e497a85de296b70d068e91a74 /sysutils/rsfetch
parent61838c3a6dfed88ab8847098f378a8b8c61d60a1 (diff)
downloadfreebsd-ports-865ff6c1033a5613a11e788c64879ddf28d5becf.zip
sysutils/rsfetch: fix memory reporting and add DragonFlyBSD support
Import upstream fix [1] to fix fix memory reporting and add DragonFlyBSD support. [1] https://github.com/rsfetch/rsfetch/commit/2bd3ef9eaf1a0369f115022f8acb650682a1bf3e PR: 244861 Approved by: Lewis Cook (maintainer), manu (mentor, implicit)
Diffstat (limited to 'sysutils/rsfetch')
-rw-r--r--sysutils/rsfetch/Makefile1
-rw-r--r--sysutils/rsfetch/files/patch-src_memory.rs20
-rw-r--r--sysutils/rsfetch/files/patch-src_util.rs28
3 files changed, 49 insertions, 0 deletions
diff --git a/sysutils/rsfetch/Makefile b/sysutils/rsfetch/Makefile
index 7011746f7540..8a00a8d2a645 100644
--- a/sysutils/rsfetch/Makefile
+++ b/sysutils/rsfetch/Makefile
@@ -2,6 +2,7 @@
PORTNAME= rsfetch
DISTVERSION= 2.0.0
+PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= vulcan@wired.sh
diff --git a/sysutils/rsfetch/files/patch-src_memory.rs b/sysutils/rsfetch/files/patch-src_memory.rs
new file mode 100644
index 000000000000..d621f6fbb884
--- /dev/null
+++ b/sysutils/rsfetch/files/patch-src_memory.rs
@@ -0,0 +1,20 @@
+--- src/memory.rs.orig 2020-03-16 13:12:22 UTC
++++ src/memory.rs
+@@ -74,12 +74,15 @@ impl RAMInfo {
+ self.used = Some(used / 1024_f64 / 1024_f64);
+ self.total = Some(total / 1024_f64 / 1024_f64);
+ return Ok(());
+- } else if os == &OS::FreeBSD || os == &OS::Other {
++ } else if os == &OS::FreeBSD || os == &OS::DragonflyBSD {
+ let mut buffer = String::new();
+ Command::new("sysctl").arg("-n").arg("hw.physmem")
+ .output().context(RAMErr)?.stdout.iter()
+ .for_each(|b| buffer.push(*b as char));
+- total = buffer.parse::<f64>().unwrap();
++
++ // remove non-integer chars from buffer
++ buffer = buffer.trim().replace("\n", "");
++ total = buffer.parse::<u64>().unwrap() as f64;
+
+ let pagesize: f64;
+ let inactive: f64;
diff --git a/sysutils/rsfetch/files/patch-src_util.rs b/sysutils/rsfetch/files/patch-src_util.rs
new file mode 100644
index 000000000000..d378406a159a
--- /dev/null
+++ b/sysutils/rsfetch/files/patch-src_util.rs
@@ -0,0 +1,28 @@
+--- src/util.rs.orig 2020-03-16 13:14:06 UTC
++++ src/util.rs
+@@ -8,6 +8,7 @@ pub enum OS {
+ FreeBSD,
+ OpenBSD,
+ NetBSD,
++ DragonflyBSD,
+ Other
+ }
+
+@@ -23,11 +24,12 @@ impl OSInfo {
+ .output()?.stdout.iter()
+ .for_each(|b| uname.push(*b as char));
+ let os = match uname.replace("\n", "").trim().as_ref() {
+- "Linux" => OS::Linux,
+- "FreeBSD" => OS::FreeBSD,
+- "NetBSD" => OS::NetBSD,
+- "OpenBSD" => OS::OpenBSD,
+- &_ => OS::Other,
++ "Linux" => OS::Linux,
++ "FreeBSD" => OS::FreeBSD,
++ "NetBSD" => OS::NetBSD,
++ "OpenBSD" => OS::OpenBSD,
++ "DragonFly" => OS::DragonflyBSD,
++ &_ => OS::Other,
+ };
+
+ Ok(os)