aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-05-17 16:30:00 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-05-17 16:30:00 +0000
commit94920ca28e97cfa167f7740a558cbc7eef54beb5 (patch)
treebd1c1dd046dcaa05e2835edf9791b037e037d35b
parent1fa666a802e747c38fda17c21a5e1ca40a752539 (diff)
downloadpaludis-94920ca28e97cfa167f7740a558cbc7eef54beb5.tar.gz
paludis-94920ca28e97cfa167f7740a558cbc7eef54beb5.tar.xz
Switch to our own implementation of einfo et al, and remove dep on functions.sh
-rwxr-xr-xebuild/ebuild.bash1
-rw-r--r--ebuild/echo_functions.bash76
2 files changed, 76 insertions, 1 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 9c41a09..1e7edbb 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -64,7 +64,6 @@ ebuild_load_module()
source "${EBUILD_MODULES_DIR}/${1}.bash" || die "Error loading module ${1}"
}
-source /sbin/functions.sh || die "Couldn't source functions.sh"
ebuild_load_module echo_functions
ebuild_load_module sandbox
ebuild_load_module portage_stubs
diff --git a/ebuild/echo_functions.bash b/ebuild/echo_functions.bash
index f57d39b..016e136 100644
--- a/ebuild/echo_functions.bash
+++ b/ebuild/echo_functions.bash
@@ -21,6 +21,82 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
+COLOUR_GOOD=$'\e[32;01m'
+COLOUR_WARN=$'\e[33;01m'
+COLOUR_BAD=$'\e[31;01m'
+COLOUR_BRACKET=$'\e[34;01m'
+COLOUR_NORMAL=$'\e[0m'
+PALUDIS_ENDCOL=$'\e[A\e['$(( ${COLUMNS:-80} - 7 ))'G'
+
+einfon()
+{
+ echo -ne " ${COLOUR_GOOD}*${COLOUR_NORMAL} $*"
+ PALUDIS_LAST_E_CMD=einfon
+}
+
+einfo()
+{
+ einfon "$*\n"
+ PALUDIS_LAST_E_CMD=einfo
+}
+
+ewarn()
+{
+ echo -e " ${COLOUR_WARN}*${COLOUR_NORMAL} $*"
+ PALUDIS_LAST_E_CMD=ewarn
+}
+
+eerror()
+{
+ echo -e " ${COLOUR_BAD}*${COLOUR_NORMAL} $*"
+ PALUDIS_LAST_E_CMD=eerror
+}
+
+ebegin()
+{
+ einfo "$* ..."
+ PALUDIS_LAST_E_CMD=ebegin
+ PALUDIS_LAST_E_LEN=$(( 4 + ${#msg} ))
+}
+
+_eend()
+{
+ local retval=${1:-0} efunc=${2:-eerror} msg
+ shift 2
+
+ if [[ ${retval} == 0 ]]; then
+ msg="${COLOUR_BRACKET}[ ${COLOUR_GOOD}ok${COLOUR_BRACKET} ]${COLOUR_NORMAL}"
+ else
+ if [[ -n "$*" ]]; then
+ ${efunc} $*
+ fi
+ msg="${COLOUR_BRACKET}[ ${COLOUR_BAD}!!${COLOUR_BRACKET} ]${COLOUR_NORMAL}"
+ fi
+
+# printf "%$(( ${COLUMNS:-80} - PALUDIS_LAST_E_LEN - 6))s%b\n" '' "${msg}"
+ echo -e "${PALUDIS_ENDCOL} ${msg}"
+
+ return ${retval}
+}
+
+eend()
+{
+ local retval=${1:-0}
+ shift
+ _eend ${retval} eerror "$*"
+ PALUDIS_LAST_E_CMD=eend
+ return ${retval}
+}
+
+ewend()
+{
+ local retval=${1:-0}
+ shift
+ _eend ${retval} ewarn "$*"
+ PALUDIS_LAST_E_CMD=ewend
+ return ${retval}
+}
+
use_with()
{
if useq "${1}" ; then