public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass
@ 2015-12-28  8:43 Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 1/9] check-reqs.eclass: Only inherit eclass once Justin Lecher
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Dear all,

please review my suggestion to the check-reqs.eclass according to cleanups
and EAPI=6 support. Any further ideas you like to see implemented?

Justin

Justin Lecher (9):
  check-reqs.eclass: Only inherit eclass once
  check-reqs.eclass: Use eqawarn() from eutils.eclass
  check-reqs.eclass: Mark interal function with @INTERNAL
  check-reqs.eclass: Fix typo
  check-reqs.eclass: Replace obsolete df option -m with -B ###
  check-reqs.eclass: Ban obsolete functions in newer EAPIs
  check-reqs.eclass: Sanitize MERGE_TYPE for EAPI < 4
  check-reqs.eclass: Require units for CHECKREQS_ in EAPIs > 5
  check-reqs.eclass: Enable EAPI 6 support

 eclass/check-reqs.eclass | 40 ++++++++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 10 deletions(-)

-- 
2.6.4



^ permalink raw reply	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 1/9] check-reqs.eclass: Only inherit eclass once
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 2/9] check-reqs.eclass: Use eqawarn() from eutils.eclass Justin Lecher
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index d685f1f..4f74536 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -38,6 +38,8 @@
 # These checks should probably mostly work on non-Linux, and they should
 # probably degrade gracefully if they don't. Probably.
 
+if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
+
 inherit eutils
 
 # @ECLASS-VARIABLE: CHECKREQS_MEMORY
@@ -353,3 +355,6 @@ check-reqs_unsatisfied() {
 	# Internal, do not set yourself.
 	CHECKREQS_FAILED="true"
 }
+
+_CHECK_REQS_ECLASS_=1
+fi
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 2/9] check-reqs.eclass: Use eqawarn() from eutils.eclass
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 1/9] check-reqs.eclass: Only inherit eclass once Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 3/9] check-reqs.eclass: Mark interal function with @INTERNAL Justin Lecher
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 4f74536..219023e 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -76,10 +76,10 @@ check_reqs() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	echo
-	ewarn "QA: Package calling old ${FUNCNAME} function."
-	ewarn "QA: Please file a bug against the package."
-	ewarn "QA: It should call check-reqs_pkg_pretend and check-reqs_pkg_setup"
-	ewarn "QA: and possibly use EAPI=4 or later."
+	eqawarn "Package calling old ${FUNCNAME} function."
+	eqawarn "Please file a bug against the package."
+	eqawarn "It should call check-reqs_pkg_pretend and check-reqs_pkg_setup"
+	eqawarn "and possibly use EAPI=4 or later."
 	echo
 
 	check-reqs_pkg_setup "$@"
