Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 485438 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/eclass/eutils.eclass (-14 / +34 lines)
Lines 948-953 Link Here
948
	) || die "installing desktop file failed"
948
	) || die "installing desktop file failed"
949
}
949
}
950
950
951
# @FUNCTION: _eutils_eprefix_init
952
# @USAGE:
953
# @DESCRIPTION:
954
# Initialized prefix variables for EAPI<3. 
955
_eutils_eprefix_init() {
956
	has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
957
}
958
951
# @FUNCTION: validate_desktop_entries
959
# @FUNCTION: validate_desktop_entries
952
# @USAGE: [directories]
960
# @USAGE: [directories]
953
# @MAINTAINER:
961
# @MAINTAINER:
Lines 955-965 Link Here
955
# @DESCRIPTION:
963
# @DESCRIPTION:
956
# Validate desktop entries using desktop-file-utils
964
# Validate desktop entries using desktop-file-utils
957
validate_desktop_entries() {
965
validate_desktop_entries() {
958
	if [[ -x /usr/bin/desktop-file-validate ]] ; then
966
	_eutils_eprefix_init
967
	if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]] ; then
959
		einfo "Checking desktop entry validity"
968
		einfo "Checking desktop entry validity"
960
		local directories=""
969
		local directories=""
961
		for d in /usr/share/applications $@ ; do
970
		for d in /usr/share/applications $@ ; do
962
			[[ -d ${D}${d} ]] && directories="${directories} ${D}${d}"
