aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-06 16:04:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-06 16:04:20 +0000
commit2592e84abee0edfc7164732b116be430dc822090 (patch)
tree20295a93aec995d9c2462203a593fb71728ea36f /paludis/repositories
parent5433e9197a10f5bdd170fe70aac503e246c0731b (diff)
downloadpaludis-2592e84abee0edfc7164732b116be430dc822090.tar.gz
paludis-2592e84abee0edfc7164732b116be430dc822090.tar.xz
Replace builtin_strip with a common Stripper class. Support stripping when using importare. Fixes: ticket:424
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/e_stripper.cc93
-rw-r--r--paludis/repositories/e/e_stripper.hh59
-rw-r--r--paludis/repositories/e/eapis/0.conf3
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf3
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf3
-rw-r--r--paludis/repositories/e/ebuild.cc26
-rw-r--r--paludis/repositories/e/ebuild.hh1
-rw-r--r--paludis/repositories/e/ebuild/0/Makefile.am1
-rw-r--r--paludis/repositories/e/ebuild/0/builtin_strip.bash86
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash2
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/Makefile.am1
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/builtin_strip.bash91
-rw-r--r--paludis/repositories/e/ebuild_entries.cc37
-rw-r--r--paludis/repositories/e/vdb_merger.cc2
-rw-r--r--paludis/repositories/unpackaged/Makefile.am2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc23
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.cc93
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.hh59
19 files changed, 373 insertions, 214 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index af44046df..d33dbd351 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -58,6 +58,7 @@ paludis_repositories_e_include_HEADERS = \
e_repository_profile.hh \
e_repository_profile_file.hh \
e_repository_sets.hh \
+ e_stripper.hh \
eapi.hh \
eapi-sr.hh \
eapi-fwd.hh \
@@ -115,6 +116,7 @@ libpaludiserepository_la_SOURCES = \
e_repository_profile.cc \
e_repository_profile_file.cc \
e_repository_sets.cc \
+ e_stripper.cc \
eapi.cc \
eapi_phase.cc \
ebuild.cc \
diff --git a/paludis/repositories/e/e_stripper.cc b/paludis/repositories/e/e_stripper.cc
new file mode 100644
index 000000000..1f32d5d49
--- /dev/null
+++ b/paludis/repositories/e/e_stripper.cc
@@ -0,0 +1,93 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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 version 2, as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#include <paludis/repositories/e/e_stripper.hh>
+#include <paludis/util/kc.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <iostream>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<EStripper>
+ {
+ EStripperOptions options;
+
+ Implementation(const EStripperOptions & o) :
+ options(o)
+ {
+ }
+ };
+}
+
+EStripper::EStripper(const EStripperOptions & options) :
+ Stripper(StripperOptions::named_create()
+ (k::image_dir(), options[k::image_dir()])
+ (k::debug_build(), options[k::debug_build()])
+ (k::debug_dir(), options[k::debug_dir()])
+ ),
+ PrivateImplementationPattern<EStripper>(new Implementation<EStripper>(options)),
+ _imp(PrivateImplementationPattern<EStripper>::_imp)
+{
+}
+
+EStripper::~EStripper()
+{
+}
+
+void
+EStripper::on_strip(const FSEntry & f)
+{
+ std::cout << "str " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+EStripper::on_split(const FSEntry & f, const FSEntry & g)
+{
+ std::cout << "spl " << f.strip_leading(_imp->options[k::image_dir()]) <<
+ " -> " << g.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+EStripper::on_unknown(const FSEntry & f)
+{
+ std::cout << "--- " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+EStripper::on_enter_dir(const FSEntry &)
+{
+}
+
+void
+EStripper::on_leave_dir(const FSEntry &)
+{
+}
+
+void
+EStripper::strip()
+{
+ std::cout << ">>> Stripping inside " << _imp->options[k::image_dir()] << std::endl;
+ Stripper::strip();
+}
+
diff --git a/paludis/repositories/e/e_stripper.hh b/paludis/repositories/e/e_stripper.hh
new file mode 100644
index 000000000..14f97ba56
--- /dev/null
+++ b/paludis/repositories/e/e_stripper.hh
@@ -0,0 +1,59 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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 version 2, as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_STRIPPER_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_STRIPPER_HH 1
+
+#include <paludis/stripper.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ typedef kc::KeyedClass<
+ kc::Field<k::package_id, tr1::shared_ptr<const PackageID> >,
+ kc::Field<k::image_dir, FSEntry>,
+ kc::Field<k::debug_dir, FSEntry>,
+ kc::Field<k::debug_build, InstallActionDebugOption>
+ > EStripperOptions;
+
+ class EStripper :
+ public Stripper,
+ private PrivateImplementationPattern<EStripper>
+ {
+ private:
+ PrivateImplementationPattern<EStripper>::ImpPtr & _imp;
+
+ protected:
+ virtual void on_strip(const FSEntry &);
+ virtual void on_split(const FSEntry &, const FSEntry &);
+ virtual void on_enter_dir(const FSEntry &);
+ virtual void on_leave_dir(const FSEntry &);
+ virtual void on_unknown(const FSEntry &);
+
+ public:
+ EStripper(const EStripperOptions &);
+ ~EStripper();
+
+ virtual void strip();
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 68040a257..c5943513d 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -85,7 +85,8 @@ ebuild_install = \
sandbox userpriv : loadenv unpack compile saveenv ; \
sandbox userpriv checkphase checks=always : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
- prepost : loadenv strip preinst saveenv ; \
+ strip : ; \
+ prepost : loadenv preinst saveenv ; \
merge : ; \
prepost : loadenv postinst saveenv ; \
: tidyup
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 3d466b097..cebc5194c 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -90,7 +90,8 @@ ebuild_install = \
sandbox userpriv : loadenv unpack prepare configure compile saveenv ; \
sandbox userpriv checkphase checks=default checks=always : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
- sandbox : loadenv strip preinst saveenv ; \
+ strip : ; \
+ sandbox : loadenv preinst saveenv ; \
merge : ; \
sandbox : loadenv postinst saveenv ; \
: tidyup
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index d4335db0c..9b528115b 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -91,7 +91,8 @@ ebuild_install = \
sandbox userpriv : loadenv unpack compile saveenv ; \
sandbox userpriv checkphase checks=default checks=always : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
- sandbox : loadenv strip preinst saveenv ; \
+ strip : ; \
+ sandbox : loadenv preinst saveenv ; \
merge : ; \
sandbox : loadenv postinst saveenv ; \
: tidyup
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 4e7113641..1b09b740a 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -556,31 +556,6 @@ EbuildInstallCommand::failure()
Command
EbuildInstallCommand::extend_command(const Command & cmd)
{
- std::string debug_build;
- do
- {
- switch (install_params[k::debug_build()])
- {
- case iado_none:
- debug_build = "none";
- continue;
-
- case iado_split:
- debug_build = "split";
- continue;
-
- case iado_internal:
- debug_build = "internal";
- continue;
-
- case last_iado:
- break;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad debug_build value");
- }
- while (false);
-
Command result(Command(cmd)
.with_setenv("A", install_params[k::a()])
.with_setenv("ROOT", install_params[k::root()])
@@ -589,7 +564,6 @@ EbuildInstallCommand::extend_command(const Command & cmd)
.with_setenv("PALUDIS_CONFIG_PROTECT_MASK", install_params[k::config_protect_mask()])
.with_setenv("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
install_params[k::disable_cfgpro()] ? "/" : "")
- .with_setenv("PALUDIS_DEBUG_BUILD", debug_build)
.with_setenv("PALUDIS_PROFILE_DIR", stringify(*install_params[k::profiles()]->begin()))
.with_setenv("PALUDIS_PROFILE_DIRS", join(install_params[k::profiles()]->begin(),
install_params[k::profiles()]->end(), " "))
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 012f9cc3b..d25702b98 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -104,7 +104,6 @@ namespace paludis
kc::Field<k::profiles, tr1::shared_ptr<const FSEntrySequence> >,
kc::Field<k::expand_vars, tr1::shared_ptr<const Map<std::string, std::string> > >,
kc::Field<k::disable_cfgpro, bool>,
- kc::Field<k::debug_build, InstallActionDebugOption>,
kc::Field<k::slot, SlotName>,
kc::Field<k::config_protect, std::string>,
kc::Field<k::config_protect_mask, std::string>,
diff --git a/paludis/repositories/e/ebuild/0/Makefile.am b/paludis/repositories/e/ebuild/0/Makefile.am
index 38b4118c6..4c890d31b 100644
--- a/paludis/repositories/e/ebuild/0/Makefile.am
+++ b/paludis/repositories/e/ebuild/0/Makefile.am
@@ -16,7 +16,6 @@ libexecprog0_SCRIPTS = \
builtin_killoldrm.bash \
builtin_killoldmisc.bash \
builtin_saveenv.bash \
- builtin_strip.bash \
builtin_tidyup.bash \
builtin_tidyuprm.bash \
builtin_tidyupmisc.bash \
diff --git a/paludis/repositories/e/ebuild/0/builtin_strip.bash b/paludis/repositories/e/ebuild/0/builtin_strip.bash
deleted file mode 100644
index 183e05149..000000000
--- a/paludis/repositories/e/ebuild/0/builtin_strip.bash
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006 Ciaran McCreesh
-# Copyright (c) 2006 Stephen Bennett
-#
-# 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, version 2, as published by the Free Software Foundation.
-#
-# 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_strip()
-{
- STRIP=${STRIP:-${CHOST}-strip}
- if ! type -p -- ${STRIP} >/dev/null; then
- STRIP=strip
- fi
- PALUDIS_STRIP_FLAGS=${PALUDIS_STRIP_FLAGS:---strip-unneeded}
-
- if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
- OBJCOPY=${OBJCOPY:-${CHOST}-objcopy}
- if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
- OBJCOPY=objcopy
- fi
- if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
- die "Can't work out what OBJCOPY should be"
- fi
- fi
-
- if [[ -d "${ROOT}/usr/lib" ]] ; then
- LIBDIR=$(basename "$(canonicalise "${ROOT}/usr/lib")")
- else
- LIBDIR="lib"
- fi
-
- for fn in $(find "${D}" -type f \
- \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do
- local ft=$(file "${fn}")
- if [[ $? != 0 || -z ${ft} ]]; then
- return 1
- fi
-
- if [[ ${ft} == *"current ar archive"* ]]; then
- if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
- echo ${STRIP} -g "${fn}"
- ${STRIP} -g "${fn}"
- fi
- elif [[ ${ft} == *"SB executable"* || ${ft} == *"SB shared object"* ]]; then
- if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
- local fd="${D}usr/${LIBDIR}/debug/${fn:${#D}}.debug"
- mkdir -p "$(dirname "${fd}" )"
- echo ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
- ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
- echo ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
- ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
- chmod a-x,o-w "${fd}"
- fi
- if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
- echo ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
- ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
- fi
- fi
- done
-}
-
-ebuild_f_strip()
-{
- if hasq "strip" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_strip (RESTRICT)"
- elif hasq "strip" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_strip (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_strip"
- builtin_strip
- ebuild_section "Done builtin_strip"
- fi
-}
-
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 1ec733344..b6777593e 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -413,7 +413,7 @@ ebuild_main()
for action in $@ ; do
case ${action} in
metadata|variable|init|initmisc|initrm|killold|killoldmisc|killoldrm|merge|\
- unmerge|tidyup|tidyupmisc|tidyuprm|strip|loadenv|saveenv|initbin|\
+ unmerge|tidyup|tidyupmisc|tidyuprm|loadenv|saveenv|initbin|\
unpackbin|infovars|pivotbin|installbin)
ebuild_load_module builtin_${action}
;;
diff --git a/paludis/repositories/e/ebuild/exheres-0/Makefile.am b/paludis/repositories/e/ebuild/exheres-0/Makefile.am
index 3800e3f09..e354d8557 100644
--- a/paludis/repositories/e/ebuild/exheres-0/Makefile.am
+++ b/paludis/repositories/e/ebuild/exheres-0/Makefile.am
@@ -16,7 +16,6 @@ libexecprogexheres_SCRIPTS = \
builtin_killoldrm.bash \
builtin_killoldmisc.bash \
builtin_saveenv.bash \
- builtin_strip.bash \
builtin_tidyup.bash \
builtin_tidyuprm.bash \
builtin_tidyupmisc.bash \
diff --git a/paludis/repositories/e/ebuild/exheres-0/builtin_strip.bash b/paludis/repositories/e/ebuild/exheres-0/builtin_strip.bash
deleted file mode 100644
index 449e3bdfe..000000000
--- a/paludis/repositories/e/ebuild/exheres-0/builtin_strip.bash
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006, 2008 Ciaran McCreesh
-# Copyright (c) 2006 Stephen Bennett
-#
-# 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, version 2, as published by the Free Software Foundation.
-#
-# 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_strip()
-{
- STRIP=${STRIP:-${CHOST}-strip}
- if ! type -p -- ${STRIP} >/dev/null; then
- STRIP=strip
- fi
- PALUDIS_STRIP_FLAGS=${PALUDIS_STRIP_FLAGS:---strip-unneeded}
-
- if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
- OBJCOPY=${OBJCOPY:-${CHOST}-objcopy}
- if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
- OBJCOPY=objcopy
- fi
- if ! type -p -- "${OBJCOPY}" &>/dev/null ; then
- die "Can't work out what OBJCOPY should be"
- fi
- fi
-
- if [[ -d "${ROOT}/usr/lib" ]] ; then
- LIBDIR=$(basename "$(canonicalise "${ROOT}/usr/lib")")
- else
- LIBDIR="lib"
- fi
-
- for fn in $(find "${D}" -type f \
- \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do
- local ft=$(file "${fn}")
- if [[ $? != 0 || -z ${ft} ]]; then
- return 1
- fi
-
- if [[ ${ft} == *"current ar archive"* ]]; then
- if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
- echo ${STRIP} -g "${fn}"
- ${STRIP} -g "${fn}"
- fi
- elif [[ ${ft} == *"SB executable"* || ${ft} == *"SB shared object"* ]]; then
- if [[ "${PALUDIS_DEBUG_BUILD}" == "split" ]] ; then
- local fd="${D}usr/${LIBDIR}/debug/${fn:${#D}}.debug"
- mkdir -p "$(dirname "${fd}" )"
- echo ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
- ${OBJCOPY} --only-keep-debug "${fn}" "${fd}"
- echo ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
- ${OBJCOPY} --add-gnu-debuglink="${fd}" "${fn}"
- chmod a-x,o-w "${fd}"
- fi
- if [[ "${PALUDIS_DEBUG_BUILD}" != "internal" ]] ; then
- echo ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
- ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
- fi
- fi
- done
-}
-
-exheres_internal_strip()
-{
- if hasq "strip" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_strip (RESTRICT)"
- elif hasq "strip" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_strip (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_strip"
- builtin_strip
- ebuild_section "Done builtin_strip"
- fi
-}
-
-ebuild_f_strip()
-{
- exheres_internal_strip ""
-}
-
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index d21550a7c..11895e676 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -28,6 +28,7 @@
#include <paludis/repositories/e/fetch_visitor.hh>
#include <paludis/repositories/e/check_fetched_files_visitor.hh>
#include <paludis/repositories/e/aa_visitor.hh>
+#include <paludis/repositories/e/e_stripper.hh>
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -429,7 +430,7 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
Context context("When installing '" + stringify(*id) + "':");
- bool userpriv_restrict;
+ bool userpriv_restrict, strip_restrict;
{
DepSpecFlattener<RestrictSpecTree, PlainTextDepSpec> restricts(_imp->params.environment);
if (id->restrict_key())
@@ -440,6 +441,12 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
+
+ strip_restrict =
+ indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
+ tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "strip")) ||
+ indirect_iterator(restricts.end()) != std::find_if(indirect_iterator(restricts.begin()), indirect_iterator(restricts.end()),
+ tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nostrip"));
}
std::string archives, all_archives;
@@ -550,6 +557,33 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
(k::options(), (*(*id->eapi())[k::supported()])[k::merger_options()])
);
}
+ else if (phase->option("strip"))
+ {
+ if (! strip_restrict)
+ {
+ std::string libdir("lib");
+ FSEntry root(o[k::destination()]->installed_root_key() ?
+ stringify(o[k::destination()]->installed_root_key()->value()) : "/");
+ if ((root / "usr" / "lib").is_symbolic_link())
+ {
+ libdir = (root / "usr" / "lib").readlink();
+ if (std::string::npos != libdir.find_first_of("./"))
+ libdir = "lib";
+ }
+
+ Log::get_instance()->message(ll_debug, lc_context) << "Using '" << libdir << "' for libdir";
+
+ EStripper stripper(EStripperOptions::named_create()
+ (k::package_id(), id)
+ (k::image_dir(), _imp->params.builddir / stringify(id->name().category) / (stringify(id->name().package) + "-"
+ + stringify(id->version())) / "image")
+ (k::debug_dir(), _imp->params.builddir / stringify(id->name().category) / (stringify(id->name().package) + "-"
+ + stringify(id->version())) / "image" / "usr" / libdir / "debug")
+ (k::debug_build(), o[k::debug_build()])
+ );
+ stripper.strip();
+ }
+ }
else if ((! phase->option("prepost")) ||
((*o[k::destination()])[k::destination_interface()] &&
(*o[k::destination()])[k::destination_interface()]->want_pre_post_phases()))
@@ -605,7 +639,6 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
stringify(o[k::destination()]->installed_root_key()->value()) : "/")
(k::profiles(), _imp->params.profiles)
(k::disable_cfgpro(), o[k::no_config_protect()])
- (k::debug_build(), o[k::debug_build()])
(k::config_protect(), _imp->e_repository->profile_variable("CONFIG_PROTECT"))
(k::config_protect_mask(), _imp->e_repository->profile_variable("CONFIG_PROTECT_MASK"))
(k::loadsaveenv_dir(), _imp->params.builddir / stringify(id->name().category) / (
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index b4f9d39c2..b2af472bc 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -40,8 +40,6 @@
using namespace paludis;
-#include <iostream>
-
namespace paludis
{
template<>
diff --git a/paludis/repositories/unpackaged/Makefile.am b/paludis/repositories/unpackaged/Makefile.am
index 33bd1b908..a3656f9da 100644
--- a/paludis/repositories/unpackaged/Makefile.am
+++ b/paludis/repositories/unpackaged/Makefile.am
@@ -27,6 +27,7 @@ paludis_repositories_unpackaged_include_HEADERS = \
unpackaged_repository.hh \
unpackaged_repository-sr.hh \
unpackaged_key.hh \
+ unpackaged_stripper.hh \
installed_repository.hh \
installed_repository-sr.hh \
installed_id.hh
@@ -38,6 +39,7 @@ libpaludisunpackagedrepository_la_SOURCES = \
unpackaged_id.cc \
unpackaged_repository.cc \
unpackaged_key.cc \
+ unpackaged_stripper.cc \
installed_repository.cc \
installed_id.cc \
registration.cc \
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 594990b42..b3032c746 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -19,6 +19,7 @@
#include <paludis/repositories/unpackaged/unpackaged_id.hh>
#include <paludis/repositories/unpackaged/unpackaged_key.hh>
+#include <paludis/repositories/unpackaged/unpackaged_stripper.hh>
#include <paludis/repositories/unpackaged/dep_parser.hh>
#include <paludis/repositories/unpackaged/dep_printer.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -28,6 +29,7 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/kc.hh>
+#include <paludis/util/log.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_database.hh>
@@ -311,6 +313,27 @@ UnpackagedID::perform_action(Action & action) const
+ "' to destination '" + stringify(install_action->options[k::destination()]->name())
+ "' because destination does not provide destination_interface");
+ std::string libdir("lib");
+ FSEntry root(install_action->options[k::destination()]->installed_root_key() ?
+ stringify(install_action->options[k::destination()]->installed_root_key()->value()) : "/");
+ if ((root / "usr" / "lib").is_symbolic_link())
+ {
+ libdir = (root / "usr" / "lib").readlink();
+ if (std::string::npos != libdir.find_first_of("./"))
+ libdir = "lib";
+ }
+
+ Log::get_instance()->message(ll_debug, lc_context) << "Using '" << libdir << "' for libdir";
+
+ UnpackagedStripper stripper(UnpackagedStripperOptions::named_create()
+ (k::image_dir(), fs_location_key()->value())
+ (k::debug_dir(), fs_location_key()->value() / "usr" / libdir / "debug")
+ (k::debug_build(), install_action->options[k::debug_build()])
+ (k::package_id(), shared_from_this())
+ );
+
+ stripper.strip();
+
(*install_action->options[k::destination()])[k::destination_interface()]->merge(
MergeParams::named_create()
(k::package_id(), shared_from_this())
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.cc b/paludis/repositories/unpackaged/unpackaged_stripper.cc
new file mode 100644
index 000000000..670c2377f
--- /dev/null
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.cc
@@ -0,0 +1,93 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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 version 2, as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#include <paludis/repositories/unpackaged/unpackaged_stripper.hh>
+#include <paludis/util/kc.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <iostream>
+
+using namespace paludis;
+using namespace paludis::unpackaged_repositories;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<UnpackagedStripper>
+ {
+ UnpackagedStripperOptions options;
+
+ Implementation(const UnpackagedStripperOptions & o) :
+ options(o)
+ {
+ }
+ };
+}
+
+UnpackagedStripper::UnpackagedStripper(const UnpackagedStripperOptions & options) :
+ Stripper(StripperOptions::named_create()
+ (k::image_dir(), options[k::image_dir()])
+ (k::debug_build(), options[k::debug_build()])
+ (k::debug_dir(), options[k::debug_dir()])
+ ),
+ PrivateImplementationPattern<UnpackagedStripper>(new Implementation<UnpackagedStripper>(options)),
+ _imp(PrivateImplementationPattern<UnpackagedStripper>::_imp)
+{
+}
+
+UnpackagedStripper::~UnpackagedStripper()
+{
+}
+
+void
+UnpackagedStripper::on_strip(const FSEntry & f)
+{
+ std::cout << "str " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+UnpackagedStripper::on_split(const FSEntry & f, const FSEntry & g)
+{
+ std::cout << "spl " << f.strip_leading(_imp->options[k::image_dir()]) <<
+ " -> " << g.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+UnpackagedStripper::on_unknown(const FSEntry & f)
+{
+ std::cout << "--- " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+}
+
+void
+UnpackagedStripper::on_enter_dir(const FSEntry &)
+{
+}
+
+void
+UnpackagedStripper::on_leave_dir(const FSEntry &)
+{
+}
+
+void
+UnpackagedStripper::strip()
+{
+ std::cout << ">>> Stripping inside " << _imp->options[k::image_dir()] << std::endl;
+ Stripper::strip();
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.hh b/paludis/repositories/unpackaged/unpackaged_stripper.hh
new file mode 100644
index 000000000..5cb0474da
--- /dev/null
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.hh
@@ -0,0 +1,59 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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 version 2, as published by the Free Software Foundation.
+ *
+ * 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_UNPACKAGED_STRIPPER_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_UNPACKAGED_STRIPPER_HH 1
+
+#include <paludis/stripper.hh>
+
+namespace paludis
+{
+ namespace unpackaged_repositories
+ {
+ typedef kc::KeyedClass<
+ kc::Field<k::package_id, tr1::shared_ptr<const PackageID> >,
+ kc::Field<k::image_dir, FSEntry>,
+ kc::Field<k::debug_dir, FSEntry>,
+ kc::Field<k::debug_build, InstallActionDebugOption>
+ > UnpackagedStripperOptions;
+
+ class UnpackagedStripper :
+ public Stripper,
+ private PrivateImplementationPattern<UnpackagedStripper>
+ {
+ private:
+ PrivateImplementationPattern<UnpackagedStripper>::ImpPtr & _imp;
+
+ protected:
+ virtual void on_strip(const FSEntry &);
+ virtual void on_split(const FSEntry &, const FSEntry &);
+ virtual void on_enter_dir(const FSEntry &);
+ virtual void on_leave_dir(const FSEntry &);
+ virtual void on_unknown(const FSEntry &);
+
+ public:
+ UnpackagedStripper(const UnpackagedStripperOptions &);
+ ~UnpackagedStripper();
+
+ virtual void strip();
+ };
+ }
+}
+
+#endif