From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1EGIQb-0005qX-T2 for garchives@archives.gentoo.org; Fri, 16 Sep 2005 15:47:06 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j8GFfCp7014659; Fri, 16 Sep 2005 15:41:12 GMT Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j8GFcCvg020802 for ; Fri, 16 Sep 2005 15:38:13 GMT Received: by zproxy.gmail.com with SMTP id x7so521810nzc for ; Fri, 16 Sep 2005 08:43:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:mime-version:content-type:content-transfer-encoding:message-id:sender; b=gOdaA/DjWFNw93uIjTqWay9iuUU9wPgZeOFYT9ok13u1BIiEYo9wOi7MR2L3MQRXpE37/5qGl+/JEcApNAZlaz3P4/0pNddOU5q5OgiZWKSqlh3XFe/ceoxqiWF3HkkWEmnG0YhAlhbYrF7Hla99uOxRGNJuFyTXG1TnkrnfVQI= Received: by 10.54.49.10 with SMTP id w10mr429284wrw; Fri, 16 Sep 2005 08:43:19 -0700 (PDT) Received: from ?192.168.0.2? ( [151.56.16.118]) by mx.gmail.com with ESMTP id d61sm292415wra.2005.09.16.08.43.15; Fri, 16 Sep 2005 08:43:19 -0700 (PDT) From: "Diego 'Flameeyes' =?iso-8859-1?q?Petten=F2?=" To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [RFC] Portability eclass Date: Fri, 16 Sep 2005 17:42:58 +0200 User-Agent: KMail/1.8.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1879894.EavdPxQKBt"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200509161743.07528@enterprise.flameeyes.is-a-geek.org> Sender: "=?UTF-8?Q?Diego=20\"Flameeyes\"=20Petten=C3=B2?=" X-Archives-Salt: 2495fa83-1f1f-4b57-9595-2822791983da X-Archives-Hash: 7b0bbc80d24f62358732d8d5a303ad68 --nextPart1879894.EavdPxQKBt Content-Type: multipart/mixed; boundary="Boundary-01=_LguKD44SDVJkD0t" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_LguKD44SDVJkD0t Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline If nobody finds problem in the attached eclass, I'm going to commit this=20 tonight or tomorrow. The first function is a drop-in replacement for cp --parent (that doesn't w= ork=20 on BSD userland), the second one is a commodity function to symlink command= s=20 and manpages at once (as done by bsdtar and other packages). If we'll find other functions needed for portability's sake, they'll probab= ly=20 going to be there, too. Comments? =2D-=20 Diego "Flameeyes" Petten=F2 Gentoo Developer - http://dev.gentoo.org/~flameeyes/ (Gentoo/FreeBSD, Video, Gentoo/AMD64, Sound, PAM) --Boundary-01=_LguKD44SDVJkD0t Content-Type: text/plain; charset="iso-8859-1"; name="portability.eclass" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="portability.eclass" # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # # Author: Diego Petten=C3=B2 # # This eclass is created to avoid using non-portable GNUisms inside ebuilds # # NB: If you add anything, please comment it! # treecopy orig1 orig2 orig3 .... dest # # mimic cp --parents copy, but working on BSD userland as well treecopy() { dest=3D$(eval "echo \${$#}") files_count=3D$# for (( i=3D1; ${i} < ${files_count}; i=3D$((${i}+1)) )); do dirstruct=3D$(dirname "$1") mkdir -p "${dest}/${dirstruct}" cp -pPR "$1" "${dest}/${dirstruct}" shift done } # symcmd oldcmd newcmd [mansection] # # Symlinks a given command to a new one, useful to shade a package that is # the default provider of a command in a given userland. # When mansection is specified, also the manpage with basename(oldcmd) is # symlinked to basename(newcmd). symcmd() { dosym ${newcmd} ${oldcmd} || die "symlink failed" if [[ -n "$3" ]]; then dosym ${oldcmd}.$3.gz /usr/share/man/man$3/${newcmd}.$3.gz fi } --Boundary-01=_LguKD44SDVJkD0t-- --nextPart1879894.EavdPxQKBt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDKugLe2h1+2mHVWMRAlFaAJ9oLsNwTUubZpuORV66kpez3ozsoACguuui rJb2nQN9iXWYPS+/fMAUksU= =yova -----END PGP SIGNATURE----- --nextPart1879894.EavdPxQKBt-- -- gentoo-dev@gentoo.org mailing list