aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-30 13:43:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-30 13:43:30 +0000
commit54a8f8e65e9366f170d4b3b374cf05ab4eca344a (patch)
treef1f4905cafb36ddc73052f16b82f772a727f547b
parent66e9ecd85d32b4eda1ce5964369f32e428b56735 (diff)
downloadpaludis-54a8f8e65e9366f170d4b3b374cf05ab4eca344a.tar.gz
paludis-54a8f8e65e9366f170d4b3b374cf05ab4eca344a.tar.xz
More work on ebuild
-rw-r--r--ebuild/ebuild.bash63
-rw-r--r--ebuild/install_functions.bash11
-rw-r--r--ebuild/sandbox_stubs.bash4
-rw-r--r--ebuild/src_unpack.bash5
-rw-r--r--ebuild/unpack_functions.bash2
-rw-r--r--ebuild/usage_error.bash28
6 files changed, 90 insertions, 23 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index df64d2c..65238e8 100644
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -30,36 +30,55 @@ shopt -s expand_aliases
EBUILD_KILL_PID=$$
alias die='diefunc "$FUNCNAME" "$LINENO" "$@"'
alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ -z "${_pipestatus//[ 0]/}" ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
-trap 'echo "exiting." ; exit 250' 15
+trap 'echo "exiting with error." ; exit 250' 15
diefunc()
{
- local func="$1" line="$2" exitcode="$3"
- shift 3
+ local func="$1" line="$2"
+ shift 2
echo 1>&2
- echo "ERROR in ${CATEGORY}/${PF}:" 1>&2
- echo "!!! $funcname at $lineno gave exit code $exitcode" 1>&2
+ echo "ERROR in ${CATEGORY:-?}/${PF:-?}:" 1>&2
+ echo "!!! In ${func:-?} at line ${line:-?}" 1>&2
echo "!!! ${@:-(no message provided)}" 1>&2
echo 1>&2
- kill ${ESELECT_KILL_TARGET}
+ kill ${EBUILD_KILL_PID}
exit 249
}
-umask 022
-export DESTTREE="/usr"
-export INSDESTTREE=""
-export EXEDESTTREE=""
-export DOCDESTTREE=""
-export INSOPTIONS="-m0644"
-export EXEOPTIONS="-m0755"
-export LIBOPTIONS="-m0644"
-export DIROPTIONS="-m0755"
-export MOPREFIX="${PN}"
+EBUILD_MODULES_DIR=$(readlink -f $(dirname $0 ) )
+[[ -d ${EBUILD_MODULES_DIR} ]] || die "${EBUILD_MODULES_DIR} is not a directory"
+
+ebuild_load_module()
+{
+ source "${EBUILD_MODULES_DIR}/${1}.bash" || die "Error loading module ${1}"
+}
+
+ebuild_load_module sandbox_stubs
+ebuild_load_module portage_stubs
+ebuild_load_module list_functions
+ebuild_load_module echo_functions
+ebuild_load_module install_functions
+ebuild_load_module build_functions
+ebuild_load_module unpack_functions
+
+ebuild_load_ebuild()
+{
+ [[ -f "${1}" ]] || die "Ebuild '${1}' is not a file"
+ source ${1} || die "Error sourcing ebuild '${1}'"
+}
+
+case ${1:x} in
+ unpack)
+ ebuild_load_ebuild "${2}"
+ ebuild_load_module src_unpack
+ ebuild_f_unpack
+ ;;
+
+ *)
+ ebuild_load_module usage_error
+ ebuild_f_usage_error
+ exit 1
+ ;;
+esac
-source sandbox_stubs.bash
-source portage_stubs.bash
-source list_functions.bash
-source echo_functions.bash
-source install_functions.bash
-source build_functions.bash
diff --git a/ebuild/install_functions.bash b/ebuild/install_functions.bash
index 2610614..ef02e3c 100644
--- a/ebuild/install_functions.bash
+++ b/ebuild/install_functions.bash
@@ -21,6 +21,17 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
+umask 022
+export DESTTREE="/usr"
+export INSDESTTREE=""
+export EXEDESTTREE=""
+export DOCDESTTREE=""
+export INSOPTIONS="-m0644"
+export EXEOPTIONS="-m0755"
+export LIBOPTIONS="-m0644"
+export DIROPTIONS="-m0755"
+export MOPREFIX="${PN}"
+
keepdir()
{
dodir "$@"
diff --git a/ebuild/sandbox_stubs.bash b/ebuild/sandbox_stubs.bash
index cfc1512..c15636f 100644
--- a/ebuild/sandbox_stubs.bash
+++ b/ebuild/sandbox_stubs.bash
@@ -23,17 +23,21 @@
addread()
{
+ :
}
addwrite()
{
+ :
}
adddeny()
{
+ :
}
addpredict()
{
+ :
}
diff --git a/ebuild/src_unpack.bash b/ebuild/src_unpack.bash
index ef7bf88..fc93851 100644
--- a/ebuild/src_unpack.bash
+++ b/ebuild/src_unpack.bash
@@ -26,3 +26,8 @@ src_unpack()
[[ -n "${A}" ]] && unpack ${A}
}
+ebuild_f_unpack()
+{
+
+}
+
diff --git a/ebuild/unpack_functions.bash b/ebuild/unpack_functions.bash
index f9b98f0..85acb1a 100644
--- a/ebuild/unpack_functions.bash
+++ b/ebuild/unpack_functions.bash
@@ -46,7 +46,7 @@ unpack_one()
tar zxf "${1}" || die "Couldn't unpack ${1}"
;;
- *.tar.bz2|*.tbz2
+ *.tar.bz2|*.tbz2)
tar jxf "${1}" || die "Couldn't unpack ${1}"
;;
diff --git a/ebuild/usage_error.bash b/ebuild/usage_error.bash
new file mode 100644
index 0000000..0270472
--- /dev/null
+++ b/ebuild/usage_error.bash
@@ -0,0 +1,28 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaranm@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.
+#
+# 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 as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# 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
+
+ebuild_f_usage_error()
+{
+ die "Usage error"
+}
+