aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-21 15:38:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-21 15:38:12 +0000
commit0713546041f72f1305d0e8fc45db43ced6f3574f (patch)
treec10855843dc380d1dc7409ba0c0d8e049050f8d8
parentef39995fea40d192520fc8d1b2251af57896039a (diff)
downloadpaludis-0713546041f72f1305d0e8fc45db43ced6f3574f.tar.gz
paludis-0713546041f72f1305d0e8fc45db43ced6f3574f.tar.xz
Detect non-GNU things at runtime. Fixes: ticket:408
-rw-r--r--configure.ac87
-rwxr-xr-xhooks/gnu_info_index.bash4
-rwxr-xr-xpaludis/fetchers/dowget.in2
-rw-r--r--paludis/repositories/e/ebuild.cc12
-rw-r--r--paludis/repositories/e/ebuild/Makefile.am3
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash1
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/builtin_fetch.bash2
-rw-r--r--paludis/repositories/e/ebuild/utils/Makefile.am20
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/awk19
-rw-r--r--paludis/repositories/e/ebuild/utils/awk_TEST.bash47
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/getfsize5
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/getmtime5
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/make19
-rw-r--r--paludis/repositories/e/ebuild/utils/make_TEST.bash (renamed from paludis/repositories/e/ebuild/work_around_broken_utilities.bash.in)35
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/patch19
-rw-r--r--paludis/repositories/e/ebuild/utils/patch_TEST.bash75
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/sed19
-rw-r--r--[-rwxr-xr-x]paludis/repositories/e/ebuild/utils/sed_TEST.bash (renamed from paludis/repositories/e/ebuild/utils/getfsize_TEST.bash)36
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/wrapped_getfsize18
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/wrapped_getfsize_TEST.bash44
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/wrapped_getmtime19
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/wrapped_ldconfig19
-rwxr-xr-xpaludis/repositories/e/ebuild/write_vdb_entry.bash1
-rwxr-xr-xpaludis/repositories/e/vdb_unmerger_TEST_setup.sh6
-rwxr-xr-xpaludis/repositories/unpackaged/installed_unpackaged_repository_TEST_setup.sh4
25 files changed, 372 insertions, 149 deletions
diff --git a/configure.ac b/configure.ac
index e04d78c..55a49cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1153,62 +1153,6 @@ if test "x$need_gtkmm_check" = "xyes" ; then
fi
dnl }}}
-dnl {{{ is sed gnu sed
-AC_MSG_CHECKING([if we need a sed wrapper])
-AC_SUBST([NEED_SED_WRAPPER])
-AC_CACHE_VAL(paludis_need_sed_wrapper,[sed --version &>/dev/null || paludis_need_sed_wrapper=yes])
-AM_CONDITIONAL([NEED_SED_WRAPPER], test x$paludis_need_sed_wrapper = "xyes")
-if test x$paludis_need_sed_wrapper = "xyes"; then
- AC_DEFINE([NEED_SED_WRAPPER], 1, [Do we need sed wrapper?])
- AC_MSG_RESULT([yes])
-else
- AC_DEFINE([NEED_SED_WRAPPER], 0)
- AC_MSG_RESULT([no])
-fi
-dnl }}}
-
-dnl {{{ is awk gnu awk
-AC_MSG_CHECKING([if we need an awk wrapper])
-AC_SUBST([NEED_AWK_WRAPPER])
-AC_CACHE_VAL(paludis_need_awk_wrapper,[awk --version &>/dev/null || paludis_need_awk_wrapper=yes])
-AM_CONDITIONAL([NEED_AWK_WRAPPER], test x$paludis_need_awk_wrapper = "xyes")
-if test x$paludis_need_awk_wrapper = "xyes"; then
- AC_DEFINE([NEED_AWK_WRAPPER], 1, [Do we need awk wrapper?])
- AC_MSG_RESULT([yes])
-else
- AC_DEFINE([NEED_AWK_WRAPPER], 0)
- AC_MSG_RESULT([no])
-fi
-dnl }}}
-
-dnl {{{ is make gnu make
-AC_MSG_CHECKING([if we need a make wrapper])
-AC_SUBST([NEED_MAKE_WRAPPER])
-AC_CACHE_VAL(paludis_need_make_wrapper,[make --version &>/dev/null || paludis_need_make_wrapper=yes])
-AM_CONDITIONAL([NEED_MAKE_WRAPPER], test x$paludis_need_make_wrapper = "xyes")
-if test x$paludis_need_make_wrapper = "xyes"; then
- AC_DEFINE([NEED_MAKE_WRAPPER], 1, [Do we need make wrapper?])
- AC_MSG_RESULT([yes])
-else
- AC_DEFINE([NEED_MAKE_WRAPPER], 0)
- AC_MSG_RESULT([no])
-fi
-dnl }}}
-
-dnl {{{ is patch gnu patch
-AC_MSG_CHECKING([if we need a patch wrapper])
-AC_SUBST([NEED_PATCH_WRAPPER])
-AC_CACHE_VAL(paludis_need_patch_wrapper,[patch -g0 < /dev/null &>/dev/null || paludis_need_patch_wrapper=yes])
-AM_CONDITIONAL([NEED_PATCH_WRAPPER], test x$paludis_need_patch_wrapper = "xyes")
-if test x$paludis_need_patch_wrapper = "xyes"; then
- AC_DEFINE([NEED_PATCH_WRAPPER], 1, [Do we need patch wrapper?])
- AC_MSG_RESULT([yes])
-else
- AC_DEFINE([NEED_PATCH_WRAPPER], 0)
- AC_MSG_RESULT([no])
-fi
-dnl }}}
-
dnl {{{ check for eselect
AC_MSG_CHECKING([for eselect])
if eselect version >/dev/null 2>/dev/null ; then
@@ -1229,36 +1173,6 @@ for m in env news ; do
done
dnl }}}
-dnl {{{ is ldconfig gnu ldconfig
-AC_MSG_CHECKING([if ldconfig is GNU])
-AC_ARG_ENABLE([gnu-ldconfig],
- AS_HELP_STRING([--enable-gnu-ldconfig], [Use GNU ldconfig syntax (default: autodetect)]),
- [
- HAVE_GNU_LDCONFIG=$enableval
- AC_MSG_RESULT([$HAVE_GNU_LDCONFIG])
- ],
- [
- AC_MSG_RESULT([auto-detect])
- AC_MSG_CHECKING([whether ldconfig is GNU])
- if ! type ldconfig &>/dev/null ; then
- AC_MSG_RESULT([don't know])
- AC_MSG_ERROR([ldconfig not found. Use --enable-gnu-ldconfig or --disable-gnu-ldconfig])
- fi
- if ldconfig --version &>/dev/null ; then
- HAVE_GNU_LDCONFIG=yes
- AC_MSG_RESULT([$HAVE_GNU_LDCONFIG])
- else
- HAVE_GNU_LDCONFIG=no
- AC_MSG_RESULT([$HAVE_GNU_LDCONFIG])
- fi
- ])
-if test "x$HAVE_GNU_LDCONFIG" = "xyes"; then
- AC_DEFINE([HAVE_GNU_LDCONFIG], 1, [Define to 1 if you have GNU 'ldconfig'.])
-fi
-AC_SUBST([HAVE_GNU_LDCONFIG])
-AM_CONDITIONAL([HAVE_GNU_LDCONFIG], test "x$HAVE_GNU_LDCONFIG" = "xyes")
-dnl }}}
-
dnl {{{ pkg-config
AC_SUBST([PALUDIS_PC_CFLAGS])
AC_SUBST([PALUDIS_PC_LIBS])
@@ -1337,7 +1251,6 @@ AC_OUTPUT(
paludis/repositories/e/ebuild/exheres-0/echo_functions.bash
paludis/repositories/e/ebuild/utils/Makefile
paludis/repositories/e/ebuild/utils/exheres-0/Makefile
- paludis/repositories/e/ebuild/work_around_broken_utilities.bash
paludis/repositories/e/qa/Makefile
paludis/repositories/fake/Makefile
paludis/repositories/gems/Makefile
diff --git a/hooks/gnu_info_index.bash b/hooks/gnu_info_index.bash
index 58e016c..237b9d2 100755
--- a/hooks/gnu_info_index.bash
+++ b/hooks/gnu_info_index.bash
@@ -32,10 +32,10 @@ vdb_loc=$(${PALUDIS_COMMAND} --configuration-variable installed location )
for info_path in ${INFOPATH/:/ } ; do
info_path="${ROOT%/}/${info_path}"
[[ -d "${info_path}" ]] || continue
- info_time=$(getmtime "${info_path}" )
+ info_time=$(wrapped_getmtime "${info_path}" )
if [[ -f "${vdb_loc}/.cache/info_time_cache" ]] ; then
- info_time_cache=$(getmtime "${vdb_loc}"/.cache/info_time_cache )
+ info_time_cache=$(wrapped_getmtime "${vdb_loc}"/.cache/info_time_cache )
[[ "${info_time}" -le "${info_time_cache}" ]] && continue
fi
diff --git a/paludis/fetchers/dowget.in b/paludis/fetchers/dowget.in
index 3537dfb..0348b4c 100755
--- a/paludis/fetchers/dowget.in
+++ b/paludis/fetchers/dowget.in
@@ -29,7 +29,7 @@ done
if [[ -n "${PALUDIS_USE_SAFE_RESUME}" ]] ; then
if [[ -f "${2}.-PARTIAL-" ]] ; then
- if [[ $(getfsize "${2}".-PARTIAL- ) -ge 123456 ]] ; then
+ if [[ $(wrapped_getfsize "${2}".-PARTIAL- ) -ge 123456 ]] ; then
einfo_unhooked "Attempting resume using ${2}.-PARTIAL-"
else
einfo_unhooked "Not attempting resume using ${2}.-PARTIAL- (too small)"
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 6ca35d5..4b592c3 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -690,14 +690,10 @@ VDBPostMergeCommand::operator() ()
if (! getenv_with_default("PALUDIS_NO_GLOBAL_HOOKS", "").empty())
return;
-#ifdef HAVE_GNU_LDCONFIG
- std::string ebuild_cmd("ldconfig -r '" + stringify(params.root) + "'");
-#else
- std::string ebuild_cmd("ldconfig -elf -i -f '" + stringify(params.root) +
- "var/run/ld-elf.so.hints' '" + stringify(params.root) + "etc/ld.so.conf'");
-#endif
-
- if (0 != (run_command(ebuild_cmd)))
+ Command cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
+ "/utils/wrapped_ldconfig.bash '" + stringify(params.root) + "'");
+
+ if (0 != (run_command(cmd)))
throw InstallActionError("VDB Entry post merge commands failed");
}
diff --git a/paludis/repositories/e/ebuild/Makefile.am b/paludis/repositories/e/ebuild/Makefile.am
index 5c332cd..cc2a4e1 100644
--- a/paludis/repositories/e/ebuild/Makefile.am
+++ b/paludis/repositories/e/ebuild/Makefile.am
@@ -44,8 +44,7 @@ libexecprog_SCRIPTS = \
src_test.bash \
src_unpack.bash \
usage_error.bash \
- write_vdb_entry.bash \
- work_around_broken_utilities.bash
+ write_vdb_entry.bash
TESTS_ENVIRONMENT = env \
PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/e/ebuild/" \
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 4b27226..c9cee98 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -103,7 +103,6 @@ ebuild_load_module install_functions
ebuild_load_module build_functions
ebuild_load_module eclass_functions
ebuild_load_module exlib_functions
-ebuild_load_module work_around_broken_utilities
export PALUDIS_HOME="$(canonicalise ${PALUDIS_HOME:-${HOME}} )"
diff --git a/paludis/repositories/e/ebuild/exheres-0/builtin_fetch.bash b/paludis/repositories/e/ebuild/exheres-0/builtin_fetch.bash
index f1c9c53..94c08cf 100644
--- a/paludis/repositories/e/ebuild/exheres-0/builtin_fetch.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/builtin_fetch.bash
@@ -25,7 +25,7 @@ builtin_fetch()
local aa=${a##*/}
hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
- if [[ -f "${FETCHEDDIR}/${aa}" ]] && [[ "0" != $(getfsize "${FETCHEDDIR}/${aa}") ]] ; then
+ if [[ -f "${FETCHEDDIR}/${aa}" ]] && [[ "0" != $(wrapped_getfsize "${FETCHEDDIR}/${aa}") ]] ; then
if [[ "${old_aa}" != "${aa}" ]] ; then
ebuild_section "Already have ${aa}"
old_aa="${aa}"
diff --git a/paludis/repositories/e/ebuild/utils/Makefile.am b/paludis/repositories/e/ebuild/utils/Makefile.am
index 342e3d1..86a8086 100644
--- a/paludis/repositories/e/ebuild/utils/Makefile.am
+++ b/paludis/repositories/e/ebuild/utils/Makefile.am
@@ -28,8 +28,6 @@ libexecprog_SCRIPTS = \
emake \
fowners \
fperms \
- getmtime \
- getfsize \
newbin \
newconfd \
newdoc \
@@ -50,7 +48,14 @@ libexecprog_SCRIPTS = \
prepinfo \
prepdocs \
prepalldocs \
- unpack
+ unpack \
+ wrapped_ldconfig \
+ wrapped_getfsize \
+ wrapped_getmtime \
+ make \
+ sed \
+ awk \
+ patch
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -63,7 +68,13 @@ TESTS_ENVIRONMENT = env \
TEST_SCRIPT_DIR="$(srcdir)/" \
bash $(top_srcdir)/paludis/repositories/e/ebuild/utils/run_test.bash
-TESTS = dobin_TEST.bash getfsize_TEST.bash
+TESTS = \
+ dobin_TEST.bash \
+ wrapped_getfsize_TEST.bash \
+ sed_TEST.bash \
+ awk_TEST.bash \
+ patch_TEST.bash \
+ make_TEST.bash
prep_scripts = prepall prepallstrip prepallman prepallinfo prepstrip prepman prepinfo prepdocs prepalldocs
@@ -99,3 +110,4 @@ distcheck-deps : distcheck-deps-subdirs
distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/repositories/e/ebuild/utils/awk b/paludis/repositories/e/ebuild/utils/awk
new file mode 100755
index 0000000..f7dc583
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/awk
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if /bin/awk --version &>/dev/null ; then
+ /bin/awk "$@"
+ exit $?
+elif /usr/bin/awk --version &>/dev/null ; then
+ /usr/bin/awk "$@"
+ exit $?
+elif /usr/local/bin/awk --version &>/dev/null ; then
+ /usr/local/bin/awk "$@"
+ exit $?
+elif gawk --version &>/dev/null ; then
+ gawk "$@"
+ exit $?
+else
+ echo "!!! Don't know how to use GNU awk on this system" 1>&2
+ exit 1
+fi
+
diff --git a/paludis/repositories/e/ebuild/utils/awk_TEST.bash b/paludis/repositories/e/ebuild/utils/awk_TEST.bash
new file mode 100644
index 0000000..c0011b9
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/awk_TEST.bash
@@ -0,0 +1,47 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+awk_TEST()
+{
+ mkdir -p awk_TEST_dir ; test_return_code
+
+ cat <<"END" > awk_TEST_dir/before ; test_return_code
+one
+two
+three
+END
+
+ ${PALUDIS_EBUILD_DIR}/utils/awk --version >/dev/null ; test_return_code
+ ${PALUDIS_EBUILD_DIR}/utils/awk -- '/t\wo/ { gsub(/two/, "five"); } { print }' \
+ awk_TEST_dir/before > awk_TEST_dir/after ; test_return_code
+
+ cat <<"END" > awk_TEST_dir/expected ; test_return_code
+one
+five
+three
+END
+
+ ! cmp awk_TEST_dir/before awk_TEST_dir/after >/dev/null ; test_return_code
+ cmp awk_TEST_dir/after awk_TEST_dir/expected >/dev/null ; test_return_code
+
+ ! ${PALUDIS_EBUILD_DIR}/utils/awk -- '/t\wo/ { gsub(/two/, "five"); } { print }' \
+ awk_TEST_dir/doesnotexist 2>/dev/null ; test_return_code
+
+ rm -fr awk_TEST_dir
+}
+
diff --git a/paludis/repositories/e/ebuild/utils/getfsize b/paludis/repositories/e/ebuild/utils/getfsize
deleted file mode 100755
index 38a271b..0000000
--- a/paludis/repositories/e/ebuild/utils/getfsize
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-case $(uname -s) in
- FreeBSD) stat -f '%z' "$@" ;;
- *) stat -c '%s' "$@" ;;
-esac
diff --git a/paludis/repositories/e/ebuild/utils/getmtime b/paludis/repositories/e/ebuild/utils/getmtime
deleted file mode 100755
index 88a74b2..0000000
--- a/paludis/repositories/e/ebuild/utils/getmtime
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-case $(uname -s) in
- FreeBSD) stat -f '%m' "$@" ;;
- *) stat -c '%Y' "$@" ;;
-esac
diff --git a/paludis/repositories/e/ebuild/utils/make b/paludis/repositories/e/ebuild/utils/make
new file mode 100755
index 0000000..5006f69
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/make
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if /bin/make --version &>/dev/null ; then
+ /bin/make "$@"
+ exit $?
+elif /usr/bin/make --version &>/dev/null ; then
+ /usr/bin/make "$@"
+ exit $?
+elif /usr/local/bin/make --version &>/dev/null ; then
+ /usr/local/bin/make "$@"
+ exit $?
+elif gmake --version &>/dev/null ; then
+ gmake "$@"
+ exit $?
+else
+ echo "!!! Don't know how to use GNU make on this system" 1>&2
+ exit 1
+fi
+
diff --git a/paludis/repositories/e/ebuild/work_around_broken_utilities.bash.in b/paludis/repositories/e/ebuild/utils/make_TEST.bash
index cb97656..5237765 100644
--- a/paludis/repositories/e/ebuild/work_around_broken_utilities.bash.in
+++ b/paludis/repositories/e/ebuild/utils/make_TEST.bash
@@ -1,15 +1,11 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006 Timothy Redaelli <drizzt@gentoo.org>
-#
-# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
-# Gentoo Foundation and distributed under the terms of the GNU General
-# Public License v2.
+# Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
#
# This file is part of the Paludis package manager. Paludis is free software;
# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License, version 2, as published by the Free Software Foundation.
+# Public License version 2, as published by the Free Software Foundation.
#
# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -20,7 +16,26 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
-@NEED_SED_WRAPPER_TRUE@alias sed=gsed
-@NEED_AWK_WRAPPER_TRUE@alias awk=gawk
-@NEED_MAKE_WRAPPER_TRUE@alias make=gmake
-@NEED_PATCH_WRAPPER_TRUE@alias patch=gpatch
+make_TEST()
+{
+ mkdir -p make_TEST_dir ; test_return_code
+
+ ${PALUDIS_EBUILD_DIR}/utils/sed -e 's, ,\t,g' <<"END" > make_TEST_dir/GNUmakefile
+A=x
+B=$(A:C/$/.1/)
+
+x.1 :
+ exit 1
+
+yes : $(B)
+
+no : x.1
+END
+
+ ${PALUDIS_EBUILD_DIR}/utils/make --version >/dev/null ; test_return_code
+ ${PALUDIS_EBUILD_DIR}/utils/make -C make_TEST_dir yes &>/dev/null ; test_return_code
+ ! ${PALUDIS_EBUILD_DIR}/utils/make -C make_TEST_dir no &>/dev/null ; test_return_code
+
+ rm -fr make_TEST_dir
+}
+
diff --git a/paludis/repositories/e/ebuild/utils/patch b/paludis/repositories/e/ebuild/utils/patch
new file mode 100755
index 0000000..4b7d8db
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/patch
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if /bin/patch -g0 </dev/null &>/dev/null ; then
+ /bin/patch "$@"
+ exit $?
+elif /usr/bin/patch -g0 </dev/null &>/dev/null ; then
+ /usr/bin/patch "$@"
+ exit $?
+elif /usr/local/bin/patch -g0 </dev/null &>/dev/null ; then
+ /usr/local/bin/patch "$@"
+ exit $?
+elif gpatch -g0 </dev/null &>/dev/null ; then
+ gpatch "$@"
+ exit $?
+else
+ echo "!!! Don't know how to use GNU patch on this system" 1>&2
+ exit 1
+fi
+
diff --git a/paludis/repositories/e/ebuild/utils/patch_TEST.bash b/paludis/repositories/e/ebuild/utils/patch_TEST.bash
new file mode 100644
index 0000000..01b1cbb
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/patch_TEST.bash
@@ -0,0 +1,75 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+patch_TEST()
+{
+ mkdir -p patch_TEST_dir ; test_return_code
+
+ cat <<"END" > patch_TEST_dir/a ; test_return_code
+one
+two
+three
+four
+ five
+six
+END
+
+ ${PALUDIS_EBUILD_DIR}/utils/patch --version >/dev/null ; test_return_code
+ cat <<"END" | ${PALUDIS_EBUILD_DIR}/utils/patch -l -p1 ; test_return_code
+What's the deal with the giant space monkeys?
+--- old/patch_TEST_dir/a
++++ new/patch_TEST_dir/a
+@@ -1,6 +1,6 @@
+ one
+ two
+-three
++ten
+ four
+- five
++five
+ six
+END
+
+ cat <<"END" > patch_TEST_dir/expected ; test_return_code
+one
+two
+ten
+four
+five
+six
+END
+
+ cmp patch_TEST_dir/expected patch_TEST_dir/a >/dev/null ; test_return_code
+
+ cat <<"END" | { ! ${PALUDIS_EBUILD_DIR}/utils/patch -l -p1 &>/dev/null ; } ; test_return_code
+--- old/patch_TEST_dir/b
++++ new/patch_TEST_dir/b
+@@ -1,6 +1,6 @@
+ one
+ two
+-three
++ten
+ four
+- five
++five
+ six
+END
+
+ rm -fr patch_TEST_dir
+}
+
diff --git a/paludis/repositories/e/ebuild/utils/sed b/paludis/repositories/e/ebuild/utils/sed
new file mode 100755
index 0000000..4ddac24
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/sed
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if /bin/sed --version &>/dev/null ; then
+ /bin/sed "$@"
+ exit $?
+elif /usr/bin/sed --version &>/dev/null ; then
+ /usr/bin/sed "$@"
+ exit $?
+elif /usr/local/bin/sed --version &>/dev/null ; then
+ /usr/local/bin/sed "$@"
+ exit $?
+elif gsed --version &>/dev/null ; then
+ gsed "$@"
+ exit $?
+else
+ echo "!!! Don't know how to use GNU sed on this system" 1>&2
+ exit 1
+fi
+
diff --git a/paludis/repositories/e/ebuild/utils/getfsize_TEST.bash b/paludis/repositories/e/ebuild/utils/sed_TEST.bash
index 3688bdf..c956880 100755..100644
--- a/paludis/repositories/e/ebuild/utils/getfsize_TEST.bash
+++ b/paludis/repositories/e/ebuild/utils/sed_TEST.bash
@@ -16,29 +16,31 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
-getfsize_TEST()
+sed_TEST()
{
- mkdir -p getfsize_TEST_dir ; test_return_code
+ mkdir -p sed_TEST_dir ; test_return_code
- echo -n "12345" > getfsize_TEST_dir/five
- echo "12345" > getfsize_TEST_dir/six
+ cat <<"END" > sed_TEST_dir/before ; test_return_code
+one
+two
+three
+END
- ${PALUDIS_EBUILD_DIR}/utils/getfsize getfsize_TEST_dir/five >/dev/null ; test_return_code
- ${PALUDIS_EBUILD_DIR}/utils/getfsize getfsize_TEST_dir/six >/dev/null ; test_return_code
+ ${PALUDIS_EBUILD_DIR}/utils/sed --version >/dev/null ; test_return_code
+ ${PALUDIS_EBUILD_DIR}/utils/sed --in-place -e '/\(two\|four\)/s/two/five/' \
+ sed_TEST_dir/before ; test_return_code
- [[ $(${PALUDIS_EBUILD_DIR}/utils/getfsize getfsize_TEST_dir/five ) == "5" ]] ; test_return_code
- [[ $(${PALUDIS_EBUILD_DIR}/utils/getfsize getfsize_TEST_dir/six ) == "6" ]] ; test_return_code
+ cat <<"END" > sed_TEST_dir/after ; test_return_code
+one
+five
+three
+END
- rm -fr getfsize_TEST_dir
-}
-
-getfsize_fail_TEST()
-{
- mkdir -p getfsize_TEST_dir ; test_return_code
+ cmp sed_TEST_dir/before sed_TEST_dir/after >/dev/null ; test_return_code
- ! ${PALUDIS_EBUILD_DIR}/utils/getfsize getfsize_TEST_dir/seven 2>/dev/null ; test_return_code
+ ! ${PALUDIS_EBUILD_DIR}/utils/sed -i -e '/\(two\|four\)/s/two/five/' \
+ sed_TEST_dir/doesnotexist 2>/dev/null ; test_return_code
- rm -fr getfsize_TEST_dir
+ rm -fr sed_TEST_dir
}
-
diff --git a/paludis/repositories/e/ebuild/utils/wrapped_getfsize b/paludis/repositories/e/ebuild/utils/wrapped_getfsize
new file mode 100755
index 0000000..6bbc449
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/wrapped_getfsize
@@ -0,0 +1,18 @@
+#!/bin/bash
+case $(uname -s) in
+ FreeBSD)
+ stat -f '%z' "$@"
+ exit $?
+ ;;
+
+ Linux)
+ stat -c '%s' "$@"
+ exit $?
+ ;;
+
+ *)
+ echo "!!! Don't know how to use stat on this system" 1>&2
+ exit 1
+ ;;
+esac
+
diff --git a/paludis/repositories/e/ebuild/utils/wrapped_getfsize_TEST.bash b/paludis/repositories/e/ebuild/utils/wrapped_getfsize_TEST.bash
new file mode 100755
index 0000000..349a511
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/wrapped_getfsize_TEST.bash
@@ -0,0 +1,44 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+wrapped_getfsize_TEST()
+{
+ mkdir -p wrapped_getfsize_TEST_dir ; test_return_code
+
+ echo -n "12345" > wrapped_getfsize_TEST_dir/five
+ echo "12345" > wrapped_getfsize_TEST_dir/six
+
+ ${PALUDIS_EBUILD_DIR}/utils/wrapped_getfsize wrapped_getfsize_TEST_dir/five >/dev/null ; test_return_code
+ ${PALUDIS_EBUILD_DIR}/utils/wrapped_getfsize wrapped_getfsize_TEST_dir/six >/dev/null ; test_return_code
+
+ [[ $(${PALUDIS_EBUILD_DIR}/utils/wrapped_getfsize wrapped_getfsize_TEST_dir/five ) == "5" ]] ; test_return_code
+ [[ $(${PALUDIS_EBUILD_DIR}/utils/wrapped_getfsize wrapped_getfsize_TEST_dir/six ) == "6" ]] ; test_return_code
+
+ rm -fr wrapped_getfsize_TEST_dir
+}
+
+wrapped_getfsize_fail_TEST()
+{
+ mkdir -p wrapped_getfsize_TEST_dir ; test_return_code
+
+ ! ${PALUDIS_EBUILD_DIR}/utils/wrapped_getfsize wrapped_getfsize_TEST_dir/seven 2>/dev/null ; test_return_code
+
+ rm -fr wrapped_getfsize_TEST_dir
+}
+
+
diff --git a/paludis/repositories/e/ebuild/utils/wrapped_getmtime b/paludis/repositories/e/ebuild/utils/wrapped_getmtime
new file mode 100755
index 0000000..e2616de
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/wrapped_getmtime
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+case $(uname -s) in
+ FreeBSD)
+ stat -f '%m' "$@"
+ exit $?
+ ;;
+
+ Linux)
+ stat -c '%Y' "$@"
+ exit $?
+ ;;
+
+ *)
+ echo "!!! Don't know how to use stat on this system" 1>&2
+ exit $?
+ ;;
+esac
+
diff --git a/paludis/repositories/e/ebuild/utils/wrapped_ldconfig b/paludis/repositories/e/ebuild/utils/wrapped_ldconfig
new file mode 100755
index 0000000..ecb53eb
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/wrapped_ldconfig
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+case $(uname -s) in
+ FreeBSD)
+ ldconfig -elf -i -f "$1"/var/run/ld-elf.so.hints "$1"/etc/ld.so.conf
+ exit $?
+ ;;
+
+ Linux)
+ ldconfig -r "$1"
+ exit $?
+ ;;
+
+ *)
+ echo "!!! Don't know how to use ldconfig on this system" 1>&2
+ exit 1
+ ;;
+esac
+
diff --git a/paludis/repositories/e/ebuild/write_vdb_entry.bash b/paludis/repositories/e/ebuild/write_vdb_entry.bash
index 9e16bb6..9905611 100755
--- a/paludis/repositories/e/ebuild/write_vdb_entry.bash
+++ b/paludis/repositories/e/ebuild/write_vdb_entry.bash
@@ -46,7 +46,6 @@ ebuild_load_module()
ebuild_load_module die_functions
ebuild_load_module echo_functions
-ebuild_load_module work_around_broken_utilities
export PALUDIS_HOME="$(canonicalise ${PALUDIS_HOME:-${HOME}} )"
diff --git a/paludis/repositories/e/vdb_unmerger_TEST_setup.sh b/paludis/repositories/e/vdb_unmerger_TEST_setup.sh
index 3ef41e0..353713a 100755
--- a/paludis/repositories/e/vdb_unmerger_TEST_setup.sh
+++ b/paludis/repositories/e/vdb_unmerger_TEST_setup.sh
@@ -13,7 +13,7 @@ make_file() {
echo "foo" > "file_$1"
md5=${2:-$(md5sum "file_$1" | cut -f1 -d' ')}
- mtime=${3:-$(${PALUDIS_EBUILD_DIR}/utils/getmtime "file_$1")}
+ mtime=${3:-$(${PALUDIS_EBUILD_DIR}/utils/wrapped_getmtime "file_$1")}
echo "obj /file_$1 ${md5} ${mtime}" > "../CONTENTS/file_$1"
}
@@ -24,7 +24,7 @@ make_sym() {
> "sym_$1_dst"
ln -s "${dst}" "${src}"
- mtime=${3:-$(${PALUDIS_EBUILD_DIR}/utils/getmtime "sym_$1")}
+ mtime=${3:-$(${PALUDIS_EBUILD_DIR}/utils/wrapped_getmtime "sym_$1")}
echo "sym /${src} -> sym_$1_dst ${mtime}" > "../CONTENTS/sym_$1"
}
@@ -95,6 +95,6 @@ mkdir protected_dir_not_really
touch protected_dir_not_really/unprotected_file
find . -name '*protected*' -type f -print | while read file; do
- echo obj "${file#.}" "$(md5sum "${file}" | cut -f1 -d' ')" "$(${PALUDIS_EBUILD_DIR}/utils/getmtime "${file}")"
+ echo obj "${file#.}" "$(md5sum "${file}" | cut -f1 -d' ')" "$(${PALUDIS_EBUILD_DIR}/utils/wrapped_getmtime "${file}")"
done >../CONTENTS/config_protect
diff --git a/paludis/repositories/unpackaged/installed_unpackaged_repository_TEST_setup.sh b/paludis/repositories/unpackaged/installed_unpackaged_repository_TEST_setup.sh
index 55e650f..0b635c6 100755
--- a/paludis/repositories/unpackaged/installed_unpackaged_repository_TEST_setup.sh
+++ b/paludis/repositories/unpackaged/installed_unpackaged_repository_TEST_setup.sh
@@ -35,8 +35,8 @@ mkdir -p repo2/data/asdf/1.2.3:fred:ghjk
ln -s ../../../data/asdf repo2/indices/categories/cat-one/foo
ln -s ../../../data/asdf repo2/indices/packages/foo/cat-one
cat <<END > repo2/data/asdf/1.2.3:fred:ghjk/contents
-type=file path=/first md5=c0ba8bfb6501abb1b7105ec79536b848 mtime=$(${PALUDIS_EBUILD_DIR}/utils/getmtime "root2/first")
-type=file path=/first md5=0 mtime=$(${PALUDIS_EBUILD_DIR}/utils/getmtime "root2/second")
+type=file path=/first md5=c0ba8bfb6501abb1b7105ec79536b848 mtime=$(${PALUDIS_EBUILD_DIR}/utils/wrapped_getmtime "root2/first")
+type=file path=/first md5=0 mtime=$(${PALUDIS_EBUILD_DIR}/utils/wrapped_getmtime "root2/second")
END
cat <<"END" > repo2/ndbam.conf
ndbam_format = 1