Hi.

Please consider this revised patch instead. It's a little bit more readable
than the previous one.

Thanks.
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+graph-tool (2.77+ds-2) unstable; urgency=medium
+
+  * Team upload.
+  * Limit RAM per CPU ratio to 10000 MB / CPU. Closes: #1042029.
+
+ -- Jerome Benoit <calcu...@rezozer.net>  Wed, 16 Oct 2024 16:40:00 +0200
+
 graph-tool (2.77+ds-1) unstable; urgency=medium
 
   * New upstream release (Closes: #1077450).
--- a/debian/rules
+++ b/debian/rules
@@ -25,6 +25,11 @@ endif
 ##CPPFLAGS += -mxgot --param ggc-min-expand=10
 ##endif
 
+MEM_PER_CPU = 10000
+NCPUS := $(or $(subst parallel=,,$(filter 
parallel=%,$(DEB_BUILD_OPTIONS))),$(shell nproc))
+NJOBS := $(shell awk -vn=$(NCPUS) -vm=$(MEM_PER_CPU) '/^MemAvailable:/ { mt = 
$$2 } \
+  END { n2 = int(mt/1024/m); print (n==1 || n2<=1) ? 1 : (n2<=n ? n2 : n) }' 
/proc/meminfo)
+
 default:
        @uscan --no-conf --dehs --report || true
 
@@ -40,6 +45,9 @@ override_dh_auto_configure:
                        --with-sparsehash-prefix=google \
                        --with-boost-python=boost_python$(PY3DOTLESSVERSION)
 
+override_dh_auto_build:
+       dh_auto_build -- -j $(NJOBS)
+
 override_dh_auto_test:
        true
 

Reply via email to