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

Diff of /eclass/alternatives.eclass

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

Revision 1.1 Revision 1.2
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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/alternatives.eclass,v 1.1 2003/10/07 17:21:40 liquidx Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.2 2003/10/07 20:26:50 liquidx Exp $
4 4
5# Author : Alastair Tse <liquidx@gentoo.org> (03 Oct 2003) 5# Author : Alastair Tse <liquidx@gentoo.org> (03 Oct 2003)
6# Short Desc: Creates symlink to the latest version of multiple slotted 6# Short Desc: Creates symlink to the latest version of multiple slotted
7# packages. 7# packages.
8# 8#
50 local SOURCE REGEX ALT 50 local SOURCE REGEX ALT
51 local unsorted 51 local unsorted
52 SOURCE=$1 52 SOURCE=$1
53 REGEX=$2 53 REGEX=$2
54 54
55 ALT="`ls -1 ${ROOT}${REGEX} | sort -r | xargs`" 55 ALT="`ls -1 --color=never ${ROOT}${REGEX} | sed -e "s:^${ROOT}::" | sort -r | xargs`"
56 einfo "alternatives: $ROOT $REGEX $ALT"
56 if [ -n "${ALT}" ]; then 57 if [ -n "${ALT}" ]; then
57 alternatives_makesym ${SOURCE} ${ALT} 58 alternatives_makesym ${SOURCE} ${ALT}
58 else 59 else
59 eerror "regex ${REGEX} doesn't match any files." 60 eerror "regex ${REGEX} doesn't match any files."
60 fi 61 fi
76 if [ -f "${ROOT}${alt}" ]; then 77 if [ -f "${ROOT}${alt}" ]; then
77 if [ -L "${ROOT}${SOURCE}" ]; then 78 if [ -L "${ROOT}${SOURCE}" ]; then
78 rm -f ${ROOT}${SOURCE} 79 rm -f ${ROOT}${SOURCE}
79 fi 80 fi
80 einfo "Linking ${alt} to ${SOURCE}" 81 einfo "Linking ${alt} to ${SOURCE}"
81 ln -s ${alt} ${ROOT}${SOURCE} 82 # we do this instead of ${ROOT}${SOURCE} because if
83 # ROOT=/, then a symlink to //usr/bin/python confuses distutils
84 cd ${ROOT}; ln -s ${alt} ${SOURCE}
82 break 85 break
83 fi 86 fi
84 done 87 done
85 88
86 # report any errors 89 # report any errors

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

  ViewVC Help
Powered by ViewVC 1.1.20