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

Diff of /eclass/portability.eclass

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

Revision 1.23 Revision 1.24
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.23 2011/12/27 17:55:12 fauli Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.24 2012/01/04 05:57:19 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#
13 13
14# treecopy orig1 orig2 orig3 .... dest 14# treecopy orig1 orig2 orig3 .... dest
15# 15#
16# mimic cp --parents copy, but working on BSD userland as well 16# mimic cp --parents copy, but working on BSD userland as well
17treecopy() { 17treecopy() {
18 dest=${!#} 18 local dest=${!#}
19 files_count=$# 19 local files_count=$#
20 20
21 while(( $# > 1 )); do 21 while (( $# > 1 )); do
22 dirstruct=$(dirname "$1") 22 local dirstruct=$(dirname "$1")
23 mkdir -p "${dest}/${dirstruct}" 23 mkdir -p "${dest}/${dirstruct}"
24 cp -pPR "$1" "${dest}/${dirstruct}" 24 cp -pPR "$1" "${dest}/${dirstruct}"
25 25
26 shift 26 shift
27 done 27 done
36 if [[ -n ${p} ]] ; then 36 if [[ -n ${p} ]] ; then
37 "${p}" "$@" 37 "${p}" "$@"
38 return $? 38 return $?
39 fi 39 fi
40 40
41 local min max step
41 case $# in 42 case $# in
42 1) min=1 max=$1 step=1 ;; 43 1) min=1 max=$1 step=1 ;;
43 2) min=$1 max=$2 step=1 ;; 44 2) min=$1 max=$2 step=1 ;;
44 3) min=$1 max=$3 step=$2 ;; 45 3) min=$1 max=$3 step=$2 ;;
45 *) die "seq called with wrong number of arguments" ;; 46 *) die "seq called with wrong number of arguments" ;;

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.20