aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-24 21:01:16 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-24 21:01:16 +0000
commit4ea049085d61e47f4c5673958dc8ca2a972a5eda (patch)
tree85dabb1fde835d7891bd7170812c243988728e1a
parente3f04350febc1e7f744e4fe886982369efdaa587 (diff)
downloadpaludis-4ea049085d61e47f4c5673958dc8ca2a972a5eda.tar.gz
paludis-4ea049085d61e47f4c5673958dc8ca2a972a5eda.tar.xz
--checks none|default|always. Fixes: ticket:289
-rw-r--r--paludis/action.se9
-rw-r--r--paludis/action.sr1
-rw-r--r--paludis/repositories/e/eapi_phase.hh1
-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_entries.cc24
-rw-r--r--paludis/tasks/install_task.cc7
-rw-r--r--paludis/tasks/install_task.hh1
-rw-r--r--src/clients/paludis/command_line.cc1
-rw-r--r--src/clients/paludis/command_line.hh4
-rw-r--r--src/clients/paludis/install.cc3
-rwxr-xr-xsrc/clients/paludis/install_TEST8
-rwxr-xr-xsrc/clients/paludis/install_TEST_setup.sh5
-rw-r--r--src/common_args/Makefile.am1
-rw-r--r--src/common_args/checks_arg.cc52
-rw-r--r--src/common_args/checks_arg.hh42
17 files changed, 158 insertions, 10 deletions
diff --git a/paludis/action.se b/paludis/action.se
index a390b0d..7293b20 100644
--- a/paludis/action.se
+++ b/paludis/action.se
@@ -16,3 +16,12 @@ make_enum_InstallActionDebugOption()
END
}
+make_enum_InstallActionChecksOption()
+{
+ prefix iaco
+
+ key iaco_none "No checks"
+ key iaco_default "Checks where they would usually be carried out"
+ key iaco_always "Always use checks"
+}
+
diff --git a/paludis/action.sr b/paludis/action.sr
index cd7a7a8..5e4a4e9 100644
--- a/paludis/action.sr
+++ b/paludis/action.sr
@@ -27,6 +27,7 @@ make_class_InstallActionOptions()
key no_config_protect bool
key debug_build InstallActionDebugOption
+ key checks InstallActionChecksOption
key destination "tr1::shared_ptr<Repository>"
doxygen_comment << "END"
diff --git a/paludis/repositories/e/eapi_phase.hh b/paludis/repositories/e/eapi_phase.hh
index 09f5e39..d850b35 100644
--- a/paludis/repositories/e/eapi_phase.hh
+++ b/paludis/repositories/e/eapi_phase.hh
@@ -51,6 +51,7 @@ namespace paludis
///\{
bool option(const std::string &) const;
+ bool option_contains(const std::string &, const std::string &) const;
typedef libwrapiter::ForwardIterator<EAPIPhase, const std::string> Iterator;
Iterator begin_commands() const;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 0ecb5fd..007fbb9 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -57,7 +57,8 @@ ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
: loadenv setup saveenv ; \
- sandbox userpriv : loadenv unpack compile test saveenv ; \
+ sandbox userpriv : loadenv unpack compile saveenv ; \
+ sandbox userpriv checkphase checks=always : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
prepost : loadenv strip preinst saveenv ; \
merge : ; \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index ffcba08..5692e7e 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -60,7 +60,8 @@ ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
sandbox : loadenv setup saveenv ; \
- sandbox userpriv : loadenv unpack compile test saveenv ; \
+ 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 ; \
merge : ; \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 2b72be9..e287b95 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -59,7 +59,8 @@ ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
sandbox : loadenv setup saveenv ; \
- sandbox userpriv : loadenv unpack compile test saveenv ; \
+ 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 ; \
merge : ; \
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index cff0fe1..fd694f3 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -596,6 +596,30 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
else if ((! phase->option("prepost")) ||
(o.destination->destination_interface && o.destination->destination_interface->want_pre_post_phases()))
{
+ if (phase->option("checkphase"))
+ {
+ switch (o.checks)
+ {
+ case iaco_none:
+ if (! phase->option("checks=none"))
+ continue;
+ break;
+
+ case iaco_default:
+ if (! phase->option("checks=default"))
+ continue;
+ break;
+
+ case iaco_always:
+ if (! phase->option("checks=always"))
+ continue;
+ break;
+
+ case last_iaco:
+ break;
+ }
+ }
+
EbuildCommandParams command_params(EbuildCommandParams::create()
.environment(_imp->params.environment)
.package_id(id)
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 6fe696f..31d69be 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -77,6 +77,7 @@ namespace paludis
InstallActionOptions::create()
.no_config_protect(false)
.debug_build(iado_none)
+ .checks(iaco_default)
.destination(tr1::shared_ptr<Repository>())
),
uninstall_options(false),
@@ -559,6 +560,12 @@ InstallTask::set_debug_mode(const InstallActionDebugOption value)
}
void
+InstallTask::set_checks_mode(const InstallActionChecksOption value)
+{
+ _imp->install_options.checks = value;
+}
+
+void
InstallTask::set_add_to_world_spec(const std::string & value)
{
_imp->add_to_world_spec.reset(new std::string(value));
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index f7bd00d..c94823b 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -66,6 +66,7 @@ namespace paludis
void set_pretend(const bool value);
void set_preserve_world(const bool value);
void set_debug_mode(const InstallActionDebugOption value);
+ void set_checks_mode(const InstallActionChecksOption value);
void set_add_to_world_spec(const std::string &);
void set_safe_resume(const bool);
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 64a5cfe..afb3cda 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -86,6 +86,7 @@ CommandLine::CommandLine() :
"Use this spec, rather than all targets, for updating world (for resume commands)"),
a_no_config_protection(&install_args, "no-config-protection", '\0', "Disable config file protection (dangerous)"),
a_debug_build(&install_args, "debug-build", '\0'),
+ a_checks(&install_args, "checks", '\0'),
a_fetch(&install_args, "fetch", 'f', "Only fetch sources; don't install anything"),
a_no_safe_resume(&install_args, "no-safe-resume", '\0', "Do not allow interrupted downloads to be resumed"),
a_show_reasons(&install_args, "show-reasons", '\0', "Show why packages are being (un)installed",
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index d1abc4c..99c3c59 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -23,6 +23,7 @@
#include <paludis/args/args.hh>
#include <paludis/util/instantiation_policy.hh>
#include <src/common_args/debug_build_arg.hh>
+#include <src/common_args/checks_arg.hh>
#include <src/common_args/log_level_arg.hh>
#include <src/common_args/deps_option_arg.hh>
@@ -203,6 +204,9 @@ class CommandLine :
/// --debug-build
paludis::args::DebugBuildArg a_debug_build;
+ /// --checks
+ paludis::args::ChecksArg a_checks;
+
/// --fetch
paludis::args::SwitchArg a_fetch;
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index afad9a6..14fe000 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -559,6 +559,9 @@ do_install(tr1::shared_ptr<Environment> env)
if (CommandLine::get_instance()->a_debug_build.specified())
task.set_debug_mode(CommandLine::get_instance()->a_debug_build.option());
+ if (CommandLine::get_instance()->a_checks.specified())
+ task.set_checks_mode(CommandLine::get_instance()->a_checks.option());
+
InstallKilledCatcher install_killed_catcher(env, task);
try
diff --git a/src/clients/paludis/install_TEST b/src/clients/paludis/install_TEST
index 1e83e04..aa92938 100755
--- a/src/clients/paludis/install_TEST
+++ b/src/clients/paludis/install_TEST
@@ -8,12 +8,12 @@ PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
--has-version test-category/target && exit 1
-PALUDIS_INSTALL_TEST_DIE_PLEASE=yes \
- PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
- --install target --resume-command-template `pwd`/install_TEST_dir/resume && exit 2
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
+ --install target --resume-command-template `pwd`/install_TEST_dir/resume \
+ --checks always && exit 2
( echo -n './paludis ' ; cut -d ' ' -f2- < install_TEST_dir/resume ) > install_TEST_dir/fixedresume
cat install_TEST_dir/fixedresume
-PALUDIS_HOME=./install_TEST_dir/config/ bash `pwd`/install_TEST_dir/fixedresume || exit 3
+PALUDIS_HOME=./install_TEST_dir/config/ bash `pwd`/install_TEST_dir/fixedresume --checks none || exit 3
./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null || exit 4
grep target install_TEST_dir/root/var/db/pkg/world >/dev/null || exit 5
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
diff --git a/src/clients/paludis/install_TEST_setup.sh b/src/clients/paludis/install_TEST_setup.sh
index 088be44..650e88b 100755
--- a/src/clients/paludis/install_TEST_setup.sh
+++ b/src/clients/paludis/install_TEST_setup.sh
@@ -113,8 +113,6 @@ pkg_setup() {
use userland_test || die "bad use for userland"
use kernel_test || die "bad use for kernel"
use test || die "bad use for arch"
-
- [[ -n "${PALUDIS_INSTALL_TEST_DIE_PLEASE}" ]] && die "told to die"
}
src_unpack() {
@@ -127,10 +125,11 @@ src_unpack() {
src_compile() {
inherit_was_ok || die "inherit didn't work"
+ ./testbin | grep success || die "failure"
}
src_test() {
- ./testbin | grep success || die "failure"
+ die "giant monkey detected"
}
src_install() {
diff --git a/src/common_args/Makefile.am b/src/common_args/Makefile.am
index c3ca076..ee1c6f5 100644
--- a/src/common_args/Makefile.am
+++ b/src/common_args/Makefile.am
@@ -10,6 +10,7 @@ noinst_LIBRARIES = libcommonargs.a
libcommonargs_a_SOURCES = \
do_help.hh \
+ checks_arg.hh checks_arg.cc \
debug_build_arg.hh debug_build_arg.cc \
deps_option_arg.hh deps_option_arg.cc \
log_level_arg.hh log_level_arg.cc
diff --git a/src/common_args/checks_arg.cc b/src/common_args/checks_arg.cc
new file mode 100644
index 0000000..3eb1775
--- /dev/null
+++ b/src/common_args/checks_arg.cc
@@ -0,0 +1,52 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.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 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 "checks_arg.hh"
+#include "do_help.hh"
+
+using namespace paludis;
+using namespace paludis::args;
+
+ChecksArg::ChecksArg(ArgsGroup * const grp, const std::string & ln, char sh) :
+ EnumArg(grp, ln, sh, "Whether to run post-build checks",
+ EnumArgOptions
+ ("none", "Don't run checks, even if they should be run")
+ ("default", "Run checks if they should be run by default")
+ ("always", "Always run checks"),
+ "default")
+{
+}
+
+ChecksArg::~ChecksArg()
+{
+}
+
+InstallActionChecksOption
+ChecksArg::option() const
+{
+ if ("none" == argument())
+ return iaco_none;
+ if ("default" == argument())
+ return iaco_default;
+ if ("always" == argument())
+ return iaco_always;
+
+ throw DoHelp("Bad value for --" + long_name());
+}
+
diff --git a/src/common_args/checks_arg.hh b/src/common_args/checks_arg.hh
new file mode 100644
index 0000000..b3a820d
--- /dev/null
+++ b/src/common_args/checks_arg.hh
@@ -0,0 +1,42 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.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 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_SRC_COMMON_ARGS_CHECKS_ARG_HH
+#define PALUDIS_GUARD_SRC_COMMON_ARGS_CHECKS_ARG_HH 1
+
+#include <paludis/args/args_option.hh>
+#include <paludis/action-fwd.hh>
+
+namespace paludis
+{
+ namespace args
+ {
+ class PALUDIS_VISIBLE ChecksArg :
+ public EnumArg
+ {
+ public:
+ ChecksArg(ArgsGroup * const, const std::string &, char);
+ ~ChecksArg();
+
+ InstallActionChecksOption option() const;
+ };
+ }
+}
+
+#endif