@@ -194,9 +194,9 @@ check-reqs_get_number() {
 	# Check for unset units and warn about them.
 	# Backcompat.
 	if [[ ${size} == ${1} ]]; then
-		ewarn "QA: Package does not specify unit for the size check"
-		ewarn "QA: Assuming mebibytes."
-		ewarn "QA: File bug against the package. It should specify the unit."
+		eqawarn "Package does not specify unit for the size check"
+		eqawarn "Assuming mebibytes."
+		eqawarn "File bug against the package. It should specify the unit."
 	fi
 
 	echo ${size}
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 3/9] check-reqs.eclass: Mark interal function with @INTERNAL
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 1/9] check-reqs.eclass: Only inherit eclass once Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 2/9] check-reqs.eclass: Use eqawarn() from eutils.eclass Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 4/9] check-reqs.eclass: Fix typo Justin Lecher
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 219023e..3c98baf 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -108,6 +108,7 @@ check-reqs_pkg_pretend() {
 }
 
 # @FUNCTION: check-reqs_prepare
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that checks the variables that should be defined.
 check-reqs_prepare() {
@@ -124,6 +125,7 @@ check-reqs_prepare() {
 }
 
 # @FUNCTION: check-reqs_run
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that runs the check based on variable settings.
 check-reqs_run() {
@@ -158,6 +160,7 @@ check-reqs_run() {
 }
 
 # @FUNCTION: check-reqs_get_mebibytes
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that returns number in mebibytes.
 # Returns 1024 for 1G or 1048576 for 1T.
@@ -180,6 +183,7 @@ check-reqs_get_mebibytes() {
 }
 
 # @FUNCTION: check-reqs_get_number
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that returns the numerical value without the unit.
 # Returns "1" for "1G" or "150" for "150T".
@@ -203,6 +207,7 @@ check-reqs_get_number() {
 }
 
 # @FUNCTION: check-reqs_get_unit
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that return the unit without the numerical value.
 # Returns "GiB" for "1G" or "TiB" for "150T".
@@ -224,6 +229,7 @@ check-reqs_get_unit() {
 }
 
 # @FUNCTION: check-reqs_output
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that prints the warning and dies if required based on
 # the test results.
@@ -246,6 +252,7 @@ check-reqs_output() {
 }
 
 # @FUNCTION: check-reqs_memory
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that checks size of RAM.
 check-reqs_memory() {
@@ -283,6 +290,7 @@ check-reqs_memory() {
 }
 
 # @FUNCTION: check-reqs_disk
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that checks space on the harddrive.
 check-reqs_disk() {
@@ -316,6 +324,7 @@ check-reqs_disk() {
 }
 
 # @FUNCTION: check-reqs_start_phase
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that inform about started check
 check-reqs_start_phase() {
@@ -331,6 +340,7 @@ check-reqs_start_phase() {
 }
 
 # @FUNCTION: check-reqs_unsatisfied
+# @INTERNAL
 # @DESCRIPTION:
 # Internal function that inform about check result.
 # It has different output between pretend and setup phase,
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 4/9] check-reqs.eclass: Fix typo
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (2 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 3/9] check-reqs.eclass: Mark interal function with @INTERNAL Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ### Justin Lecher
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 3c98baf..138bfec 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -71,7 +71,7 @@ esac
 
 # @FUNCTION: check_reqs
 # @DESCRIPTION:
-# Obsolete function executing all the checks and priting out results
+# Obsolete function executing all the checks and printing out results
 check_reqs() {
 	debug-print-function ${FUNCNAME} "$@"
 
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (3 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 4/9] check-reqs.eclass: Fix typo Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28 13:58   ` Andrew Savchenko
  2015-12-28 14:24   ` Michał Górny
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 6/9] check-reqs.eclass: Ban obsolete functions in newer EAPIs Justin Lecher
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 138bfec..a32f8f8 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -306,7 +306,7 @@ check-reqs_disk() {
 		${size} \
 		"disk space at \"${path}\""
 
-	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
+	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
 
 	if [[ $? == 0 && -n ${space_megs} ]] ; then
 		if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ; then
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 6/9] check-reqs.eclass: Ban obsolete functions in newer EAPIs
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (4 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ### Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 7/9] check-reqs.eclass: Sanitize MERGE_TYPE for EAPI < 4 Justin Lecher
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index a32f8f8..ad032b9 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -75,6 +75,8 @@ esac
 check_reqs() {
 	debug-print-function ${FUNCNAME} "$@"
 
+	[[ ${EAPI:-0} == [012345] ]] || die "${FUNCNAME} is banned in EAPI > 5"
+
 	echo
 	eqawarn "Package calling old ${FUNCNAME} function."
 	eqawarn "Please file a bug against the package."
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 7/9] check-reqs.eclass: Sanitize MERGE_TYPE for EAPI < 4
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (5 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 6/9] check-reqs.eclass: Ban obsolete functions in newer EAPIs Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 8/9] check-reqs.eclass: Require units for CHECKREQS_ in EAPIs > 5 Justin Lecher
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index ad032b9..4513904 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -136,6 +136,8 @@ check-reqs_run() {
 	# some people are *censored*
 	unset CHECKREQS_FAILED
 
+	[[ ${EAPI:-0} == [0123] ]] && local MERGE_TYPE=""
+
 	# use != in test, because MERGE_TYPE only exists in EAPI 4 and later
 	if [[ ${MERGE_TYPE} != binary ]]; then
 		[[ -n ${CHECKREQS_MEMORY} ]] && \
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 8/9] check-reqs.eclass: Require units for CHECKREQS_ in EAPIs > 5
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (6 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 7/9] check-reqs.eclass: Sanitize MERGE_TYPE for EAPI < 4 Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 9/9] check-reqs.eclass: Enable EAPI 6 support Justin Lecher
  2015-12-28  9:35 ` [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Andrew Savchenko
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 4513904..26f2dc1 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -198,13 +198,14 @@ check-reqs_get_number() {
 
 	local unit=${1:(-1)}
 	local size=${1%[GMT]}
+	local msg=eerror
+	[[ ${EAPI:-0} == [012345] ]] && msg=eqawarn
 
 	# Check for unset units and warn about them.
 	# Backcompat.
 	if [[ ${size} == ${1} ]]; then
-		eqawarn "Package does not specify unit for the size check"
-		eqawarn "Assuming mebibytes."
-		eqawarn "File bug against the package. It should specify the unit."
+		${msg} "Package does not specify unit for the size check"
+		${msg} "File bug against the package. It should specify the unit."
 	fi
 
 	echo ${size}
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH 9/9] check-reqs.eclass: Enable EAPI 6 support
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (7 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 8/9] check-reqs.eclass: Require units for CHECKREQS_ in EAPIs > 5 Justin Lecher
@ 2015-12-28  8:43 ` Justin Lecher
  2015-12-28  9:35 ` [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Andrew Savchenko
  9 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher @ 2015-12-28  8:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 26f2dc1..d22e8c2 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -65,7 +65,7 @@ inherit eutils
 EXPORT_FUNCTIONS pkg_setup
 case "${EAPI:-0}" in
 	0|1|2|3) ;;
-	4|5) EXPORT_FUNCTIONS pkg_pretend ;;
+	4|5|6) EXPORT_FUNCTIONS pkg_pretend ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac
 
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass
  2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
                   ` (8 preceding siblings ...)
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 9/9] check-reqs.eclass: Enable EAPI 6 support Justin Lecher
@ 2015-12-28  9:35 ` Andrew Savchenko
  2015-12-28  9:40   ` Justin Lecher (jlec)
  9 siblings, 1 reply; 22+ messages in thread
From: Andrew Savchenko @ 2015-12-28  9:35 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Hi,

On Mon, 28 Dec 2015 09:43:46 +0100 Justin Lecher wrote:
> Dear all,
> 
> please review my suggestion to the check-reqs.eclass according to cleanups
> and EAPI=6 support. Any further ideas you like to see implemented?

It would be useful to allow users to include swap space for memory
estimation. Sometimes this is the only way to build package without
cross-compiling. So I propose something like:

CHECKREQS_MEMORY_USE_SWAP="yes|no"

which can be set on command line, in make.conf or in per-package env
setup.

This option should be disabled by default, of course.

Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass
  2015-12-28  9:35 ` [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Andrew Savchenko
@ 2015-12-28  9:40   ` Justin Lecher (jlec)
  2015-12-28 12:34     ` Andrew Savchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Justin Lecher (jlec) @ 2015-12-28  9:40 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 28/12/15 10:35, Andrew Savchenko wrote:
> Hi,
> 
> On Mon, 28 Dec 2015 09:43:46 +0100 Justin Lecher wrote:
>> Dear all,
>> 
>> please review my suggestion to the check-reqs.eclass according to
>> cleanups and EAPI=6 support. Any further ideas you like to see
>> implemented?
> 
> It would be useful to allow users to include swap space for memory 
> estimation. Sometimes this is the only way to build package
> without cross-compiling. So I propose something like:
> 
> CHECKREQS_MEMORY_USE_SWAP="yes|no"
> 
> which can be set on command line, in make.conf or in per-package
> env setup.
> 
> This option should be disabled by default, of course.
> 
> Best regards, Andrew Savchenko
> 

Hi Andrew,

could you please file a bug for this? We do not bind this to any EAPI
as this is an additional feature.

Thanks,

Justin


-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWgQOKXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiUGwQALGC6G1QpuNLmRoi3HNO4SwF
TrFEpiEqBRhYN09PQQOs82ke8m6MkU7miBZazv9ty/GwVz1x+aNsRj3b7IY6kT9S
gTTjUcUFtn62mZtym0OFBqlOcjeeHcPMFCfQxBJ5Opgayjcr2//xd8cEj6TH8z11
M4vLvXbQ7283+0bvbd3g0G+JMquF51z+A87zZEu950sTKv2ZF35FBECzqCEmWYOM
/o0qj089VxGppvRuA5JWS/BfH/Rjxe4XvdJv9PEwfNX/S9rLHOYi63mb8d2eyINO
Eug8pkVSxXl9sGllanVYYNo/WlVZZQDZRwzAV6AsBBKU7QP+OHPjST0ikV2TE0nP
eRZ1biekprTYWaL6eucTh8VRhBPewHRC33cElWOYW9mqPz0bF+R1jTgNMU6+D96x
j5Uzx/gi1AXN6dnK8B2TqEBbsvBXig6mHiszI2c81A55GrPmpYXZiYpeOKpklopz
vwb0h021gTFYScxynthomDDFVWdUprkePHtR3rPLwbiL/aAx0FbVf6yi5QBJBmuM
HOSlYtOUK/8yYwl9fXTymvWBJlMbXqUToRsKU+/98S97JnxMBju6JVB+m4+R8PE3
YOQrZirU9JqyOxQZ4f9NHwiwnlGth732qQ3GZd4sVkxNG7b/v0YzEVvrzJtIHo7R
lk1NIx/RFE2BQ4YVNrv7
=nfVS
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass
  2015-12-28  9:40   ` Justin Lecher (jlec)
@ 2015-12-28 12:34     ` Andrew Savchenko
  0 siblings, 0 replies; 22+ messages in thread
From: Andrew Savchenko @ 2015-12-28 12:34 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

Hi,

On Mon, 28 Dec 2015 10:40:26 +0100 Justin Lecher (jlec) wrote:
> On 28/12/15 10:35, Andrew Savchenko wrote:
> > On Mon, 28 Dec 2015 09:43:46 +0100 Justin Lecher wrote:
> >> please review my suggestion to the check-reqs.eclass according to
> >> cleanups and EAPI=6 support. Any further ideas you like to see
> >> implemented?
> > 
> > It would be useful to allow users to include swap space for memory 
> > estimation. Sometimes this is the only way to build package
> > without cross-compiling. So I propose something like:
> > 
> > CHECKREQS_MEMORY_USE_SWAP="yes|no"
> > 
> > which can be set on command line, in make.conf or in per-package
> > env setup.
> > 
> > This option should be disabled by default, of course.
> > 
> > Best regards, Andrew Savchenko
> > 
> 
> Hi Andrew,
> 
> could you please file a bug for this? We do not bind this to any EAPI
> as this is an additional feature.

Done:
https://bugs.gentoo.org/show_bug.cgi?id=569966

Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ### Justin Lecher
@ 2015-12-28 13:58   ` Andrew Savchenko
  2015-12-28 14:16     ` Justin Lecher (jlec)
  2015-12-28 14:24   ` Michał Górny
  1 sibling, 1 reply; 22+ messages in thread
From: Andrew Savchenko @ 2015-12-28 13:58 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

Hi,

On Mon, 28 Dec 2015 09:43:51 +0100 Justin Lecher wrote:
> Signed-off-by: Justin Lecher <jlec@gentoo.org>
> ---
>  eclass/check-reqs.eclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
> index 138bfec..a32f8f8 100644
> --- a/eclass/check-reqs.eclass
> +++ b/eclass/check-reqs.eclass
> @@ -306,7 +306,7 @@ check-reqs_disk() {
>  		${size} \
>  		"disk space at \"${path}\""
>  
> -	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
> +	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')

Why not "-BM"? IMHO, this will be more readable, though, of course,
both arguments are semantically correct.

Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28 13:58   ` Andrew Savchenko
@ 2015-12-28 14:16     ` Justin Lecher (jlec)
  0 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher (jlec) @ 2015-12-28 14:16 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 28/12/15 14:58, Andrew Savchenko wrote:
> Hi,
> 
> On Mon, 28 Dec 2015 09:43:51 +0100 Justin Lecher wrote:
>> Signed-off-by: Justin Lecher <jlec@gentoo.org> --- 
>> eclass/check-reqs.eclass | 2 +- 1 file changed, 1 insertion(+), 1
>> deletion(-)
>> 
>> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass 
>> index 138bfec..a32f8f8 100644 --- a/eclass/check-reqs.eclass +++
>> b/eclass/check-reqs.eclass @@ -306,7 +306,7 @@ check-reqs_disk()
>> { ${size} \ "disk space at \"${path}\""
>> 
>> -	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print
>> $4}') +	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk
>> 'FNR == 2 {print $4}')
> 
> Why not "-BM"? IMHO, this will be more readable, though, of
> course, both arguments are semantically correct.
> 

Because the output is different to the original version.

$ (0) df -Pm /
Filesystem     1048576-blocks  Used Available Capacity Mounted on
/dev/root               47244 25665     19157      58% /
$ (0) df -P -B 1048576 /
Filesystem     1048576-blocks  Used Available Capacity Mounted on
/dev/root               47244 25665     19157      58% /
$ (0) df -P -BM /
Filesystem     1048576-blocks   Used Available Capacity Mounted on
/dev/root              47244M 25665M    19157M      58% /
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWgUQzXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiAEUP/RQJRmOaXjUD5orDBpXj/nvj
CszwErjdwR43HwEsWeNVGMX1dXd0l1KM5p8tK5d4cn2u920VG8U8ef+SsfJhmfbn
tnlM7hOhLmWZOqp57YpLeOvEpz0gqfjgKw3b/5Ywg4ISacufgAwNxbsSBnEmqQYv
wETPveQAVETa0SoKD3Ki9PLRVVMN1t+/azMc9hn7+Tm2dth0QoF2sQ3Tm5VbQG/H
BfQ4IWAUgpSrU991uliOt7kVTXTEShScSVPVACNoU63qtbNrYU92XGlDCAzPBsjp
E8l7jdrlHXlgqu8zh+wvrJ/1qw3t3eqnB96pGe8HAfhdeJ6cVd3mNZITMNmmRl/G
IaIdQ1dZlQLmP1ywK3bxS0ehi4XCmaQJKxP0vNAcnrlY41ea8qHp6UhrHT69c+Nr
WKCKmanfaadsoLQkHgFiy4kGuXna20XyBdyr1zP9y6L8aSz8Cq6WbESkFu3aNgFT
FTNOW4Z6fFwEc/Le3Kaowk8arv9E7yryjkqWzl4EO2nwUReg/4UmfkqgBCSOFh0z
JUd1Xvoaeo6hiSEw/VmL+D/HCzlm7Z+SRtNKDR3d8gsyCY0lVMBZscBYdSpAKbn2
5RkkynZdR52Y+1cr8Rt9G7Uz+AaX82L19+WgYd9y5dcUynNJgDU5+SRFT1/hZfSR
eO0pNmZ9ywefEvYh/2Mc
=4hR/
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28  8:43 ` [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ### Justin Lecher
  2015-12-28 13:58   ` Andrew Savchenko
@ 2015-12-28 14:24   ` Michał Górny
  2015-12-28 14:28     ` Justin Lecher (jlec)
  1 sibling, 1 reply; 22+ messages in thread
From: Michał Górny @ 2015-12-28 14:24 UTC (permalink / raw
  To: gentoo-dev, Justin Lecher; +Cc: qa, Justin Lecher

Dnia 28 grudnia 2015 09:43:51 CET, Justin Lecher <jlec@gentoo.org> napisał(a):
>Signed-off-by: Justin Lecher <jlec@gentoo.org>
>---
> eclass/check-reqs.eclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
>index 138bfec..a32f8f8 100644
>--- a/eclass/check-reqs.eclass
>+++ b/eclass/check-reqs.eclass
>@@ -306,7 +306,7 @@ check-reqs_disk() {
> 		${size} \
> 		"disk space at \"${path}\""
> 
>-	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
>+	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk 'FNR == 2
>{print $4}')

I don't want to spoil the party but '-B' doesn't seem portable. I don't see that option in FreeBSD man page.

> 
> 	if [[ $? == 0 && -n ${space_megs} ]] ; then
>		if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ; then


-- 
Best regards,
Michał Górny (by phone)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28 14:24   ` Michał Górny
@ 2015-12-28 14:28     ` Justin Lecher (jlec)
  2015-12-28 14:34       ` Michał Górny
  0 siblings, 1 reply; 22+ messages in thread
From: Justin Lecher (jlec) @ 2015-12-28 14:28 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 28/12/15 15:24, Michał Górny wrote:
> Dnia 28 grudnia 2015 09:43:51 CET, Justin Lecher <jlec@gentoo.org>
> napisał(a):
>> Signed-off-by: Justin Lecher <jlec@gentoo.org> --- 
>> eclass/check-reqs.eclass | 2 +- 1 file changed, 1 insertion(+), 1
>> deletion(-)
>> 
>> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass 
>> index 138bfec..a32f8f8 100644 --- a/eclass/check-reqs.eclass +++
>> b/eclass/check-reqs.eclass @@ -306,7 +306,7 @@ check-reqs_disk()
>> { ${size} \ "disk space at \"${path}\""
>> 
>> -	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print
>> $4}') +	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk
>> 'FNR == 2 {print $4}')
> 
> I don't want to spoil the party but '-B' doesn't seem portable. I
> don't see that option in FreeBSD man page.

The source code says


case 'm': /* obsolescent, exists for BSD compatibility */


So it might silently go away. Let me have a look at the BSD sources.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWgUclXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiiUgP/itabhl/43o8fY79y/cuZuRW
xmvQirepGlHrqVZvgOGiBxyK2q0wpVhrsgHe/hwkK/lV8NA+C0eOIUW2wlwLiyEN
T6UavwPFdoZ4YgNuj9m8ZCNbZVrJUyEFP01RUWuHyEah6MFBg+D8Jtl8vWNlzZKm
W8z3KPDTrDhpcg8i+r9D915RARpo9wraTc/LvK8QXF51YuBcn1MWsRjd50g2FQiu
R6Epylw7EmAL4AT9bhx7skdBS2z5GRHJQFEObYqtxve0PDdXOvw8SOcxwcqQXCv2
ZCEuVCURfOlOOVdL1mgfIJa/h1FMO3n1NjrZXFFZtVNs1T3sYm9/lyYjGuYQIFP3
ITkIVPBunjgbmG+wNRFOonNRDnxY0Y8F0AiaDNi07WpbkAoo52oHz9gWL/hsdhDd
vfH074JoIVtoXS6yeaESPSwOlurQ30bwhpAz7xzWLW8sWopyR+sGkuW7AQ9PkmZc
mwVX6ZIWBdZ6Zk5Ae7UNi3Lc3akSrz4GkiAlbLmxg946BMrTfJFIPBFvR82TkkNw
+mRPJUPuiCWDDDyDKNCpGb/YQB8kjkiWHZkr1Id7PLhIIDkeuccVqvEvzTNU22pk
DdQkUt9L69FxTE8OtskEDueaINaBMtBpGpPh5K+arsKUt85jIX4oM25IXau8HAWx
mDTncoD6QRn2dNXuf5gx
=O924
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ###
  2015-12-28 14:28     ` Justin Lecher (jlec)
@ 2015-12-28 14:34       ` Michał Górny
  2015-12-28 15:27         ` [gentoo-dev] [PATCH] Replace df -m with df -k Justin Lecher
  0 siblings, 1 reply; 22+ messages in thread
From: Michał Górny @ 2015-12-28 14:34 UTC (permalink / raw
  To: gentoo-dev, Justin Lecher (jlec); +Cc: qa

Dnia 28 grudnia 2015 15:28:53 CET, "Justin Lecher (jlec)" <jlec@gentoo.org> napisał(a):
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA512
>
>On 28/12/15 15:24, Michał Górny wrote:
>> Dnia 28 grudnia 2015 09:43:51 CET, Justin Lecher <jlec@gentoo.org>
>> napisał(a):
>>> Signed-off-by: Justin Lecher <jlec@gentoo.org> --- 
>>> eclass/check-reqs.eclass | 2 +- 1 file changed, 1 insertion(+), 1
>>> deletion(-)
>>> 
>>> diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass 
>>> index 138bfec..a32f8f8 100644 --- a/eclass/check-reqs.eclass +++
>>> b/eclass/check-reqs.eclass @@ -306,7 +306,7 @@ check-reqs_disk()
>>> { ${size} \ "disk space at \"${path}\""
>>> 
>>> -	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print
>>> $4}') +	space_megs=$(df -P -B 1048576 "${1}" 2>/dev/null | awk
>>> 'FNR == 2 {print $4}')
>> 
>> I don't want to spoil the party but '-B' doesn't seem portable. I
>> don't see that option in FreeBSD man page.
>
>The source code says
>
>
>case 'm': /* obsolescent, exists for BSD compatibility */
>
>
>So it might silently go away. Let me have a look at the BSD sources.

POSIX gives you '-k -P' only, so you should probably stick to that.

>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG/MacGPG2 v2.0
>
>iQJ8BAEBCgBmBQJWgUclXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
>ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
>OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiiUgP/itabhl/43o8fY79y/cuZuRW
>xmvQirepGlHrqVZvgOGiBxyK2q0wpVhrsgHe/hwkK/lV8NA+C0eOIUW2wlwLiyEN
>T6UavwPFdoZ4YgNuj9m8ZCNbZVrJUyEFP01RUWuHyEah6MFBg+D8Jtl8vWNlzZKm
>W8z3KPDTrDhpcg8i+r9D915RARpo9wraTc/LvK8QXF51YuBcn1MWsRjd50g2FQiu
>R6Epylw7EmAL4AT9bhx7skdBS2z5GRHJQFEObYqtxve0PDdXOvw8SOcxwcqQXCv2
>ZCEuVCURfOlOOVdL1mgfIJa/h1FMO3n1NjrZXFFZtVNs1T3sYm9/lyYjGuYQIFP3
>ITkIVPBunjgbmG+wNRFOonNRDnxY0Y8F0AiaDNi07WpbkAoo52oHz9gWL/hsdhDd
>vfH074JoIVtoXS6yeaESPSwOlurQ30bwhpAz7xzWLW8sWopyR+sGkuW7AQ9PkmZc
>mwVX6ZIWBdZ6Zk5Ae7UNi3Lc3akSrz4GkiAlbLmxg946BMrTfJFIPBFvR82TkkNw
>+mRPJUPuiCWDDDyDKNCpGb/YQB8kjkiWHZkr1Id7PLhIIDkeuccVqvEvzTNU22pk
>DdQkUt9L69FxTE8OtskEDueaINaBMtBpGpPh5K+arsKUt85jIX4oM25IXau8HAWx
>mDTncoD6QRn2dNXuf5gx
>=O924
>-----END PGP SIGNATURE-----


-- 
Best regards,
Michał Górny (by phone)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH] Replace df -m with df -k
  2015-12-28 14:34       ` Michał Górny
@ 2015-12-28 15:27         ` Justin Lecher
  2015-12-28 15:27           ` [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k Justin Lecher
  0 siblings, 1 reply; 22+ messages in thread
From: Justin Lecher @ 2015-12-28 15:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

I replaced al calculations from mbi to kbi so that we can use the
common -k flag.

Justin


Justin Lecher (1):
  check-reqs.eclass: Replace obsolete df option -m with -k

 eclass/check-reqs.eclass | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

-- 
2.6.4



^ permalink raw reply	[flat|nested] 22+ messages in thread

* [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k
  2015-12-28 15:27         ` [gentoo-dev] [PATCH] Replace df -m with df -k Justin Lecher
@ 2015-12-28 15:27           ` Justin Lecher
  2015-12-28 15:41             ` Michał Górny
  0 siblings, 1 reply; 22+ messages in thread
From: Justin Lecher @ 2015-12-28 15:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: qa, Justin Lecher

Using kbi as base unit for calculation as linux and bsd only have -k as
common option

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/check-reqs.eclass | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 138bfec..a649693 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -159,12 +159,12 @@ check-reqs_run() {
 	fi
 }
 
-# @FUNCTION: check-reqs_get_mebibytes
+# @FUNCTION: check-reqs_get_kbibytes
 # @INTERNAL
 # @DESCRIPTION:
-# Internal function that returns number in mebibytes.
-# Returns 1024 for 1G or 1048576 for 1T.
-check-reqs_get_mebibytes() {
+# Internal function that returns number in kbibytes.
+# Returns 1024**2 for 1G or 1024**3 for 1T.
+check-reqs_get_kbibytes() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
@@ -173,9 +173,10 @@ check-reqs_get_mebibytes() {
 	local size=${1%[GMT]}
 
 	case ${unit} in
-		G) echo $((1024 * size)) ;;
-		[M0-9]) echo ${size} ;;
-		T) echo $((1024 * 1024 * size)) ;;
+		G) echo $((1024 * 1024 * size)) ;;
+		M) echo $((1024 * size)) ;;
+		T) echo $((1024 * 1024 * 1024 * size)) ;;
+		[0-9]) echo $((1024 * size)) ;;
 		*)
 			die "${FUNCNAME}: Unknown unit: ${unit}"
 		;;
