aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-05 10:50:58 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-05 10:50:58 +0000
commitd0508b5817568ca9bbe742bfd848467716edc9ab (patch)
tree927ebd3fa199d63ab5d68b38008f8997c6f253d5 /paludis/repositories
parenta814a9530164c0214a952654a864e0ae516c1f08 (diff)
downloadpaludis-d0508b5817568ca9bbe742bfd848467716edc9ab.tar.gz
paludis-d0508b5817568ca9bbe742bfd848467716edc9ab.tar.xz
Add :*/:= slot support
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc1
-rw-r--r--paludis/repositories/cran/package_dep_spec.cc4
-rw-r--r--paludis/repositories/e/Makefile.am18
-rw-r--r--paludis/repositories/e/dep_parser.se2
-rw-r--r--paludis/repositories/e/e_installed_repository.cc1
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc1
-rw-r--r--paludis/repositories/e/e_repository_sets.cc7
-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/binary_functions.bash2
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash1
-rwxr-xr-xpaludis/repositories/e/ebuild/pipe_functions.bash8
-rwxr-xr-xpaludis/repositories/e/ebuild/write_vdb_entry.bash4
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc1
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.cc217
-rw-r--r--paludis/repositories/e/fix_locked_dependencies.hh41
-rw-r--r--paludis/repositories/e/fix_locked_dependencies_TEST.cc84
-rw-r--r--paludis/repositories/e/package_dep_spec.cc86
-rw-r--r--paludis/repositories/e/package_dep_spec.hh35
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc35
-rw-r--r--paludis/repositories/e/qa/visibility.cc4
-rw-r--r--paludis/repositories/e/qa/visibility_TEST.cc3
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc1
-rw-r--r--paludis/repositories/unpackaged/dep_parser.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc1
-rw-r--r--paludis/repositories/virtuals/package_id.cc3
-rw-r--r--paludis/repositories/virtuals/virtuals_repository_TEST.cc1
28 files changed, 547 insertions, 24 deletions
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 8c8dd4292..842918e31 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -27,6 +27,7 @@
#include <paludis/set_file.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/cran_installed_repository.hh>
diff --git a/paludis/repositories/cran/package_dep_spec.cc b/paludis/repositories/cran/package_dep_spec.cc
index d02cd798c..b193f0a34 100644
--- a/paludis/repositories/cran/package_dep_spec.cc
+++ b/paludis/repositories/cran/package_dep_spec.cc
@@ -90,9 +90,9 @@ namespace
return vr_and;
}
- virtual tr1::shared_ptr<const SlotName> slot_ptr() const
+ virtual tr1::shared_ptr<const SlotRequirement> slot_requirement_ptr() const
{
- return tr1::shared_ptr<const SlotName>();
+ return tr1::shared_ptr<const SlotRequirement>();
}
virtual tr1::shared_ptr<const RepositoryName> repository_ptr() const
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 55b919af8..af44046df 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -72,6 +72,7 @@ paludis_repositories_e_include_HEADERS = \
exndbam_repository.hh \
exndbam_repository-sr.hh \
fetch_visitor.hh \
+ fix_locked_dependencies.hh \
glsa-sr.hh \
glsa.hh \
layout.hh \
@@ -125,6 +126,7 @@ libpaludiserepository_la_SOURCES = \
exndbam_repository.cc \
exheres_layout.cc \
fetch_visitor.cc \
+ fix_locked_dependencies.cc \
glsa.cc \
layout.cc \
make_ebuild_repository.cc \
@@ -302,6 +304,18 @@ source_uri_finder_TEST_LDADD = \
$(top_builddir)/test/libtest.a \
$(DYNAMIC_LD_LIBS)
+fix_locked_dependencies_TEST_SOURCES = fix_locked_dependencies_TEST.cc
+
+fix_locked_dependencies_TEST_LDADD = \
+ libpaludiserepository.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
EXTRA_DIST = \
aa_visitor_TEST.cc \
dep_lexer_TEST.cc \
@@ -340,6 +354,7 @@ EXTRA_DIST = \
fetch_visitor_TEST.cc \
fetch_visitor_TEST_setup.sh \
fetch_visitor_TEST_cleanup.sh \
+ fix_locked_dependencies_TEST.cc \
manifest2_entry.sr \
manifest2_entry-sr.hh \
manifest2_entry-sr.cc \
@@ -507,7 +522,8 @@ TESTS = \
fetch_visitor_TEST \
source_uri_finder_TEST \
exndbam_repository_TEST \
- vdb_repository_TEST
+ vdb_repository_TEST \
+ fix_locked_dependencies_TEST
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/e/dep_parser.se b/paludis/repositories/e/dep_parser.se
index b31560046..81fe33976 100644
--- a/paludis/repositories/e/dep_parser.se
+++ b/paludis/repositories/e/dep_parser.se
@@ -8,6 +8,8 @@ make_enum_PackageDepSpecParseOption()
namespace paludis::erepository
key pdspo_allow_slot_deps "Allow :slot deps"
+ key pdspo_allow_slot_star_deps "Allow :* slot deps"
+ key pdspo_allow_slot_equal_deps "Allow := and :=blah slot deps"
key pdspo_allow_repository_deps "Allow ::repo deps"
key pdspo_allow_square_bracket_deps "Allow [use] and [opver] deps"
key pdspo_allow_tilde_greater_deps "Allow ~> deps"
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 70d11e763..177c0683c 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -41,6 +41,7 @@
#include <paludis/set_file.hh>
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
+#include <paludis/user_dep_spec.hh>
#include <fstream>
using namespace paludis;
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 29b80a146..7313ccb9b 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -39,6 +39,7 @@
#include <paludis/query.hh>
#include <paludis/action.hh>
#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 2f00f0ca8..c876ff565 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2006 Danny van Dyk
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -22,6 +22,7 @@
#include <paludis/repositories/e/e_repository_sets.hh>
#include <paludis/repositories/e/glsa.hh>
#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/package_dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/util/config_file.hh>
@@ -31,6 +32,7 @@
#include <paludis/package_id.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/is_file_with_extension.hh>
@@ -42,6 +44,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <algorithm>
#include <list>
@@ -291,7 +294,7 @@ ERepositorySets::security_set(bool insecurity) const
_imp->environment->package_database()->query(
query::Matches(make_package_dep_spec()
.package(glsa_pkg->name())
- .slot((*c)->slot())) &
+ .slot_requirement(make_shared_ptr(new erepository::ESlotExactRequirement((*c)->slot(), false)))) &
query::SupportsAction<InstallAction>() &
query::NotMasked(),
qo_order_by_version));
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 37eb858ea..3d466b097 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -6,7 +6,8 @@ exported_name = exheres-0
can_be_pbin = true
package_dep_spec_parse_options = allow_slot_deps allow_square_bracket_deps \
- allow_tilde_greater_deps strict_star_operator strict_parsing
+ allow_tilde_greater_deps strict_star_operator strict_parsing \
+ allow_slot_equal_deps allow_slot_star_deps
dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow
iuse_flag_parse_options = strict_parsing
merger_options =
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 32bf92faf..d4335db0c 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -6,7 +6,8 @@ exported_name = paludis-1
can_be_pbin = true
package_dep_spec_parse_options = allow_slot_deps allow_square_bracket_deps \
- allow_repository_deps allow_tilde_greater_deps strict_parsing
+ allow_repository_deps allow_tilde_greater_deps strict_parsing \
+ allow_slot_equal_deps allow_slot_star_deps
dependency_spec_tree_parse_options = disallow_any_use uri_supports_arrow
iuse_flag_parse_options = allow_iuse_defaults
merger_options = rewrite_symlinks allow_empty_dirs
diff --git a/paludis/repositories/e/ebuild/binary_functions.bash b/paludis/repositories/e/ebuild/binary_functions.bash
index 3d05d7803..f1150ae1e 100644
--- a/paludis/repositories/e/ebuild/binary_functions.bash
+++ b/paludis/repositories/e/ebuild/binary_functions.bash
@@ -65,7 +65,7 @@ make_binary_ebuild()
local p
for p in ${PALUDIS_BINARY_FROM_ENV_VARIABLES} ; do
set -o noglob
- local k=${!p}
+ local k=$(paludis_rewrite_var BINARY "${p}" "${!p}" )
k=${k//\\/\\\\}
k=${k//\"/\\\"}
# {"} fix vim syntax highlighting
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index c4b106f4c..1ec733344 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -234,6 +234,7 @@ ebuild_scrub_environment()
unset -f diefunc perform_hook inherit builtin_loadenv builtin_saveenv
unset -f ebuild_safe_source portageq best_version has_version paludis_pipe_command
+ unset -f paludis_rewrite_var
if [[ "${2}" == "--pivot" ]] ; then
unset -f ${PALUDIS_IGNORE_PIVOT_ENV_FUNCTIONS}
diff --git a/paludis/repositories/e/ebuild/pipe_functions.bash b/paludis/repositories/e/ebuild/pipe_functions.bash
index b9dcdee7e..dc9112c8e 100755
--- a/paludis/repositories/e/ebuild/pipe_functions.bash
+++ b/paludis/repositories/e/ebuild/pipe_functions.bash
@@ -71,3 +71,11 @@ paludis_pipe_command()
echo "$rest"
}
+paludis_rewrite_var()
+{
+ [[ "${#@}" -ne 3 ]] && die "$0 should take exactly three args"
+ local r=$(paludis_pipe_command REWRITE_VAR "$EAPI" "$1" "$2" "$3" )
+ echo ${r#*;}
+ return ${r%%;*}
+}
+
diff --git a/paludis/repositories/e/ebuild/write_vdb_entry.bash b/paludis/repositories/e/ebuild/write_vdb_entry.bash
index 1a47cc059..001457412 100755
--- a/paludis/repositories/e/ebuild/write_vdb_entry.bash
+++ b/paludis/repositories/e/ebuild/write_vdb_entry.bash
@@ -117,7 +117,7 @@ main()
local v VDB_FORMAT="paludis-2" COUNTER="$(date +%s )"
for v in ${PALUDIS_VDB_FROM_ENV_VARIABLES} ; do
- if ! echo "${!v}" > "${vdbdir}"/${v} ; then
+ if ! paludis_rewrite_var VDB "${v}" "${!v}" > "${vdbdir}"/${v} ; then
echo "!!! vdb write ${v} failed"
exit 1
fi
@@ -125,7 +125,7 @@ main()
for v in ${PALUDIS_VDB_FROM_ENV_UNLESS_EMPTY_VARIABLES} ; do
[[ -z "${!v}" ]] && continue
- if ! echo "${!v}" > "${vdbdir}"/${v} ; then
+ if ! paludis_rewrite_var VDB "${v}" "${!v}" > "${vdbdir}"/${v} ; then
echo "!!! vdb write ${v} failed"
exit 1
fi
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index 3f5125b26..4aab93318 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -28,6 +28,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/package_database.hh>
#include <paludis/query.hh>
+#include <paludis/user_dep_spec.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <fstream>
diff --git a/paludis/repositories/e/fix_locked_dependencies.cc b/paludis/repositories/e/fix_locked_dependencies.cc
new file mode 100644
index 000000000..90c03cdc7
--- /dev/null
+++ b/paludis/repositories/e/fix_locked_dependencies.cc
@@ -0,0 +1,217 @@
+/* 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/fix_locked_dependencies.hh>
+#include <paludis/repositories/e/package_dep_spec.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/query.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
+#include <paludis/package_id.hh>
+#include <algorithm>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace
+{
+ void cannot_add(const tr1::shared_ptr<const DependencySpecTree::ConstItem> &) PALUDIS_ATTRIBUTE((noreturn));
+
+ void cannot_add(const tr1::shared_ptr<const DependencySpecTree::ConstItem> &)
+ {
+ throw InternalError(PALUDIS_HERE, "Got weird tree");
+ }
+
+ struct Fixer :
+ ConstVisitor<DependencySpecTree>
+ {
+ std::list<std::pair<
+ tr1::shared_ptr<DependencySpecTree::ConstItem>,
+ tr1::function<void (const tr1::shared_ptr<DependencySpecTree::ConstItem> &)> > > stack;
+
+ tr1::shared_ptr<const DependencySpecTree::ConstItem> result;
+
+ const Environment * const env;
+ const EAPI & eapi;
+ const tr1::shared_ptr<const PackageID> id;
+
+ Fixer(const Environment * const e, const EAPI & a, const tr1::shared_ptr<const PackageID> & i) :
+ env(e),
+ eapi(a),
+ id(i)
+ {
+ }
+
+ void visit_sequence(const AllDepSpec & s,
+ DependencySpecTree::ConstSequenceIterator cur,
+ DependencySpecTree::ConstSequenceIterator end)
+ {
+ tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > c(
+ new ConstTreeSequence<DependencySpecTree, AllDepSpec>(
+ tr1::static_pointer_cast<AllDepSpec>(s.clone())));
+
+ if (! stack.empty())
+ stack.begin()->second(c);
+ else
+ result = c;
+
+ using namespace tr1::placeholders;
+ stack.push_front(std::make_pair(c, tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, c.get(), _1)));
+ std::for_each(cur, end, accept_visitor(*this));
+ stack.pop_front();
+ }
+
+ void visit_sequence(const AnyDepSpec & s,
+ DependencySpecTree::ConstSequenceIterator cur,
+ DependencySpecTree::ConstSequenceIterator end)
+ {
+ tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AnyDepSpec> > c(
+ new ConstTreeSequence<DependencySpecTree, AnyDepSpec>(
+ tr1::static_pointer_cast<AnyDepSpec>(s.clone())));
+
+ if (! stack.empty())
+ stack.begin()->second(c);
+ else
+ result = c;
+
+ using namespace tr1::placeholders;
+ stack.push_front(std::make_pair(c, tr1::bind(&ConstTreeSequence<DependencySpecTree, AnyDepSpec>::add, c.get(), _1)));
+ std::for_each(cur, end, accept_visitor(*this));
+ stack.pop_front();
+ }
+
+ void visit_sequence(const ConditionalDepSpec & s,
+ DependencySpecTree::ConstSequenceIterator cur,
+ DependencySpecTree::ConstSequenceIterator end)
+ {
+ tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, ConditionalDepSpec> > c(
+ new ConstTreeSequence<DependencySpecTree, ConditionalDepSpec>(
+ tr1::static_pointer_cast<ConditionalDepSpec>(s.clone())));
+
+ if (! stack.empty())
+ stack.begin()->second(c);
+ else
+ result = c;
+
+ using namespace tr1::placeholders;
+ stack.push_front(std::make_pair(c, tr1::bind(&ConstTreeSequence<DependencySpecTree, ConditionalDepSpec>::add, c.get(), _1)));
+ std::for_each(cur, end, accept_visitor(*this));
+ stack.pop_front();
+ }
+
+ void visit_leaf(const PackageDepSpec & s)
+ {
+ tr1::shared_ptr<TreeLeaf<DependencySpecTree, PackageDepSpec> > c;
+
+ do
+ {
+ if (! s.slot_requirement_ptr())
+ break;
+
+ const SlotAnyLockedRequirement * const r(visitor_cast<const SlotAnyLockedRequirement>(*s.slot_requirement_ptr()));
+ if (! r)
+ break;
+
+ tr1::shared_ptr<const PackageIDSequence> matches(env->package_database()->query(
+ query::Matches(s) & query::InstalledAtRoot(FSEntry("/")), qo_order_by_version));
+ if (matches->empty())
+ break;
+
+ PackageDepSpec new_s(partial_parse_e_package_dep_spec(stringify(s), eapi, id).slot_requirement(
+ make_shared_ptr(new ESlotExactRequirement((*matches->last())->slot(), true))));
+
+ c.reset(new TreeLeaf<DependencySpecTree, PackageDepSpec>(tr1::static_pointer_cast<PackageDepSpec>(
+ PackageDepSpec(new_s).clone())));
+ } while (false);
+
+ if (! c)
+ c.reset(new TreeLeaf<DependencySpecTree, PackageDepSpec>(tr1::static_pointer_cast<PackageDepSpec>(s.clone())));
+
+ if (stack.empty())
+ {
+ stack.push_front(std::make_pair(c, &cannot_add));
+ result = c;
+ }
+ else
+ stack.begin()->second(c);
+ }
+
+ void visit_leaf(const NamedSetDepSpec & s)
+ {
+ tr1::shared_ptr<TreeLeaf<DependencySpecTree, NamedSetDepSpec> > c(
+ new TreeLeaf<DependencySpecTree, NamedSetDepSpec>(tr1::static_pointer_cast<NamedSetDepSpec>(s.clone())));
+
+ if (stack.empty())
+ {
+ stack.push_front(std::make_pair(c, &cannot_add));
+ result = c;
+ }
+ else
+ stack.begin()->second(c);
+ }
+
+ void visit_leaf(const BlockDepSpec & s)
+ {
+ tr1::shared_ptr<TreeLeaf<DependencySpecTree, BlockDepSpec> > c(
+ new TreeLeaf<DependencySpecTree, BlockDepSpec>(tr1::static_pointer_cast<BlockDepSpec>(s.clone())));
+
+ if (stack.empty())
+ {
+ stack.push_front(std::make_pair(c, &cannot_add));
+ result = c;
+ }
+ else
+ stack.begin()->second(c);
+ }
+
+ void visit_leaf(const DependencyLabelsDepSpec & s)
+ {
+ tr1::shared_ptr<TreeLeaf<DependencySpecTree, DependencyLabelsDepSpec> > c(
+ new TreeLeaf<DependencySpecTree, DependencyLabelsDepSpec>(tr1::static_pointer_cast<DependencyLabelsDepSpec>(s.clone())));
+
+ if (stack.empty())
+ {
+ stack.push_front(std::make_pair(c, &cannot_add));
+ result = c;
+ }
+ else
+ stack.begin()->second(c);
+ }
+ };
+}
+
+const tr1::shared_ptr<const DependencySpecTree::ConstItem>
+paludis::erepository::fix_locked_dependencies(
+ const Environment * const env,
+ const EAPI & e, const tr1::shared_ptr<const PackageID> & id,
+ const tr1::shared_ptr<const DependencySpecTree::ConstItem> & b)
+{
+ Fixer f(env, e, id);
+ b->accept(f);
+ return f.result;
+}
+
diff --git a/paludis/repositories/e/fix_locked_dependencies.hh b/paludis/repositories/e/fix_locked_dependencies.hh
new file mode 100644
index 000000000..f41e14770
--- /dev/null
+++ b/paludis/repositories/e/fix_locked_dependencies.hh
@@ -0,0 +1,41 @@
+/* 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_FIX_LOCKED_DEPENDENCIES_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_FIX_LOCKED_DEPENDENCIES_HH 1
+
+#include <paludis/repositories/e/eapi-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/tr1_memory.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/dep_tree.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ const tr1::shared_ptr<const DependencySpecTree::ConstItem> fix_locked_dependencies(
+ const Environment * const env,
+ const EAPI &, const tr1::shared_ptr<const PackageID> &,
+ const tr1::shared_ptr<const DependencySpecTree::ConstItem> &) PALUDIS_VISIBLE;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/fix_locked_dependencies_TEST.cc b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
new file mode 100644
index 000000000..f25ac3de2
--- /dev/null
+++ b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
@@ -0,0 +1,84 @@
+/* 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/fix_locked_dependencies.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/package_database.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace test;
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace test_cases
+{
+ struct FixLockedDependenciesTest : TestCase
+ {
+ FixLockedDependenciesTest() : TestCase("fix locked dependencies") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
+ env.package_database()->add_repository(1, repo);
+ tr1::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
+
+ tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
+ env.package_database()->add_repository(2, installed_repo);
+ installed_repo->add_version("cat", "installed", "1")->set_slot(SlotName("monkey"));
+
+ tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"));
+
+ tr1::shared_ptr<DependencySpecTree::ConstItem> bb(parse_depend(
+ "|| ( foo/bar ( bar/baz oink/squeak ) ) blah/blah", &env, id, *eapi)),
+ aa(fix_locked_dependencies(&env, *eapi, id, bb));
+
+ StringifyFormatter ff;
+ DepSpecPrettyPrinter
+ a(0, tr1::shared_ptr<const PackageID>(), ff, 0, false),
+ b(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ aa->accept(a);
+ bb->accept(b);
+
+ TEST_CHECK_STRINGIFY_EQUAL(a, b);
+
+ tr1::shared_ptr<DependencySpecTree::ConstItem> cc(parse_depend(
+ "foo/bar:= cat/installed:= >=cat/installed-1.2:= <=cat/installed-1.2:=", &env, id, *eapi)),
+ dd(fix_locked_dependencies(&env, *eapi, id, cc));
+
+ DepSpecPrettyPrinter
+ c(0, tr1::shared_ptr<const PackageID>(), ff, 0, false),
+ d(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ cc->accept(c);
+ dd->accept(d);
+
+ TEST_CHECK_STRINGIFY_EQUAL(c, "foo/bar:= cat/installed:= >=cat/installed-1.2:= <=cat/installed-1.2:=");
+ TEST_CHECK_STRINGIFY_EQUAL(d, "foo/bar:= cat/installed:=monkey >=cat/installed-1.2:= <=cat/installed-1.2:=monkey");
+ }
+ } test_fix_locked_dependencies;
+}
+
diff --git a/paludis/repositories/e/package_dep_spec.cc b/paludis/repositories/e/package_dep_spec.cc
index d994fceaf..5ef6c8693 100644
--- a/paludis/repositories/e/package_dep_spec.cc
+++ b/paludis/repositories/e/package_dep_spec.cc
@@ -23,6 +23,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/kc.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
@@ -31,8 +32,9 @@
using namespace paludis;
using namespace paludis::erepository;
-PackageDepSpec
-paludis::erepository::parse_e_package_dep_spec(const std::string & ss, const EAPI & eapi, const tr1::shared_ptr<const PackageID> & id)
+PartiallyMadePackageDepSpec
+paludis::erepository::partial_parse_e_package_dep_spec(
+ const std::string & ss, const EAPI & eapi, const tr1::shared_ptr<const PackageID> & id)
{
Context context("When parsing package dep spec '" + ss + "' with eapi '" + stringify(eapi[k::name()]) + "':");
@@ -229,15 +231,47 @@ paludis::erepository::parse_e_package_dep_spec(const std::string & ss, const EAP
std::string::size_type slot_p;
if (std::string::npos != ((slot_p = s.rfind(':'))))
{
- if (! (*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_allow_slot_deps])
+ std::string match(s.substr(slot_p + 1));
+ if (match.empty())
+ throw PackageDepSpecError("Empty slot dependency specified");
+
+ if ("*" == match)
{
- if ((*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_strict_parsing])
- throw PackageDepSpecError("Slot dependencies not safe for use with this EAPI");
- else
- Log::get_instance()->message(ll_warning, lc_context, "Slot dependencies not safe for use with this EAPI");
+ if (! (*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_allow_slot_star_deps])
+ {
+ if ((*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_strict_parsing])
+ throw PackageDepSpecError("Slot '*' dependencies not safe for use with this EAPI");
+ else
+ Log::get_instance()->message(ll_warning, lc_context, "Slot '*' dependencies not safe for use with this EAPI");
+ }
+ result.slot_requirement(make_shared_ptr(new ESlotAnyUnlockedRequirement));
}
+ else if ('=' == match.at(0))
+ {
+ if (! (*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_allow_slot_equal_deps])
+ {
+ if ((*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_strict_parsing])
+ throw PackageDepSpecError("Slot '=' dependencies not safe for use with this EAPI");
+ else
+ Log::get_instance()->message(ll_warning, lc_context, "Slot '=' dependencies not safe for use with this EAPI");
+ }
- result.slot(SlotName(s.substr(slot_p + 1)));
+ if (1 == match.length())
+ result.slot_requirement(make_shared_ptr(new ESlotAnyLockedRequirement));
+ else
+ result.slot_requirement(make_shared_ptr(new ESlotExactRequirement(SlotName(s.substr(slot_p + 2)), true)));
+ }
+ else
+ {
+ if (! (*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_allow_slot_deps])
+ {
+ if ((*eapi[k::supported()])[k::package_dep_spec_parse_options()][pdspo_strict_parsing])
+ throw PackageDepSpecError("Slot dependencies not safe for use with this EAPI");
+ else
+ Log::get_instance()->message(ll_warning, lc_context, "Slot dependencies not safe for use with this EAPI");
+ }
+ result.slot_requirement(make_shared_ptr(new ESlotExactRequirement(SlotName(s.substr(slot_p + 1)), false)));
+ }
s.erase(slot_p);
}
@@ -352,3 +386,39 @@ paludis::erepository::parse_e_package_dep_spec(const std::string & ss, const EAP
return result;
}
+PackageDepSpec
+paludis::erepository::parse_e_package_dep_spec(const std::string & ss, const EAPI & eapi, const tr1::shared_ptr<const PackageID> & id)
+{
+ return partial_parse_e_package_dep_spec(ss, eapi, id);
+}
+
+ESlotExactRequirement::ESlotExactRequirement(const SlotName & s, const bool e) :
+ _s(s),
+ _e(e)
+{
+}
+
+const std::string
+ESlotExactRequirement::as_string() const
+{
+ return ":" + std::string(_e ? "=" : "") + stringify(_s);
+}
+
+const SlotName
+ESlotExactRequirement::slot() const
+{
+ return _s;
+}
+
+const std::string
+ESlotAnyUnlockedRequirement::as_string() const
+{
+ return ":*";
+}
+
+const std::string
+ESlotAnyLockedRequirement::as_string() const
+{
+ return ":=";
+}
+
diff --git a/paludis/repositories/e/package_dep_spec.hh b/paludis/repositories/e/package_dep_spec.hh
index 64c5f6ece..02f9159fb 100644
--- a/paludis/repositories/e/package_dep_spec.hh
+++ b/paludis/repositories/e/package_dep_spec.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
@@ -23,6 +23,8 @@
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/repositories/e/eapi-fwd.hh>
+#include <paludis/slot_requirement.hh>
+#include <paludis/name.hh>
namespace paludis
{
@@ -30,6 +32,37 @@ namespace paludis
{
PackageDepSpec parse_e_package_dep_spec(const std::string &, const EAPI & eapi,
const tr1::shared_ptr<const PackageID> & id) PALUDIS_VISIBLE;
+
+ PartiallyMadePackageDepSpec partial_parse_e_package_dep_spec(const std::string &, const EAPI & eapi,
+ const tr1::shared_ptr<const PackageID> & id) PALUDIS_VISIBLE;
+
+ class ESlotExactRequirement :
+ public SlotExactRequirement
+ {
+ private:
+ const SlotName _s;
+ const bool _e;
+
+ public:
+ ESlotExactRequirement(const SlotName &, const bool equals);
+
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class ESlotAnyUnlockedRequirement :
+ public SlotAnyUnlockedRequirement
+ {
+ public:
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class ESlotAnyLockedRequirement :
+ public SlotAnyLockedRequirement
+ {
+ public:
+ virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
}
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index f6a4cba5f..1445c6896 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -20,6 +20,9 @@
#include <paludis/repositories/e/pipe_command_handler.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/package_dep_spec.hh>
+#include <paludis/repositories/e/fix_locked_dependencies.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
#include <paludis/util/exception.hh>
@@ -35,6 +38,7 @@
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/stringify_formatter.hh>
#include <vector>
using namespace paludis;
@@ -215,6 +219,37 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "O0;" + stringify(visitor_cast<const MetadataValueKey<FSEntry> >(**key)->value());
}
}
+ else if (tokens[0] == "REWRITE_VAR")
+ {
+ if (tokens.size() < 4)
+ {
+ Log::get_instance()->message(ll_warning, lc_context) << "Got bad REWRITE_VAR pipe command";
+ return "Ebad REWRITE_VAR command";
+ }
+
+ tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(tokens[1]));
+ if (! (*eapi)[k::supported()])
+ return "EREWRITE_VAR EAPI " + tokens[1] + " unsupported";
+
+ std::string var(tokens[2]);
+
+ if ((var == (*(*eapi)[k::supported()])[k::ebuild_metadata_variables()].metadata_build_depend) ||
+ (var == (*(*eapi)[k::supported()])[k::ebuild_metadata_variables()].metadata_run_depend) ||
+ (var == (*(*eapi)[k::supported()])[k::ebuild_metadata_variables()].metadata_pdepend) ||
+ (var == (*(*eapi)[k::supported()])[k::ebuild_metadata_variables()].metadata_dependencies))
+ {
+ tr1::shared_ptr<const DependencySpecTree::ConstItem> before(parse_depend(join(tokens.begin() + 4, tokens.end(), " "),
+ environment, package_id, *eapi));
+ tr1::shared_ptr<const DependencySpecTree::ConstItem> after(fix_locked_dependencies(
+ environment, *eapi, package_id, before));
+ StringifyFormatter ff;
+ DepSpecPrettyPrinter p(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ after->accept(p);
+ return "O0;" + stringify(p);
+ }
+
+ return "O0;" + join(tokens.begin() + 4, tokens.end(), " ");
+ }
else if (tokens[0] == "EVER")
{
if (tokens.size() < 3)
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 586b2834a..f5983b456 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -127,8 +127,8 @@ namespace
tr1::bind(&PartiallyMadePackageDepSpec::version_requirement, &pp, _1));
pp.package(*v->second->package_ptr());
- if (orig_p.slot_ptr())
- pp.slot(*orig_p.slot_ptr());
+ if (orig_p.slot_requirement_ptr())
+ pp.slot_requirement(orig_p.slot_requirement_ptr());
if (orig_p.repository_ptr())
pp.repository(*orig_p.repository_ptr());
diff --git a/paludis/repositories/e/qa/visibility_TEST.cc b/paludis/repositories/e/qa/visibility_TEST.cc
index fa4f3c170..d1b474310 100644
--- a/paludis/repositories/e/qa/visibility_TEST.cc
+++ b/paludis/repositories/e/qa/visibility_TEST.cc
@@ -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
@@ -28,6 +28,7 @@
#include <paludis/qa.hh>
#include <paludis/query.hh>
#include <paludis/package_database.hh>
+#include <paludis/user_dep_spec.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 1a61c2e1a..e5278e271 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/action.hh>
#include <paludis/util/config_file.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/dep_tag.hh>
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 1b963c53d..a44624e0e 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -29,6 +29,7 @@
#include <paludis/util/options.hh>
#include <paludis/query.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
#include <test/test_framework.hh>
diff --git a/paludis/repositories/unpackaged/dep_parser.cc b/paludis/repositories/unpackaged/dep_parser.cc
index 49a9b7272..98b084ebe 100644
--- a/paludis/repositories/unpackaged/dep_parser.cc
+++ b/paludis/repositories/unpackaged/dep_parser.cc
@@ -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
@@ -23,6 +23,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/options.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/user_dep_spec.hh>
#include <list>
using namespace paludis;
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index a7b1e3241..0b15a7383 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -24,6 +24,7 @@
#include <paludis/query.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
+#include <paludis/user_dep_spec.hh>
#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index f508ded44..451fd7f8e 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -38,6 +38,7 @@
#include <paludis/package_database.hh>
#include <paludis/query.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/user_dep_spec.hh>
using namespace paludis;
using namespace paludis::virtuals;
@@ -60,7 +61,7 @@ namespace paludis
make_package_dep_spec()
.package(v->name())
.version_requirement(VersionRequirement(vo_equal, v->version()))
- .slot(v->slot())
+ .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(v->slot())))
.repository(v->repository()->name()))))
:
new TreeLeaf<DependencySpecTree, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(
diff --git a/paludis/repositories/virtuals/virtuals_repository_TEST.cc b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
index 941908d7e..917d00c76 100644
--- a/paludis/repositories/virtuals/virtuals_repository_TEST.cc
+++ b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
@@ -32,6 +32,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/query.hh>
+#include <paludis/user_dep_spec.hh>
using namespace test;
using namespace paludis;