aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 15:54:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 15:42:26 +0000
commit53a91d350edc930f20aadac42c2c848cb3c2a5a8 (patch)
tree5ef16ff6ca33cc5680f653af54033c8b93f46e23
parent13949d19fce22dcbe24649993dcb2589cfd2f494 (diff)
downloadpaludis-53a91d350edc930f20aadac42c2c848cb3c2a5a8.tar.gz
paludis-53a91d350edc930f20aadac42c2c848cb3c2a5a8.tar.xz
Skip certain skippable phases
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/can_skip_phase.cc44
-rw-r--r--paludis/repositories/e/can_skip_phase.hh36
-rw-r--r--paludis/repositories/e/eapi_phase.cc11
-rw-r--r--paludis/repositories/e/eapi_phase.hh4
-rw-r--r--paludis/repositories/e/eapis/0.conf8
-rw-r--r--paludis/repositories/e/eapis/2.conf8
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf8
-rw-r--r--paludis/repositories/e/eapis/kdebuild-1.conf8
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf10
-rw-r--r--paludis/repositories/e/ebuild_entries.cc11
-rwxr-xr-xpaludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh3
-rw-r--r--paludis/repositories/e/exndbam_repository.cc8
-rw-r--r--paludis/repositories/e/vdb_repository.cc8
-rw-r--r--ruby/package_id_TEST.rb2
15 files changed, 147 insertions, 24 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index a08b3d1..2faf59b 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -26,6 +26,7 @@ libpaludiserepository_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_
paludis_repositories_e_include_HEADERS = \
aa_visitor.hh \
+ can_skip_phase.hh \
check_fetched_files_visitor.hh \
dep_parser.hh \
dep_parser-se.hh \
@@ -86,6 +87,7 @@ paludis_repositories_e_include_HEADERS = \
libpaludiserepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
aa_visitor.cc \
+ can_skip_phase.cc \
check_fetched_files_visitor.cc \
dep_parser.cc \
dep_spec_pretty_printer.cc \
diff --git a/paludis/repositories/e/can_skip_phase.cc b/paludis/repositories/e/can_skip_phase.cc
new file mode 100644
index 0000000..e82907a
--- /dev/null
+++ b/paludis/repositories/e/can_skip_phase.cc
@@ -0,0 +1,44 @@
+/* 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/can_skip_phase.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/metadata_key.hh>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+bool
+paludis::erepository::can_skip_phase(const std::tr1::shared_ptr<const ERepositoryID> & id,
+ const EAPIPhase & phase)
+{
+ if (! id->defined_phases_key())
+ return false;
+
+ std::string skipifno(phase.equal_option("skipifno"));
+ if (skipifno.empty())
+ return false;
+
+ if (id->defined_phases_key()->value()->end() != id->defined_phases_key()->value()->find(skipifno))
+ return false;
+
+ return true;
+}
+
diff --git a/paludis/repositories/e/can_skip_phase.hh b/paludis/repositories/e/can_skip_phase.hh
new file mode 100644
index 0000000..a4d47ea
--- /dev/null
+++ b/paludis/repositories/e/can_skip_phase.hh
@@ -0,0 +1,36 @@
+/* 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_CAN_SKIP_PHASE_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_CAN_SKIP_PHASE_HH 1
+
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/eapi_phase.hh>
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ bool can_skip_phase(const std::tr1::shared_ptr<const ERepositoryID> & id,
+ const EAPIPhase &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/eapi_phase.cc b/paludis/repositories/e/eapi_phase.cc
index dfdbfb4..2de0e77 100644
--- a/paludis/repositories/e/eapi_phase.cc
+++ b/paludis/repositories/e/eapi_phase.cc
@@ -77,6 +77,17 @@ EAPIPhase::option(const std::string & s) const
return _imp->options.count(s);
}
+std::string
+EAPIPhase::equal_option(const std::string & s) const
+{
+ for (std::set<std::string>::const_iterator i(_imp->options.begin()), i_end(_imp->options.end()) ;
+ i != i_end ; ++i)
+ if (0 == i->compare(0, s.length() + 1, s + "="))
+ return i->substr(s.length() + 1);
+
+ return "";
+}
+
EAPIPhase::ConstIterator
EAPIPhase::begin_commands() const
{
diff --git a/paludis/repositories/e/eapi_phase.hh b/paludis/repositories/e/eapi_phase.hh
index 011e8a8..a1ebebc 100644
--- a/paludis/repositories/e/eapi_phase.hh
+++ b/paludis/repositories/e/eapi_phase.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -51,7 +51,7 @@ namespace paludis
///\{
bool option(const std::string &) const;
- bool option_contains(const std::string &, const std::string &) const;
+ std::string equal_option(const std::string &) const;
struct ConstIteratorTag;
typedef WrappedForwardIterator<ConstIteratorTag, const std::string> ConstIterator;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 0b360d1..389f6ce 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -103,14 +103,14 @@ ebuild_functions = \
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
- : loadenv setup saveenv ; \
+ skipifno=setup : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
sandbox userpriv optional_tests : loadenv test saveenv ; \
- sandbox : loadenv install saveenv ; \
+ skipifno=install sandbox : loadenv install saveenv ; \
strip : ; \
- prepost : loadenv preinst saveenv ; \
+ skipifno=preinst prepost : loadenv preinst saveenv ; \
merge : ; \
- prepost : loadenv postinst saveenv ; \
+ skipifno=postinst prepost : loadenv postinst saveenv ; \
: tidyup
ebuild_uninstall = \
diff --git a/paludis/repositories/e/eapis/2.conf b/paludis/repositories/e/eapis/2.conf
index 58927f6..111769b 100644
--- a/paludis/repositories/e/eapis/2.conf
+++ b/paludis/repositories/e/eapis/2.conf
@@ -14,14 +14,14 @@ ebuild_functions = ${ebuild_functions} src_prepare src_configure
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
- : loadenv setup saveenv ; \
+ skipifno=setup : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack prepare configure compile saveenv ; \
sandbox userpriv optional_tests : loadenv test saveenv ; \
- sandbox : loadenv install saveenv ; \
+ skipifno=install sandbox : loadenv install saveenv ; \
strip : ; \
- prepost : loadenv preinst saveenv ; \
+ skipifno=preinst prepost : loadenv preinst saveenv ; \
merge : ; \
- prepost : loadenv postinst saveenv ; \
+ skipifno=postinst prepost : loadenv postinst saveenv ; \
: tidyup
ebuild_new_upgrade_phase_order = true
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 89b0d68..743ea7b 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -106,14 +106,14 @@ ebuild_functions = \
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
- sandbox : loadenv setup saveenv ; \
+ skipifno=setup sandbox : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack prepare configure compile saveenv ; \
sandbox userpriv recommended_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
- sandbox : loadenv preinst saveenv ; \
+ skipifno=preinst sandbox : loadenv preinst saveenv ; \
merge : ; \
- sandbox : loadenv postinst saveenv ; \
+ skipifno=postinst sandbox : loadenv postinst saveenv ; \
: tidyup
ebuild_uninstall = \
@@ -124,7 +124,7 @@ ebuild_uninstall = \
: tidyuprm
ebuild_pretend = \
- sandbox userpriv : pretend
+ skipifno=pretend sandbox userpriv : pretend
ebuild_bad_options = \
sandbox userpriv : bad_options
diff --git a/paludis/repositories/e/eapis/kdebuild-1.conf b/paludis/repositories/e/eapis/kdebuild-1.conf
index 62eff92..fea0b58 100644
--- a/paludis/repositories/e/eapis/kdebuild-1.conf
+++ b/paludis/repositories/e/eapis/kdebuild-1.conf
@@ -28,14 +28,14 @@ flat_list_minimum_size = -1
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
- : loadenv setup saveenv ; \
+ skipifno=setup : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
sandbox userpriv recommended_tests : loadenv test saveenv ; \
- sandbox : loadenv install saveenv ; \
+ skipifno=install sandbox : loadenv install saveenv ; \
strip : ; \
- prepost : loadenv preinst saveenv ; \
+ skipifno=preinst prepost : loadenv preinst saveenv ; \
merge : ; \
- prepost : loadenv postinst saveenv ; \
+ skipifno=postinst prepost : loadenv postinst saveenv ; \
: tidyup
ebuild_info = \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 02a39c6..be0e4ab 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -105,14 +105,14 @@ ebuild_functions = \
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
- sandbox : loadenv setup saveenv ; \
+ skipifno=setup sandbox : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
sandbox userpriv recommended_tests : loadenv test saveenv ; \
- sandbox : loadenv install saveenv ; \
+ skipifno=install sandbox : loadenv install saveenv ; \
strip : ; \
- sandbox : loadenv preinst saveenv ; \
+ skipifno=preinst sandbox : loadenv preinst saveenv ; \
merge : ; \
- sandbox : loadenv postinst saveenv ; \
+ skipifno=postinst sandbox : loadenv postinst saveenv ; \
: tidyup
ebuild_uninstall = \
@@ -123,7 +123,7 @@ ebuild_uninstall = \
: tidyuprm
ebuild_pretend = \
- sandbox userpriv : pretend
+ skipifno=pretend sandbox userpriv : pretend
ebuild_info = \
: killoldmisc ; \
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 79d92fa..eb06176 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -31,6 +31,7 @@
#include <paludis/repositories/e/aa_visitor.hh>
#include <paludis/repositories/e/e_stripper.hh>
#include <paludis/repositories/e/myoptions_requirements_verifier.hh>
+#include <paludis/repositories/e/can_skip_phase.hh>
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -57,6 +58,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
+#include <iostream>
#include <fstream>
#include <list>
#include <set>
@@ -621,6 +623,12 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ if (can_skip_phase(id, *phase))
+ {
+ std::cout << "No need to do anything for " << phase->equal_option("skipifno") << " phase" << std::endl;
+ continue;
+ }
+
if (phase->option("merge"))
{
if (! (*o.destination()).destination_interface())
@@ -1031,6 +1039,9 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ if (can_skip_phase(id, *phase))
+ continue;
+
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
value_for<n::builddir>(_imp->params.builddir()),
value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
index 93368c0..fb94a78 100755
--- a/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache_TEST_setup.sh
@@ -1094,6 +1094,7 @@ DESCRIPTION=A nice package
KEYWORDS=test
IUSE=bar
EAPI=0
+DEFINED_PHASES=-
END
cat <<END > cache/expected/cat/write-eclasses-1
@@ -1108,6 +1109,7 @@ DESCRIPTION=A nice package
KEYWORDS=test
IUSE=bar quux
EAPI=0
+DEFINED_PHASES=-
END
cat <<END > cache/expected/cat/write-exlibs-1
@@ -1121,5 +1123,6 @@ SUMMARY=A nice package
PLATFORMS=test
MYOPTIONS=bar quux
EAPI=exheres-0
+DEFINED_PHASES=-
END
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 3a1229c..0720760 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/extra_distribution_data.hh>
+#include <paludis/repositories/e/can_skip_phase.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/log.hh>
@@ -45,6 +46,7 @@
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
#include <tr1/functional>
+#include <iostream>
#include <fstream>
using namespace paludis;
@@ -443,6 +445,12 @@ ExndbamRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositor
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ if (can_skip_phase(id, *phase))
+ {
+ std::cout << "No need to do anything for " << phase->equal_option("skipifno") << " phase" << std::endl;
+ continue;
+ }
+
if (phase->option("unmerge"))
{
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb, supplement with env */
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index d50e4ef..f97ec5d 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -28,6 +28,7 @@
#include <paludis/repositories/e/e_repository_params.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/extra_distribution_data.hh>
+#include <paludis/repositories/e/can_skip_phase.hh>
#include <paludis/action.hh>
#include <paludis/util/config_file.hh>
@@ -73,6 +74,7 @@
#include <tr1/unordered_map>
#include <tr1/functional>
#include <fstream>
+#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
@@ -414,6 +416,12 @@ VDBRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositoryID>
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ if (can_skip_phase(id, *phase))
+ {
+ std::cout << "No need to do anything for " << phase->equal_option("skipifno") << " phase" << std::endl;
+ continue;
+ }
+
if (phase->option("unmerge"))
{
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb, supplement with env */
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 456ebf9..8590315 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -159,7 +159,7 @@ module Paludis
keys = { "DESCRIPTION" => 1, "INHERITED" => 1, "KEYWORDS" => 1, "EAPI" => 1, "repository_mask" => 1,
"profile_mask" => 1, "DEPEND" => 1, "RDEPEND" => 1, "PDEPEND" => 1, "LICENSE" => 1, "PROVIDE" => 1,
"RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1, "EBUILD" => 1, "PROPERTIES" => 1, "IUSE" => 1,
- "PALUDIS_CHOICES" => 1 }
+ "PALUDIS_CHOICES" => 1, "DEFINED_PHASES" => 1 }
pid_testrepo.each_metadata do | key |
assert keys.has_key?(key.raw_name), "no key #{key.raw_name}"
keys.delete key.raw_name