aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-25 19:14:25 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-25 19:14:25 +0000
commit02724dc917a9d54fe0e00f73db5bbeca3da19e85 (patch)
tree726148d6d7282f92e74e7478d4a5466732fb15de
parentbad61a19dbdb098dd2e23449dd368e25deb18808 (diff)
downloadpaludis-02724dc917a9d54fe0e00f73db5bbeca3da19e85.tar.gz
paludis-02724dc917a9d54fe0e00f73db5bbeca3da19e85.tar.xz
Make a canonicalise wrapper, rather than using realpath or readlink -f. Tinker with PATH ordering so that this actually works.
-rw-r--r--doc/Makefile.am2
-rw-r--r--ebuild/Makefile.am2
-rw-r--r--ebuild/builtin_init.bash2
-rw-r--r--ebuild/builtin_merge.bash2
-rw-r--r--ebuild/builtin_unmerge.bash2
-rwxr-xr-xebuild/ebuild.bash7
-rw-r--r--ebuild/portage_stubs.bash4
-rw-r--r--ebuild/utils/Makefile.am1
-rwxr-xr-xebuild/utils/canonicalise6
-rwxr-xr-xebuild/utils/merge4
-rw-r--r--ebuild/utils/merge_TEST.bash2
-rwxr-xr-xebuild/utils/unmerge2
-rw-r--r--ebuild/utils/unmerge_TEST.bash2
13 files changed, 24 insertions, 14 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5424ed8..6c233d5 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -42,6 +42,6 @@ maintainer-clean-local :
find html/ -type f | grep -v '\.svn' | xargs rm
upload-homepage : doxygen
- cd `realpath $(top_srcdir)/doc/html` && tar jc ./ | \
+ cd `readlink -f $(top_srcdir)/doc/html` && tar jc ./ | \
ssh shell.berlios.de tar vjx -C /home/groups/paludis/htdocs/
diff --git a/ebuild/Makefile.am b/ebuild/Makefile.am
index 9c0fec4..1aa2692 100644
--- a/ebuild/Makefile.am
+++ b/ebuild/Makefile.am
@@ -37,7 +37,7 @@ libexecprog_SCRIPTS = \
usage_error.bash
TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \
+ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
TEST_SCRIPT_DIR="$(srcdir)/" \
bash $(top_srcdir)/ebuild/run_test.bash
diff --git a/ebuild/builtin_init.bash b/ebuild/builtin_init.bash
index e8aac74..2a45eea 100644
--- a/ebuild/builtin_init.bash
+++ b/ebuild/builtin_init.bash
@@ -56,8 +56,6 @@ builtin_init()
declare -r IMAGE="${IMAGE}"
export S="${WORKDIR}/${P}"
-
- export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}"
}
ebuild_f_init()
diff --git a/ebuild/builtin_merge.bash b/ebuild/builtin_merge.bash
index 95ac79c..ff2ac5d 100644
--- a/ebuild/builtin_merge.bash
+++ b/ebuild/builtin_merge.bash
@@ -84,7 +84,7 @@ ebuild_f_merge()
local old_sandbox_write="${SANDBOX_WRITE}"
SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/"
local old_sandbox_on="${SANDBOX_ON}"
- [[ "$(realpath ${ROOT} )" != "/" ]] || SANDBOX_ON=0
+ [[ "$(canonicalise ${ROOT} )" != "/" ]] || SANDBOX_ON=0
if hasq "merge" ${RESTRICT} ; then
ebuild_section "Skipping builtin_merge (RESTRICT)"
diff --git a/ebuild/builtin_unmerge.bash b/ebuild/builtin_unmerge.bash
index 0eb0b62..d616c3d 100644
--- a/ebuild/builtin_unmerge.bash
+++ b/ebuild/builtin_unmerge.bash
@@ -61,7 +61,7 @@ ebuild_f_unmerge()
local old_sandbox_write="${SANDBOX_WRITE}"
SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/"
local old_sandbox_on="${SANDBOX_ON}"
- [[ "$(realpath ${ROOT} )" != "/" ]] || SANDBOX_ON=0
+ [[ "$(canonicalise ${ROOT} )" != "/" ]] || SANDBOX_ON=0
if hasq "unmerge" ${RESTRICT} ; then
ebuild_section "Skipping builtin_unmerge (RESTRICT)"
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 8fd069e..02ad324 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -55,7 +55,8 @@ diefunc()
exit 249
}
-EBUILD_MODULES_DIR=$(realpath $(dirname $0 ) )
+export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}"
+EBUILD_MODULES_DIR=$(canonicalise $(dirname $0 ) )
[[ -d ${EBUILD_MODULES_DIR} ]] || die "${EBUILD_MODULES_DIR} is not a directory"
export PALUDIS_EBUILD_MODULES_DIR="${EBUILD_MODULES_DIR}"
@@ -79,7 +80,7 @@ ebuild_source_profile()
{
if [[ -f ${1}/parent ]] ; then
while read line; do
- ebuild_source_profile $(realpath ${1}/${line} )
+ ebuild_source_profile $(canonicalise ${1}/${line} )
done <${1}/parent
fi
@@ -99,7 +100,7 @@ for var in ${save_vars} ; do
done
if [[ -n "${PALUDIS_PROFILE_DIR}" ]] ; then
- ebuild_source_profile $(realpath "${PALUDIS_PROFILE_DIR}")
+ ebuild_source_profile $(canonicalise "${PALUDIS_PROFILE_DIR}")
fi
unset ${save_vars}
diff --git a/ebuild/portage_stubs.bash b/ebuild/portage_stubs.bash
index 0063a0f..fe6fdea 100644
--- a/ebuild/portage_stubs.bash
+++ b/ebuild/portage_stubs.bash
@@ -30,7 +30,7 @@ portageq()
{
# \todo Make this suck less...
if [[ "$1" == "has_version" ]] ; then
- if [[ "$(realpath $2 )" != "$(realpath $ROOT )" ]] ; then
+ if [[ "$(canonicalise $2 )" != "$(canonicalise $ROOT )" ]] ; then
eerror "Error emulating 'portageq $@':"
die "portageq has_version emulation only works on current ROOT"
else
@@ -38,7 +38,7 @@ portageq()
has_version "$@"
fi
elif [[ "$1" == "best_version" ]] ; then
- if [[ "$(realpath $2 )" != "$(realpath $ROOT )" ]] ; then
+ if [[ "$(canonicalise $2 )" != "$(canonicalise $ROOT )" ]] ; then
eerror "Error emulating 'portageq $@':"
die "portageq best_version emulation only works on current ROOT"
else
diff --git a/ebuild/utils/Makefile.am b/ebuild/utils/Makefile.am
index 817db31..92f5349 100644
--- a/ebuild/utils/Makefile.am
+++ b/ebuild/utils/Makefile.am
@@ -8,6 +8,7 @@ libexecprog_SCRIPTS_extra = sed
endif
libexecprog_SCRIPTS = \
+ canonicalise \
dobin \
doconfd \
dodir \
diff --git a/ebuild/utils/canonicalise b/ebuild/utils/canonicalise
new file mode 100755
index 0000000..d070f34
--- /dev/null
+++ b/ebuild/utils/canonicalise
@@ -0,0 +1,6 @@
+#!/bin/bash
+case $(uname -s) in
+ FreeBSD) realpath $@ ;;
+ *) readlink -f $@ ;;
+esac
+
diff --git a/ebuild/utils/merge b/ebuild/utils/merge
index 794af15..85e8f8c 100755
--- a/ebuild/utils/merge
+++ b/ebuild/utils/merge
@@ -27,10 +27,10 @@ fi
shopt -s dotglob
shopt -s nullglob
-src=$(realpath "${1%/}/" )
+src=$(canonicalise "${1%/}/" )
src="${src//+(\/)/\/}"
export top_src="${src}"
-dst=$(realpath "${2%/}/" )
+dst=$(canonicalise "${2%/}/" )
dst="${dst//+(\/)/\/}"
export top_dst="${dst}"
export contents=${3}
diff --git a/ebuild/utils/merge_TEST.bash b/ebuild/utils/merge_TEST.bash
index 88b070f..fe138f4 100644
--- a/ebuild/utils/merge_TEST.bash
+++ b/ebuild/utils/merge_TEST.bash
@@ -16,6 +16,8 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
+export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}"
+
merge_empty_TEST()
{
${PALUDIS_EBUILD_DIR}/utils/merge "merge_TEST_dir/empty_src" \
diff --git a/ebuild/utils/unmerge b/ebuild/utils/unmerge
index f829834..17dce91 100755
--- a/ebuild/utils/unmerge
+++ b/ebuild/utils/unmerge
@@ -27,7 +27,7 @@ fi
shopt -s dotglob
shopt -s nullglob
-ROOT=$(realpath "${1%+(/)}/" )
+ROOT=$(canonicalise "${1%+(/)}/" )
export ROOT
export contents=${2}
diff --git a/ebuild/utils/unmerge_TEST.bash b/ebuild/utils/unmerge_TEST.bash
index a9d75d6..2b1d5cb 100644
--- a/ebuild/utils/unmerge_TEST.bash
+++ b/ebuild/utils/unmerge_TEST.bash
@@ -16,6 +16,8 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
+export PATH="${PALUDIS_EBUILD_DIR}/utils:${PATH}"
+
unmerge_empty_TEST()
{
${PALUDIS_EBUILD_DIR}/utils/merge "unmerge_TEST_dir/empty_src" \