Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Michał Górny <mgorny@g.o>
Subject: Re: [RFC] check-reqs.eclass.patch
Date: Wed, 31 Aug 2011 12:14:47 +0200
On Wed, 32 Aug 2011 10:57:08 +0200
Tomáš Chvátal <scarabeus@g.o> wrote:

> Good pointer is that we should probably check if the
> MERGE_TYPE=binary and not check-reqs ram and disk_build in that case.
> But there is slight problem how to do it in older eapis.

We simply don't. Life is hard :P.

> Also Michal if you want to have that DISK array thingu there could
> you write a patch?

Well, I don't see really a need for that if we're still keeping old
vars.

Now about the code:

* I don't see units mentioned nor described in @DESCRIPTION or vars,

> EXPORT_FUNCTIONS pkg_setup
> case "${EAPI:-0}" in
> 	0|1|2|3) ;;
> 	4) EXPORT_FUNCTIONS pkg_pretend ;;
> 	*) die "EAPI=${EAPI} is not supported" ;;
> esac

Either you export them (which breaks backwards compat) or require users
to call them (your @CODE@). Don't do both, it's confusing.

> check-reqs_get_megs() {
> 	debug-print-function ${FUNCNAME} "$@"
> 
> 	[[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]"
> 
> 	local unit=${1#${1%?}}
> 	local size

local unit=${1:(-1)}

> 
> 	# Temporary workaround for unset units.
> 	# Backcompat.
> 	if [[ "${unit//*([[:digit:]])}" ]]; then
> 		# the unit itself was set ; strip it out
> 		size=${1%\%}
> 	else
> 		size=${1}
> 		unit="M"
> 	fi

local size=${1%[GMT]}

> 
> 	case ${unit} in
> 		[gG]) echo $((1024 * ${size})) ;;
> 		[mM]) echo ${size} ;;
> 		[tT]) echo $((1024 * 1024 * ${size})) ;;

I'd just go with capital letters there.

		[0-9]) echo ${size} ;;

(you can add that to the 'M' cond)

> 		*)
> 			die "${FUNCNAME}: Unknown unit size: ${unit}"

Size unit. Again.

> 		;;
> 	esac
> }

> 		[gG]) echo "Gigabytes" ;;
> 		[mM]) echo "Megabytes" ;;
> 		[tT]) echo "Terabytes" ;;

gibibytes, mebibytes, tebibytes.

> # @FUNCTION: check-reqs_memory
> # @DESCRIPTION:
> # Internal function that checks space on the RAM.

'space on the RAM' sounds bad :P.

> 	check-reqs_start_phase \
> 		$(check-reqs_get_number ${size}) \
> 		$(check-reqs_get_unit ${size}) \
> 		"RAM"

Move the number/unit split to _start_phase()?

> 		actual_memory=$(sed -n -e '/MemTotal:/s/^[^:]*:
> *\([0-9]\+\) kB/\1/p' \ /proc/meminfo)

awk '/MemTotal/ { print $2 }' /proc/meminfo

> 	space_megs=$(df -Pm ${1} 2>/dev/null | sed -n \
> 		'$s/\(\S\+\s\+\)\{3\}\([0-9]\+\).*/\2/p' 2>/dev/null)

OMFG.

space_megs=$(df -Pm "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}')

I guess.

> # @FUNCTION: check-reqs_unsattisfied

unsatisfied.

> 	# @DEAULT_UNSET

@INTERNAL.

-- 
Best regards,
Michał Górny
Attachment:
signature.asc (PGP signature)
Replies:
Re: [RFC] check-reqs.eclass.patch
-- Alec Warner
Re: [RFC] check-reqs.eclass.patch
-- Tomáš Chvátal
References:
[RFC] check-reqs.eclass.patch
-- Tomáš Chvátal
Re: [RFC] check-reqs.eclass.patch
-- Michał Górny
Re: [RFC] check-reqs.eclass.patch
-- Tomáš Chvátal
Re: [RFC] check-reqs.eclass.patch
-- Ulrich Mueller
Re: [RFC] check-reqs.eclass.patch
-- Tomáš Chvátal
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: [RFC] check-reqs.eclass.patch
Next by thread:
Re: [RFC] check-reqs.eclass.patch
Previous by date:
Re: [RFC] category for openoffice/libreoffice extensions
Next by date:
Re: [RFC] check-reqs.eclass.patch


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.