aboutsummaryrefslogtreecommitdiff
path: root/ebuild
diff options
context:
space:
mode:
Diffstat (limited to 'ebuild')
-rw-r--r--ebuild/Makefile.am1
-rw-r--r--ebuild/builtin_merge.bash7
-rw-r--r--ebuild/builtin_unmerge.bash122
-rwxr-xr-xebuild/ebuild.bash35
-rw-r--r--ebuild/pkg_postrm.bash15
-rw-r--r--ebuild/pkg_prerm.bash14
6 files changed, 179 insertions, 15 deletions
diff --git a/ebuild/Makefile.am b/ebuild/Makefile.am
index b03ae2b..423ca71 100644
--- a/ebuild/Makefile.am
+++ b/ebuild/Makefile.am
@@ -26,6 +26,7 @@ libexecprog_SCRIPTS = \
src_compile.bash \
builtin_fetch.bash \
builtin_merge.bash \
+ builtin_unmerge.bash \
builtin_tidyup.bash \
builtin_strip.bash \
src_install.bash \
diff --git a/ebuild/builtin_merge.bash b/ebuild/builtin_merge.bash
index f7751c7..19104fd 100644
--- a/ebuild/builtin_merge.bash
+++ b/ebuild/builtin_merge.bash
@@ -54,9 +54,14 @@ builtin_merge()
done
[[ -f "${EBUILD}" ]] && cp "${EBUILD}" ${dbdir}/
+ local x
+ for i in ${INHERITED} ; do
+ cp "${ECLASSDIR}/${i}".eclass "${dbdir}/" || die "save eclass ${i} failed"
+ done
+
env | bzip2 > ${dbdir}/environment.bz2
- touch ${dbdir}/CONTENTS || die "pkg db write CONTENTS failed"
+ > ${dbdir}/CONTENTS || die "pkg db write CONTENTS failed"
if [[ -n "${D}" ]] && [[ -d "${D}" ]] ; then
local f ff
find "${D}/" | \
diff --git a/ebuild/builtin_unmerge.bash b/ebuild/builtin_unmerge.bash
new file mode 100644
index 0000000..5d2ffa4
--- /dev/null
+++ b/ebuild/builtin_unmerge.bash
@@ -0,0 +1,122 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.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 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
+
+builtin_unmerge()
+{
+ local dbdir="${ROOT}"/var/db/pkg/"${CATEGORY}/${PF}" entry
+ [[ -d "${dbdir}" ]] || die "couldn't find pkg db directory (\"${dbdir}\")"
+
+ for v in CATEGORY CBUILD CFLAGS CHOST CXXFLAGS DEPEND DESCRIPTION EAPI \
+ FEATURES HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
+ PROVIDE RDEPEND SLOT SRC_URI USE ; do
+ eval "${v}='$(< ${dbdir}/${v} )' || die \"Load key ${v} failed\""
+ done
+
+ sort -r -t ' ' -k 2 < "${dbdir}/CONTENTS" | \
+ while read entry ; do
+ local items=( ${entry} )
+ case ${items[0]} in
+ dir)
+ ;;
+
+ sym)
+ if ! [[ -L "${ROOT}/${items[1]}" ]] ; then
+ echo "skip !type ${items[1]}"
+ elif [[ $(readlink "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
+ echo "skip !dest ${items[1]}"
+ elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[4]}" ]] ; then
+ echo "skip !time ${items[1]}"
+ else
+ echo "remove ${items[1]}"
+ rm -f "${ROOT}/${items[1]}"
+ fi
+ ;;
+
+ obj)
+ if ! [[ -f "${ROOT}/${items[1]}" ]] ; then
+ echo "skip !type ${items[1]}"
+ elif [[ $(md5sum "${ROOT}/${items[1]}" | cut -d' ' -f1 ) != "${items[2]}" ]] ; then
+ echo "skip !md5 ${items[1]}"
+ elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
+ echo "skip !time ${items[1]}"
+ else
+ echo "remove ${items[1]}"
+ rm -f "${ROOT}/${items[1]}"
+ fi
+ ;;
+
+ misc)
+ if [[ -f "${ROOT}/${items[1]}" ]] ; then
+ echo "skip !type ${items[1]}"
+ elif [[ $(stat -c '%Y' "${ROOT}/${items[1]}" ) != "${items[2]}" ]] ; then
+ echo "skip !time ${items[1]}"
+ else
+ echo "remove ${items[1]}"
+ rm -f "${ROOT}/${items[1]}"
+ fi
+ ;;
+
+ *)
+ die "Unknown VDB entry kind '${kind}'"
+ ;;
+ esac
+ done
+
+ shopt -q dotglob
+ local olddotglob=$?
+ shopt -s dotglob
+
+ sort -r -t ' ' -k 2 < "${dbdir}/CONTENTS" | \
+ while read entry ; do
+ local items=( ${entry} )
+ case ${items[0]} in
+ dir)
+ if ! [[ -d "${ROOT}/${items[1]}" ]] ; then
+ echo "skip !type ${items[1]}"
+ elif [[ $(echo "${ROOT}/${items[1]}"/* ) != "${ROOT}/${items[1]}/*" ]] ; then
+ echo "skip !empty ${items[1]}"
+ else
+ echo "remove ${items[1]}"
+ rm -fr "${ROOT}/${items[1]}"
+ fi
+ ;;
+ esac
+ done
+
+ [[ $olddotglob != 0 ]] && shopt -u dotglob
+ shopt -q dotglob
+ [[ $olddotglob == $? ]] || ebuild_notice "warning" "shopt dotglob restore failed"
+
+ rm -fr "${dbdir}"
+}
+
+ebuild_f_unmerge()
+{
+ if hasq "unmerge" ${RESTRICT} ; then
+ ebuild_section "Skipping builtin_unmerge (RESTRICT)"
+ elif hasq "unmerge" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping builtin_unmerge (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting builtin_unmerge"
+ builtin_unmerge
+ ebuild_section "Done builtin_unmerge"
+ fi
+}
+
+
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 810a722..a23040f 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -87,7 +87,9 @@ for var in ${save_vars} ; do
eval "export save_var_${var}='${!var}'"
done
-ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}")
+if [[ -n "${PALUDIS_PROFILE_DIR}" ]] ; then
+ ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}")
+fi
unset ${save_vars}
@@ -134,31 +136,19 @@ ebuild_main()
for action in $@ ; do
case ${action} in
metadata)
- for f in cut tr ; do
- eval "export ebuild_real_${f}=\"$(which $f )\""
- eval "${f}() { ebuild_notice qa 'global scope ${f}' ; $(which $f ) \"\$@\" ; }"
- done
- PATH="" ebuild_load_ebuild "${ebuild}"
ebuild_load_module depend
- ebuild_f_depend || die "${action} failed"
;;
- init|fetch|merge|tidyup|strip)
+ init|fetch|merge|unmerge|tidyup|strip)
ebuild_load_module builtin_${action}
- ebuild_load_ebuild "${ebuild}"
- ebuild_f_${action} || die "${action} failed"
;;
unpack|compile|install|test)
ebuild_load_module src_${action}
- ebuild_load_ebuild "${ebuild}"
- ebuild_f_${action} || die "${action} failed"
;;
setup|config|nofetch|preinst|postinst|prerm|postrm)
ebuild_load_module pkg_${action}
- ebuild_load_ebuild "${ebuild}"
- ebuild_f_${action} || die "${action} failed"
;;
*)
@@ -168,6 +158,23 @@ ebuild_main()
;;
esac
done
+
+ if [[ $1 == metadata ]] ; then
+ for f in cut tr ; do
+ eval "export ebuild_real_${f}=\"$(which $f )\""
+ eval "${f}() { ebuild_notice qa 'global scope ${f}' ; $(which $f ) \"\$@\" ; }"
+ done
+ PATH="" ebuild_load_ebuild "${ebuild}"
+ ebuild_f_depend || die "${1} failed"
+ else
+ ebuild_load_ebuild "${ebuild}"
+ for action in $@ ; do
+ ebuild_f_${action} || die "${action} failed"
+ if [[ ${action} == "init" ]] ; then
+ ebuild_load_ebuild "${ebuild}"
+ fi
+ done
+ fi
}
ebuild_main $@
diff --git a/ebuild/pkg_postrm.bash b/ebuild/pkg_postrm.bash
index 8190200..c0d8f3f 100644
--- a/ebuild/pkg_postrm.bash
+++ b/ebuild/pkg_postrm.bash
@@ -23,5 +23,20 @@
pkg_postrm()
{
+ :
}
+ebuild_f_postrm()
+{
+ if hasq "postrm" ${RESTRICT} ; then
+ ebuild_section "Skipping pkg_postrm (RESTRICT)"
+ elif hasq "postrm" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping pkg_postrm (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting pkg_postrm"
+ pkg_postrm
+ ebuild_section "Done pkg_postrm"
+ fi
+}
+
+
diff --git a/ebuild/pkg_prerm.bash b/ebuild/pkg_prerm.bash
index a725183..5a70f88 100644
--- a/ebuild/pkg_prerm.bash
+++ b/ebuild/pkg_prerm.bash
@@ -23,5 +23,19 @@
pkg_prerm()
{
+ :
+}
+
+ebuild_f_prerm()
+{
+ if hasq "prerm" ${RESTRICT} ; then
+ ebuild_section "Skipping pkg_prerm (RESTRICT)"
+ elif hasq "prerm" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping pkg_prerm (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting pkg_prerm"
+ pkg_prerm
+ ebuild_section "Done pkg_prerm"
+ fi
}