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

Diff of /eclass/multilib.eclass

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

Revision 1.5 Revision 1.6
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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/multilib.eclass,v 1.5 2005/01/12 22:39:44 eradicator Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.6 2005/01/13 00:43:41 eradicator Exp $
4# 4#
5# Author: Jeremy Huddleston <eradicator@gentoo.org> 5# Author: Jeremy Huddleston <eradicator@gentoo.org>
6# 6#
7# This eclass is for all functions pertaining to handling multilib. 7# This eclass is for all functions pertaining to handling multilib.
8# configurations. 8# configurations.
294 294
295# Helper function for create_ml_includes 295# Helper function for create_ml_includes
296create_ml_includes-tidy_path() { 296create_ml_includes-tidy_path() {
297 local removed="${1}" 297 local removed="${1}"
298 298
299 if [ -n "${1}" ]; then 299 if [ -n "${removed}" ]; then
300 # Remove multiple slashes 300 # Remove multiple slashes
301 while [ "${removed}" != "${removed/\/\//\/}" ]; do 301 while [ "${removed}" != "${removed/\/\//\/}" ]; do
302 removed=${removed/\/\//\/} 302 removed=${removed/\/\//\/}
303 done 303 done
304 304
307 removed=${removed//\/.\//\/} 307 removed=${removed//\/.\//\/}
308 done 308 done
309 [ "${removed##*/}" = "." ] && removed=${removed%/*} 309 [ "${removed##*/}" = "." ] && removed=${removed%/*}
310 310
311 # Removed .. directories 311 # Removed .. directories
312 # I wonder if there's a non-trivial bashism for this one... 312 while [ "${removed}" != "${removed//\/..\/}" ]; do
313 while [ "${removed}" != "$(echo ${removed} | sed -e 's:[^/]*/\.\./::')" ]; do 313 local p1="${removed%%\/..\/*}"
314 removed=$(echo ${removed} | sed -e 's:[^/]*/\.\./::') 314 local p2="${removed#*\/..\/}"
315
316 removed="${p1%\/*}/${p2}"
315 done 317 done
316 318
317 # Remove trailing .. 319 # Remove trailing ..
318 removed=$(echo ${removed} | sed -e 's:/[^/]*/\.\.$::') 320 [ "${removed##*/}" = ".." ] && removed=${removed%/*/*}
319 321
320 # Remove trailing / 322 # Remove trailing /
321 [ "${removed##*/}" = "" ] && removed=${removed%/*} 323 [ "${removed##*/}" = "" ] && removed=${removed%/*}
322 324
323 echo ${removed} 325 echo ${removed}

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20