/[gentoo-x86]/eclass/portability.eclass
Gentoo

Diff of /eclass/portability.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.3
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.2 2005/09/20 13:13:42 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.3 2005/09/21 02:46:41 vapier Exp $
4# 4#
5# Author: Diego Pettenò <flameeyes@gentoo.org> 5# Author: Diego Pettenò <flameeyes@gentoo.org>
6# 6#
7# This eclass is created to avoid using non-portable GNUisms inside ebuilds 7# This eclass is created to avoid using non-portable GNUisms inside ebuilds
8# 8#
26 26
27# seq min max 27# seq min max
28# 28#
29# compatibility function that mimes seq command if not available 29# compatibility function that mimes seq command if not available
30seq() { 30seq() {
31 local p
32 p=$(type -P seq) 31 local p=$(type -P seq)
33 32
34 case $# in 33 case $# in
35 1) 34 1) min=1 max=$1 step=1 ;;
36 min=1 35 2) min=$1 max=$2 step=1 ;;
37 max=$1 36 3) min=$1 max=$3 step=$2 ;;
38 step=1 37 *) die "seq called with wrong number of arguments" ;;
39 ;;
40 2)
41 min=$1
42 max=$2
43 step=1
44 ;;
45 3)
46 min=$1
47 max=$3
48 step=$2
49 ;;
50 *)
51 die "seq called with wrong parameters number"
52 esac 38 esac
53 39
54 if [[ -z "${p}" ]]; then 40 if [[ -z ${p} ]] ; then
55 local reps 41 local reps
56 # BSD userland 42 # BSD userland
57 if [[ ${step} != 0 ]]; then 43 if [[ ${step} != 0 ]]; then
58 reps=$(( ($max-$min) / $step +1 )) 44 reps=$(( ($max-$min) / $step +1 ))
59 else 45 else

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20