Portage_Extension_Script
- This page is a candidate for deletion
- Reason given: Not used and provides no explination of form or function of this script
- If you disagree with its deletion, please explain why on its discussion page.
- If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
- Make sure no other pages link here and check the page's history before deleting.
Portage overlays are really useful. But if you want a rather custom system, they're pretty hard to use. When packages get update, etc. you need to redo your overlay. But here's a patch to simplify making custom ebuilds:
--- usr/lib/portage/bin/ebuild.sh 2005-02-18 17:07:34.742019008 -0500
+++ usr/lib/portage/bin/ebuild.sh.new 2005-02-20 16:01:36.275220768 -0500
@@ -212,6 +212,121 @@
/usr/lib/portage/bin/portageq "$@"
}
+extendscript_run() {
+ if hasq extendscript $FEATURES; then
+ ebuild_extension $1
+ else
+ $1
+ fi
+}
+
+if hasq extendscript $FEATURES; then
+ # Use the binary so we don't have to deal with aliases
+ revextendlist="$(/usr/bin/ls /etc/portage/extend/ | rev)"
+ extendlist="$(echo $revextendlist | rev)"
+
+ ees_inherit() {
+ source /etc/portage/extend/virtual.$@
+ }
+
+ ges_inherit() {
+ for inheritscript in $@; do
+ if ! hasq $inheritscript $ges_total; then
+ if [ -e /etc/portage/extend/global/$inheritscript ]; then
+ source /etc/portage/extend/global/$inheritscript
+ ges_total="$ges_total $inheritscript"
+ else
+ die "Global Extension Script $script not found"
+ fi
+ fi
+ done
+ }
+
+ for script in /etc/portage/extend/*; do
+ if [[ "`basename $script`" == "${CATEGORY}.${PF}" ||
+ "`basename $script`" == "${CATEGORY}.${PN}" ||
+ "`basename $script`" == "${CATEGORY}" ]]; then
+ source $script
+ break
+ fi
+ done
+
+ for script in $GES_SCRIPT; do
+ if ! hasq $script $ges_total; then
+ if [ -e /etc/portage/extend/global/$script ]; then
+ source /etc/portage/extend/global/$script
+ ges_total="$ges_total $script"
+ else
+ die "Global Extension Script $script not found"
+ fi
+ fi
+ done
+
+ # Run the global extension function
+ global_extension() {
+ # 1 - Function Name: pkg_preinst
+
+ local functionbase="$(echo $1 | sed -e "s:^.*_::")"
+ local gesvariable="GES_$(echo $functionbase | tr "[a-z]" "[A-Z]")"
+
+ for script in $ges_total; do
+ if [ "$(eval echo \$${script}_${gesvariable})" == "extend" ]; then
+ ${script}_ges_${functionbase}
+ fi
+ done
+ }
+
+ # Run a function given the function name
+ ebuild_extension() {
+ # 1 - Function Name: pkg_preinst
+
+ local functionbase="$(echo $1 | sed -e "s:^.*_::")"
+ local eesvariable="EES_$(echo $functionbase | tr "[a-z]" "[A-Z]")"
+
+ # Ebuild, global, specific: extend
+ # Ebuild, global: undefined
+ # Global, specific: override
+ # Global: global
+ # Specific: only
+ # Nothing: void
+
+
+ # Not defined: Run ebuild, global
+ if [ -z "${!eesvariable}" ]; then
+ $1; global_extension $1
+
+ # "void": Run nothing
+ elif [ "${!eesvariable}" == "void" ]; then
+ einfo "Skipping $functionbase"
+
+ else
+ ebegin "Running $functionbase: ${!eesvariable}"
+
+ # "extend": Run ebuild, global, specific
+ if [ "${!eesvariable}" == "extend" ]; then
+ $1; global_extension $1; ees_$functionbase;
+
+ # "override": Run global, specific
+ elif [ "${!eesvariable}" == "override" ]; then
+ global_extension $1; ees_$functionbase
+
+ # "global": Run global
+ elif [ "${!eesvariable}" == "global" ]; then
+ global_extension $1
+
+ # "only": Run specific
+ elif [ "${!eesvariable}" == "only" ]; then
+ ees_$functionbase
+
+ else
+ die "Illegal $eesvariable setting"
+ fi
+ eend $?
+ fi
+ }
+fi
+
+
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
@@ -464,7 +579,8 @@
--sysconfdir=/etc \
--localstatedir=/var/lib \
${EXTRA_ECONF} \
- "$@"
+ "$@" \
+ ${EES_ECONF}
if ! "${ECONF_SOURCE}/configure" \
--prefix=/usr \
@@ -475,7 +591,8 @@
--sysconfdir=/etc \
--localstatedir=/var/lib \
${EXTRA_ECONF} \
- "$@" ; then
+ "$@" \
+ ${EES_ECONF} ; then
if [ -s config.log ]; then
echo
@@ -678,7 +795,7 @@
install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
[ -d "$WORKDIR" ] && cd "${WORKDIR}"
echo ">>> Unpacking source..."
- src_unpack
+ extendscript_run "src_unpack"
touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
echo ">>> Source unpacked."
cd "$BUILDDIR"
@@ -1126,8 +1243,8 @@
# set IMAGE depending if this is a binary or compile merge
[ "${EMERGE_FROM}" == "binary" ] && IMAGE=${PKG_TMPDIR}/${PF}/bin \
|| IMAGE=${D}
-
- pkg_preinst
+
+ extendscript_run "pkg_preinst"
# hopefully this will someday allow us to get rid of the no* feature flags
# we don't want globbing for initial expansion, but afterwards, we do
Last modified: Mon, 28 Apr 2008 04:15:00 +1000 Hits: 6,744
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