971
			[[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}"
963
		done
972
		done
964
		if [[ -n ${directories} ]] ; then
973
		if [[ -n ${directories} ]] ; then
965
			for FILE in $(find ${directories} -name "*\.desktop" \
974
			for FILE in $(find ${directories} -name "*\.desktop" \
Lines 967-973 Link Here
967
			do
976
			do
968
				local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \
977
				local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \
969
								sed -e "s|error: ||" -e "s|${FILE}:|--|g" )
978
								sed -e "s|error: ||" -e "s|${FILE}:|--|g" )
970
				[[ -n $temp ]] && elog ${temp/--/${FILE/${D}/}:}
979
				[[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:}
971
			done
980
			done
972
		fi
981
		fi
973
		echo ""
982
		echo ""
Lines 1227-1232 Link Here
1227
# solution, so instead you can call this from pkg_preinst.  See also the
1236
# solution, so instead you can call this from pkg_preinst.  See also the
1228
# preserve_old_lib_notify function.
1237
# preserve_old_lib_notify function.
1229
preserve_old_lib() {
1238
preserve_old_lib() {
1239
	_eutils_eprefix_init
1230
	if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
1240
	if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
1231
		eerror "preserve_old_lib() must be called from pkg_preinst() only"
1241
		eerror "preserve_old_lib() must be called from pkg_preinst() only"
1232
		die "Invalid preserve_old_lib() usage"
1242
		die "Invalid preserve_old_lib() usage"
Lines 1238-1248 Link Here
1238
1248
1239
	local lib dir
1249
	local lib dir
1240
	for lib in "$@" ; do
1250
	for lib in "$@" ; do
1241
		[[ -e ${ROOT}/${lib} ]] || continue
1251
		[[ -e ${EROOT}/${lib} ]] || continue
1242
		dir=${lib%/*}
1252
		dir=${lib%/*}
1243
		dodir ${dir} || die "dodir ${dir} failed"
1253
		dodir ${dir} || die "dodir ${dir} failed"
1244
		cp "${ROOT}"/${lib} "${D}"/${lib} || die "cp ${lib} failed"
1254
		cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed"
1245
		touch "${D}"/${lib}
1255
		touch "${ED}"/${lib}
1246
	done
1256
	done
1247
}
1257
}
1248
1258
Lines 1259-1267 Link Here
1259
	# let portage worry about it
1269
	# let portage worry about it
1260
	has preserve-libs ${FEATURES} && return 0
1270
	has preserve-libs ${FEATURES} && return 0
1261
1271
1272
	_eutils_eprefix_init
1273
	
1262
	local lib notice=0
1274
	local lib notice=0
1263
	for lib in "$@" ; do
1275
	for lib in "$@" ; do
1264
		[[ -e ${ROOT}/${lib} ]] || continue
1276
		[[ -e ${EROOT}/${lib} ]] || continue
1265
		if [[ ${notice} -eq 0 ]] ; then
1277
		if [[ ${notice} -eq 0 ]] ; then
1266
			notice=1
1278
			notice=1
1267
			ewarn "Old versions of installed libraries were detected on your system."
1279
			ewarn "Old versions of installed libraries were detected on your system."
Lines 1297-1302 Link Here
1297
# Remember that this function isn't terribly intelligent so order of optional
1309
# Remember that this function isn't terribly intelligent so order of optional
1298
# flags matter.
1310
# flags matter.
1299
built_with_use() {
1311
built_with_use() {
1312
	_eutils_eprefix_init
1300
	local hidden="no"
1313
	local hidden="no"
1301
	if [[ $1 == "--hidden" ]] ; then
1314
	if [[ $1 == "--hidden" ]] ; then
1302
		hidden="yes"
1315
		hidden="yes"
Lines 1320-1327 Link Here
1320
	[[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package"
1333
	[[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package"
1321
	shift
1334
	shift
1322
1335
1323
	local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE
1336
	local USEFILE="${EROOT}"/var/db/pkg/${PKG}/USE
1324
	local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE
1337
	local IUSEFILE="${EROOT}"/var/db/pkg/${PKG}/IUSE
1325
1338
1326
	# if the IUSE file doesn't exist, the read will error out, we need to handle
1339
	# if the IUSE file doesn't exist, the read will error out, we need to handle
1327
	# this gracefully
1340
	# this gracefully
Lines 1401-1406 Link Here
1401
# first optionally setting LD_LIBRARY_PATH to the colon-delimited
1414
# first optionally setting LD_LIBRARY_PATH to the colon-delimited
1402
# libpaths followed by optionally changing directory to chdir.
1415
# libpaths followed by optionally changing directory to chdir.
1403
make_wrapper() {
1416
make_wrapper() {
1417
	_eutils_eprefix_init
1404
	local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
1418
	local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
1405
	local tmpwrapper=$(emktemp)
1419
	local tmpwrapper=$(emktemp)
1406
1420
Lines 1408-1424 Link Here
1408
	echo '#!/bin/sh'
1422
	echo '#!/bin/sh'
1409
	[[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}"
1423
	[[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}"
1410
	if [[ -n ${libdir} ]] ; then
1424
	if [[ -n ${libdir} ]] ; then
1425
		if [[ ${CHOST} == *-darwin* ]] ; then
1426
			var=DYLD_LIBRARY_PATH
1427
		else
1428
			var=LD_LIBRARY_PATH
1429
		fi
1411
		cat <<-EOF
1430
		cat <<-EOF
1412
			if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
1431
			if [ "\${${var}+set}" = "set" ] ; then
1413
				export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
1432
				export ${var}="\${${var}}:${EPREFIX}${libdir}"
1414
			else
1433
			else
1415
				export LD_LIBRARY_PATH="${libdir}"
1434
				export ${var}="${EPREFIX}${libdir}"
1416
			fi
1435
			fi
1417
		EOF
1436
		EOF
1418
	fi
1437
	fi
1419
	# We don't want to quote ${bin} so that people can pass complex
1438
	# We don't want to quote ${bin} so that people can pass complex
1420
	# things as ${bin} ... "./someprog --args"
1439
	# things as ${bin} ... "./someprog --args"
1421
	printf 'exec %s "$@"\n' "${bin}"
1440
	printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}\/}"
1422
	) > "${tmpwrapper}"
1441
	) > "${tmpwrapper}"
1423
	chmod go+rx "${tmpwrapper}"
1442
	chmod go+rx "${tmpwrapper}"
1424
1443
Lines 1529-1534 Link Here
1529
	debug-print-function ${FUNCNAME} "$@"
1548
	debug-print-function ${FUNCNAME} "$@"
1530
1549
1531
	local removing_all removing_modules opt
1550
	local removing_all removing_modules opt
1551
	_eutils_eprefix_init
1532
	for opt; do
1552
	for opt; do
1533
		case "${opt}" in
1553
		case "${opt}" in
1534
			--all)
1554
			--all)
Lines 1638-1644 Link Here
1638
			einfo "Removing unnecessary ${f#${D%/}} (${reason})"
1658
			einfo "Removing unnecessary ${f#${D%/}} (${reason})"
1639
			queue+=( "${f}" )
1659
			queue+=( "${f}" )
1640
		fi
1660
		fi
1641
	done < <(find "${D}" -xtype f -name '*.la' -print0)
1661
	done < <(find "${ED}" -xtype f -name '*.la' -print0)
1642
1662
1643
	if [[ ${queue[@]} ]]; then
1663
	if [[ ${queue[@]} ]]; then
1644
		rm -f "${queue[@]}"
1664
		rm -f "${queue[@]}"

Return to bug 485438