Update to latest version.

This commit is contained in:
Elliott Sales de Andrade 2020-02-25 21:44:08 -05:00
parent b0e6f343e0
commit 5cf6ac24b8
5 changed files with 46 additions and 56 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/ps_1.1.0.tar.gz
/ps_1.3.0.tar.gz
/ps_1.3.2.tar.gz

View File

@ -0,0 +1,32 @@
From 403d0337ff8e3c4c138f509294b7a01baa0513ab Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 25 Feb 2020 21:16:57 -0500
Subject: [PATCH] Don't run example that uses the network.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
man/ps_connections.Rd | 2 ++
1 file changed, 2 insertions(+)
diff --git a/man/ps_connections.Rd b/man/ps_connections.Rd
index e72b73e..0c1c206 100644
--- a/man/ps_connections.Rd
+++ b/man/ps_connections.Rd
@@ -32,12 +32,14 @@ For a zombie process it throws a \code{zombie_process} error.
}
\examples{
\dontshow{if (ps::ps_is_supported()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
+\dontrun{
p <- ps_handle()
ps_connections(p)
sc <- socketConnection("httpbin.org", port = 80)
ps_connections(p)
close(sc)
ps_connections(p)
+}
\dontshow{\}) # examplesIf}
}
\seealso{
--
2.21.1

View File

@ -1,51 +0,0 @@
From 49bb399e608ab564892a43a830ffd554ed240111 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 18 Mar 2019 00:13:47 -0400
Subject: [PATCH] Get physical CPU count from lscpu if available.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
R/linux.R | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/R/linux.R b/R/linux.R
index add8043..0d44689 100644
--- a/R/linux.R
+++ b/R/linux.R
@@ -140,7 +140,20 @@ psl__decode_address <- function(addr, family) {
}
}
-ps_cpu_count_physical_linux <- function() {
+psl__cpu_count_from_lscpu <- function() {
+ lines <- system("lscpu -p=core", intern = TRUE)
+ cores = list()
+
+ for (l in lines) {
+ if (!str_starts_with(l, "#")) {
+ cores[str_strip(l)] <- 1
+ }
+ }
+
+ length(cores)
+}
+
+psl__cpu_count_from_cpuinfo <- function() {
lines <- readLines("/proc/cpuinfo")
mapping = list()
current = list()
@@ -165,3 +178,11 @@ ps_cpu_count_physical_linux <- function() {
sum(as.integer(unlist(mapping)))
}
+
+ps_cpu_count_physical_linux <- function() {
+ if (Sys.which("lscpu") != "") {
+ psl__cpu_count_from_lscpu()
+ } else {
+ psl__cpu_count_from_cpuinfo()
+ }
+}
--
2.20.1

View File

@ -1,18 +1,20 @@
%global packname ps
%global packname ps
%global packver 1.3.2
%global rlibdir %{_libdir}/R/library
# Tests requires processx which requires this package.
%global with_test 1
Name: R-%{packname}
Version: 1.3.0
Version: 1.3.2
Release: 1%{?dist}
Summary: List, Query, Manipulate System Processes
License: BSD
URL: https://CRAN.R-project.org/package=%{packname}
Source0: https://cran.r-project.org/src/contrib/%{packname}_%{version}.tar.gz
Patch0001: 0001-Get-physical-CPU-count-from-lscpu-if-available.patch
Source0: https://cran.r-project.org/src/contrib/%{packname}_%{packver}.tar.gz
# No network on builders.
Patch0001: 0001-Don-t-run-example-that-uses-the-network.patch
# Here's the R view of the dependencies world:
# Depends:
@ -63,6 +65,9 @@ mkdir -p %{buildroot}%{rlibdir}
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
rm -f %{buildroot}%{rlibdir}/R.css
# Only used to run ./configure on Windows.
rm %{buildroot}%{rlibdir}/%{packname}/tools/winver.R
%check
%if %{with_test}
@ -91,6 +96,9 @@ _R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --no-tests
%changelog
* Mon Feb 24 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.3.2-1
- Update to latest version
* Fri Mar 22 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.3.0-1
- Update to latest version
- Patch to work on non-x86 systems

View File

@ -1 +1 @@
SHA512 (ps_1.3.0.tar.gz) = dedc24076f78b780c370031d3ddf22e64b8f5b11f9248525fc8405c796eafe1028155c42b52c7773d71ce4167f6de9745d21069bab45c3748219eded4829c7bb
SHA512 (ps_1.3.2.tar.gz) = 2dd5b46375636ad09427ba5080cc6bf3876a94683fb04d10225d9848e9dc21094884163e613cce624193c9c051711229ffb1587d2bcb7074cc99729e2f82eb17