Date: Wed, 18 Mar 2020 08:34:36 +0000 (UTC) From: Mikael Urankar <mikael@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r528635 - in head/sysutils/rsfetch: . files Message-ID: <202003180834.02I8Ya8F061219@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mikael Date: Wed Mar 18 08:34:36 2020 New Revision: 528635 URL: https://svnweb.freebsd.org/changeset/ports/528635 Log: 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) Added: head/sysutils/rsfetch/files/ head/sysutils/rsfetch/files/patch-src_memory.rs (contents, props changed) head/sysutils/rsfetch/files/patch-src_util.rs (contents, props changed) Modified: head/sysutils/rsfetch/Makefile Modified: head/sysutils/rsfetch/Makefile ============================================================================== --- head/sysutils/rsfetch/Makefile Wed Mar 18 08:07:56 2020 (r528634) +++ head/sysutils/rsfetch/Makefile Wed Mar 18 08:34:36 2020 (r528635) @@ -2,6 +2,7 @@ PORTNAME= rsfetch DISTVERSION= 2.0.0 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= vulcan@wired.sh Added: head/sysutils/rsfetch/files/patch-src_memory.rs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rsfetch/files/patch-src_memory.rs Wed Mar 18 08:34:36 2020 (r528635) @@ -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; Added: head/sysutils/rsfetch/files/patch-src_util.rs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/rsfetch/files/patch-src_util.rs Wed Mar 18 08:34:36 2020 (r528635) @@ -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003180834.02I8Ya8F061219>