aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-29 16:15:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-29 16:15:49 +0000
commit01bf0b6ffd6378992da93ba49e80aea03d325c4e (patch)
tree6e0c68c7ced2d4f691dfb10c997e57c164a3d848
parent83203330ddf9c5b781a471b1cf6630803eeca06e (diff)
downloadpaludis-01bf0b6ffd6378992da93ba49e80aea03d325c4e.tar.gz
paludis-01bf0b6ffd6378992da93ba49e80aea03d325c4e.tar.xz
Add in the start of an ebuild.bash implementation. Not currently used or usable.
-rw-r--r--ebuild/ebuild.bash60
-rw-r--r--ebuild/echo_functions.bash42
-rw-r--r--ebuild/install_functions.bash94
-rw-r--r--ebuild/list_functions.bash71
-rw-r--r--ebuild/portage_stubs.bash43
-rw-r--r--ebuild/sandbox_stubs.bash39
6 files changed, 349 insertions, 0 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
new file mode 100644
index 0000000..379f71e
--- /dev/null
+++ b/ebuild/ebuild.bash
@@ -0,0 +1,60 @@
+#!/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
+
+unalias -a
+unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
+eval unset LANG ${!LC_*}
+
+shopt -s expand_aliases
+
+EBUILD_KILL_PID=$$
+alias die='diefunc "$FUNCNAME" "$LINENO" "$@"'
+alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ -z "${_pipestatus//[ 0]/}" ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
+
+diefunc()
+{
+ local func="$1" line="$2" exitcode="$3"
+ shift 3
+ echo 1>&2
+ echo "ERROR in ${CATEGORY}/${PF}:" 1>&2
+ echo "!!! $funcname at $lineno gave exit code $exitcode" 1>&2
+ echo "!!! ${@:-(no message provided)}" 1>&2
+ echo 1>&2
+}
+
+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}"
+
+source sandbox_stubs.bash
+source portage_stubs.bash
+source list_functions.bash
+source echo_functions.bash
+source install_functions.bash
diff --git a/ebuild/echo_functions.bash b/ebuild/echo_functions.bash
new file mode 100644
index 0000000..1580905
--- /dev/null
+++ b/ebuild/echo_functions.bash
@@ -0,0 +1,42 @@
+#!/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
+
+use_with()
+{
+ if useq "${1}" ; then
+ echo "--with-${2:1}${3+=${3}}"
+ else
+ echo "--without-${2:1}"
+ fi
+}
+
+use_with()
+{
+ if useq "${1}" ; then
+ echo "--enable-${2:1}${3+=${3}}"
+ else
+ echo "--disable-${2:1}"
+ fi
+}
+
+
diff --git a/ebuild/install_functions.bash b/ebuild/install_functions.bash
new file mode 100644
index 0000000..a6c77b1
--- /dev/null
+++ b/ebuild/install_functions.bash
@@ -0,0 +1,94 @@
+#!/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
+
+keepdir()
+{
+ dodir "$@"
+ if [[ "${1}" == "-R" ]] || [[ "${1}" == "-r" ]] ; then
+ shift
+ find "$@" -type d -printf "${D}/%p/.keep\0" | xargs -0 touch
+ assert "Failed to create .keep files"
+ else
+ local f
+ for f in "$@" ; do
+ touch "${D}/${x}/.keep" || die "Couldn't touch .keep in ${x}"
+ done
+ fi
+}
+
+unpack()
+{
+ [[ -z "$@" ]] && die "No arguments given to unpack"
+
+ for x in "$@" ; do
+ echo ">>> Unpacking ${x} to ${PWD}"
+ [[ "${x:0:2}" == "./" ]] || x="${DISTDIR}/${x}"
+ unpack_one "${x}"
+ done
+}
+
+unpack_one()
+{
+ [[ -z "$1" ]] && die "Bad argument for unpack_one"
+ [[ -e "$1" ]] || die "${1} doesn't exist"
+
+ case "${x}" in
+ *.tar)
+ tar xf "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.tar.gz|*.tgz)
+ tar zxf "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.tar.bz2|*.tbz2
+ tar jxf "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.zip|*.ZIP|*.jar)
+ unzip -qo "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.gz|*.Z|*.z)
+ gzip -dc "${1}" > "${1%.*}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.bz2)
+ bunzip2 -dc "${1}" > "${1%.*}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.rar|*.RAR)
+ unrar x -idq "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *.LHa|*.LHA|*.lha|*.lzh)
+ lha xqf "${1}" || die "Couldn't unpack ${1}"
+ ;;
+
+ *)
+ echo "Skipping unpack for ${1}"
+ ;;
+ esac
+
+}
+
diff --git a/ebuild/list_functions.bash b/ebuild/list_functions.bash
new file mode 100644
index 0000000..8efc1d0
--- /dev/null
+++ b/ebuild/list_functions.bash
@@ -0,0 +1,71 @@
+#!/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
+
+use()
+{
+ useq "${USE}" "${1}"
+}
+
+usev()
+{
+ if useq "${USE}" "${1}" ; then
+ echo "${1}"
+ return 0
+ else
+ return 1
+ fi
+}
+
+useq()
+{
+ if [[ "${1:0:1}" == "!" ]] ; then
+ ! hasq "${USE}" "${1}"
+ else
+ hasq "${USE}" "${1}"
+ fi
+}
+
+has()
+{
+ hasq "${@}"
+}
+
+hasv()
+{
+ if hasq "${@}" ; then
+ echo "${1}"
+ return 0
+ else
+ return 1
+ fi
+}
+
+hasq()
+{
+ local x= want="$1"
+ shift
+ for x in "$@" ; do
+ [[ "${x}" == "${want}" ]] && return 0
+ done
+ return 1
+}
diff --git a/ebuild/portage_stubs.bash b/ebuild/portage_stubs.bash
new file mode 100644
index 0000000..cfb8f98
--- /dev/null
+++ b/ebuild/portage_stubs.bash
@@ -0,0 +1,43 @@
+#!/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
+
+has_version()
+{
+ die "has_version not implemented"
+}
+
+portageq()
+{
+ die "portageq not implemented"
+}
+
+best_version()
+{
+ die "best_version not implemented"
+}
+
+check_KV()
+{
+ die "check_KV not implenented"
+}
+
diff --git a/ebuild/sandbox_stubs.bash b/ebuild/sandbox_stubs.bash
new file mode 100644
index 0000000..cfc1512
--- /dev/null
+++ b/ebuild/sandbox_stubs.bash
@@ -0,0 +1,39 @@
+#!/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
+
+addread()
+{
+}
+
+addwrite()
+{
+}
+
+adddeny()
+{
+}
+
+addpredict()
+{
+}
+