@@ -275,7 +276,7 @@ check-reqs_memory() {
 			actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' )
 	fi
 	if [[ -n ${actual_memory} ]] ; then
-		if [[ ${actual_memory} -lt $((1024 * $(check-reqs_get_mebibytes ${size}))) ]] ; then
+		if [[ ${actual_memory} -lt $(check-reqs_get_kbibytes ${size}) ]] ; then
 			eend 1
 			check-reqs_unsatisfied \
 				${size} \
@@ -300,16 +301,16 @@ check-reqs_disk() {
 
 	local path=${1}
 	local size=${2}
-	local space_megs
+	local space_kbi
 
 	check-reqs_start_phase \
 		${size} \
 		"disk space at \"${path}\""
 
-	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
+	space_kbi=$(df -Pk "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
 
-	if [[ $? == 0 && -n ${space_megs} ]] ; then
-		if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ; then
+	if [[ $? == 0 && -n ${space_kbi} ]] ; then
+		if [[ ${space_kbi} -lt $(check-reqs_get_kbibytes ${size}) ]] ; then
 			eend 1
 			check-reqs_unsatisfied \
 				${size} \
-- 
2.6.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k
  2015-12-28 15:27           ` [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k Justin Lecher
@ 2015-12-28 15:41             ` Michał Górny
  2015-12-28 15:45               ` Justin Lecher (jlec)
  0 siblings, 1 reply; 22+ messages in thread
From: Michał Górny @ 2015-12-28 15:41 UTC (permalink / raw
  To: gentoo-dev, Justin Lecher; +Cc: qa, Justin Lecher

Dnia 28 grudnia 2015 16:27:43 CET, Justin Lecher <jlec@gentoo.org> napisał(a):
>Using kbi as base unit for calculation as linux and bsd only have -k as
>common option

It's 'kibibyte', or KiB in short.

>
>Signed-off-by: Justin Lecher <jlec@gentoo.org>
>---
> eclass/check-reqs.eclass | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
>diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
>index 138bfec..a649693 100644
>--- a/eclass/check-reqs.eclass
>+++ b/eclass/check-reqs.eclass
>@@ -159,12 +159,12 @@ check-reqs_run() {
> 	fi
> }
> 
>-# @FUNCTION: check-reqs_get_mebibytes
>+# @FUNCTION: check-reqs_get_kbibytes
> # @INTERNAL
> # @DESCRIPTION:
>-# Internal function that returns number in mebibytes.
>-# Returns 1024 for 1G or 1048576 for 1T.
>-check-reqs_get_mebibytes() {
>+# Internal function that returns number in kbibytes.
>+# Returns 1024**2 for 1G or 1024**3 for 1T.
>+check-reqs_get_kbibytes() {
> 	debug-print-function ${FUNCNAME} "$@"
> 
> 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
>@@ -173,9 +173,10 @@ check-reqs_get_mebibytes() {
> 	local size=${1%[GMT]}
> 
> 	case ${unit} in
>-		G) echo $((1024 * size)) ;;
>-		[M0-9]) echo ${size} ;;
>-		T) echo $((1024 * 1024 * size)) ;;
>+		G) echo $((1024 * 1024 * size)) ;;
>+		M) echo $((1024 * size)) ;;
>+		T) echo $((1024 * 1024 * 1024 * size)) ;;
>+		[0-9]) echo $((1024 * size)) ;;
> 		*)
> 			die "${FUNCNAME}: Unknown unit: ${unit}"
> 		;;
>@@ -275,7 +276,7 @@ check-reqs_memory() {
> 			actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' )
> 	fi
> 	if [[ -n ${actual_memory} ]] ; then
>-		if [[ ${actual_memory} -lt $((1024 * $(check-reqs_get_mebibytes
>${size}))) ]] ; then
>+		if [[ ${actual_memory} -lt $(check-reqs_get_kbibytes ${size}) ]] ;
>then
> 			eend 1
> 			check-reqs_unsatisfied \
> 				${size} \
>@@ -300,16 +301,16 @@ check-reqs_disk() {
> 
> 	local path=${1}
> 	local size=${2}
>-	local space_megs
>+	local space_kbi
> 
> 	check-reqs_start_phase \
> 		${size} \
> 		"disk space at \"${path}\""
> 
>-	space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
>+	space_kbi=$(df -Pk "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')
> 
>-	if [[ $? == 0 && -n ${space_megs} ]] ; then
>-		if [[ ${space_megs} -lt $(check-reqs_get_mebibytes ${size}) ]] ;
>then
>+	if [[ $? == 0 && -n ${space_kbi} ]] ; then
>+		if [[ ${space_kbi} -lt $(check-reqs_get_kbibytes ${size}) ]] ; then
> 			eend 1
> 			check-reqs_unsatisfied \
> 				${size} \


-- 
Best regards,
Michał Górny (by phone)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k
  2015-12-28 15:41             ` Michał Górny
@ 2015-12-28 15:45               ` Justin Lecher (jlec)
  0 siblings, 0 replies; 22+ messages in thread
From: Justin Lecher (jlec) @ 2015-12-28 15:45 UTC (permalink / raw
  To: Michał Górny, gentoo-dev; +Cc: qa

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 28/12/15 16:41, Michał Górny wrote:
> Dnia 28 grudnia 2015 16:27:43 CET, Justin Lecher <jlec@gentoo.org>
> napisał(a):
>> Using kbi as base unit for calculation as linux and bsd only have
>> -k as common option
> 
> It's 'kibibyte', or KiB in short.

Updated, I had the suspicion that it wasn't correct, but didn't do any
research.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWgVkVXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmi3AkQALwjL7LRN3AcmQnWBHy56YFK
3YmDwFUDZZ9aA6doO3C5TVKzwBc/+WopqS7sDb8djC4yMmPVJqZJIYmwNbkch7SE
UamDfBo8d8asbW+KmfKdOm56IWlL3P+ObPD3qaUcVsOkfw4q4iF5VK55Of7l/Va2
oh1rugmQ22nY0lcSo1QCioiuwqsivQnBdnK+iEHNXxEiF+WFg2MXnedcVF0blGii
iXTqJZXavjTanXANPyHn35WpPIw6cQR+vYjXT9JX8uDqchfKtgooYNsatGSc7Osi
0vykwSa4/A7SKrksyPdQ5/NcSArQZEk9M6udEEChx6LLuURtsMMKPEeAxF45CMGR
Pqc6InN2xU8eocAHm2eZO+Pj065Pvio3WSXCL4LCADwU9mlktb6GJZIEpOBVs3QP
WrV7TFzikbiW4vKfD0nvv3o6IqcwNQQeoPbBOiigPnXOGzJGVklMs8g/VOQvslsZ
ALscmFhKmhbS5ISpivXhbQMaZlChhXLCJHmsED2Mf2C5rIuOUxSLjly05K6v7+gB
1Zowqny/nFa6Z9OejNmuSyk0OB/PLV1U0cel0lmsL6RKpRDl9g3YUsIsE09GDWdx
x8CWsJXB0YdIaQ8b7TC39/DdT9o2nwddKlfHZVHwXzfq4zn++lU1yq1AAh0fecOz
PTt3IvS+XyZlR7Npt298
=OXj4
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-12-28 15:45 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28  8:43 [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 1/9] check-reqs.eclass: Only inherit eclass once Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 2/9] check-reqs.eclass: Use eqawarn() from eutils.eclass Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 3/9] check-reqs.eclass: Mark interal function with @INTERNAL Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 4/9] check-reqs.eclass: Fix typo Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 5/9] check-reqs.eclass: Replace obsolete df option -m with -B ### Justin Lecher
2015-12-28 13:58   ` Andrew Savchenko
2015-12-28 14:16     ` Justin Lecher (jlec)
2015-12-28 14:24   ` Michał Górny
2015-12-28 14:28     ` Justin Lecher (jlec)
2015-12-28 14:34       ` Michał Górny
2015-12-28 15:27         ` [gentoo-dev] [PATCH] Replace df -m with df -k Justin Lecher
2015-12-28 15:27           ` [gentoo-dev] [PATCH] check-reqs.eclass: Replace obsolete df option -m with -k Justin Lecher
2015-12-28 15:41             ` Michał Górny
2015-12-28 15:45               ` Justin Lecher (jlec)
2015-12-28  8:43 ` [gentoo-dev] [PATCH 6/9] check-reqs.eclass: Ban obsolete functions in newer EAPIs Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 7/9] check-reqs.eclass: Sanitize MERGE_TYPE for EAPI < 4 Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 8/9] check-reqs.eclass: Require units for CHECKREQS_ in EAPIs > 5 Justin Lecher
2015-12-28  8:43 ` [gentoo-dev] [PATCH 9/9] check-reqs.eclass: Enable EAPI 6 support Justin Lecher
2015-12-28  9:35 ` [gentoo-dev] [PATCH 0/9] Cleanup and EAPI=6 support for check-reqs.eclass Andrew Savchenko
2015-12-28  9:40   ` Justin Lecher (jlec)
2015-12-28 12:34     ` Andrew Savchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox