Revert the package dep spec changes
This commit is contained in:
parent
80bf4ad14b
commit
e525718611
1
.gitignore
vendored
1
.gitignore
vendored
@ -265,7 +265,6 @@ paludis-*.*.*.tar.bz2
|
||||
/paludis/ihateautomake.cc
|
||||
/paludis/name_TEST
|
||||
/paludis/paludis.hh
|
||||
/paludis/partially_made_package_dep_spec_TEST
|
||||
/paludis/repositories/accounts/accounts_repository_TEST
|
||||
/paludis/repositories/e/aa_visitor_TEST
|
||||
/paludis/repositories/e/dep_parser_TEST
|
||||
|
@ -59,39 +59,85 @@ int main(int argc, char * argv[])
|
||||
/* Display information about the PackageDepSpec. */
|
||||
cout << "Information about '" << spec << "':" << endl;
|
||||
|
||||
if (spec.package_name_requirement())
|
||||
cout << " " << left << setw(24) << "Package:" << " " << spec.package_name_requirement()->name() << endl;
|
||||
if (spec.package_ptr())
|
||||
cout << " " << left << setw(24) << "Package:" << " " << *spec.package_ptr() << endl;
|
||||
|
||||
if (spec.category_name_part_requirement())
|
||||
cout << " " << left << setw(24) << "Category part:" << " " << spec.category_name_part_requirement()->name_part() << endl;
|
||||
if (spec.category_name_part_ptr())
|
||||
cout << " " << left << setw(24) << "Category part:" << " " << *spec.category_name_part_ptr() << endl;
|
||||
|
||||
if (spec.package_name_part_requirement())
|
||||
cout << " " << left << setw(24) << "Package part:" << " " << spec.package_name_part_requirement()->name_part() << endl;
|
||||
if (spec.package_name_part_ptr())
|
||||
cout << " " << left << setw(24) << "Package part:" << " " << *spec.package_name_part_ptr() << endl;
|
||||
|
||||
if (spec.exact_slot_requirement())
|
||||
cout << " " << left << setw(24) << "Slot:" << " " << spec.exact_slot_requirement()->name() << endl;
|
||||
if (spec.version_requirements_ptr() && ! spec.version_requirements_ptr()->empty())
|
||||
{
|
||||
cout << " " << left << setw(24) << "Version requirements:" << " ";
|
||||
bool need_join(false);
|
||||
for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
|
||||
r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
{
|
||||
if (need_join)
|
||||
{
|
||||
switch (spec.version_requirements_mode())
|
||||
{
|
||||
case vr_and:
|
||||
cout << " and ";
|
||||
break;
|
||||
|
||||
if (spec.in_repository_requirement())
|
||||
case vr_or:
|
||||
cout << " or ";
|
||||
break;
|
||||
|
||||
case last_vr:
|
||||
throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
|
||||
}
|
||||
}
|
||||
|
||||
cout << r->version_operator() << r->version_spec();
|
||||
need_join = true;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
if (spec.slot_requirement_ptr())
|
||||
cout << " " << left << setw(24) << "Slot:" << " " << *spec.slot_requirement_ptr() << endl;
|
||||
|
||||
if (spec.in_repository_ptr())
|
||||
cout << " " << left << setw(24) << "In repository:" << " " <<
|
||||
spec.in_repository_requirement()->name() << endl;
|
||||
*spec.in_repository_ptr() << endl;
|
||||
|
||||
if (spec.from_repository_requirement())
|
||||
if (spec.from_repository_ptr())
|
||||
cout << " " << left << setw(24) << "From repository:" << " " <<
|
||||
spec.from_repository_requirement()->name() << endl;
|
||||
*spec.from_repository_ptr() << endl;
|
||||
|
||||
if (spec.installed_at_path_requirement())
|
||||
if (spec.installed_at_path_ptr())
|
||||
cout << " " << left << setw(24) << "Installed at path:" << " " <<
|
||||
spec.installed_at_path_requirement()->path() << endl;
|
||||
*spec.installed_at_path_ptr() << endl;
|
||||
|
||||
if (spec.installable_to_path_requirement())
|
||||
if (spec.installable_to_path_ptr())
|
||||
cout << " " << left << setw(24) << "Installable to path:" << " " <<
|
||||
spec.installable_to_path_requirement()->path() << ", " <<
|
||||
spec.installable_to_path_requirement()->include_masked() << endl;
|
||||
spec.installable_to_path_ptr()->path() << ", " <<
|
||||
spec.installable_to_path_ptr()->include_masked() << endl;
|
||||
|
||||
if (spec.installable_to_repository_requirement())
|
||||
if (spec.installable_to_repository_ptr())
|
||||
cout << " " << left << setw(24) << "Installable to repository:" << " " <<
|
||||
spec.installable_to_repository_requirement()->name() << ", " <<
|
||||
spec.installable_to_repository_requirement()->include_masked() << endl;
|
||||
spec.installable_to_repository_ptr()->repository() << ", " <<
|
||||
spec.installable_to_repository_ptr()->include_masked() << endl;
|
||||
|
||||
if (spec.additional_requirements_ptr() && ! spec.additional_requirements_ptr()->empty())
|
||||
{
|
||||
cout << " " << left << setw(24) << "Additional requirements:" << " ";
|
||||
bool need_join(false);
|
||||
for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
|
||||
u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
|
||||
{
|
||||
if (need_join)
|
||||
cout << " and ";
|
||||
|
||||
cout << (*u)->as_raw_string() + " (meaning: " + (*u)->as_human_string(make_null_shared_ptr()) + ")";
|
||||
need_join = true;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
/* And display packages matching that spec */
|
||||
cout << " " << left << setw(24) << "Matches:" << " ";
|
||||
|
@ -54,7 +54,7 @@ int main(int argc, char * argv[])
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
/* Is it paludis? */
|
||||
if (match_package(*env, MutablePackageDepSpecData({ }).require_package(
|
||||
if (match_package(*env, make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), *i, make_null_shared_ptr(), { }))
|
||||
cout << left << setw(50) << (stringify(**i) + ":") << " " << "paludis" << endl;
|
||||
|
||||
|
@ -62,13 +62,13 @@ int main(int argc, char * argv[])
|
||||
* object used determines the number and ordering of results. In the
|
||||
* simplest form, it takes a Generator as a parameter. */
|
||||
show_selection(env, selection::AllVersionsSorted(
|
||||
generator::Matches(MutablePackageDepSpecData({ }).require_package(
|
||||
generator::Matches(make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { })));
|
||||
|
||||
/* Generators can be passed through a Filter. The Selection optimises
|
||||
* the code internally to avoid doing excess work. */
|
||||
show_selection(env, selection::AllVersionsSorted(
|
||||
generator::Matches(MutablePackageDepSpecData({ }).require_package(
|
||||
generator::Matches(make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
|
||||
filter::InstalledAtSlash()));
|
||||
|
||||
@ -76,7 +76,7 @@ int main(int argc, char * argv[])
|
||||
* with filter::SupportsAction<InstallAction>, since installed packages
|
||||
* aren't masked. */
|
||||
show_selection(env, selection::AllVersionsSorted(
|
||||
generator::Matches(MutablePackageDepSpecData({ }).require_package(
|
||||
generator::Matches(make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
|
||||
filter::SupportsAction<InstallAction>() |
|
||||
filter::NotMasked()));
|
||||
@ -85,7 +85,7 @@ int main(int argc, char * argv[])
|
||||
* is no metadata cache. Consider using other Selection objects if
|
||||
* you only need the best matching or some arbitrary matching ID. */
|
||||
show_selection(env, selection::BestVersionOnly(
|
||||
generator::Matches(MutablePackageDepSpecData({ }).require_package(
|
||||
generator::Matches(make_package_dep_spec({ }).package(
|
||||
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
|
||||
filter::SupportsAction<InstallAction>() |
|
||||
filter::NotMasked()));
|
||||
|
@ -40,16 +40,15 @@ the following order:</p>
|
||||
<li><code>[.key?]</code>: Match only if the specified metadata key exists. <code>key</code> may be a key's raw
|
||||
name (e.g. <code>DESCRIPTION</code>, <code>DEPEND</code>) or a role prefixed with a dollar sign (e.g.
|
||||
<code>$short_description</code>, <code>$build_dependencies</code>). If the key's name is prefixed with
|
||||
<code>::</code>, metadata from the repository rather than the package ID is checked. If the key is in
|
||||
<code>(parens)</code>, matches masks by role, token or associated key (and <code>(*)</code> matches any mask).</li>
|
||||
<code>::</code>, metadata from the repository rather than the package ID is checked.</li>
|
||||
|
||||
<li><code>[.key=value]</code>: Match only if the specified metadata key has a particular exact value. Only works for
|
||||
simple values, sets and sequences, not spec trees and other complex compound keys. If <code><</code> is used in
|
||||
place of <code>=</code>, for numeric values a less-than comparison is used, and for sets, sequences and spec trees,
|
||||
a match occurs if any member of the set or sequence is equal to the value. If <code>></code> is used,
|
||||
for numeric values a greater-than comparison is used; it does not match for other types of values. If <code>~</code>
|
||||
is used, a substring match is performed. As above, the key may be a raw name or a dollar-prefixed role name, and
|
||||
may be prefixed with <code>::</code> for checking repository metadata.</li>
|
||||
a match occurs if any member of the set or sequence is equal to the value. Similarly if <code>></code> is used,
|
||||
for numeric values a greater-than comparison is used; it does not match for other types of values. As above, the key
|
||||
may be a raw name or a dollar-prefixed role name, and may be prefixed with <code>::</code> for checking repository
|
||||
metadata.</li>
|
||||
</ul>
|
||||
|
||||
<p>Repository requirements are in the form <code>to</code>, <code>from-></code> or <code>::from->to</code>. The
|
||||
|
48
paludis/additional_package_dep_spec_requirement-fwd.hh
Normal file
48
paludis/additional_package_dep_spec_requirement-fwd.hh
Normal file
@ -0,0 +1,48 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH 1
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/sequence-fwd.hh>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class AdditionalPackageDepSpecRequirement;
|
||||
|
||||
/**
|
||||
* An AdditionalPackageDepSpecRequirement can be written to an ostream.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
std::ostream & operator<< (std::ostream &, const AdditionalPackageDepSpecRequirement &) PALUDIS_VISIBLE;
|
||||
|
||||
/**
|
||||
* A collection of additional requirements for a PackageDepSpec.
|
||||
*
|
||||
* \since 0.26
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
typedef Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> > AdditionalPackageDepSpecRequirements;
|
||||
}
|
||||
|
||||
#endif
|
38
paludis/additional_package_dep_spec_requirement.cc
Normal file
38
paludis/additional_package_dep_spec_requirement.cc
Normal file
@ -0,0 +1,38 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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/additional_package_dep_spec_requirement.hh>
|
||||
#include <paludis/util/sequence-impl.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator-impl.hh>
|
||||
#include <ostream>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
AdditionalPackageDepSpecRequirement::~AdditionalPackageDepSpecRequirement() = default;
|
||||
|
||||
std::ostream &
|
||||
paludis::operator<< (std::ostream & s, const AdditionalPackageDepSpecRequirement & a)
|
||||
{
|
||||
s << a.as_raw_string();
|
||||
return s;
|
||||
}
|
||||
|
||||
template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
|
||||
template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag, const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
|
||||
|
119
paludis/additional_package_dep_spec_requirement.hh
Normal file
119
paludis/additional_package_dep_spec_requirement.hh
Normal file
@ -0,0 +1,119 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_ADDITIONAL_PACKAGE_DEP_SPEC_REQUIREMENT_HH 1
|
||||
|
||||
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator.hh>
|
||||
#include <paludis/util/tribool-fwd.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
#include <paludis/changed_choices-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <utility>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
/**
|
||||
* An additional requirement for a PackageDepSpec.
|
||||
*
|
||||
* \since 0.26
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
class PALUDIS_VISIBLE AdditionalPackageDepSpecRequirement
|
||||
{
|
||||
public:
|
||||
AdditionalPackageDepSpecRequirement() = default;
|
||||
virtual ~AdditionalPackageDepSpecRequirement();
|
||||
|
||||
AdditionalPackageDepSpecRequirement(const AdditionalPackageDepSpecRequirement &) = delete;
|
||||
AdditionalPackageDepSpecRequirement & operator= (const AdditionalPackageDepSpecRequirement &) = delete;
|
||||
|
||||
/**
|
||||
* Is our requirement met for a given PackageID?
|
||||
*
|
||||
* The string in the return type might be a description of why the
|
||||
* requirement was not met. Sometimes better messages can be given
|
||||
* than simply the return value of as_human_string() when the ID to
|
||||
* be matched is known. If the bool is false, the string is
|
||||
* meaningless.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.44 returns pair<bool, std::string>
|
||||
* \since 0.51 takes optional ChangedChoices arguments
|
||||
* \since 0.58 takes id by shared_ptr
|
||||
* \since 0.58 takes spec_id
|
||||
*/
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const std::shared_ptr<const PackageID> & target_id,
|
||||
const std::shared_ptr<const PackageID> & spec_id,
|
||||
const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* If possible, indicate which choices to change to make our
|
||||
* requirement met for a particular ID.
|
||||
*
|
||||
* Verifies that the ID has the appropriate choice, and that that
|
||||
* choice isn't locked.
|
||||
*
|
||||
* Returns true for changes made, false for not possible,
|
||||
* indeterminate for nothing needs changing.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.51
|
||||
* \since 0.55 returns Tribool
|
||||
* \since 0.58 takes spec_id
|
||||
*/
|
||||
virtual Tribool accumulate_changes_to_make_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> & spec_id,
|
||||
ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* Return a human readable string representation of ourself.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.58 takes spec_id
|
||||
*/
|
||||
virtual const std::string as_human_string(
|
||||
const std::shared_ptr<const PackageID> & spec_id) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* Return a raw string representation of ourself.
|
||||
*/
|
||||
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
};
|
||||
|
||||
extern template class Sequence<std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
|
||||
extern template class WrappedForwardIterator<AdditionalPackageDepSpecRequirements::ConstIteratorTag,
|
||||
const std::shared_ptr<const AdditionalPackageDepSpecRequirement> >;
|
||||
}
|
||||
|
||||
#endif
|
@ -18,15 +18,13 @@
|
||||
*/
|
||||
|
||||
#include <paludis/changed_choices.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/tribool.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/serialise-impl.hh>
|
||||
#include <paludis/elike_use_requirement-fwd.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/tribool.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <map>
|
||||
|
||||
using namespace paludis;
|
||||
@ -61,16 +59,16 @@ ChangedChoices::empty() const
|
||||
}
|
||||
|
||||
void
|
||||
ChangedChoices::add_requirements_to(MutablePackageDepSpecData & spec) const
|
||||
ChangedChoices::add_additional_requirements_to(PartiallyMadePackageDepSpec & spec) const
|
||||
{
|
||||
for (auto o(_imp->overrides.begin()), o_end(_imp->overrides.end()) ;
|
||||
o != o_end ; ++o)
|
||||
{
|
||||
if (o->second)
|
||||
spec.require_choice(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
|
||||
spec.additional_requirement(parse_elike_use_requirement("" + stringify(o->first) + "(-)",
|
||||
{ euro_allow_default_values }));
|
||||
else
|
||||
spec.require_choice(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
|
||||
spec.additional_requirement(parse_elike_use_requirement("-" + stringify(o->first) + "(-)",
|
||||
{ euro_allow_default_values }));
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <paludis/choice-fwd.hh>
|
||||
#include <paludis/serialise-fwd.hh>
|
||||
#include <paludis/dep_spec-fwd.hh>
|
||||
#include <paludis/dep_spec_data-fwd.hh>
|
||||
#include <paludis/partially_made_package_dep_spec-fwd.hh>
|
||||
#include <memory>
|
||||
|
||||
namespace paludis
|
||||
@ -47,7 +47,7 @@ namespace paludis
|
||||
|
||||
bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
void add_requirements_to(MutablePackageDepSpecData &) const;
|
||||
void add_additional_requirements_to(PartiallyMadePackageDepSpec &) const;
|
||||
|
||||
void serialise(Serialiser &) const;
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
@ -57,14 +57,15 @@ namespace
|
||||
i != i_end ; ++i)
|
||||
if (slots && (*i)->slot_key())
|
||||
result->top()->append(std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package((*i)->name())
|
||||
.require_exact_slot((*i)->slot_key()->parse_value(), false)
|
||||
make_package_dep_spec({ })
|
||||
.package((*i)->name())
|
||||
.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(
|
||||
(*i)->slot_key()->parse_value(), false))
|
||||
));
|
||||
else
|
||||
result->top()->append(std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package((*i)->name())
|
||||
make_package_dep_spec({ })
|
||||
.package((*i)->name())
|
||||
));
|
||||
|
||||
return result;
|
||||
|
@ -64,6 +64,9 @@ namespace paludis
|
||||
*/
|
||||
typedef LabelsDepSpec<DependenciesLabel> DependenciesLabelsDepSpec;
|
||||
|
||||
struct InstallableToRepository;
|
||||
struct InstallableToPath;
|
||||
|
||||
/**
|
||||
* A PlainTextDepSpec can be written to an ostream.
|
||||
*
|
||||
|
@ -21,10 +21,7 @@
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/util/clone-impl.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
@ -37,8 +34,8 @@
|
||||
#include <paludis/util/iterator_funcs.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
@ -188,7 +185,14 @@ ConditionalDepSpec::_as_string() const
|
||||
return _imp->data->as_string();
|
||||
}
|
||||
|
||||
std::string
|
||||
StringDepSpec::text() const
|
||||
{
|
||||
return _str;
|
||||
}
|
||||
|
||||
NamedSetDepSpec::NamedSetDepSpec(const SetName & n) :
|
||||
StringDepSpec(stringify(n)),
|
||||
_name(n)
|
||||
{
|
||||
}
|
||||
@ -199,12 +203,6 @@ NamedSetDepSpec::name() const
|
||||
return _name;
|
||||
}
|
||||
|
||||
const std::string
|
||||
NamedSetDepSpec::text() const
|
||||
{
|
||||
return stringify(_name);
|
||||
}
|
||||
|
||||
std::shared_ptr<DepSpec>
|
||||
NamedSetDepSpec::clone() const
|
||||
{
|
||||
@ -214,24 +212,18 @@ NamedSetDepSpec::clone() const
|
||||
}
|
||||
|
||||
BlockDepSpec::BlockDepSpec(const std::string & s, const PackageDepSpec & p) :
|
||||
_text(s),
|
||||
StringDepSpec(s),
|
||||
_spec(p)
|
||||
{
|
||||
}
|
||||
|
||||
BlockDepSpec::BlockDepSpec(const BlockDepSpec & other) :
|
||||
_text(other._text),
|
||||
StringDepSpec(other.text()),
|
||||
_spec(other._spec)
|
||||
{
|
||||
set_annotations(other.maybe_annotations());
|
||||
}
|
||||
|
||||
const std::string
|
||||
BlockDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
paludis::operator<< (std::ostream & s, const PlainTextDepSpec & a)
|
||||
{
|
||||
@ -281,7 +273,7 @@ paludis::operator<< (std::ostream & s, const SimpleURIDepSpec & p)
|
||||
std::ostream &
|
||||
paludis::operator<< (std::ostream & s, const PackageDepSpec & a)
|
||||
{
|
||||
s << a.text();
|
||||
s << a._as_string();
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -318,8 +310,18 @@ PackageDepSpecError::PackageDepSpecError(const std::string & msg) throw () :
|
||||
{
|
||||
}
|
||||
|
||||
StringDepSpec::StringDepSpec(const std::string & s) :
|
||||
_str(s)
|
||||
{
|
||||
}
|
||||
|
||||
StringDepSpec::~StringDepSpec()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PlainTextDepSpec::PlainTextDepSpec(const std::string & s) :
|
||||
_text(s)
|
||||
StringDepSpec(s)
|
||||
{
|
||||
}
|
||||
|
||||
@ -331,14 +333,8 @@ PlainTextDepSpec::clone() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string
|
||||
PlainTextDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
PlainTextLabelDepSpec::PlainTextLabelDepSpec(const std::string & s) :
|
||||
_text(s)
|
||||
StringDepSpec(s)
|
||||
{
|
||||
}
|
||||
|
||||
@ -354,12 +350,6 @@ PlainTextLabelDepSpec::clone() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string
|
||||
PlainTextLabelDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
const std::string
|
||||
PlainTextLabelDepSpec::label() const
|
||||
{
|
||||
@ -367,7 +357,7 @@ PlainTextLabelDepSpec::label() const
|
||||
}
|
||||
|
||||
LicenseDepSpec::LicenseDepSpec(const std::string & s) :
|
||||
_text(s)
|
||||
StringDepSpec(s)
|
||||
{
|
||||
}
|
||||
|
||||
@ -379,14 +369,8 @@ LicenseDepSpec::clone() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string
|
||||
LicenseDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
SimpleURIDepSpec::SimpleURIDepSpec(const std::string & s) :
|
||||
_text(s)
|
||||
StringDepSpec(s)
|
||||
{
|
||||
}
|
||||
|
||||
@ -398,12 +382,6 @@ SimpleURIDepSpec::clone() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string
|
||||
SimpleURIDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
const PackageDepSpec
|
||||
BlockDepSpec::blocking() const
|
||||
{
|
||||
@ -419,7 +397,7 @@ BlockDepSpec::clone() const
|
||||
}
|
||||
|
||||
FetchableURIDepSpec::FetchableURIDepSpec(const std::string & s) :
|
||||
_text(s)
|
||||
StringDepSpec(s)
|
||||
{
|
||||
}
|
||||
|
||||
@ -466,12 +444,6 @@ FetchableURIDepSpec::clone() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string
|
||||
FetchableURIDepSpec::text() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <typename T_>
|
||||
@ -536,32 +508,12 @@ LabelsDepSpec<T_>::add_label(const std::shared_ptr<const T_> & item)
|
||||
_imp->items.push_back(item);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename I_, typename P_>
|
||||
I_ find_unique_if(I_ cur, I_ end, P_ pred)
|
||||
{
|
||||
I_ result(end);
|
||||
for ( ; cur != end ; ++cur)
|
||||
if (pred(*cur))
|
||||
{
|
||||
if (result != end)
|
||||
return end;
|
||||
else
|
||||
result = cur;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <>
|
||||
struct Imp<PackageDepSpec>
|
||||
{
|
||||
const std::shared_ptr<const PackageDepSpecData> data;
|
||||
std::string text;
|
||||
|
||||
Imp(const std::shared_ptr<const PackageDepSpecData> & d) :
|
||||
data(d)
|
||||
@ -572,216 +524,9 @@ namespace paludis
|
||||
|
||||
PackageDepSpec::PackageDepSpec(const std::shared_ptr<const PackageDepSpecData> & d) :
|
||||
Cloneable<DepSpec>(),
|
||||
StringDepSpec(d->as_string()),
|
||||
_imp(d)
|
||||
{
|
||||
std::ostringstream s;
|
||||
|
||||
std::shared_ptr<VersionRequirementSequence> all_versions;
|
||||
std::shared_ptr<KeyRequirementSequence> all_keys;
|
||||
std::shared_ptr<ChoiceRequirementSequence> all_choices;
|
||||
|
||||
for (auto u(_imp->data->requirements()->begin()), u_end(_imp->data->requirements()->end()) ;
|
||||
u != u_end ; ++u)
|
||||
{
|
||||
if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<VersionRequirement>()))
|
||||
{
|
||||
if (! all_versions)
|
||||
all_versions = std::make_shared<VersionRequirementSequence>();
|
||||
all_versions->push_back(std::static_pointer_cast<const VersionRequirement>(*u));
|
||||
}
|
||||
else if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<KeyRequirement>()))
|
||||
{
|
||||
if (! all_keys)
|
||||
all_keys = std::make_shared<KeyRequirementSequence>();
|
||||
all_keys->push_back(std::static_pointer_cast<const KeyRequirement>(*u));
|
||||
}
|
||||
else if ((*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ChoiceRequirement>()))
|
||||
{
|
||||
if (! all_choices)
|
||||
all_choices = std::make_shared<ChoiceRequirementSequence>();
|
||||
all_choices->push_back(std::static_pointer_cast<const ChoiceRequirement>(*u));
|
||||
}
|
||||
}
|
||||
|
||||
if (all_versions)
|
||||
{
|
||||
if (all_versions->begin() == all_versions->end())
|
||||
{
|
||||
}
|
||||
else if (next(all_versions->begin()) == all_versions->end() &&
|
||||
! _imp->data->options()[pdsdo_always_use_ranged_deps])
|
||||
{
|
||||
if ((*all_versions->begin())->version_operator() == vo_stupid_equal_star ||
|
||||
(*all_versions->begin())->version_operator() == vo_nice_equal_star)
|
||||
s << "=";
|
||||
else
|
||||
s << (*all_versions->begin())->version_operator();
|
||||
}
|
||||
}
|
||||
|
||||
if (package_name_requirement())
|
||||
s << package_name_requirement()->name();
|
||||
else
|
||||
{
|
||||
if (category_name_part_requirement())
|
||||
s << category_name_part_requirement()->name_part();
|
||||
else
|
||||
s << "*";
|
||||
|
||||
s << "/";
|
||||
|
||||
if (package_name_part_requirement())
|
||||
s << package_name_part_requirement()->name_part();
|
||||
else
|
||||
s << "*";
|
||||
}
|
||||
|
||||
if (all_versions)
|
||||
{
|
||||
if (all_versions->begin() == all_versions->end())
|
||||
{
|
||||
}
|
||||
else if (next(all_versions->begin()) == all_versions->end() &&
|
||||
! _imp->data->options()[pdsdo_always_use_ranged_deps])
|
||||
{
|
||||
s << "-" << (*all_versions->begin())->version_spec();
|
||||
if ((*all_versions->begin())->version_operator() == vo_stupid_equal_star ||
|
||||
(*all_versions->begin())->version_operator() == vo_nice_equal_star)
|
||||
s << "*";
|
||||
}
|
||||
}
|
||||
|
||||
if (exact_slot_requirement())
|
||||
{
|
||||
if (exact_slot_requirement()->locked())
|
||||
s << ":=";
|
||||
else
|
||||
s << ":";
|
||||
|
||||
s << stringify(exact_slot_requirement()->name());
|
||||
}
|
||||
|
||||
if (any_slot_requirement())
|
||||
{
|
||||
if (any_slot_requirement()->locking())
|
||||
s << ":=";
|
||||
else
|
||||
s << ":*";
|
||||
}
|
||||
|
||||
std::string left, right;
|
||||
bool need_arrow(false);
|
||||
|
||||
if (from_repository_requirement())
|
||||
left = stringify(from_repository_requirement()->name());
|
||||
|
||||
if (in_repository_requirement())
|
||||
right = stringify(in_repository_requirement()->name());
|
||||
|
||||
if (installed_at_path_requirement())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
right.append(stringify(installed_at_path_requirement()->path()));
|
||||
}
|
||||
|
||||
if (installable_to_repository_requirement())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
if (installable_to_repository_requirement()->include_masked())
|
||||
right.append(stringify(installable_to_repository_requirement()->name()) + "??");
|
||||
else
|
||||
right.append(stringify(installable_to_repository_requirement()->name()) + "?");
|
||||
}
|
||||
|
||||
if (installable_to_path_requirement())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
if (installable_to_path_requirement()->include_masked())
|
||||
right.append(stringify(installable_to_path_requirement()->path()) + "??");
|
||||
else
|
||||
right.append(stringify(installable_to_path_requirement()->path()) + "?");
|
||||
}
|
||||
|
||||
if (need_arrow || ((! left.empty()) && (! right.empty())))
|
||||
s << "::" << left << "->" << right;
|
||||
else if (! right.empty())
|
||||
s << "::" << right;
|
||||
else if (! left.empty())
|
||||
s << "::" << left << "->";
|
||||
|
||||
if (all_versions)
|
||||
{
|
||||
if (all_versions->begin() == all_versions->end())
|
||||
{
|
||||
}
|
||||
else if (next(all_versions->begin()) == all_versions->end() &&
|
||||
! _imp->data->options()[pdsdo_always_use_ranged_deps])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
bool need_op(false);
|
||||
s << "[";
|
||||
for (auto r(all_versions->begin()), r_end(all_versions->end()) ; r != r_end ; ++r)
|
||||
{
|
||||
if (need_op)
|
||||
{
|
||||
do
|
||||
{
|
||||
switch ((*r)->combiner())
|
||||
{
|
||||
case vrc_and:
|
||||
s << "&";
|
||||
continue;
|
||||
|
||||
case vrc_or:
|
||||
s << "|";
|
||||
continue;
|
||||
|
||||
case last_vrc:
|
||||
;
|
||||
}
|
||||
throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
|
||||
} while (false);
|
||||
}
|
||||
|
||||
if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
|
||||
s << "=";
|
||||
else
|
||||
s << (*r)->version_operator();
|
||||
|
||||
s << (*r)->version_spec();
|
||||
|
||||
if ((*r)->version_operator() == vo_stupid_equal_star || (*r)->version_operator() == vo_nice_equal_star)
|
||||
s << "*";
|
||||
|
||||
need_op = true;
|
||||
}
|
||||
s << "]";
|
||||
}
|
||||
}
|
||||
|
||||
if (all_choices)
|
||||
for (auto u(all_choices->begin()), u_end(all_choices->end()) ; u != u_end ; ++u)
|
||||
s << (*u)->as_raw_string();
|
||||
|
||||
if (all_keys)
|
||||
for (auto u(all_keys->begin()), u_end(all_keys->end()) ; u != u_end ; ++u)
|
||||
s << (*u)->as_raw_string();
|
||||
|
||||
_imp->text = s.str();
|
||||
}
|
||||
|
||||
PackageDepSpec::~PackageDepSpec()
|
||||
@ -790,142 +535,92 @@ PackageDepSpec::~PackageDepSpec()
|
||||
|
||||
PackageDepSpec::PackageDepSpec(const PackageDepSpec & d) :
|
||||
Cloneable<DepSpec>(d),
|
||||
StringDepSpec(d._imp->data->as_string()),
|
||||
CloneUsingThis<DepSpec, PackageDepSpec>(d),
|
||||
_imp(d._imp->data)
|
||||
{
|
||||
set_annotations(d.maybe_annotations());
|
||||
_imp->text = d._imp->text;
|
||||
}
|
||||
|
||||
const std::string
|
||||
PackageDepSpec::text() const
|
||||
std::shared_ptr<const QualifiedPackageName>
|
||||
PackageDepSpec::package_ptr() const
|
||||
{
|
||||
return _imp->text;
|
||||
return _imp->data->package_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const NameRequirement>
|
||||
PackageDepSpec::package_name_requirement() const
|
||||
std::shared_ptr<const PackageNamePart>
|
||||
PackageDepSpec::package_name_part_ptr() const
|
||||
{
|
||||
return _imp->data->package_name_requirement();
|
||||
return _imp->data->package_name_part_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const PackageNamePartRequirement>
|
||||
PackageDepSpec::package_name_part_requirement() const
|
||||
std::shared_ptr<const CategoryNamePart>
|
||||
PackageDepSpec::category_name_part_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<PackageNamePartRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const PackageNamePartRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->category_name_part_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const CategoryNamePartRequirement>
|
||||
PackageDepSpec::category_name_part_requirement() const
|
||||
std::shared_ptr<const VersionRequirements>
|
||||
PackageDepSpec::version_requirements_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<CategoryNamePartRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const CategoryNamePartRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->version_requirements_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const ExactSlotRequirement>
|
||||
PackageDepSpec::exact_slot_requirement() const
|
||||
VersionRequirementsMode
|
||||
PackageDepSpec::version_requirements_mode() const
|
||||
{
|
||||
return _imp->data->exact_slot_requirement();
|
||||
return _imp->data->version_requirements_mode();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const AnySlotRequirement>
|
||||
PackageDepSpec::any_slot_requirement() const
|
||||
std::shared_ptr<const SlotRequirement>
|
||||
PackageDepSpec::slot_requirement_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<AnySlotRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const AnySlotRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->slot_requirement_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const InRepositoryRequirement>
|
||||
PackageDepSpec::in_repository_requirement() const
|
||||
std::shared_ptr<const RepositoryName>
|
||||
PackageDepSpec::in_repository_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<InRepositoryRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const InRepositoryRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->in_repository_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const InstallableToRepositoryRequirement>
|
||||
PackageDepSpec::installable_to_repository_requirement() const
|
||||
std::shared_ptr<const InstallableToRepository>
|
||||
PackageDepSpec::installable_to_repository_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<InstallableToRepositoryRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const InstallableToRepositoryRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->installable_to_repository_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const FromRepositoryRequirement>
|
||||
PackageDepSpec::from_repository_requirement() const
|
||||
std::shared_ptr<const RepositoryName>
|
||||
PackageDepSpec::from_repository_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<FromRepositoryRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const FromRepositoryRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->from_repository_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const InstalledAtPathRequirement>
|
||||
PackageDepSpec::installed_at_path_requirement() const
|
||||
std::shared_ptr<const FSPath>
|
||||
PackageDepSpec::installed_at_path_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<InstalledAtPathRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const InstalledAtPathRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->installed_at_path_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const InstallableToPathRequirement>
|
||||
PackageDepSpec::installable_to_path_requirement() const
|
||||
std::shared_ptr<const InstallableToPath>
|
||||
PackageDepSpec::installable_to_path_ptr() const
|
||||
{
|
||||
DetectPackageDepSpecRequirement<InstallableToPathRequirement> v;
|
||||
auto r(find_unique_if(indirect_iterator(_imp->data->requirements()->begin()),
|
||||
indirect_iterator(_imp->data->requirements()->end()), accept_visitor_returning<bool>(v)));
|
||||
|
||||
if (r != indirect_iterator(_imp->data->requirements()->end()))
|
||||
return std::static_pointer_cast<const InstallableToPathRequirement>(*r.underlying_iterator());
|
||||
else
|
||||
return make_null_shared_ptr();
|
||||
return _imp->data->installable_to_path_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const PackageDepSpecRequirementSequence>
|
||||
PackageDepSpec::requirements() const
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirements>
|
||||
PackageDepSpec::additional_requirements_ptr() const
|
||||
{
|
||||
return _imp->data->requirements();
|
||||
return _imp->data->additional_requirements_ptr();
|
||||
}
|
||||
|
||||
const std::shared_ptr<const PackageDepSpecData>
|
||||
std::string
|
||||
PackageDepSpec::_as_string() const
|
||||
{
|
||||
return _imp->data->as_string();
|
||||
}
|
||||
|
||||
std::shared_ptr<const PackageDepSpecData>
|
||||
PackageDepSpec::data() const
|
||||
{
|
||||
return _imp->data;
|
||||
|
@ -32,12 +32,15 @@
|
||||
#include <paludis/dep_spec-fwd.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/version_operator-fwd.hh>
|
||||
#include <paludis/version_requirements-fwd.hh>
|
||||
#include <paludis/version_spec-fwd.hh>
|
||||
#include <paludis/slot_requirement-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/partially_made_package_dep_spec-fwd.hh>
|
||||
#include <paludis/dep_spec_data-fwd.hh>
|
||||
#include <paludis/dep_spec_annotations-fwd.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -236,11 +239,60 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE StringDepSpec :
|
||||
public DepSpec
|
||||
{
|
||||
private:
|
||||
std::string _str;
|
||||
|
||||
protected:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
StringDepSpec(const std::string &);
|
||||
|
||||
~StringDepSpec();
|
||||
|
||||
///\}
|
||||
|
||||
/**
|
||||
* Change our text.
|
||||
*/
|
||||
void set_text(const std::string &);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Fetch our text.
|
||||
*/
|
||||
virtual const std::string text() const = 0;
|
||||
std::string text() const;
|
||||
};
|
||||
|
||||
namespace n
|
||||
{
|
||||
typedef Name<struct name_include_masked> include_masked;
|
||||
typedef Name<struct name_path> path;
|
||||
typedef Name<struct name_repository> repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for PackageDepSpec.installable_to_repository_ptr() etc.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.32
|
||||
*/
|
||||
struct InstallableToRepository
|
||||
{
|
||||
NamedValue<n::include_masked, bool> include_masked;
|
||||
NamedValue<n::repository, RepositoryName> repository;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data for PackageDepSpec.installable_to_path_ptr() etc.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.32
|
||||
*/
|
||||
struct InstallableToPath
|
||||
{
|
||||
NamedValue<n::include_masked, bool> include_masked;
|
||||
NamedValue<n::path, FSPath> path;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -268,6 +320,7 @@ namespace paludis
|
||||
|
||||
private:
|
||||
const PackageDepSpec & operator= (const PackageDepSpec &);
|
||||
std::string _as_string() const;
|
||||
|
||||
Pimp<PackageDepSpec> _imp;
|
||||
|
||||
@ -293,100 +346,76 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
/**
|
||||
* Fetch the package name (may be a zero pointer).
|
||||
*/
|
||||
std::shared_ptr<const QualifiedPackageName> package_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch our NameRequirement, if we have one, or a null pointer otherwise.
|
||||
*
|
||||
* If we have multiple NameRequirement requirements, returns one such
|
||||
* requirement.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the package name part, if wildcarded, or a zero pointer otherwise.
|
||||
*/
|
||||
const std::shared_ptr<const NameRequirement> package_name_requirement() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
std::shared_ptr<const PackageNamePart> package_name_part_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single PackageNamePartRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the category name part, if wildcarded, or a zero pointer otherwise.
|
||||
*/
|
||||
const std::shared_ptr<const PackageNamePartRequirement> package_name_part_requirement() const;
|
||||
std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single CategoryNamePartRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the version requirements (may be a zero pointer).
|
||||
*/
|
||||
const std::shared_ptr<const CategoryNamePartRequirement> category_name_part_requirement() const;
|
||||
std::shared_ptr<const VersionRequirements> version_requirements_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch our ExactSlotRequirement, if we have one, or a null pointer otherwise.
|
||||
*
|
||||
* If we have multiple ExactSlotRequirement requirements, returns one such
|
||||
* requirement.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the version requirements mode.
|
||||
*/
|
||||
const std::shared_ptr<const ExactSlotRequirement> exact_slot_requirement() const;
|
||||
VersionRequirementsMode version_requirements_mode() const;
|
||||
|
||||
/**
|
||||
* Fetch the single AnySlotRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the slot requirement (may be a zero pointer).
|
||||
*/
|
||||
const std::shared_ptr<const AnySlotRequirement> any_slot_requirement() const;
|
||||
std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single InRepositoryRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the in-repository requirement (may be a zero pointer).
|
||||
*/
|
||||
const std::shared_ptr<const InRepositoryRequirement> in_repository_requirement() const;
|
||||
std::shared_ptr<const RepositoryName> in_repository_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single InstallableToRepositoryRequirement, if we have one, or
|
||||
* Fetch the installable-to-repository requirement (may be a zero pointer).
|
||||
*
|
||||
* \since 0.61
|
||||
* \since 0.32
|
||||
*/
|
||||
const std::shared_ptr<const InstallableToRepositoryRequirement> installable_to_repository_requirement() const;
|
||||
std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single FromRepositoryRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
* Fetch the from-repository requirement (may be a zero pointer).
|
||||
*/
|
||||
const std::shared_ptr<const FromRepositoryRequirement> from_repository_requirement() const;
|
||||
std::shared_ptr<const RepositoryName> from_repository_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single InstalledAtPathRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
* Fetch the installed-at-path requirement (may be a zero pointer).
|
||||
*
|
||||
* \since 0.61
|
||||
* \since 0.32
|
||||
*/
|
||||
const std::shared_ptr<const InstalledAtPathRequirement> installed_at_path_requirement() const;
|
||||
std::shared_ptr<const FSPath> installed_at_path_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch the single InstallableToPathRequirement, if we have one, or
|
||||
* a null pointer otherwise.
|
||||
* Fetch the installable-to-path requirement (may be a zero pointer).
|
||||
*
|
||||
* \since 0.61
|
||||
* \since 0.32
|
||||
*/
|
||||
const std::shared_ptr<const InstallableToPathRequirement> installable_to_path_requirement() const;
|
||||
std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const;
|
||||
|
||||
/**
|
||||
* Fetch all our requirements.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch any additional requirements (may be a zero pointer).
|
||||
*/
|
||||
const std::shared_ptr<const PackageDepSpecRequirementSequence> requirements() const;
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
|
||||
|
||||
/**
|
||||
* Access to our data.
|
||||
*/
|
||||
const std::shared_ptr<const PackageDepSpecData> data() const;
|
||||
std::shared_ptr<const PackageDepSpecData> data() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -398,9 +427,6 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE PlainTextDepSpec :
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
@ -409,8 +435,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
virtual std::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
@ -434,8 +458,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
/// Fetch the name of our set.
|
||||
const SetName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
@ -452,9 +474,6 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE LicenseDepSpec :
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
@ -463,8 +482,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
virtual std::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
@ -482,9 +499,6 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE FetchableURIDepSpec :
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
@ -493,8 +507,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
/**
|
||||
* The original URL (that is, the text to the left of the arrow, if present,
|
||||
* or the entire text otherwise).
|
||||
@ -528,9 +540,6 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE SimpleURIDepSpec :
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
@ -539,8 +548,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
virtual std::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
@ -575,7 +582,6 @@ namespace paludis
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
PackageDepSpec _spec;
|
||||
|
||||
public:
|
||||
@ -588,8 +594,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
/**
|
||||
* Fetch the spec we're blocking.
|
||||
*
|
||||
@ -646,9 +650,6 @@ namespace paludis
|
||||
class PALUDIS_VISIBLE PlainTextLabelDepSpec :
|
||||
public StringDepSpec
|
||||
{
|
||||
private:
|
||||
std::string _text;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
@ -658,8 +659,6 @@ namespace paludis
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::string text() const;
|
||||
|
||||
virtual std::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
const std::string label() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/environments/test/test_environment.hh>
|
||||
|
||||
#include <paludis/util/clone-impl.hh>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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
|
||||
@ -20,27 +20,10 @@
|
||||
#ifndef PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_FWD_HH 1
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/options-fwd.hh>
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class PackageDepSpecData;
|
||||
class ConditionalDepSpecData;
|
||||
|
||||
#include <paludis/dep_spec_data-se.hh>
|
||||
|
||||
class MutablePackageDepSpecData;
|
||||
|
||||
/**
|
||||
* Options for PackageDepSpecData.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.61
|
||||
*/
|
||||
typedef Options<PackageDepSpecDataOption> PackageDepSpecDataOptions;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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
|
||||
@ -18,398 +18,10 @@
|
||||
*/
|
||||
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator.hh>
|
||||
#include <paludis/util/wrapped_output_iterator.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
#include <paludis/dep_spec_data-se.cc>
|
||||
|
||||
ConditionalDepSpecData::~ConditionalDepSpecData() = default;
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <>
|
||||
struct Imp<PackageDepSpecData>
|
||||
{
|
||||
std::shared_ptr<const NameRequirement> package_name_requirement;
|
||||
std::shared_ptr<const ExactSlotRequirement> exact_slot_requirement;
|
||||
std::shared_ptr<PackageDepSpecRequirementSequence> requirements;
|
||||
PackageDepSpecDataOptions options;
|
||||
|
||||
Imp(const PackageDepSpecDataOptions & o) :
|
||||
requirements(std::make_shared<PackageDepSpecRequirementSequence>()),
|
||||
options(o)
|
||||
{
|
||||
}
|
||||
|
||||
Imp(const PackageDepSpecData & other) :
|
||||
package_name_requirement(other.package_name_requirement()),
|
||||
exact_slot_requirement(other.exact_slot_requirement()),
|
||||
requirements(std::make_shared<PackageDepSpecRequirementSequence>()),
|
||||
options(other.options())
|
||||
{
|
||||
std::copy(other.requirements()->begin(), other.requirements()->end(), requirements->back_inserter());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PackageDepSpecData::PackageDepSpecData(const PackageDepSpecDataOptions & o) :
|
||||
_imp(o)
|
||||
{
|
||||
}
|
||||
|
||||
PackageDepSpecData::PackageDepSpecData(const PackageDepSpecData & o) :
|
||||
_imp(o)
|
||||
{
|
||||
}
|
||||
|
||||
PackageDepSpecData::~PackageDepSpecData() = default;
|
||||
|
||||
const std::shared_ptr<const PackageDepSpecRequirementSequence>
|
||||
PackageDepSpecData::requirements() const
|
||||
{
|
||||
return _imp->requirements;
|
||||
}
|
||||
|
||||
const PackageDepSpecDataOptions
|
||||
PackageDepSpecData::options() const
|
||||
{
|
||||
return _imp->options;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const NameRequirement>
|
||||
PackageDepSpecData::package_name_requirement() const
|
||||
{
|
||||
return _imp->package_name_requirement;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const ExactSlotRequirement>
|
||||
PackageDepSpecData::exact_slot_requirement() const
|
||||
{
|
||||
return _imp->exact_slot_requirement;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData::MutablePackageDepSpecData(const PackageDepSpecDataOptions & o) :
|
||||
PackageDepSpecData(o)
|
||||
{
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData::MutablePackageDepSpecData(const PackageDepSpecData & o) :
|
||||
PackageDepSpecData(o)
|
||||
{
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData::MutablePackageDepSpecData(const MutablePackageDepSpecData & o) :
|
||||
PackageDepSpecData(o)
|
||||
{
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData::~MutablePackageDepSpecData() = default;
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_package(const QualifiedPackageName & name)
|
||||
{
|
||||
auto r(NameRequirementPool::get_instance()->create(name));
|
||||
_imp->package_name_requirement = r;
|
||||
_imp->requirements->push_front(r);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_package()
|
||||
{
|
||||
if (_imp->package_name_requirement)
|
||||
{
|
||||
_imp->package_name_requirement.reset();
|
||||
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<NameRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_package_name_part(const PackageNamePart & part)
|
||||
{
|
||||
_imp->requirements->push_front(PackageNamePartRequirementPool::get_instance()->create(part));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_package_name_part()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<PackageNamePartRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_category_name_part(const CategoryNamePart & part)
|
||||
{
|
||||
_imp->requirements->push_front(CategoryNamePartRequirementPool::get_instance()->create(part));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_category_name_part()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<CategoryNamePartRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_version(const VersionRequirementCombiner vc, const VersionOperator & vo, const VersionSpec & vs)
|
||||
{
|
||||
auto r(std::make_shared<VersionRequirement>(vs, vo, vc));
|
||||
_imp->requirements->push_back(r);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_versions()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<VersionRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_exact_slot(const SlotName & n, const bool s)
|
||||
{
|
||||
auto r(ExactSlotRequirementPool::get_instance()->create(n, s));
|
||||
_imp->exact_slot_requirement = r;
|
||||
_imp->requirements->push_back(r);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_exact_slot()
|
||||
{
|
||||
if (_imp->exact_slot_requirement)
|
||||
{
|
||||
_imp->exact_slot_requirement.reset();
|
||||
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ExactSlotRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_in_repository(const RepositoryName & s)
|
||||
{
|
||||
_imp->requirements->push_back(InRepositoryRequirementPool::get_instance()->create(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_in_repository()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InRepositoryRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_installable_to_path(const FSPath & s, const bool i)
|
||||
{
|
||||
_imp->requirements->push_back(InstallableToPathRequirementPool::get_instance()->create(s, i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_installable_to_path()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstallableToPathRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_installable_to_repository(const RepositoryName & n, const bool i)
|
||||
{
|
||||
_imp->requirements->push_back(InstallableToRepositoryRequirementPool::get_instance()->create(n, i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_installable_to_repository()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstallableToRepositoryRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_from_repository(const RepositoryName & n)
|
||||
{
|
||||
_imp->requirements->push_back(FromRepositoryRequirementPool::get_instance()->create(n));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_from_repository()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<FromRepositoryRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_installed_at_path(const FSPath & s)
|
||||
{
|
||||
_imp->requirements->push_back(InstalledAtPathRequirementPool::get_instance()->create(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_installed_at_path()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<InstalledAtPathRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_any_slot(const bool s)
|
||||
{
|
||||
_imp->requirements->push_back(AnySlotRequirementPool::get_instance()->create(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_any_slot()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<AnySlotRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_choice(const std::shared_ptr<const ChoiceRequirement> & c)
|
||||
{
|
||||
_imp->requirements->push_back(c);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_choices()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<ChoiceRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::require_key(const KeyRequirementKeyType t, const std::string & k, const KeyRequirementOperation o, const std::string & p)
|
||||
{
|
||||
auto r(KeyRequirementPool::get_instance()->create(t, k, o, p));
|
||||
|
||||
_imp->requirements->push_back(r);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData &
|
||||
MutablePackageDepSpecData::unrequire_keys()
|
||||
{
|
||||
auto r(std::make_shared<PackageDepSpecRequirementSequence>());
|
||||
for (auto u(_imp->requirements->begin()), u_end(_imp->requirements->end()) ;
|
||||
u != u_end ; ++u)
|
||||
if (! (*u)->accept_returning<bool>(DetectPackageDepSpecRequirement<KeyRequirement>()))
|
||||
r->push_back(*u);
|
||||
|
||||
_imp->requirements = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData::operator PackageDepSpec() const
|
||||
{
|
||||
/* convoluted because it's private... */
|
||||
PackageDepSpecData * data(new MutablePackageDepSpecData(*this));
|
||||
return PackageDepSpec(std::shared_ptr<PackageDepSpecData>(data));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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
|
||||
@ -21,19 +21,18 @@
|
||||
#define PALUDIS_GUARD_PALUDIS_DEP_SPEC_DATA_HH 1
|
||||
|
||||
#include <paludis/dep_spec_data-fwd.hh>
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/fs_path-fwd.hh>
|
||||
#include <paludis/changed_choices-fwd.hh>
|
||||
#include <paludis/name-fwd.hh>
|
||||
#include <paludis/version_operator-fwd.hh>
|
||||
#include <paludis/version_requirements-fwd.hh>
|
||||
#include <paludis/slot_requirement-fwd.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/dep_spec-fwd.hh>
|
||||
#include <paludis/partially_made_package_dep_spec-fwd.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/version_spec-fwd.hh>
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/fs_path-fwd.hh>
|
||||
#include <paludis/util/pimp.hh>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
@ -93,268 +92,95 @@ namespace paludis
|
||||
* Data for a PackageDepSpec.
|
||||
*
|
||||
* \since 0.26
|
||||
* \since 0.61 is not abstract
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
class PALUDIS_VISIBLE PackageDepSpecData
|
||||
{
|
||||
protected:
|
||||
Pimp<PackageDepSpecData> _imp;
|
||||
|
||||
PackageDepSpecData(const PackageDepSpecData &);
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
explicit PackageDepSpecData(const PackageDepSpecDataOptions &);
|
||||
|
||||
virtual ~PackageDepSpecData();
|
||||
|
||||
///\}
|
||||
|
||||
/**
|
||||
* All our requirements.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch ourself as a string.
|
||||
*/
|
||||
const std::shared_ptr<const PackageDepSpecRequirementSequence> requirements() const;
|
||||
virtual std::string as_string() const = 0;
|
||||
|
||||
/**
|
||||
* Our options.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the package name (may be a zero pointer).
|
||||
*/
|
||||
const PackageDepSpecDataOptions options() const;
|
||||
virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Fetch one of our NameRequirement requirements, if we have any, or
|
||||
* a null pointer otherwise.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the package name part, if wildcarded, or a zero pointer otherwise.
|
||||
*/
|
||||
const std::shared_ptr<const NameRequirement> package_name_requirement() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Fetch our ExactSlotRequirement, if we have one, or a null pointer otherwise.
|
||||
*
|
||||
* If we have multiple ExactSlotRequirement requirements, returns one such
|
||||
* requirement.
|
||||
*
|
||||
* \since 0.61
|
||||
* Fetch the category name part, if wildcarded, or a zero pointer otherwise.
|
||||
*/
|
||||
const std::shared_ptr<const ExactSlotRequirement> exact_slot_requirement() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Partially constructed PackageDepSpecData, which can be used to build up a
|
||||
* PackageDepSpec.
|
||||
*
|
||||
* \since 0.61
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
class PALUDIS_VISIBLE MutablePackageDepSpecData :
|
||||
private PackageDepSpecData
|
||||
{
|
||||
public:
|
||||
explicit MutablePackageDepSpecData(const PackageDepSpecDataOptions &);
|
||||
|
||||
MutablePackageDepSpecData(const PackageDepSpecData &);
|
||||
|
||||
MutablePackageDepSpecData(const MutablePackageDepSpecData &);
|
||||
|
||||
~MutablePackageDepSpecData();
|
||||
virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Add a package requirement.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the version requirements (may be a zero pointer).
|
||||
*/
|
||||
MutablePackageDepSpecData & require_package(const QualifiedPackageName &);
|
||||
virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Clear any package requirements.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the version requirements mode.
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_package();
|
||||
virtual VersionRequirementsMode version_requirements_mode() const = 0;
|
||||
|
||||
/**
|
||||
* Add a package name part requirement.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the slot name (may be a zero pointer).
|
||||
*/
|
||||
MutablePackageDepSpecData & require_package_name_part(const PackageNamePart &);
|
||||
virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Clear any package name part requirements.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the from-repository requirement (may be a zero pointer).
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_package_name_part();
|
||||
virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Add a category name part requirement.
|
||||
* Fetch the installable-to-repository requirement (may be a zero pointer).
|
||||
*
|
||||
* \return *this
|
||||
* \since 0.32
|
||||
*/
|
||||
MutablePackageDepSpecData & require_category_name_part(const CategoryNamePart &);
|
||||
virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Clear any category name part requirements.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the from-repository requirement (may be a zero pointer).
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_category_name_part();
|
||||
virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Add a version requirement.
|
||||
* Fetch the installed-at-path requirement (may be a zero pointer).
|
||||
*
|
||||
* The combiner must be vcc_and if this is the first version
|
||||
* requirement.
|
||||
*
|
||||
* \return *this
|
||||
* \since 0.32
|
||||
*/
|
||||
MutablePackageDepSpecData & require_version(const VersionRequirementCombiner, const VersionOperator &, const VersionSpec &);
|
||||
virtual std::shared_ptr<const FSPath> installed_at_path_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Clear any version requirements.
|
||||
* Fetch the installable-to-path requirement (may be a zero pointer).
|
||||
*
|
||||
* \return *this
|
||||
* \since 0.32
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_versions();
|
||||
virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Add an exact slot requirement.
|
||||
*
|
||||
* \return *this
|
||||
* Fetch the additional requirements (may be a zero pointer).
|
||||
*/
|
||||
MutablePackageDepSpecData & require_exact_slot(const SlotName &, const bool locked);
|
||||
virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const = 0;
|
||||
|
||||
/**
|
||||
* Clear any exact slot requirements.
|
||||
* Fetch options if we're being used to construct a new PartiallyMadePackageDepSpec.
|
||||
*
|
||||
* \return *this
|
||||
* \since 0.38
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_exact_slot();
|
||||
|
||||
/**
|
||||
* Add an in repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_in_repository(const RepositoryName &);
|
||||
|
||||
/**
|
||||
* Clear any in repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_in_repository();
|
||||
|
||||
/**
|
||||
* Add an installable to path requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_installable_to_path(const FSPath &, const bool);
|
||||
|
||||
/**
|
||||
* Clear any installable to path requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_installable_to_path();
|
||||
|
||||
/**
|
||||
* Add an installable to repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_installable_to_repository(const RepositoryName &, const bool);
|
||||
|
||||
/**
|
||||
* Clear any installable to repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_installable_to_repository();
|
||||
|
||||
/**
|
||||
* Add a from repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_from_repository(const RepositoryName &);
|
||||
|
||||
/**
|
||||
* Clear any from repository requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_from_repository();
|
||||
|
||||
/**
|
||||
* Add an installed at path requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_installed_at_path(const FSPath &);
|
||||
|
||||
/**
|
||||
* Clear any installed at path requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_installed_at_path();
|
||||
|
||||
/**
|
||||
* Add an any slot requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_any_slot(const bool);
|
||||
|
||||
/**
|
||||
* Clear our AnySlotRequirement, if we have one.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_any_slot();
|
||||
|
||||
/**
|
||||
* Add a choice requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_choice(const std::shared_ptr<const ChoiceRequirement> &);
|
||||
|
||||
/**
|
||||
* Clear any choice requirements.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_choices();
|
||||
|
||||
/**
|
||||
* Add a key requirement.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & require_key(
|
||||
const KeyRequirementKeyType, const std::string &, const KeyRequirementOperation, const std::string &);
|
||||
|
||||
/**
|
||||
* Clear any key requirements.
|
||||
*
|
||||
* \return *this
|
||||
*/
|
||||
MutablePackageDepSpecData & unrequire_keys();
|
||||
|
||||
/**
|
||||
* Convert ourself to a PackageDepSpec.
|
||||
*/
|
||||
operator PackageDepSpec() const;
|
||||
virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: set sw=4 sts=4 et ft=sh :
|
||||
|
||||
make_enum_PackageDepSpecDataOption()
|
||||
{
|
||||
prefix pdsdo
|
||||
|
||||
key pdsdo_always_use_ranged_deps "Always write [>=1] style dependencies"
|
||||
|
||||
doxygen_comment << "END"
|
||||
/**
|
||||
* Options for PackageDepSpecData.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.61
|
||||
*/
|
||||
END
|
||||
}
|
||||
|
@ -22,14 +22,11 @@
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/options-fwd.hh>
|
||||
|
||||
#include <paludis/dep_spec-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/version_operator-fwd.hh>
|
||||
#include <paludis/version_spec-fwd.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/dep_spec_data-fwd.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec-fwd.hh>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
|
||||
@ -45,7 +42,7 @@ namespace paludis
|
||||
PackageDepSpec parse_generic_elike_package_dep_spec(const std::string & ss, const GenericELikePackageDepSpecParseFunctions & fns)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
MutablePackageDepSpecData partial_parse_generic_elike_package_dep_spec(const std::string & ss,
|
||||
PartiallyMadePackageDepSpec partial_parse_generic_elike_package_dep_spec(const std::string & ss,
|
||||
const GenericELikePackageDepSpecParseFunctions & fns)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
@ -53,23 +50,23 @@ namespace paludis
|
||||
const VersionSpecOptions &)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
MutablePackageDepSpecData partial_parse_elike_package_dep_spec(const std::string & ss,
|
||||
PartiallyMadePackageDepSpec partial_parse_elike_package_dep_spec(const std::string & ss,
|
||||
const ELikePackageDepSpecOptions &,
|
||||
const VersionSpecOptions &)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
|
||||
void elike_check_sanity(const std::string & s) PALUDIS_VISIBLE;
|
||||
|
||||
bool elike_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
bool elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options,
|
||||
const VersionSpecOptions & version_options,
|
||||
bool & had_bracket_version_requirements,
|
||||
bool & had_use_requirements) PALUDIS_VISIBLE;
|
||||
|
||||
void elike_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
void elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
|
||||
|
||||
void elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
void elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options) PALUDIS_VISIBLE;
|
||||
|
||||
bool elike_has_version_operator(const std::string & s, const bool had_bracket_version_requirements,
|
||||
@ -81,21 +78,10 @@ namespace paludis
|
||||
VersionSpec elike_get_remove_trailing_version(std::string & s,
|
||||
const VersionSpecOptions &) PALUDIS_VISIBLE;
|
||||
|
||||
void elike_add_version_requirement(
|
||||
const VersionSpec & spec,
|
||||
const VersionOperator & op,
|
||||
const VersionRequirementCombiner,
|
||||
MutablePackageDepSpecData & result)
|
||||
void elike_add_version_requirement(const VersionOperator & op, const VersionSpec & spec, PartiallyMadePackageDepSpec & result)
|
||||
PALUDIS_VISIBLE;
|
||||
|
||||
void parse_elike_version_range(
|
||||
const std::string &,
|
||||
MutablePackageDepSpecData &,
|
||||
const ELikePackageDepSpecOptions & options,
|
||||
const VersionSpecOptions & version_options,
|
||||
bool & had_bracket_version_requirements) PALUDIS_VISIBLE;
|
||||
|
||||
void elike_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result) PALUDIS_VISIBLE;
|
||||
void elike_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result) PALUDIS_VISIBLE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -19,25 +19,23 @@
|
||||
|
||||
#include <paludis/elike_package_dep_spec.hh>
|
||||
#include <paludis/elike_use_requirement.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/return_literal_function.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <strings.h>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
#include <paludis/elike_package_dep_spec-se.cc>
|
||||
|
||||
MutablePackageDepSpecData
|
||||
PartiallyMadePackageDepSpec
|
||||
paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, const GenericELikePackageDepSpecParseFunctions & fns)
|
||||
{
|
||||
Context context("When parsing generic package dep spec '" + ss + "':");
|
||||
@ -46,7 +44,7 @@ paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, co
|
||||
fns.check_sanity()(ss);
|
||||
|
||||
std::string s(ss);
|
||||
MutablePackageDepSpecData result(fns.options_for_partially_made_package_dep_spec()());
|
||||
PartiallyMadePackageDepSpec result(fns.options_for_partially_made_package_dep_spec()());
|
||||
|
||||
/* Remove trailing [use], [version] etc parts. */
|
||||
while (fns.remove_trailing_square_bracket_if_exists()(s, result))
|
||||
@ -62,7 +60,7 @@ paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, co
|
||||
/* Leading (or maybe =*) operator, so trailing version. */
|
||||
VersionOperator op(fns.get_remove_version_operator()(s));
|
||||
VersionSpec spec(fns.get_remove_trailing_version()(s));
|
||||
fns.add_version_requirement()(spec, op, vrc_and, result);
|
||||
fns.add_version_requirement()(op, spec, result);
|
||||
fns.add_package_requirement()(s, result);
|
||||
}
|
||||
else
|
||||
@ -88,7 +86,7 @@ paludis::elike_check_sanity(const std::string & s)
|
||||
}
|
||||
|
||||
bool
|
||||
paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options,
|
||||
const VersionSpecOptions & version_options,
|
||||
bool & had_bracket_version_requirements,
|
||||
@ -125,7 +123,68 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Mutable
|
||||
<< "Version range dependencies not safe for use here";
|
||||
}
|
||||
|
||||
parse_elike_version_range(flag, result, options, version_options, had_bracket_version_requirements);
|
||||
{
|
||||
char needed_mode(0);
|
||||
|
||||
while (! flag.empty())
|
||||
{
|
||||
Context cc("When parsing [] segment '" + flag + "':");
|
||||
|
||||
std::string op;
|
||||
std::string::size_type opos(0);
|
||||
while (opos < flag.length())
|
||||
if (std::string::npos == std::string("><=~").find(flag.at(opos)))
|
||||
break;
|
||||
else
|
||||
++opos;
|
||||
|
||||
op = flag.substr(0, opos);
|
||||
flag.erase(0, opos);
|
||||
|
||||
if (op.empty())
|
||||
throw PackageDepSpecError("Missing operator inside []");
|
||||
|
||||
VersionOperator vop(op);
|
||||
|
||||
std::string ver;
|
||||
opos = flag.find_first_of("|&");
|
||||
if (std::string::npos == opos)
|
||||
{
|
||||
|
||||
ver = flag;
|
||||
flag.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == needed_mode)
|
||||
needed_mode = flag.at(opos);
|
||||
else if (needed_mode != flag.at(opos))
|
||||
throw PackageDepSpecError("Mixed & and | inside []");
|
||||
|
||||
result.version_requirements_mode((flag.at(opos) == '|' ? vr_or : vr_and));
|
||||
ver = flag.substr(0, opos++);
|
||||
flag.erase(0, opos);
|
||||
}
|
||||
|
||||
if (ver.empty())
|
||||
throw PackageDepSpecError("Missing version after operator '" + stringify(vop) + " inside []");
|
||||
|
||||
if ('*' == ver.at(ver.length() - 1))
|
||||
{
|
||||
ver.erase(ver.length() - 1);
|
||||
if (vop == vo_equal)
|
||||
vop = options[epdso_nice_equal_star] ? vo_nice_equal_star : vo_stupid_equal_star;
|
||||
else
|
||||
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
|
||||
}
|
||||
|
||||
VersionSpec vs(ver, version_options);
|
||||
result.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = vop,
|
||||
n::version_spec() = vs));
|
||||
had_bracket_version_requirements = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '.':
|
||||
@ -138,9 +197,8 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Mutable
|
||||
Log::get_instance()->message("e.package_dep_spec.key_not_allowed", ll_warning, lc_context)
|
||||
<< "Key requirements not safe for use here";
|
||||
}
|
||||
|
||||
auto k(parse_user_key_requirement(flag.substr(1)));
|
||||
result.require_key(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(std::make_shared<UserKeyRequirement>(flag.substr(1)));
|
||||
result.additional_requirement(req);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -180,7 +238,8 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Mutable
|
||||
if (options[epdso_strict_parsing])
|
||||
euro += euro_strict_parsing;
|
||||
|
||||
result.require_choice(parse_elike_use_requirement(flag, euro));
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag, euro));
|
||||
result.additional_requirement(req);
|
||||
|
||||
break;
|
||||
};
|
||||
@ -191,7 +250,7 @@ paludis::elike_remove_trailing_square_bracket_if_exists(std::string & s, Mutable
|
||||
}
|
||||
|
||||
void
|
||||
paludis::elike_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
paludis::elike_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options)
|
||||
{
|
||||
std::string::size_type repo_p;
|
||||
@ -207,12 +266,12 @@ paludis::elike_remove_trailing_repo_if_exists(std::string & s, MutablePackageDep
|
||||
<< "Repository dependencies not safe for use here";
|
||||
}
|
||||
|
||||
result.require_in_repository(RepositoryName(s.substr(repo_p + 2)));
|
||||
result.in_repository(RepositoryName(s.substr(repo_p + 2)));
|
||||
s.erase(repo_p);
|
||||
}
|
||||
|
||||
void
|
||||
paludis::elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
paludis::elike_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const ELikePackageDepSpecOptions & options)
|
||||
{
|
||||
std::string::size_type slot_p;
|
||||
@ -233,7 +292,7 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDep
|
||||
Log::get_instance()->message("e.package_dep_spec.slot_star_not_allowed", ll_warning, lc_context)
|
||||
<< "Slot '*' dependencies not safe for use here";
|
||||
}
|
||||
result.require_any_slot(false);
|
||||
result.slot_requirement(std::make_shared<ELikeSlotAnyUnlockedRequirement>());
|
||||
}
|
||||
else if ('=' == match.at(0))
|
||||
{
|
||||
@ -247,9 +306,9 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDep
|
||||
}
|
||||
|
||||
if (1 == match.length())
|
||||
result.require_any_slot(true);
|
||||
result.slot_requirement(std::make_shared<ELikeSlotAnyLockedRequirement>());
|
||||
else
|
||||
result.require_exact_slot(SlotName(s.substr(slot_p + 2)), true);
|
||||
result.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(SlotName(s.substr(slot_p + 2)), true));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,7 +320,7 @@ paludis::elike_remove_trailing_slot_if_exists(std::string & s, MutablePackageDep
|
||||
Log::get_instance()->message("e.package_dep_spec.slot_not_allowed", ll_warning, lc_context)
|
||||
<< "Slot dependencies not safe for use here";
|
||||
}
|
||||
result.require_exact_slot(SlotName(s.substr(slot_p + 1)), false);
|
||||
result.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(SlotName(s.substr(slot_p + 1)), false));
|
||||
}
|
||||
s.erase(slot_p);
|
||||
}
|
||||
@ -370,17 +429,15 @@ paludis::elike_get_remove_trailing_version(std::string & s, const VersionSpecOpt
|
||||
}
|
||||
|
||||
void
|
||||
paludis::elike_add_version_requirement(
|
||||
const VersionSpec & ver,
|
||||
const VersionOperator & op,
|
||||
const VersionRequirementCombiner vrc,
|
||||
MutablePackageDepSpecData & result)
|
||||
paludis::elike_add_version_requirement(const VersionOperator & op, const VersionSpec & spec, PartiallyMadePackageDepSpec & result)
|
||||
{
|
||||
result.require_version(vrc, op, ver);
|
||||
result.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = op,
|
||||
n::version_spec() = spec));
|
||||
}
|
||||
|
||||
void
|
||||
paludis::elike_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result)
|
||||
paludis::elike_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result)
|
||||
{
|
||||
if (std::string::npos == s.find('/'))
|
||||
throw PackageDepSpecError("No category/ found in '" + s + "' (cat/pkg is required, a simple pkg is not allowed here)");
|
||||
@ -390,19 +447,27 @@ paludis::elike_add_package_requirement(const std::string & s, MutablePackageDepS
|
||||
throw PackageDepSpecError("Wildcard '*' not allowed here");
|
||||
|
||||
if (0 != s.compare(s.length() - 2, 2, "/*"))
|
||||
result.require_package_name_part(PackageNamePart(s.substr(2)));
|
||||
result.package_name_part(PackageNamePart(s.substr(2)));
|
||||
}
|
||||
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
|
||||
{
|
||||
throw PackageDepSpecError("Wildcard '*' not allowed here");
|
||||
|
||||
result.require_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
}
|
||||
else
|
||||
result.require_package(QualifiedPackageName(s));
|
||||
result.package(QualifiedPackageName(s));
|
||||
}
|
||||
|
||||
MutablePackageDepSpecData
|
||||
namespace
|
||||
{
|
||||
const PartiallyMadePackageDepSpecOptions fixed_options_for_partially_made_package_dep_spec(PartiallyMadePackageDepSpecOptions o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec
|
||||
paludis::partial_parse_elike_package_dep_spec(
|
||||
const std::string & ss, const ELikePackageDepSpecOptions & options,
|
||||
const VersionSpecOptions & version_options)
|
||||
@ -413,19 +478,19 @@ paludis::partial_parse_elike_package_dep_spec(
|
||||
|
||||
bool had_bracket_version_requirements(false), had_use_requirements(false);
|
||||
|
||||
PackageDepSpecDataOptions o;
|
||||
PartiallyMadePackageDepSpecOptions o;
|
||||
if (options[epdso_disallow_nonranged_deps])
|
||||
o += pdsdo_always_use_ranged_deps;
|
||||
o += pmpdso_always_use_ranged_deps;
|
||||
|
||||
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
|
||||
n::add_package_requirement() = std::bind(&elike_add_package_requirement, _1, _2),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3, _4),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3),
|
||||
n::check_sanity() = &elike_check_sanity,
|
||||
n::get_remove_trailing_version() = std::bind(&elike_get_remove_trailing_version, _1, version_options),
|
||||
n::get_remove_version_operator() = std::bind(&elike_get_remove_version_operator, _1, options),
|
||||
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
|
||||
std::cref(had_bracket_version_requirements), options),
|
||||
n::options_for_partially_made_package_dep_spec() = return_literal_function(o),
|
||||
n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
|
||||
n::remove_trailing_repo_if_exists() = std::bind(&elike_remove_trailing_repo_if_exists, _1, _2, options),
|
||||
n::remove_trailing_slot_if_exists() = std::bind(&elike_remove_trailing_slot_if_exists, _1, _2, options),
|
||||
n::remove_trailing_square_bracket_if_exists() = std::bind(&elike_remove_trailing_square_bracket_if_exists,
|
||||
@ -440,68 +505,3 @@ paludis::parse_elike_package_dep_spec(const std::string & ss, const ELikePackage
|
||||
return partial_parse_elike_package_dep_spec(ss, options, version_options);
|
||||
}
|
||||
|
||||
void
|
||||
paludis::parse_elike_version_range(
|
||||
const std::string & s,
|
||||
MutablePackageDepSpecData & result,
|
||||
const ELikePackageDepSpecOptions & options,
|
||||
const VersionSpecOptions & version_options,
|
||||
bool & had_bracket_version_requirements)
|
||||
{
|
||||
std::string flag(s);
|
||||
VersionRequirementCombiner vrc(vrc_and);
|
||||
|
||||
while (! flag.empty())
|
||||
{
|
||||
Context cc("When parsing [] segment '" + flag + "':");
|
||||
VersionRequirementCombiner next_vrc(vrc);
|
||||
|
||||
std::string op;
|
||||
std::string::size_type opos(0);
|
||||
while (opos < flag.length())
|
||||
if (std::string::npos == std::string("><=~").find(flag.at(opos)))
|
||||
break;
|
||||
else
|
||||
++opos;
|
||||
|
||||
op = flag.substr(0, opos);
|
||||
flag.erase(0, opos);
|
||||
|
||||
if (op.empty())
|
||||
throw PackageDepSpecError("Missing operator inside []");
|
||||
|
||||
VersionOperator vop(op);
|
||||
|
||||
std::string ver;
|
||||
opos = flag.find_first_of("|&");
|
||||
if (std::string::npos == opos)
|
||||
{
|
||||
ver = flag;
|
||||
flag.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
next_vrc = (flag.at(opos) == '|' ? vrc_or : vrc_and);
|
||||
ver = flag.substr(0, opos++);
|
||||
flag.erase(0, opos);
|
||||
}
|
||||
|
||||
if (ver.empty())
|
||||
throw PackageDepSpecError("Missing version after operator '" + stringify(vop) + " inside []");
|
||||
|
||||
if ('*' == ver.at(ver.length() - 1))
|
||||
{
|
||||
ver.erase(ver.length() - 1);
|
||||
if (vop == vo_equal)
|
||||
vop = options[epdso_nice_equal_star] ? vo_nice_equal_star : vo_stupid_equal_star;
|
||||
else
|
||||
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
|
||||
}
|
||||
|
||||
VersionSpec vs(ver, version_options);
|
||||
result.require_version(vrc, vop, vs);
|
||||
had_bracket_version_requirements = true;
|
||||
vrc = next_vrc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2008, 2009, 2010 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
|
||||
@ -21,8 +21,6 @@
|
||||
#define PALUDIS_GUARD_PALUDIS_ELIKE_PACKAGE_DEP_SPEC_HH 1
|
||||
|
||||
#include <paludis/elike_package_dep_spec-fwd.hh>
|
||||
#include <paludis/dep_spec_data-fwd.hh>
|
||||
|
||||
#include <paludis/util/named_value.hh>
|
||||
|
||||
namespace paludis
|
||||
@ -43,20 +41,16 @@ namespace paludis
|
||||
|
||||
struct GenericELikePackageDepSpecParseFunctions
|
||||
{
|
||||
NamedValue<n::add_package_requirement, std::function<void (const std::string &, MutablePackageDepSpecData &)> > add_package_requirement;
|
||||
NamedValue<n::add_version_requirement, std::function<void (
|
||||
const VersionSpec &,
|
||||
const VersionOperator &,
|
||||
const VersionRequirementCombiner,
|
||||
MutablePackageDepSpecData &)> > add_version_requirement;
|
||||
NamedValue<n::add_package_requirement, std::function<void (const std::string &, PartiallyMadePackageDepSpec &)> > add_package_requirement;
|
||||
NamedValue<n::add_version_requirement, std::function<void (const VersionOperator &, const VersionSpec &, PartiallyMadePackageDepSpec &)> > add_version_requirement;
|
||||
NamedValue<n::check_sanity, std::function<void (const std::string &)> > check_sanity;
|
||||
NamedValue<n::get_remove_trailing_version, std::function<VersionSpec (std::string &)> > get_remove_trailing_version;
|
||||
NamedValue<n::get_remove_version_operator, std::function<VersionOperator (std::string &)> > get_remove_version_operator;
|
||||
NamedValue<n::has_version_operator, std::function<bool (const std::string &)> > has_version_operator;
|
||||
NamedValue<n::options_for_partially_made_package_dep_spec, std::function<const PackageDepSpecDataOptions ()> > options_for_partially_made_package_dep_spec;
|
||||
NamedValue<n::remove_trailing_repo_if_exists, std::function<void (std::string &, MutablePackageDepSpecData &)> > remove_trailing_repo_if_exists;
|
||||
NamedValue<n::remove_trailing_slot_if_exists, std::function<void (std::string &, MutablePackageDepSpecData &)> > remove_trailing_slot_if_exists;
|
||||
NamedValue<n::remove_trailing_square_bracket_if_exists, std::function<bool (std::string &, MutablePackageDepSpecData &)> > remove_trailing_square_bracket_if_exists;
|
||||
NamedValue<n::options_for_partially_made_package_dep_spec, std::function<const PartiallyMadePackageDepSpecOptions ()> > options_for_partially_made_package_dep_spec;
|
||||
NamedValue<n::remove_trailing_repo_if_exists, std::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_repo_if_exists;
|
||||
NamedValue<n::remove_trailing_slot_if_exists, std::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_slot_if_exists;
|
||||
NamedValue<n::remove_trailing_square_bracket_if_exists, std::function<bool (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_square_bracket_if_exists;
|
||||
};
|
||||
}
|
||||
|
||||
|
30
paludis/elike_slot_requirement-fwd.hh
Normal file
30
paludis/elike_slot_requirement-fwd.hh
Normal file
@ -0,0 +1,30 @@
|
||||
/* 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_ELIKE_SLOT_REQUIREMENT_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_ELIKE_SLOT_REQUIREMENT_FWD_HH 1
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class ELikeSlotExactRequirement;
|
||||
class ELikeSlotAnyLockedRequirement;
|
||||
class ELikeSlotAnyUnlockedRequirement;
|
||||
}
|
||||
|
||||
#endif
|
54
paludis/elike_slot_requirement.cc
Normal file
54
paludis/elike_slot_requirement.cc
Normal file
@ -0,0 +1,54 @@
|
||||
/* 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/elike_slot_requirement.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
ELikeSlotExactRequirement::ELikeSlotExactRequirement(const SlotName & s, const bool e) :
|
||||
_s(s),
|
||||
_e(e)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string
|
||||
ELikeSlotExactRequirement::as_string() const
|
||||
{
|
||||
return ":" + std::string(_e ? "=" : "") + stringify(_s);
|
||||
}
|
||||
|
||||
const SlotName
|
||||
ELikeSlotExactRequirement::slot() const
|
||||
{
|
||||
return _s;
|
||||
}
|
||||
|
||||
const std::string
|
||||
ELikeSlotAnyUnlockedRequirement::as_string() const
|
||||
{
|
||||
return ":*";
|
||||
}
|
||||
|
||||
const std::string
|
||||
ELikeSlotAnyLockedRequirement::as_string() const
|
||||
{
|
||||
return ":=";
|
||||
}
|
||||
|
58
paludis/elike_slot_requirement.hh
Normal file
58
paludis/elike_slot_requirement.hh
Normal file
@ -0,0 +1,58 @@
|
||||
/* 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_ELIKE_SLOT_REQUIREMENT_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_ELIKE_SLOT_REQUIREMENT_HH 1
|
||||
|
||||
#include <paludis/elike_slot_requirement-fwd.hh>
|
||||
#include <paludis/slot_requirement.hh>
|
||||
#include <paludis/name.hh>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class PALUDIS_VISIBLE ELikeSlotExactRequirement :
|
||||
public SlotExactRequirement
|
||||
{
|
||||
private:
|
||||
const SlotName _s;
|
||||
const bool _e;
|
||||
|
||||
public:
|
||||
ELikeSlotExactRequirement(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 PALUDIS_VISIBLE ELikeSlotAnyUnlockedRequirement :
|
||||
public SlotAnyUnlockedRequirement
|
||||
{
|
||||
public:
|
||||
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE ELikeSlotAnyLockedRequirement :
|
||||
public SlotAnyLockedRequirement
|
||||
{
|
||||
public:
|
||||
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -24,7 +24,7 @@
|
||||
#include <paludis/util/options-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/dep_spec-fwd.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement-fwd.hh>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
@ -37,7 +37,7 @@ namespace paludis
|
||||
|
||||
typedef Options<ELikeUseRequirementOption> ELikeUseRequirementOptions;
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> parse_elike_use_requirement(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> parse_elike_use_requirement(
|
||||
const std::string &, const ELikeUseRequirementOptions &)
|
||||
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
|
||||
}
|
||||
|
@ -18,15 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <paludis/elike_use_requirement.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/changed_choices.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
@ -34,7 +25,14 @@
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator.hh>
|
||||
#include <paludis/util/tribool.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/changed_choices.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
@ -503,7 +501,7 @@ namespace
|
||||
};
|
||||
|
||||
class UseRequirements :
|
||||
public ChoiceRequirement
|
||||
public AdditionalPackageDepSpecRequirement
|
||||
{
|
||||
private:
|
||||
typedef std::vector<std::shared_ptr<const UseRequirement> > Reqs;
|
||||
@ -814,7 +812,7 @@ ELikeUseRequirementError::ELikeUseRequirementError(const std::string & s, const
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement>
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement>
|
||||
paludis::parse_elike_use_requirement(const std::string & s,
|
||||
const ELikeUseRequirementOptions & options)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/elike_use_requirement.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/environments/test/test_environment.hh>
|
||||
|
||||
@ -68,25 +68,25 @@ TEST(ELikeUseRequirements, Simple)
|
||||
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
|
||||
set_conditionals(id, "enabled disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("enabled", { euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled", req1->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("disabled", { euro_strict_parsing }));
|
||||
EXPECT_EQ("[disabled]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req3(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled", { euro_strict_parsing }));
|
||||
EXPECT_EQ("[-enabled]", req3->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' disabled", req3->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req4(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-disabled", { euro_strict_parsing }));
|
||||
EXPECT_EQ("[-disabled]", req4->as_raw_string());
|
||||
EXPECT_EQ("Flag 'disabled' disabled", req4->as_human_string(make_null_shared_ptr()));
|
||||
@ -104,25 +104,25 @@ TEST(ELikeUseRequirements, Portage)
|
||||
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
|
||||
set_conditionals(id, "enabled disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("enabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled", req1->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("disabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[disabled]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req3(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-enabled]", req3->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' disabled", req3->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req4(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-disabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-disabled]", req4->as_raw_string());
|
||||
EXPECT_EQ("Flag 'disabled' disabled", req4->as_human_string(make_null_shared_ptr()));
|
||||
@ -140,31 +140,31 @@ TEST(ELikeUseRequirements, Multiple)
|
||||
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
|
||||
set_conditionals(id, "enabled disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("enabled,-disabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled,-disabled]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled", req1->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("enabled,disabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled,disabled]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' enabled", req2->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req3(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-enabled,-disabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-enabled,-disabled]", req3->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' disabled; Flag 'disabled' disabled", req3->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req4(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("enabled,-disabled,-enabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled,-disabled,-enabled]", req4->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' disabled", req4->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req4->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req5(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
|
||||
parse_elike_use_requirement("enabled,-disabled,enabled", { euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[enabled,-disabled,enabled]", req5->as_raw_string());
|
||||
EXPECT_EQ("Flag 'enabled' enabled; Flag 'disabled' disabled; Flag 'enabled' enabled", req5->as_human_string(make_null_shared_ptr()));
|
||||
@ -184,84 +184,84 @@ TEST(ELikeUseRequirements, Complex)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
|
||||
set_conditionals(id2, "pkgname");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req3(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname?]", req3->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req3->as_human_string(id));
|
||||
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req3->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req4(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname?]", req4->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req4->as_human_string(id2));
|
||||
EXPECT_TRUE(req4->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req4->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req5(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req5(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!?]", req5->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req5->as_human_string(id));
|
||||
EXPECT_TRUE(req5->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req5->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req6(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req6(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!?]", req6->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req6->as_human_string(id2));
|
||||
EXPECT_TRUE(req6->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req6->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req7(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname!?]", req7->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req8(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname!?]", req8->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
|
||||
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req9(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
|
||||
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req10(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
|
||||
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req11(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!=]", req11->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
|
||||
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req12(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!=]", req12->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
|
||||
@ -282,56 +282,56 @@ TEST(ELikeUseRequirements, ComplexPortage)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
|
||||
set_conditionals(id2, "pkgname");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req7(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req8(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
|
||||
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req9(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
|
||||
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req10(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
|
||||
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req11(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
|
||||
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req12(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
|
||||
@ -352,112 +352,112 @@ TEST(ELikeUseRequirements, Both)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
|
||||
set_conditionals(id2, "pkgname");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req7(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req8(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
|
||||
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req9(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
|
||||
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req10(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
|
||||
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req11(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
|
||||
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req12(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
|
||||
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req13(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
|
||||
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req14(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req15(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req16(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
|
||||
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req17(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req18(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
|
||||
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req19(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
|
||||
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req20(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_both_syntaxes, euro_strict_parsing }));
|
||||
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
|
||||
@ -556,112 +556,112 @@ TEST(ELikeUseRequirements, ComplexNonStrict)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
|
||||
set_conditionals(id2, "pkgname");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req7(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req8(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
|
||||
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req9(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
|
||||
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req10(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
|
||||
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req11(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
|
||||
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req12(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
|
||||
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req13(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
|
||||
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req14(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req15(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req16(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
|
||||
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req17(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req18(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
|
||||
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req19(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
|
||||
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req20(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps }));
|
||||
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
|
||||
@ -682,112 +682,112 @@ TEST(ELikeUseRequirements, PortageNonStrict)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
|
||||
set_conditionals(id2, "pkgname");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname?]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/enabled-1:0::fake'", req1->as_human_string(id));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname?]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is enabled for 'cat/disabled-1:0::fake'", req2->as_human_string(id2));
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req7(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req7(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[!pkgname?]", req7->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req7->as_human_string(id));
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req7->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req8(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req8(
|
||||
parse_elike_use_requirement("!pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[!pkgname?]", req8->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req8->as_human_string(id2));
|
||||
EXPECT_TRUE(! req8->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req8->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req9(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req9(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname=]", req9->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/enabled-1:0::fake'", req9->as_human_string(id));
|
||||
EXPECT_TRUE(req9->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(! req9->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req10(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req10(
|
||||
parse_elike_use_requirement("pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname=]", req10->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled like it is for 'cat/disabled-1:0::fake'", req10->as_human_string(id2));
|
||||
EXPECT_TRUE(! req10->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req10->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req11(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req11(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[!pkgname=]", req11->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req11->as_human_string(id));
|
||||
EXPECT_TRUE(! req11->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req11->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req12(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req12(
|
||||
parse_elike_use_requirement("!pkgname=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[!pkgname=]", req12->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req12->as_human_string(id2));
|
||||
EXPECT_TRUE(req12->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req12->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req13(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req13(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[-pkgname?]", req13->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/enabled-1:0::fake'", req13->as_human_string(id));
|
||||
EXPECT_TRUE(! req13->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req13->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req14(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req14(
|
||||
parse_elike_use_requirement("-pkgname?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[-pkgname?]", req14->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is enabled for 'cat/disabled-1:0::fake'", req14->as_human_string(id2));
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req14->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req15(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req15(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname!?]", req15->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/enabled-1:0::fake'", req15->as_human_string(id));
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req15->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req16(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req16(
|
||||
parse_elike_use_requirement("pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname!?]", req16->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled if it is disabled for 'cat/disabled-1:0::fake'", req16->as_human_string(id2));
|
||||
EXPECT_TRUE(req16->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(! req16->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req17(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req17(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[-pkgname!?]", req17->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/enabled-1:0::fake'", req17->as_human_string(id));
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req17->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req18(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req18(
|
||||
parse_elike_use_requirement("-pkgname!?", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[-pkgname!?]", req18->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' disabled if it is disabled for 'cat/disabled-1:0::fake'", req18->as_human_string(id2));
|
||||
EXPECT_TRUE(! req18->requirement_met(&env, 0, id, id2, 0).first);
|
||||
EXPECT_TRUE(req18->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req19(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req19(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname!=]", req19->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/enabled-1:0::fake'", req19->as_human_string(id));
|
||||
EXPECT_TRUE(! req19->requirement_met(&env, 0, id, id, 0).first);
|
||||
EXPECT_TRUE(req19->requirement_met(&env, 0, id2, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req20(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req20(
|
||||
parse_elike_use_requirement("pkgname!=", { euro_allow_self_deps, euro_portage_syntax }));
|
||||
EXPECT_EQ("[pkgname!=]", req20->as_raw_string());
|
||||
EXPECT_EQ("Flag 'pkgname' enabled or disabled opposite to how it is for 'cat/disabled-1:0::fake'", req20->as_human_string(id2));
|
||||
@ -806,25 +806,25 @@ TEST(ELikeUseRequirements, Defaults)
|
||||
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
|
||||
set_conditionals(id, "enabled disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("missing(+)", { euro_allow_default_values, euro_strict_parsing }));
|
||||
EXPECT_EQ("[missing(+)]", req1->as_raw_string());
|
||||
EXPECT_EQ("Flag 'missing' enabled, assuming enabled if missing", req1->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("missing(-)", { euro_allow_default_values, euro_strict_parsing }));
|
||||
EXPECT_EQ("[missing(-)]", req2->as_raw_string());
|
||||
EXPECT_EQ("Flag 'missing' enabled, assuming disabled if missing", req2->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req2->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req3(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req3(
|
||||
parse_elike_use_requirement("-missing(+)", { euro_allow_default_values, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-missing(+)]", req3->as_raw_string());
|
||||
EXPECT_EQ("Flag 'missing' disabled, assuming enabled if missing", req3->as_human_string(make_null_shared_ptr()));
|
||||
EXPECT_TRUE(! req3->requirement_met(&env, 0, id, make_null_shared_ptr(), 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req4(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req4(
|
||||
parse_elike_use_requirement("-missing(-)", { euro_allow_default_values, euro_strict_parsing }));
|
||||
EXPECT_EQ("[-missing(-)]", req4->as_raw_string());
|
||||
EXPECT_EQ("Flag 'missing' disabled, assuming disabled if missing", req4->as_human_string(make_null_shared_ptr()));
|
||||
@ -842,12 +842,12 @@ TEST(ELikeUseRequirements, PrefixStar)
|
||||
std::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
|
||||
set_conditionals(id, "foo:enabled foo:disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("foo:*", { euro_allow_default_values, euro_allow_self_deps }));
|
||||
EXPECT_EQ("[foo:*]", req1->as_raw_string());
|
||||
EXPECT_TRUE(! req1->requirement_met(&env, 0, id, id, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("foo:*=", { euro_allow_default_values, euro_allow_self_deps }));
|
||||
EXPECT_EQ("[foo:*=]", req2->as_raw_string());
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id, id, 0).first);
|
||||
@ -868,13 +868,13 @@ TEST(ELikeUseRequirements, QuestionDefaults)
|
||||
std::shared_ptr<FakePackageID> id2(fake->add_version("cat", "pkg2", "1"));
|
||||
set_conditionals(id2, "foo:enabled foo:disabled bar:enabled bar:disabled");
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req1(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
|
||||
parse_elike_use_requirement("foo:*(?)=", { euro_allow_default_values, euro_allow_self_deps, euro_allow_default_question_values }));
|
||||
EXPECT_EQ("[foo:*(?)=]", req1->as_raw_string());
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
EXPECT_TRUE(req1->requirement_met(&env, 0, id1, id2, 0).first);
|
||||
|
||||
std::shared_ptr<const ChoiceRequirement> req2(
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req2(
|
||||
parse_elike_use_requirement("bar:*(?)=", { euro_allow_default_values, euro_allow_self_deps, euro_allow_default_question_values }));
|
||||
EXPECT_EQ("[bar:*(?)=]", req2->as_raw_string());
|
||||
EXPECT_TRUE(req2->requirement_met(&env, 0, id2, id2, 0).first);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/save.hh>
|
||||
@ -499,7 +499,7 @@ EnvironmentImplementation::fetch_unique_qualified_package_name(const PackageName
|
||||
std::set<std::pair<CategoryNamePart, RepositoryName>, CategoryRepositoryNamePairComparator> checked;
|
||||
|
||||
std::shared_ptr<const PackageIDSequence> pkgs((*this)[selection::AllVersionsUnsorted(
|
||||
generator::Matches(MutablePackageDepSpecData({ }).require_package_name_part(p), make_null_shared_ptr(), { }) | f)]);
|
||||
generator::Matches(make_package_dep_spec({ }).package_name_part(p), make_null_shared_ptr(), { }) | f)]);
|
||||
|
||||
for (IndirectIterator<PackageIDSequence::ConstIterator> it(pkgs->begin()),
|
||||
it_end(pkgs->end()); it_end != it; ++it)
|
||||
|
@ -17,21 +17,18 @@
|
||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <paludis/environments/paludis/keywords_conf.hh>
|
||||
#include <paludis/environments/paludis/paludis_environment.hh>
|
||||
#include <paludis/environments/paludis/bashable_conf.hh>
|
||||
|
||||
#include "keywords_conf.hh"
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/config_file.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/environments/paludis/paludis_environment.hh>
|
||||
#include <paludis/environments/paludis/bashable_conf.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/tokeniser.hh>
|
||||
@ -41,7 +38,6 @@
|
||||
#include <paludis/util/set.hh>
|
||||
#include <paludis/util/hashes.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -108,9 +104,9 @@ KeywordsConf::add(const FSPath & filename)
|
||||
{
|
||||
std::shared_ptr<PackageDepSpec> d(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
|
||||
tokens.at(0), _imp->env, { updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
|
||||
if (d->package_name_requirement())
|
||||
if (d->package_ptr())
|
||||
{
|
||||
KeywordsList & k(_imp->qualified[d->package_name_requirement()->name()][d]);
|
||||
KeywordsList & k(_imp->qualified[*d->package_ptr()][d]);
|
||||
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
|
||||
t != t_end ; ++t)
|
||||
k.push_back(KeywordName(*t));
|
||||
|
@ -17,10 +17,7 @@
|
||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <paludis/environments/paludis/licenses_conf.hh>
|
||||
#include <paludis/environments/paludis/paludis_environment.hh>
|
||||
#include <paludis/environments/paludis/bashable_conf.hh>
|
||||
|
||||
#include "licenses_conf.hh"
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
@ -29,9 +26,9 @@
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/util/config_file.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/environments/paludis/paludis_environment.hh>
|
||||
#include <paludis/environments/paludis/bashable_conf.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/tokeniser.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
@ -40,7 +37,6 @@
|
||||
#include <paludis/util/iterator_funcs.hh>
|
||||
#include <paludis/util/hashes.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -108,9 +104,9 @@ LicensesConf::add(const FSPath & filename)
|
||||
std::shared_ptr<PackageDepSpec> d(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
|
||||
tokens.at(0), _imp->env,
|
||||
{ updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
|
||||
if (d->package_name_requirement())
|
||||
if (d->package_ptr())
|
||||
{
|
||||
LicensesList & k(_imp->qualified[d->package_name_requirement()->name()][d]);
|
||||
LicensesList & k(_imp->qualified[*d->package_ptr()][d]);
|
||||
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
|
||||
t != t_end ; ++t)
|
||||
k.push_back(*t);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <paludis/environments/paludis/paludis_environment.hh>
|
||||
#include <paludis/environments/paludis/paludis_config.hh>
|
||||
#include <paludis/environments/paludis/bashable_conf.hh>
|
||||
|
||||
#include <paludis/util/config_file.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
@ -32,7 +31,6 @@
|
||||
#include <paludis/util/iterator_funcs.hh>
|
||||
#include <paludis/util/hashes.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
@ -41,8 +39,6 @@
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/dep_spec_annotations.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -150,9 +146,9 @@ SuggestionsConf::add(const FSPath & filename)
|
||||
std::shared_ptr<PackageDepSpec> d(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
|
||||
tokens.at(0), _imp->env,
|
||||
{ updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
|
||||
if (d->package_name_requirement())
|
||||
if (d->package_ptr())
|
||||
{
|
||||
ValuesList & k(_imp->qualified[d->package_name_requirement()->name()][d]);
|
||||
ValuesList & k(_imp->qualified[*d->package_ptr()][d]);
|
||||
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
|
||||
t != t_end ; ++t)
|
||||
k.push_back(ValueFlag(*t));
|
||||
@ -212,10 +208,10 @@ SuggestionsConf::interest_in_suggestion(
|
||||
else
|
||||
{
|
||||
if (! l->pkg_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().package()) != l->pkg_requirement)
|
||||
if (stringify(spec.package_ptr()->package()) != l->pkg_requirement)
|
||||
continue;
|
||||
if (! l->cat_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().category()) != l->cat_requirement)
|
||||
if (stringify(spec.package_ptr()->category()) != l->cat_requirement)
|
||||
continue;
|
||||
|
||||
return l->negated ? false : true;
|
||||
@ -256,10 +252,10 @@ SuggestionsConf::interest_in_suggestion(
|
||||
else
|
||||
{
|
||||
if (! l->pkg_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().package()) != l->pkg_requirement)
|
||||
if (stringify(spec.package_ptr()->package()) != l->pkg_requirement)
|
||||
continue;
|
||||
if (! l->cat_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().category()) != l->cat_requirement)
|
||||
if (stringify(spec.package_ptr()->category()) != l->cat_requirement)
|
||||
continue;
|
||||
|
||||
return l->negated ? false : true;
|
||||
@ -287,10 +283,10 @@ SuggestionsConf::interest_in_suggestion(
|
||||
else
|
||||
{
|
||||
if (! l->pkg_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().package()) != l->pkg_requirement)
|
||||
if (stringify(spec.package_ptr()->package()) != l->pkg_requirement)
|
||||
continue;
|
||||
if (! l->cat_requirement.empty())
|
||||
if (stringify(spec.package_name_requirement()->name().category()) != l->cat_requirement)
|
||||
if (stringify(spec.package_ptr()->category()) != l->cat_requirement)
|
||||
continue;
|
||||
|
||||
return l->negated ? false : true;
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <paludis/environments/paludis/world.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/mutex.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
@ -26,11 +25,9 @@
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/safe_ofstream.hh>
|
||||
#include <paludis/util/fs_stat.hh>
|
||||
|
||||
#include <paludis/set_file.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <functional>
|
||||
|
||||
using namespace paludis;
|
||||
@ -169,10 +166,7 @@ void
|
||||
World::update_config_files_for_package_move(const PackageDepSpec & s, const QualifiedPackageName & n) const
|
||||
{
|
||||
if (_remove_string_from_world(stringify(s)))
|
||||
_add_string_to_world(stringify(
|
||||
MutablePackageDepSpecData(*s.data())
|
||||
.unrequire_package()
|
||||
.require_package(n)));
|
||||
_add_string_to_world(stringify(PartiallyMadePackageDepSpec(s).package(n)));
|
||||
}
|
||||
|
||||
const std::shared_ptr<const SetSpecTree>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <paludis/util/safe_ifstream.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <iterator>
|
||||
#include <cstdlib>
|
||||
@ -39,8 +39,8 @@ TEST(World, Updates)
|
||||
{
|
||||
TestEnvironment env;
|
||||
paludis_environment::World world(&env, w);
|
||||
world.update_config_files_for_package_move(MutablePackageDepSpecData({ })
|
||||
.require_package(QualifiedPackageName("cat/before")),
|
||||
world.update_config_files_for_package_move(make_package_dep_spec({ })
|
||||
.package(QualifiedPackageName("cat/before")),
|
||||
QualifiedPackageName("cat/after"));
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,7 @@
|
||||
#include <paludis/literal_metadata_key.hh>
|
||||
#include <paludis/repository_factory.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
@ -361,7 +360,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
|
||||
|
||||
template<typename I_>
|
||||
void
|
||||
PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string & def_value, const bool reject_choices)
|
||||
PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string & def_value, const bool reject_additional)
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
||||
@ -373,7 +372,7 @@ PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string &
|
||||
if (f.stat().is_directory())
|
||||
{
|
||||
std::for_each(FSIterator(f, { }), FSIterator(), std::bind(
|
||||
&PortageEnvironment::_load_atom_file<I_>, this, _1, i, def_value, reject_choices));
|
||||
&PortageEnvironment::_load_atom_file<I_>, this, _1, i, def_value, reject_additional));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,22 +388,7 @@ PortageEnvironment::_load_atom_file(const FSPath & f, I_ i, const std::string &
|
||||
|
||||
std::shared_ptr<PackageDepSpec> p(std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(
|
||||
tokens.at(0), this, UserPackageDepSpecOptions() + updso_no_disambiguation)));
|
||||
if (reject_choices && package_dep_spec_has_properties(*p, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = true,
|
||||
n::has_exact_slot_requirement() = indeterminate,
|
||||
n::has_from_repository() = indeterminate,
|
||||
n::has_in_repository() = indeterminate,
|
||||
n::has_installable_to_path() = indeterminate,
|
||||
n::has_installable_to_repository() = indeterminate,
|
||||
n::has_installed_at_path() = indeterminate,
|
||||
n::has_key_requirements() = indeterminate,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_tag() = indeterminate,
|
||||
n::has_version_requirements() = indeterminate
|
||||
)))
|
||||
if (reject_additional && p->additional_requirements_ptr())
|
||||
{
|
||||
Log::get_instance()->message("portage_environment.bad_spec", ll_warning, lc_context)
|
||||
<< "Dependency specification '" << stringify(*p)
|
||||
@ -955,10 +939,7 @@ void
|
||||
PortageEnvironment::update_config_files_for_package_move(const PackageDepSpec & s, const QualifiedPackageName & n) const
|
||||
{
|
||||
if (_remove_string_from_world(stringify(s)))
|
||||
_add_string_to_world(stringify(
|
||||
MutablePackageDepSpecData(*s.data())
|
||||
.unrequire_package()
|
||||
.require_package(n)));
|
||||
_add_string_to_world(stringify(PartiallyMadePackageDepSpec(s).package(n)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -178,8 +178,8 @@ TEST(PortageEnvironment, World)
|
||||
TestPortageEnvironment env("portage_environment_TEST_dir/world");
|
||||
FSPath w(FSPath::cwd() / "portage_environment_TEST_dir" / "world" / "var" / "lib" / "portage" / "world");
|
||||
|
||||
env.update_config_files_for_package_move(MutablePackageDepSpecData({ })
|
||||
.require_package(QualifiedPackageName("cat/before")),
|
||||
env.update_config_files_for_package_move(make_package_dep_spec({ })
|
||||
.package(QualifiedPackageName("cat/before")),
|
||||
QualifiedPackageName("cat/after"));
|
||||
|
||||
SafeIFStream f(w);
|
||||
|
@ -12,6 +12,7 @@ add(`about', `hh', `gtest')
|
||||
add(`about_metadata', `hh', `cc', `fwd')
|
||||
add(`action', `hh', `cc', `fwd', `se')
|
||||
add(`action_names', `hh', `cc', `fwd')
|
||||
add(`additional_package_dep_spec_requirement', `hh', `cc', `fwd')
|
||||
add(`always_enabled_dependency_label', `hh', `cc', `fwd')
|
||||
add(`broken_linkage_configuration', `hh', `cc', `gtest', `testscript')
|
||||
add(`broken_linkage_finder', `hh', `cc')
|
||||
@ -28,7 +29,7 @@ add(`create_output_manager_info', `hh', `cc', `fwd', `se')
|
||||
add(`dep_label', `hh', `cc', `fwd')
|
||||
add(`dep_spec', `hh', `cc', `gtest', `fwd')
|
||||
add(`dep_spec_annotations', `hh', `cc', `fwd', `se')
|
||||
add(`dep_spec_data', `hh', `cc', `fwd', `se')
|
||||
add(`dep_spec_data', `hh', `cc', `fwd')
|
||||
add(`dep_spec_flattener', `hh', `cc')
|
||||
add(`distribution', `hh', `cc', `impl', `fwd')
|
||||
add(`elf_linkage_checker', `hh', `cc')
|
||||
@ -37,6 +38,7 @@ add(`elike_choices', `hh', `cc', `fwd', `se')
|
||||
add(`elike_dep_parser', `hh', `cc', `fwd', `gtest', `se')
|
||||
add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
|
||||
add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
|
||||
add(`elike_slot_requirement', `hh', `cc', `fwd')
|
||||
add(`elike_use_requirement', `hh', `cc', `fwd', `se', `gtest')
|
||||
add(`environment', `hh', `fwd', `cc')
|
||||
add(`environment_factory', `hh', `fwd', `cc')
|
||||
@ -75,10 +77,10 @@ add(`output_manager_factory', `hh', `fwd', `cc')
|
||||
add(`output_manager_from_environment', `hh', `fwd', `cc')
|
||||
add(`package_dep_spec_collection', `hh', `cc', `fwd')
|
||||
add(`package_dep_spec_properties', `hh', `cc', `fwd')
|
||||
add(`package_dep_spec_requirement', `hh', `cc', `fwd', `se')
|
||||
add(`package_id', `hh', `cc', `fwd', `se')
|
||||
add(`paludis', `hh')
|
||||
add(`paludislike_options_conf', `hh', `cc', `fwd')
|
||||
add(`partially_made_package_dep_spec', `hh', `cc', `fwd', `se')
|
||||
add(`permitted_choice_value_parameter_values', `hh', `cc', `fwd')
|
||||
add(`pretty_print_options', `hh', `cc', `fwd', `se')
|
||||
add(`pretty_printer', `hh', `cc', `fwd')
|
||||
@ -89,6 +91,7 @@ add(`selection', `hh', `cc', `fwd', `gtest')
|
||||
add(`selection_handler', `hh', `cc', `fwd')
|
||||
add(`serialise', `hh', `cc', `fwd', `impl')
|
||||
add(`set_file', `hh', `cc', `se', `gtest', `testscript')
|
||||
add(`slot_requirement', `hh', `fwd', `cc')
|
||||
add(`spec_tree', `hh', `fwd', `cc')
|
||||
add(`standard_output_manager', `hh', `cc', `fwd')
|
||||
add(`stripper', `hh', `cc', `fwd', `gtest', `testscript')
|
||||
@ -100,5 +103,6 @@ add(`unformatted_pretty_printer', `hh', `cc', `fwd')
|
||||
add(`unmerger', `hh', `cc')
|
||||
add(`user_dep_spec', `hh', `cc', `se', `fwd', `gtest')
|
||||
add(`version_operator', `hh', `cc', `fwd', `se', `gtest')
|
||||
add(`version_requirements', `hh', `cc', `fwd')
|
||||
add(`version_spec', `hh', `cc', `se', `fwd', `gtest')
|
||||
|
||||
|
@ -467,8 +467,8 @@ namespace
|
||||
virtual std::string as_string() const
|
||||
{
|
||||
std::string suffix;
|
||||
if (options[mpo_ignore_choice_requirements])
|
||||
suffix = " (ignoring choice requirements)";
|
||||
if (options[mpo_ignore_additional_requirements])
|
||||
suffix = " (ignoring additional requirements)";
|
||||
return "packages matching " + stringify(spec) + suffix;
|
||||
}
|
||||
};
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <paludis/filter_handler.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator-impl.hh>
|
||||
@ -144,17 +143,17 @@ FuzzyCandidatesFinder::FuzzyCandidatesFinder(const Environment & e, const std::s
|
||||
{
|
||||
PackageDepSpec pds(parse_user_package_dep_spec(name, &e, { }));
|
||||
|
||||
if (pds.package_name_requirement())
|
||||
if (pds.package_ptr())
|
||||
{
|
||||
g = g & generator::Category(pds.package_name_requirement()->name().category());
|
||||
package = stringify(pds.package_name_requirement()->name().package());
|
||||
g = g & generator::Category(pds.package_ptr()->category());
|
||||
package = stringify(pds.package_ptr()->package());
|
||||
}
|
||||
|
||||
if (pds.in_repository_requirement())
|
||||
g = g & generator::InRepository(pds.in_repository_requirement()->name());
|
||||
if (pds.in_repository_ptr())
|
||||
g = g & generator::InRepository(*pds.in_repository_ptr());
|
||||
|
||||
if (pds.from_repository_requirement())
|
||||
g = g & generator::FromRepository(pds.from_repository_requirement()->name());
|
||||
if (pds.from_repository_ptr())
|
||||
g = g & generator::FromRepository(*pds.from_repository_ptr());
|
||||
}
|
||||
|
||||
std::shared_ptr<const PackageIDSequence> ids(e[selection::BestVersionOnly(g | FuzzyPackageName(package) | filter)]);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/repository.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/set.hh>
|
||||
@ -308,18 +307,16 @@ namespace
|
||||
const RepositoryContentMayExcludes & x) const
|
||||
{
|
||||
if (package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_additional_requirements() = indeterminate,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = indeterminate,
|
||||
n::has_exact_slot_requirement() = indeterminate,
|
||||
n::has_from_repository() = indeterminate,
|
||||
n::has_in_repository() = false,
|
||||
n::has_installable_to_path() = indeterminate,
|
||||
n::has_installable_to_repository() = indeterminate,
|
||||
n::has_installed_at_path() = false,
|
||||
n::has_key_requirements() = indeterminate,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_slot_requirement() = indeterminate,
|
||||
n::has_tag() = indeterminate,
|
||||
n::has_version_requirements() = indeterminate
|
||||
)))
|
||||
@ -327,25 +324,26 @@ namespace
|
||||
|
||||
std::shared_ptr<RepositoryNameSet> result(std::make_shared<RepositoryNameSet>());
|
||||
|
||||
if (spec.in_repository_requirement())
|
||||
if (spec.in_repository_ptr())
|
||||
{
|
||||
if (env->has_repository_named(spec.in_repository_requirement()->name()))
|
||||
if (env->has_repository_named(*spec.in_repository_ptr()))
|
||||
{
|
||||
if (spec.installed_at_path_requirement())
|
||||
if (spec.installed_at_path_ptr())
|
||||
{
|
||||
std::shared_ptr<const Repository> repo(env->fetch_repository(spec.in_repository_requirement()->name()));
|
||||
std::shared_ptr<const Repository> repo(env->fetch_repository(
|
||||
*spec.in_repository_ptr()));
|
||||
if (! repo->installed_root_key())
|
||||
return result;
|
||||
if (repo->installed_root_key()->parse_value() != spec.installed_at_path_requirement()->path())
|
||||
if (repo->installed_root_key()->parse_value() != *spec.installed_at_path_ptr())
|
||||
return result;
|
||||
}
|
||||
|
||||
result->insert(spec.in_repository_requirement()->name());
|
||||
result->insert(*spec.in_repository_ptr());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (spec.installed_at_path_requirement())
|
||||
if (spec.installed_at_path_ptr())
|
||||
{
|
||||
for (auto i(env->begin_repositories()),
|
||||
i_end(env->end_repositories()) ; i != i_end ; ++i)
|
||||
@ -353,7 +351,7 @@ namespace
|
||||
if (! (*i)->installed_root_key())
|
||||
continue;
|
||||
|
||||
if ((*i)->installed_root_key()->parse_value() != spec.installed_at_path_requirement()->path())
|
||||
if ((*i)->installed_root_key()->parse_value() != *spec.installed_at_path_ptr())
|
||||
continue;
|
||||
|
||||
result->insert((*i)->name());
|
||||
@ -371,45 +369,41 @@ namespace
|
||||
const std::shared_ptr<const RepositoryNameSet> & repos,
|
||||
const RepositoryContentMayExcludes & x) const
|
||||
{
|
||||
auto category_name_part_requirement(spec.category_name_part_requirement());
|
||||
if (category_name_part_requirement)
|
||||
if (spec.category_name_part_ptr())
|
||||
{
|
||||
std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
|
||||
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
|
||||
r != r_end ; ++r)
|
||||
if (env->fetch_repository(*r)->has_category_named(category_name_part_requirement->name_part(), x))
|
||||
if (env->fetch_repository(*r)->has_category_named(*spec.category_name_part_ptr(), x))
|
||||
{
|
||||
result->insert(category_name_part_requirement->name_part());
|
||||
result->insert(*spec.category_name_part_ptr());
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
auto package_name_part_requirement(spec.package_name_part_requirement());
|
||||
if (package_name_part_requirement)
|
||||
else if (spec.package_name_part_ptr())
|
||||
{
|
||||
std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
|
||||
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
|
||||
r != r_end ; ++r)
|
||||
{
|
||||
std::shared_ptr<const CategoryNamePartSet> cats(
|
||||
env->fetch_repository(*r)->category_names_containing_package(package_name_part_requirement->name_part(), x));
|
||||
env->fetch_repository(*r)
|
||||
->category_names_containing_package(*spec.package_name_part_ptr(), x));
|
||||
std::copy(cats->begin(), cats->end(), result->inserter());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
auto package_name_requirement(spec.package_name_requirement());
|
||||
if (package_name_requirement)
|
||||
else if (spec.package_ptr())
|
||||
{
|
||||
std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
|
||||
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
|
||||
r != r_end ; ++r)
|
||||
if (env->fetch_repository(*r)->has_category_named(package_name_requirement->name().category(), x))
|
||||
if (env->fetch_repository(*r)->has_category_named(spec.package_ptr()->category(), x))
|
||||
{
|
||||
result->insert(package_name_requirement->name().category());
|
||||
result->insert(spec.package_ptr()->category());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -425,29 +419,26 @@ namespace
|
||||
const std::shared_ptr<const CategoryNamePartSet> & cats,
|
||||
const RepositoryContentMayExcludes & x) const
|
||||
{
|
||||
auto package_name_part_requirement(spec.package_name_part_requirement());
|
||||
if (package_name_part_requirement)
|
||||
if (spec.package_name_part_ptr())
|
||||
{
|
||||
std::shared_ptr<QualifiedPackageNameSet> result(std::make_shared<QualifiedPackageNameSet>());
|
||||
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
|
||||
r != r_end ; ++r)
|
||||
for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
|
||||
c != c_end ; ++c)
|
||||
if (env->fetch_repository(*r)->has_package_named(*c + package_name_part_requirement->name_part(), x))
|
||||
result->insert(*c + package_name_part_requirement->name_part());
|
||||
if (env->fetch_repository(*r)->has_package_named(*c + *spec.package_name_part_ptr(), x))
|
||||
result->insert(*c + *spec.package_name_part_ptr());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
auto package_name_requirement(spec.package_name_requirement());
|
||||
if (package_name_requirement)
|
||||
else if (spec.package_ptr())
|
||||
{
|
||||
std::shared_ptr<QualifiedPackageNameSet> result(std::make_shared<QualifiedPackageNameSet>());
|
||||
for (RepositoryNameSet::ConstIterator r(repos->begin()), r_end(repos->end()) ;
|
||||
r != r_end ; ++r)
|
||||
if (env->fetch_repository(*r)->has_package_named(package_name_requirement->name(), x))
|
||||
if (env->fetch_repository(*r)->has_package_named(*spec.package_ptr(), x))
|
||||
{
|
||||
result->insert(package_name_requirement->name());
|
||||
result->insert(*spec.package_ptr());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -486,8 +477,8 @@ namespace
|
||||
virtual std::string as_string() const
|
||||
{
|
||||
std::string suffix;
|
||||
if (options[mpo_ignore_choice_requirements])
|
||||
suffix = " (ignoring choice requirements)";
|
||||
if (options[mpo_ignore_additional_requirements])
|
||||
suffix = " (ignoring additional requirements)";
|
||||
return "packages matching " + stringify(spec) + suffix;
|
||||
}
|
||||
};
|
||||
|
@ -21,13 +21,13 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/dep_spec_flattener.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/action.hh>
|
||||
#include <paludis/repository.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/contents.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/set.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
@ -36,15 +36,11 @@
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/destringify.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <list>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
@ -52,155 +48,30 @@ using namespace paludis;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct RequirementChecker
|
||||
struct SlotRequirementChecker
|
||||
{
|
||||
const Environment & env;
|
||||
const std::shared_ptr<const PackageID> & id;
|
||||
const MatchPackageOptions & options;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
bool result;
|
||||
|
||||
bool version_requirements_ok;
|
||||
std::list<const ChoiceRequirement *> defer_choice_requirements;
|
||||
|
||||
RequirementChecker(
|
||||
const Environment & e,
|
||||
const std::shared_ptr<const PackageID> & i,
|
||||
const MatchPackageOptions & o) :
|
||||
env(e),
|
||||
SlotRequirementChecker(const std::shared_ptr<const PackageID> & i) :
|
||||
id(i),
|
||||
options(o),
|
||||
version_requirements_ok(true)
|
||||
result(true)
|
||||
{
|
||||
}
|
||||
|
||||
bool visit(const NameRequirement & r)
|
||||
void visit(const SlotExactRequirement & s)
|
||||
{
|
||||
return r.name() == id->name();
|
||||
result = id->slot_key() && id->slot_key()->parse_value() == s.slot();
|
||||
}
|
||||
|
||||
bool visit(const PackageNamePartRequirement & r)
|
||||
void visit(const SlotAnyLockedRequirement &)
|
||||
{
|
||||
return r.name_part() == id->name().package();
|
||||
result = true;
|
||||
}
|
||||
|
||||
bool visit(const CategoryNamePartRequirement & r)
|
||||
void visit(const SlotAnyUnlockedRequirement &)
|
||||
{
|
||||
return r.name_part() == id->name().category();
|
||||
}
|
||||
|
||||
bool visit(const VersionRequirement & r)
|
||||
{
|
||||
bool one(r.version_operator().as_version_spec_comparator()(id->version(), r.version_spec()));
|
||||
|
||||
switch (r.combiner())
|
||||
{
|
||||
case vrc_and: version_requirements_ok &= one; break;
|
||||
case vrc_or: version_requirements_ok |= one; break;
|
||||
case last_vrc: throw InternalError(PALUDIS_HERE, "Bad vrc");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const InRepositoryRequirement & r)
|
||||
{
|
||||
return r.name() == id->repository_name();
|
||||
}
|
||||
|
||||
bool visit(const FromRepositoryRequirement & r)
|
||||
{
|
||||
if (! id->from_repositories_key())
|
||||
return false;
|
||||
|
||||
auto v(id->from_repositories_key()->parse_value());
|
||||
return v->end() != v->find(stringify(r.name()));
|
||||
}
|
||||
|
||||
bool visit(const InstalledAtPathRequirement & r)
|
||||
{
|
||||
auto repo(env.fetch_repository(id->repository_name()));
|
||||
if (! repo->installed_root_key())
|
||||
return false;
|
||||
if (repo->installed_root_key()->parse_value() != r.path())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const InstallableToRepositoryRequirement & r)
|
||||
{
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! r.include_masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
const std::shared_ptr<const Repository> dest(env.fetch_repository(r.name()));
|
||||
if (! dest->destination_interface())
|
||||
return false;
|
||||
if (! dest->destination_interface()->is_suitable_destination_for(id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const InstallableToPathRequirement & r)
|
||||
{
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! r.include_masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
bool ok(false);
|
||||
for (auto d(env.begin_repositories()), d_end(env.end_repositories()) ;
|
||||
d != d_end ; ++d)
|
||||
{
|
||||
if (! (*d)->destination_interface())
|
||||
continue;
|
||||
if (! (*d)->installed_root_key())
|
||||
continue;
|
||||
if ((*d)->installed_root_key()->parse_value() != r.path())
|
||||
continue;
|
||||
if (! (*d)->destination_interface()->is_suitable_destination_for(id))
|
||||
continue;
|
||||
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! ok)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const ExactSlotRequirement & r)
|
||||
{
|
||||
if ((! id->slot_key()) || (id->slot_key()->parse_value() != r.name()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const AnySlotRequirement &)
|
||||
{
|
||||
/* don't care */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const ChoiceRequirement & r)
|
||||
{
|
||||
if (! options[mpo_ignore_choice_requirements])
|
||||
defer_choice_requirements.push_back(&r);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const KeyRequirement & r)
|
||||
{
|
||||
if (! r.matches(&env, id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -215,22 +86,132 @@ paludis::match_package_with_maybe_changes(
|
||||
const ChangedChoices * const maybe_changes_to_target,
|
||||
const MatchPackageOptions & options)
|
||||
{
|
||||
RequirementChecker c{env, id, options};
|
||||
|
||||
for (auto r(spec.requirements()->begin()), r_end(spec.requirements()->end()) ;
|
||||
r != r_end ; ++r)
|
||||
if (! (*r)->accept_returning<bool>(c))
|
||||
return false;
|
||||
|
||||
if (! c.version_requirements_ok)
|
||||
if (spec.package_ptr() && *spec.package_ptr() != id->name())
|
||||
return false;
|
||||
|
||||
if (spec.package_name_part_ptr() && *spec.package_name_part_ptr() != id->name().package())
|
||||
return false;
|
||||
|
||||
for (auto r(c.defer_choice_requirements.begin()), r_end(c.defer_choice_requirements.end()) ;
|
||||
r != r_end ; ++r)
|
||||
if (! (*r)->requirement_met(&env, maybe_changes_to_owner, id, from_id, maybe_changes_to_target).first)
|
||||
if (spec.category_name_part_ptr() && *spec.category_name_part_ptr() != id->name().category())
|
||||
return false;
|
||||
|
||||
if (spec.version_requirements_ptr())
|
||||
switch (spec.version_requirements_mode())
|
||||
{
|
||||
case vr_and:
|
||||
for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
|
||||
r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
if (! r->version_operator().as_version_spec_comparator()(id->version(), r->version_spec()))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case vr_or:
|
||||
{
|
||||
bool matched(false);
|
||||
for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
|
||||
r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
if (r->version_operator().as_version_spec_comparator()(id->version(), r->version_spec()))
|
||||
{
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! matched)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case last_vr:
|
||||
;
|
||||
}
|
||||
|
||||
if (spec.in_repository_ptr())
|
||||
if (*spec.in_repository_ptr() != id->repository_name())
|
||||
return false;
|
||||
|
||||
if (spec.from_repository_ptr())
|
||||
{
|
||||
if (! id->from_repositories_key())
|
||||
return false;
|
||||
|
||||
auto v(id->from_repositories_key()->parse_value());
|
||||
if (v->end() == v->find(stringify(*spec.from_repository_ptr())))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installed_at_path_ptr())
|
||||
{
|
||||
auto repo(env.fetch_repository(id->repository_name()));
|
||||
if (! repo->installed_root_key())
|
||||
return false;
|
||||
if (repo->installed_root_key()->parse_value() != *spec.installed_at_path_ptr())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installable_to_repository_ptr())
|
||||
{
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! spec.installable_to_repository_ptr()->include_masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
const std::shared_ptr<const Repository> dest(env.fetch_repository(
|
||||
spec.installable_to_repository_ptr()->repository()));
|
||||
if (! dest->destination_interface())
|
||||
return false;
|
||||
if (! dest->destination_interface()->is_suitable_destination_for(id))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.installable_to_path_ptr())
|
||||
{
|
||||
if (! id->supports_action(SupportsActionTest<InstallAction>()))
|
||||
return false;
|
||||
if (! spec.installable_to_path_ptr()->include_masked())
|
||||
if (id->masked())
|
||||
return false;
|
||||
|
||||
bool ok(false);
|
||||
for (auto d(env.begin_repositories()), d_end(env.end_repositories()) ;
|
||||
d != d_end ; ++d)
|
||||
{
|
||||
if (! (*d)->destination_interface())
|
||||
continue;
|
||||
if (! (*d)->installed_root_key())
|
||||
continue;
|
||||
if ((*d)->installed_root_key()->parse_value() != spec.installable_to_path_ptr()->path())
|
||||
continue;
|
||||
if (! (*d)->destination_interface()->is_suitable_destination_for(id))
|
||||
continue;
|
||||
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! ok)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spec.slot_requirement_ptr())
|
||||
{
|
||||
SlotRequirementChecker v(id);
|
||||
spec.slot_requirement_ptr()->accept(v);
|
||||
if (! v.result)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! options[mpo_ignore_additional_requirements])
|
||||
{
|
||||
if (spec.additional_requirements_ptr())
|
||||
{
|
||||
for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
|
||||
u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
|
||||
if (! (*u)->requirement_met(&env, maybe_changes_to_owner, id, from_id, maybe_changes_to_target).first)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ make_enum_MatchPackageOption()
|
||||
prefix mpo
|
||||
want_destringify
|
||||
|
||||
key mpo_ignore_choice_requirements "Ignore choice requirements"
|
||||
key mpo_ignore_additional_requirements "Ignore additional requirements"
|
||||
|
||||
doxygen_comment << "END"
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
@ -54,8 +53,8 @@ PackageDepSpecCollection::~PackageDepSpecCollection() = default;
|
||||
void
|
||||
PackageDepSpecCollection::insert(const PackageDepSpec & spec)
|
||||
{
|
||||
if (spec.package_name_requirement())
|
||||
_imp->by_name.insert(std::make_pair(spec.package_name_requirement()->name(), spec));
|
||||
if (spec.package_ptr())
|
||||
_imp->by_name.insert(std::make_pair(*spec.package_ptr(), spec));
|
||||
else
|
||||
_imp->unnamed.push_back(spec);
|
||||
}
|
||||
|
@ -19,174 +19,40 @@
|
||||
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <paludis/util/sequence.hh>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Finder
|
||||
inline bool check(const bool c, const Tribool w)
|
||||
{
|
||||
bool has_any_slot_requirement;
|
||||
bool has_category_name_part;
|
||||
bool has_choice_requirements;
|
||||
bool has_from_repository;
|
||||
bool has_in_repository;
|
||||
bool has_installable_to_path;
|
||||
bool has_installable_to_repository;
|
||||
bool has_installed_at_path;
|
||||
bool has_key_requirements;
|
||||
bool has_package_name_part;
|
||||
bool has_tag;
|
||||
bool has_version_requirements;
|
||||
|
||||
Finder() :
|
||||
has_any_slot_requirement(false),
|
||||
has_category_name_part(false),
|
||||
has_choice_requirements(false),
|
||||
has_from_repository(false),
|
||||
has_in_repository(false),
|
||||
has_installable_to_path(false),
|
||||
has_installable_to_repository(false),
|
||||
has_installed_at_path(false),
|
||||
has_key_requirements(false),
|
||||
has_package_name_part(false),
|
||||
has_tag(false),
|
||||
has_version_requirements(false)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const NameRequirement &)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const PackageNamePartRequirement &)
|
||||
{
|
||||
has_package_name_part = true;
|
||||
}
|
||||
|
||||
void visit(const CategoryNamePartRequirement &)
|
||||
{
|
||||
has_category_name_part = true;
|
||||
}
|
||||
|
||||
void visit(const VersionRequirement &)
|
||||
{
|
||||
has_version_requirements = true;
|
||||
}
|
||||
|
||||
void visit(const InRepositoryRequirement &)
|
||||
{
|
||||
has_in_repository = true;
|
||||
}
|
||||
|
||||
void visit(const FromRepositoryRequirement &)
|
||||
{
|
||||
has_from_repository = true;
|
||||
}
|
||||
|
||||
void visit(const InstalledAtPathRequirement &)
|
||||
{
|
||||
has_installed_at_path = true;
|
||||
}
|
||||
|
||||
void visit(const InstallableToRepositoryRequirement &)
|
||||
{
|
||||
has_installable_to_repository = true;
|
||||
}
|
||||
|
||||
void visit(const InstallableToPathRequirement &)
|
||||
{
|
||||
has_installable_to_path = true;
|
||||
}
|
||||
|
||||
void visit(const ExactSlotRequirement &)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const AnySlotRequirement &)
|
||||
{
|
||||
has_any_slot_requirement = true;
|
||||
}
|
||||
|
||||
void visit(const ChoiceRequirement &)
|
||||
{
|
||||
has_choice_requirements = true;
|
||||
}
|
||||
|
||||
void visit(const KeyRequirement &)
|
||||
{
|
||||
has_key_requirements = true;
|
||||
}
|
||||
};
|
||||
if (w.is_true())
|
||||
return c;
|
||||
else if (w.is_false())
|
||||
return ! c;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
paludis::package_dep_spec_has_properties(const PackageDepSpec & spec, const PackageDepSpecProperties & properties)
|
||||
{
|
||||
if (! properties.has_package().is_indeterminate())
|
||||
if (properties.has_package().is_true() != bool(spec.package_name_requirement()))
|
||||
return false;
|
||||
bool result(true);
|
||||
|
||||
if (! properties.has_exact_slot_requirement().is_indeterminate())
|
||||
if (properties.has_exact_slot_requirement().is_true() != bool(spec.exact_slot_requirement()))
|
||||
return false;
|
||||
result = result && check(bool(spec.additional_requirements_ptr()) && ! spec.additional_requirements_ptr()->empty(), properties.has_additional_requirements());
|
||||
result = result && check(bool(spec.category_name_part_ptr()), properties.has_category_name_part());
|
||||
result = result && check(bool(spec.from_repository_ptr()), properties.has_from_repository());
|
||||
result = result && check(bool(spec.in_repository_ptr()), properties.has_in_repository());
|
||||
result = result && check(bool(spec.installable_to_path_ptr()), properties.has_installable_to_path());
|
||||
result = result && check(bool(spec.installable_to_repository_ptr()), properties.has_installable_to_repository());
|
||||
result = result && check(bool(spec.installed_at_path_ptr()), properties.has_installed_at_path());
|
||||
result = result && check(bool(spec.package_ptr()), properties.has_package());
|
||||
result = result && check(bool(spec.package_name_part_ptr()), properties.has_package_name_part());
|
||||
result = result && check(bool(spec.slot_requirement_ptr()), properties.has_slot_requirement());
|
||||
result = result && check(spec.version_requirements_ptr() && ! spec.version_requirements_ptr()->empty(), properties.has_version_requirements());
|
||||
|
||||
Finder f;
|
||||
for (auto r(spec.requirements()->begin()), r_end(spec.requirements()->end()) ;
|
||||
r != r_end ; ++r)
|
||||
(*r)->accept(f);
|
||||
|
||||
if (! properties.has_any_slot_requirement().is_indeterminate())
|
||||
if (properties.has_any_slot_requirement().is_true() != f.has_any_slot_requirement)
|
||||
return false;
|
||||
|
||||
if (! properties.has_category_name_part().is_indeterminate())
|
||||
if (properties.has_category_name_part().is_true() != f.has_category_name_part)
|
||||
return false;
|
||||
|
||||
if (! properties.has_choice_requirements().is_indeterminate())
|
||||
if (properties.has_choice_requirements().is_true() != f.has_choice_requirements)
|
||||
return false;
|
||||
|
||||
if (! properties.has_from_repository().is_indeterminate())
|
||||
if (properties.has_from_repository().is_true() != f.has_from_repository)
|
||||
return false;
|
||||
|
||||
if (! properties.has_in_repository().is_indeterminate())
|
||||
if (properties.has_in_repository().is_true() != f.has_in_repository)
|
||||
return false;
|
||||
|
||||
if (! properties.has_installable_to_path().is_indeterminate())
|
||||
if (properties.has_installable_to_path().is_true() != f.has_installable_to_path)
|
||||
return false;
|
||||
|
||||
if (! properties.has_installable_to_repository().is_indeterminate())
|
||||
if (properties.has_installable_to_repository().is_true() != f.has_installable_to_repository)
|
||||
return false;
|
||||
|
||||
if (! properties.has_installed_at_path().is_indeterminate())
|
||||
if (properties.has_installed_at_path().is_true() != f.has_installed_at_path)
|
||||
return false;
|
||||
|
||||
if (! properties.has_key_requirements().is_indeterminate())
|
||||
if (properties.has_key_requirements().is_true() != f.has_key_requirements)
|
||||
return false;
|
||||
|
||||
if (! properties.has_package_name_part().is_indeterminate())
|
||||
if (properties.has_package_name_part().is_true() != f.has_package_name_part)
|
||||
return false;
|
||||
|
||||
if (! properties.has_tag().is_indeterminate())
|
||||
if (properties.has_tag().is_true() != f.has_tag)
|
||||
return false;
|
||||
|
||||
if (! properties.has_version_requirements().is_indeterminate())
|
||||
if (properties.has_version_requirements().is_true() != f.has_version_requirements)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2009, 2010 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
|
||||
@ -21,8 +21,6 @@
|
||||
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_SPEC_PROPERTIES_HH 1
|
||||
|
||||
#include <paludis/package_dep_spec_properties-fwd.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
|
||||
#include <paludis/util/named_value.hh>
|
||||
#include <paludis/util/tribool.hh>
|
||||
|
||||
@ -30,18 +28,16 @@ namespace paludis
|
||||
{
|
||||
namespace n
|
||||
{
|
||||
typedef Name<struct name_has_any_slot_requirement> has_any_slot_requirement;
|
||||
typedef Name<struct name_has_additional_requirements> has_additional_requirements;
|
||||
typedef Name<struct name_has_category_name_part> has_category_name_part;
|
||||
typedef Name<struct name_has_choice_requirements> has_choice_requirements;
|
||||
typedef Name<struct name_has_exact_slot_requirement> has_exact_slot_requirement;
|
||||
typedef Name<struct name_has_from_repository> has_from_repository;
|
||||
typedef Name<struct name_has_in_repository> has_in_repository;
|
||||
typedef Name<struct name_has_installable_to_path> has_installable_to_path;
|
||||
typedef Name<struct name_has_installable_to_repository> has_installable_to_repository;
|
||||
typedef Name<struct name_has_installed_at_path> has_installed_at_path;
|
||||
typedef Name<struct name_has_key_requirements> has_key_requirements;
|
||||
typedef Name<struct name_has_package> has_package;
|
||||
typedef Name<struct name_has_package_name_part> has_package_name_part;
|
||||
typedef Name<struct name_has_slot_requirement> has_slot_requirement;
|
||||
typedef Name<struct name_has_tag> has_tag;
|
||||
typedef Name<struct name_has_version_requirements> has_version_requirements;
|
||||
}
|
||||
@ -54,35 +50,19 @@ namespace paludis
|
||||
*/
|
||||
struct PackageDepSpecProperties
|
||||
{
|
||||
NamedValue<n::has_any_slot_requirement, Tribool> has_any_slot_requirement;
|
||||
NamedValue<n::has_additional_requirements, Tribool> has_additional_requirements;
|
||||
NamedValue<n::has_category_name_part, Tribool> has_category_name_part;
|
||||
NamedValue<n::has_choice_requirements, Tribool> has_choice_requirements;
|
||||
NamedValue<n::has_exact_slot_requirement, Tribool> has_exact_slot_requirement;
|
||||
NamedValue<n::has_from_repository, Tribool> has_from_repository;
|
||||
NamedValue<n::has_in_repository, Tribool> has_in_repository;
|
||||
NamedValue<n::has_installable_to_path, Tribool> has_installable_to_path;
|
||||
NamedValue<n::has_installable_to_repository, Tribool> has_installable_to_repository;
|
||||
NamedValue<n::has_installed_at_path, Tribool> has_installed_at_path;
|
||||
NamedValue<n::has_key_requirements, Tribool> has_key_requirements;
|
||||
NamedValue<n::has_package, Tribool> has_package;
|
||||
NamedValue<n::has_package_name_part, Tribool> has_package_name_part;
|
||||
NamedValue<n::has_slot_requirement, Tribool> has_slot_requirement;
|
||||
NamedValue<n::has_tag, Tribool> has_tag;
|
||||
NamedValue<n::has_version_requirements, Tribool> has_version_requirements;
|
||||
};
|
||||
|
||||
template <typename T_>
|
||||
struct DetectPackageDepSpecRequirement
|
||||
{
|
||||
bool visit(const T_ &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool visit(const PackageDepSpecRequirement &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 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_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_SPEC_REQUIREMENT_FWD_HH 1
|
||||
|
||||
#include <paludis/util/pool-fwd.hh>
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/sequence-fwd.hh>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class PackageDepSpecRequirement;
|
||||
|
||||
typedef Sequence<std::shared_ptr<const PackageDepSpecRequirement> > PackageDepSpecRequirementSequence;
|
||||
|
||||
class NameRequirement;
|
||||
typedef Pool<NameRequirement> NameRequirementPool;
|
||||
|
||||
class PackageNamePartRequirement;
|
||||
typedef Pool<PackageNamePartRequirement> PackageNamePartRequirementPool;
|
||||
|
||||
class CategoryNamePartRequirement;
|
||||
typedef Pool<CategoryNamePartRequirement> CategoryNamePartRequirementPool;
|
||||
|
||||
class VersionRequirement;
|
||||
|
||||
typedef Sequence<std::shared_ptr<const VersionRequirement> > VersionRequirementSequence;
|
||||
|
||||
class InRepositoryRequirement;
|
||||
typedef Pool<InRepositoryRequirement> InRepositoryRequirementPool;
|
||||
|
||||
class FromRepositoryRequirement;
|
||||
typedef Pool<FromRepositoryRequirement> FromRepositoryRequirementPool;
|
||||
|
||||
class InstalledAtPathRequirement;
|
||||
typedef Pool<InstalledAtPathRequirement> InstalledAtPathRequirementPool;
|
||||
|
||||
class InstallableToPathRequirement;
|
||||
typedef Pool<InstallableToPathRequirement> InstallableToPathRequirementPool;
|
||||
|
||||
class InstallableToRepositoryRequirement;
|
||||
typedef Pool<InstallableToRepositoryRequirement> InstallableToRepositoryRequirementPool;
|
||||
|
||||
class ExactSlotRequirement;
|
||||
typedef Pool<ExactSlotRequirement> ExactSlotRequirementPool;
|
||||
|
||||
class AnySlotRequirement;
|
||||
typedef Pool<AnySlotRequirement> AnySlotRequirementPool;
|
||||
|
||||
class KeyRequirement;
|
||||
typedef Pool<KeyRequirement> KeyRequirementPool;
|
||||
|
||||
typedef Sequence<std::shared_ptr<const KeyRequirement> > KeyRequirementSequence;
|
||||
|
||||
class ChoiceRequirement;
|
||||
|
||||
typedef Sequence<std::shared_ptr<const ChoiceRequirement> > ChoiceRequirementSequence;
|
||||
|
||||
#include <paludis/package_dep_spec_requirement-se.hh>
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,1156 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 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/package_dep_spec_requirement.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/contents.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/repository.hh>
|
||||
#include <paludis/mask.hh>
|
||||
|
||||
#include <paludis/util/pool-impl.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/singleton-impl.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/sequence-impl.hh>
|
||||
#include <paludis/util/set-impl.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator-impl.hh>
|
||||
#include <paludis/util/wrapped_output_iterator-impl.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/timestamp.hh>
|
||||
#include <paludis/util/destringify.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
#include <paludis/package_dep_spec_requirement-se.cc>
|
||||
|
||||
PackageDepSpecRequirement::~PackageDepSpecRequirement() = default;
|
||||
|
||||
template class Sequence<std::shared_ptr<const PackageDepSpecRequirement> >;
|
||||
template class WrappedForwardIterator<Sequence<std::shared_ptr<const PackageDepSpecRequirement> >::ConstIteratorTag, const std::shared_ptr<const PackageDepSpecRequirement> >;
|
||||
template class WrappedOutputIterator<Sequence<std::shared_ptr<const PackageDepSpecRequirement> >::InserterTag, std::shared_ptr<const PackageDepSpecRequirement> >;
|
||||
|
||||
NameRequirement::NameRequirement(const QualifiedPackageName & n) :
|
||||
_name(n)
|
||||
{
|
||||
}
|
||||
|
||||
NameRequirement::~NameRequirement() = default;
|
||||
|
||||
const QualifiedPackageName
|
||||
NameRequirement::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
template class Pool<NameRequirement>;
|
||||
template class Singleton<Pool<NameRequirement> >;
|
||||
template const std::shared_ptr<const NameRequirement> Pool<NameRequirement>::create(
|
||||
const QualifiedPackageName &) const;
|
||||
|
||||
CategoryNamePartRequirement::CategoryNamePartRequirement(const CategoryNamePart & n) :
|
||||
_name_part(n)
|
||||
{
|
||||
}
|
||||
|
||||
CategoryNamePartRequirement::~CategoryNamePartRequirement() = default;
|
||||
|
||||
const CategoryNamePart
|
||||
CategoryNamePartRequirement::name_part() const
|
||||
{
|
||||
return _name_part;
|
||||
}
|
||||
|
||||
template class Pool<CategoryNamePartRequirement>;
|
||||
template class Singleton<Pool<CategoryNamePartRequirement> >;
|
||||
template const std::shared_ptr<const CategoryNamePartRequirement> Pool<CategoryNamePartRequirement>::create(
|
||||
const CategoryNamePart &) const;
|
||||
|
||||
PackageNamePartRequirement::PackageNamePartRequirement(const PackageNamePart & n) :
|
||||
_name_part(n)
|
||||
{
|
||||
}
|
||||
|
||||
PackageNamePartRequirement::~PackageNamePartRequirement() = default;
|
||||
|
||||
const PackageNamePart
|
||||
PackageNamePartRequirement::name_part() const
|
||||
{
|
||||
return _name_part;
|
||||
}
|
||||
|
||||
template class Pool<PackageNamePartRequirement>;
|
||||
template class Singleton<Pool<PackageNamePartRequirement> >;
|
||||
template const std::shared_ptr<const PackageNamePartRequirement> Pool<PackageNamePartRequirement>::create(
|
||||
const PackageNamePart &) const;
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <>
|
||||
struct Imp<VersionRequirement>
|
||||
{
|
||||
VersionSpec spec;
|
||||
VersionOperator op;
|
||||
VersionRequirementCombiner combiner;
|
||||
|
||||
Imp(const VersionSpec & s, const VersionOperator & o, const VersionRequirementCombiner c) :
|
||||
spec(s),
|
||||
op(o),
|
||||
combiner(c)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
VersionRequirement::VersionRequirement(const VersionSpec & s, const VersionOperator & o, const VersionRequirementCombiner c) :
|
||||
_imp(s, o, c)
|
||||
{
|
||||
}
|
||||
|
||||
VersionRequirement::~VersionRequirement() = default;
|
||||
|
||||
const VersionSpec
|
||||
VersionRequirement::version_spec() const
|
||||
{
|
||||
return _imp->spec;
|
||||
}
|
||||
|
||||
const VersionOperator
|
||||
VersionRequirement::version_operator() const
|
||||
{
|
||||
return _imp->op;
|
||||
}
|
||||
|
||||
VersionRequirementCombiner
|
||||
VersionRequirement::combiner() const
|
||||
{
|
||||
return _imp->combiner;
|
||||
}
|
||||
|
||||
template class Sequence<std::shared_ptr<const VersionRequirement> >;
|
||||
template class WrappedForwardIterator<Sequence<std::shared_ptr<const VersionRequirement> >::ConstIteratorTag, const std::shared_ptr<const VersionRequirement> >;
|
||||
template class WrappedOutputIterator<Sequence<std::shared_ptr<const VersionRequirement> >::InserterTag, std::shared_ptr<const VersionRequirement> >;
|
||||
template class Pimp<VersionRequirement>;
|
||||
|
||||
InRepositoryRequirement::InRepositoryRequirement(const RepositoryName & n) :
|
||||
_name(n)
|
||||
{
|
||||
}
|
||||
|
||||
InRepositoryRequirement::~InRepositoryRequirement() = default;
|
||||
|
||||
const RepositoryName
|
||||
InRepositoryRequirement::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
template class Pool<InRepositoryRequirement>;
|
||||
template class Singleton<Pool<InRepositoryRequirement> >;
|
||||
template const std::shared_ptr<const InRepositoryRequirement> Pool<InRepositoryRequirement>::create(
|
||||
const RepositoryName &) const;
|
||||
|
||||
FromRepositoryRequirement::FromRepositoryRequirement(const RepositoryName & n) :
|
||||
_name(n)
|
||||
{
|
||||
}
|
||||
|
||||
FromRepositoryRequirement::~FromRepositoryRequirement() = default;
|
||||
|
||||
const RepositoryName
|
||||
FromRepositoryRequirement::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
template class Pool<FromRepositoryRequirement>;
|
||||
template class Singleton<Pool<FromRepositoryRequirement> >;
|
||||
template const std::shared_ptr<const FromRepositoryRequirement> Pool<FromRepositoryRequirement>::create(
|
||||
const RepositoryName &) const;
|
||||
|
||||
InstalledAtPathRequirement::InstalledAtPathRequirement(const FSPath & n) :
|
||||
_path(n)
|
||||
{
|
||||
}
|
||||
|
||||
InstalledAtPathRequirement::~InstalledAtPathRequirement() = default;
|
||||
|
||||
const FSPath
|
||||
InstalledAtPathRequirement::path() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
template class Pool<InstalledAtPathRequirement>;
|
||||
template class Singleton<Pool<InstalledAtPathRequirement> >;
|
||||
template const std::shared_ptr<const InstalledAtPathRequirement> Pool<InstalledAtPathRequirement>::create(
|
||||
const FSPath &) const;
|
||||
|
||||
InstallableToPathRequirement::InstallableToPathRequirement(const FSPath & n, const bool i) :
|
||||
_path(n),
|
||||
_include_masked(i)
|
||||
{
|
||||
}
|
||||
|
||||
InstallableToPathRequirement::~InstallableToPathRequirement() = default;
|
||||
|
||||
const FSPath
|
||||
InstallableToPathRequirement::path() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
bool
|
||||
InstallableToPathRequirement::include_masked() const
|
||||
{
|
||||
return _include_masked;
|
||||
}
|
||||
|
||||
template class Pool<InstallableToPathRequirement>;
|
||||
template class Singleton<Pool<InstallableToPathRequirement> >;
|
||||
template const std::shared_ptr<const InstallableToPathRequirement> Pool<InstallableToPathRequirement>::create(
|
||||
const FSPath &, const bool &) const;
|
||||
|
||||
InstallableToRepositoryRequirement::InstallableToRepositoryRequirement(const RepositoryName & n, const bool i) :
|
||||
_name(n),
|
||||
_include_masked(i)
|
||||
{
|
||||
}
|
||||
|
||||
InstallableToRepositoryRequirement::~InstallableToRepositoryRequirement() = default;
|
||||
|
||||
const RepositoryName
|
||||
InstallableToRepositoryRequirement::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
bool
|
||||
InstallableToRepositoryRequirement::include_masked() const
|
||||
{
|
||||
return _include_masked;
|
||||
}
|
||||
|
||||
template class Pool<InstallableToRepositoryRequirement>;
|
||||
template class Singleton<Pool<InstallableToRepositoryRequirement> >;
|
||||
template const std::shared_ptr<const InstallableToRepositoryRequirement> Pool<InstallableToRepositoryRequirement>::create(
|
||||
const RepositoryName &, const bool &) const;
|
||||
|
||||
ExactSlotRequirement::ExactSlotRequirement(const SlotName & n, const bool i) :
|
||||
_name(n),
|
||||
_locked(i)
|
||||
{
|
||||
}
|
||||
|
||||
ExactSlotRequirement::~ExactSlotRequirement() = default;
|
||||
|
||||
const SlotName
|
||||
ExactSlotRequirement::name() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
bool
|
||||
ExactSlotRequirement::locked() const
|
||||
{
|
||||
return _locked;
|
||||
}
|
||||
|
||||
template class Pool<ExactSlotRequirement>;
|
||||
template class Singleton<Pool<ExactSlotRequirement> >;
|
||||
template const std::shared_ptr<const ExactSlotRequirement> Pool<ExactSlotRequirement>::create(const SlotName &, const bool &) const;
|
||||
|
||||
AnySlotRequirement::AnySlotRequirement(const bool i) :
|
||||
_locking(i)
|
||||
{
|
||||
}
|
||||
|
||||
AnySlotRequirement::~AnySlotRequirement() = default;
|
||||
|
||||
bool
|
||||
AnySlotRequirement::locking() const
|
||||
{
|
||||
return _locking;
|
||||
}
|
||||
|
||||
template class Pool<AnySlotRequirement>;
|
||||
template class Singleton<Pool<AnySlotRequirement> >;
|
||||
template const std::shared_ptr<const AnySlotRequirement> Pool<AnySlotRequirement>::create(const bool &) const;
|
||||
|
||||
KeyRequirement::KeyRequirement(const KeyRequirementKeyType t, const std::string & k, const KeyRequirementOperation o, const std::string & p) :
|
||||
_key_type(t),
|
||||
_key(k),
|
||||
_operation(o),
|
||||
_pattern(p)
|
||||
{
|
||||
}
|
||||
|
||||
KeyRequirement::~KeyRequirement() = default;
|
||||
|
||||
KeyRequirementKeyType
|
||||
KeyRequirement::key_type() const
|
||||
{
|
||||
return _key_type;
|
||||
}
|
||||
|
||||
const std::string
|
||||
KeyRequirement::key() const
|
||||
{
|
||||
return _key;
|
||||
}
|
||||
|
||||
KeyRequirementOperation
|
||||
KeyRequirement::operation() const
|
||||
{
|
||||
return _operation;
|
||||
}
|
||||
|
||||
const std::string
|
||||
KeyRequirement::pattern() const
|
||||
{
|
||||
return _pattern;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string stringify_contents_entry(const ContentsEntry & e)
|
||||
{
|
||||
return stringify(e.location_key()->parse_value());
|
||||
}
|
||||
|
||||
struct StringifyEqual
|
||||
{
|
||||
const std::string pattern;
|
||||
|
||||
StringifyEqual(const std::string & p) :
|
||||
pattern(p)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T_>
|
||||
bool operator() (const T_ & t) const
|
||||
{
|
||||
return stringify(t) == pattern;
|
||||
}
|
||||
|
||||
bool operator() (const ContentsEntry & e) const
|
||||
{
|
||||
return stringify_contents_entry(e) == pattern;
|
||||
}
|
||||
};
|
||||
|
||||
struct SpecTreeSearcher
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
const std::string pattern;
|
||||
|
||||
SpecTreeSearcher(const Environment * const e, const std::shared_ptr<const PackageID> & i, const std::string & p) :
|
||||
env(e),
|
||||
id(i),
|
||||
pattern(p)
|
||||
{
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & n) const
|
||||
{
|
||||
if (n.spec()->condition_met(env, id))
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.spec()->end()) != std::find_if(indirect_iterator(n.spec()->begin()),
|
||||
indirect_iterator(n.spec()->end()), StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.spec()->end()) != std::find_if(indirect_iterator(n.spec()->begin()),
|
||||
indirect_iterator(n.spec()->end()), StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
};
|
||||
|
||||
struct KeyComparator
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
const std::string pattern;
|
||||
const KeyRequirementOperation op;
|
||||
|
||||
KeyComparator(const Environment * const e, const std::shared_ptr<const PackageID> & i,
|
||||
const std::string & p, const KeyRequirementOperation o) :
|
||||
env(e),
|
||||
id(i),
|
||||
pattern(p),
|
||||
op(o)
|
||||
{
|
||||
}
|
||||
|
||||
bool visit(const MetadataSectionKey &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataTimeKey & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value().seconds());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value().seconds()).find(pattern);
|
||||
case kro_less_than:
|
||||
return k.parse_value().seconds() < destringify<time_t>(pattern);
|
||||
case kro_greater_than:
|
||||
return k.parse_value().seconds() > destringify<time_t>(pattern);
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::string> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<SlotName> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<FSPath> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<bool> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<long> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
return k.parse_value() < destringify<long>(pattern);
|
||||
case kro_greater_than:
|
||||
return k.parse_value() > destringify<long>(pattern);
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const Contents> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ",
|
||||
stringify_contents_entry);
|
||||
case kro_less_than:
|
||||
return indirect_iterator(v->end()) != std::find_if(
|
||||
indirect_iterator(v->begin()),
|
||||
indirect_iterator(v->end()),
|
||||
StringifyEqual(pattern));
|
||||
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case kro_tilde:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == stringify(*k.parse_value());
|
||||
case kro_tilde:
|
||||
return std::string::npos != stringify(*k.parse_value()).find(pattern);
|
||||
case kro_less_than:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<DependencySpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<SetSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<PlainTextSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<ProvideSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<SimpleURISpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<FetchableURISpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<LicenseSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return false;
|
||||
case kro_less_than:
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<FSPathSequence> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case kro_less_than:
|
||||
return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<PackageIDSequence> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ");
|
||||
case kro_less_than:
|
||||
return indirect_iterator(v->end()) != std::find_if(
|
||||
indirect_iterator(v->begin()),
|
||||
indirect_iterator(v->end()),
|
||||
StringifyEqual(pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Sequence<std::string> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case kro_less_than:
|
||||
return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Set<std::string> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case kro_less_than:
|
||||
return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Map<std::string, std::string> > &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<KeywordNameSet> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case kro_equals:
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case kro_less_than:
|
||||
return v->end() != std::find_if(v->begin(), v->end(), StringifyEqual(pattern));
|
||||
|
||||
case kro_tilde:
|
||||
case kro_greater_than:
|
||||
case kro_question:
|
||||
case last_kro:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
struct AssociatedKeyFinder
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
|
||||
const MetadataKey * const visit(const UserMask &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MetadataKey * const visit(const UnacceptedMask & m) const
|
||||
{
|
||||
auto k(id->find_metadata(m.unaccepted_key_name()));
|
||||
if (k != id->end_metadata())
|
||||
return &**k;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MetadataKey * const visit(const RepositoryMask &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MetadataKey * const visit(const UnsupportedMask &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MetadataKey * const visit(const AssociationMask &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct MaskChecker
|
||||
{
|
||||
const std::string key;
|
||||
|
||||
bool visit(const UserMask & m) const
|
||||
{
|
||||
return key == "*" || key == "user" || m.token() == key;
|
||||
}
|
||||
|
||||
bool visit(const UnacceptedMask & m) const
|
||||
{
|
||||
return key == "*" || key == "unaccepted" || m.unaccepted_key_name() == key;
|
||||
}
|
||||
|
||||
bool visit(const RepositoryMask & m) const
|
||||
{
|
||||
return key == "*" || key == "repository" || m.token() == key;
|
||||
}
|
||||
|
||||
bool visit(const UnsupportedMask &) const
|
||||
{
|
||||
return key == "*" || key == "unsupported";
|
||||
}
|
||||
|
||||
bool visit(const AssociationMask &) const
|
||||
{
|
||||
return key == "*" || key == "association";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
bool
|
||||
KeyRequirement::matches(
|
||||
const Environment * const env,
|
||||
const std::shared_ptr<const PackageID> & id) const
|
||||
{
|
||||
const MetadataKey * k(0);
|
||||
const Mask * m(0);
|
||||
|
||||
switch (key_type())
|
||||
{
|
||||
case krkt_repo_role:
|
||||
{
|
||||
auto repo(env->fetch_repository(id->repository_name()));
|
||||
if (key() == "format")
|
||||
k = repo->format_key().get();
|
||||
else if (key() == "location")
|
||||
k = repo->location_key().get();
|
||||
else if (key() == "installed_root")
|
||||
k = repo->installed_root_key().get();
|
||||
else if (key() == "accept_keywords")
|
||||
k = repo->accept_keywords_key().get();
|
||||
else if (key() == "sync_host")
|
||||
k = repo->sync_host_key().get();
|
||||
}
|
||||
break;
|
||||
|
||||
case krkt_id_role:
|
||||
{
|
||||
if (key() == "behaviours")
|
||||
k = id->behaviours_key().get();
|
||||
else if (key() == "build_dependencies")
|
||||
k = id->build_dependencies_key().get();
|
||||
else if (key() == "choices")
|
||||
k = id->choices_key().get();
|
||||
else if (key() == "contained_in")
|
||||
k = id->contained_in_key().get();
|
||||
else if (key() == "contains")
|
||||
k = id->contains_key().get();
|
||||
else if (key() == "contents")
|
||||
k = id->contents_key().get();
|
||||
else if (key() == "dependencies")
|
||||
k = id->dependencies_key().get();
|
||||
else if (key() == "fetches")
|
||||
k = id->fetches_key().get();
|
||||
else if (key() == "from_repositories")
|
||||
k = id->from_repositories_key().get();
|
||||
else if (key() == "fs_location")
|
||||
k = id->fs_location_key().get();
|
||||
else if (key() == "homepage")
|
||||
k = id->homepage_key().get();
|
||||
else if (key() == "installed_time")
|
||||
k = id->installed_time_key().get();
|
||||
else if (key() == "keywords")
|
||||
k = id->keywords_key().get();
|
||||
else if (key() == "long_description")
|
||||
k = id->long_description_key().get();
|
||||
else if (key() == "post_dependencies")
|
||||
k = id->post_dependencies_key().get();
|
||||
else if (key() == "provide")
|
||||
k = id->provide_key().get();
|
||||
else if (key() == "run_dependencies")
|
||||
k = id->run_dependencies_key().get();
|
||||
else if (key() == "short_description")
|
||||
k = id->short_description_key().get();
|
||||
else if (key() == "slot")
|
||||
k = id->slot_key().get();
|
||||
else if (key() == "suggested_dependencies")
|
||||
k = id->suggested_dependencies_key().get();
|
||||
else if (key() == "virtual_for")
|
||||
k = id->virtual_for_key().get();
|
||||
}
|
||||
break;
|
||||
|
||||
case krkt_repo:
|
||||
{
|
||||
auto repo(env->fetch_repository(id->repository_name()));
|
||||
Repository::MetadataConstIterator mm(repo->find_metadata(key()));
|
||||
if (mm != repo->end_metadata())
|
||||
k = mm->get();
|
||||
}
|
||||
break;
|
||||
|
||||
case krkt_id:
|
||||
{
|
||||
PackageID::MetadataConstIterator mm(id->find_metadata(key()));
|
||||
if (mm != id->end_metadata())
|
||||
k = mm->get();
|
||||
}
|
||||
break;
|
||||
|
||||
case krkt_id_mask:
|
||||
{
|
||||
for (auto mm(id->begin_masks()), mm_end(id->end_masks()) ;
|
||||
mm != mm_end ; ++mm)
|
||||
if ((*mm)->accept_returning<bool>(MaskChecker{key()}))
|
||||
{
|
||||
m = &**mm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case last_krkt:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((! k) && (! m))
|
||||
return false;
|
||||
|
||||
if (operation() == kro_question)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
if (m)
|
||||
k = m->accept_returning<const MetadataKey *>(AssociatedKeyFinder{env, id});
|
||||
|
||||
if (k)
|
||||
{
|
||||
KeyComparator c(env, id, pattern(), operation());
|
||||
return k->accept_returning<bool>(c);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string
|
||||
KeyRequirement::as_raw_string() const
|
||||
{
|
||||
std::stringstream s;
|
||||
s << "[.";
|
||||
|
||||
switch (key_type())
|
||||
{
|
||||
case krkt_id: break;
|
||||
case krkt_id_role: s << "$"; break;
|
||||
case krkt_id_mask: s << "("; break;
|
||||
case krkt_repo: s << "::"; break;
|
||||
case krkt_repo_role: s << "::$"; break;
|
||||
case last_krkt:
|
||||
break;
|
||||
}
|
||||
|
||||
s << key();
|
||||
|
||||
switch (operation())
|
||||
{
|
||||
case kro_equals: s << "=" << pattern(); break;
|
||||
case kro_tilde: s << "~" << pattern(); break;
|
||||
case kro_less_than: s << "<" << pattern(); break;
|
||||
case kro_greater_than: s << ">" << pattern(); break;
|
||||
case kro_question: s << "?"; break;
|
||||
|
||||
case last_kro:
|
||||
throw InternalError(PALUDIS_HERE, "Bad KeyRequirementOperation");
|
||||
}
|
||||
|
||||
switch (key_type())
|
||||
{
|
||||
case krkt_id: break;
|
||||
case krkt_id_role: break;
|
||||
case krkt_id_mask: s << ")"; break;
|
||||
case krkt_repo: break;
|
||||
case krkt_repo_role: break;
|
||||
case last_krkt:
|
||||
break;
|
||||
}
|
||||
|
||||
s << "]";
|
||||
|
||||
return s.str();
|
||||
}
|
||||
|
||||
template class Pool<KeyRequirement>;
|
||||
template class Singleton<Pool<KeyRequirement> >;
|
||||
template const std::shared_ptr<const KeyRequirement> Pool<KeyRequirement>::create(
|
||||
const KeyRequirementKeyType &, const std::string &, const KeyRequirementOperation &, const std::string &) const;
|
||||
template class Sequence<std::shared_ptr<const KeyRequirement> >;
|
||||
template class WrappedOutputIterator<Sequence<std::shared_ptr<const KeyRequirement> >::InserterTag, std::shared_ptr<const KeyRequirement> >;
|
||||
template class WrappedForwardIterator<Sequence<std::shared_ptr<const KeyRequirement> >::ConstIteratorTag, const std::shared_ptr<const KeyRequirement> >;
|
||||
|
||||
ChoiceRequirement::ChoiceRequirement() = default;
|
||||
|
||||
template class Sequence<std::shared_ptr<const ChoiceRequirement> >;
|
||||
template class WrappedForwardIterator<Sequence<std::shared_ptr<const ChoiceRequirement> >::ConstIteratorTag, const std::shared_ptr<const ChoiceRequirement> >;
|
||||
template class WrappedOutputIterator<Sequence<std::shared_ptr<const ChoiceRequirement> >::InserterTag, std::shared_ptr<const ChoiceRequirement> >;
|
||||
|
@ -1,399 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 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_PACKAGE_DEP_SPEC_REQUIREMENT_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_SPEC_REQUIREMENT_HH 1
|
||||
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/version_operator-fwd.hh>
|
||||
#include <paludis/version_spec-fwd.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
#include <paludis/package_id-fwd.hh>
|
||||
#include <paludis/changed_choices-fwd.hh>
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/pool.hh>
|
||||
#include <paludis/util/visitor.hh>
|
||||
#include <paludis/util/type_list.hh>
|
||||
#include <paludis/util/fs_path.hh>
|
||||
#include <paludis/util/pimp.hh>
|
||||
#include <paludis/util/tribool-fwd.hh>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class PALUDIS_VISIBLE PackageDepSpecRequirement :
|
||||
public virtual DeclareAbstractAcceptMethods<PackageDepSpecRequirement, MakeTypeList<
|
||||
NameRequirement,
|
||||
PackageNamePartRequirement,
|
||||
CategoryNamePartRequirement,
|
||||
VersionRequirement,
|
||||
InRepositoryRequirement,
|
||||
FromRepositoryRequirement,
|
||||
InstalledAtPathRequirement,
|
||||
InstallableToPathRequirement,
|
||||
InstallableToRepositoryRequirement,
|
||||
AnySlotRequirement,
|
||||
ExactSlotRequirement,
|
||||
KeyRequirement,
|
||||
ChoiceRequirement
|
||||
>::Type>
|
||||
{
|
||||
public:
|
||||
virtual ~PackageDepSpecRequirement() = 0;
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE NameRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, NameRequirement>
|
||||
{
|
||||
friend class Pool<NameRequirement>;
|
||||
|
||||
private:
|
||||
QualifiedPackageName _name;
|
||||
|
||||
NameRequirement(const QualifiedPackageName &);
|
||||
|
||||
NameRequirement(const NameRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~NameRequirement();
|
||||
|
||||
const QualifiedPackageName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE CategoryNamePartRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, CategoryNamePartRequirement>
|
||||
{
|
||||
friend class Pool<CategoryNamePartRequirement>;
|
||||
|
||||
private:
|
||||
CategoryNamePart _name_part;
|
||||
|
||||
CategoryNamePartRequirement(const CategoryNamePart &);
|
||||
|
||||
CategoryNamePartRequirement(const CategoryNamePartRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~CategoryNamePartRequirement();
|
||||
|
||||
const CategoryNamePart name_part() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE PackageNamePartRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, PackageNamePartRequirement>
|
||||
{
|
||||
friend class Pool<PackageNamePartRequirement>;
|
||||
|
||||
private:
|
||||
PackageNamePart _name_part;
|
||||
|
||||
PackageNamePartRequirement(const PackageNamePart &);
|
||||
|
||||
PackageNamePartRequirement(const PackageNamePartRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~PackageNamePartRequirement();
|
||||
|
||||
const PackageNamePart name_part() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE VersionRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, VersionRequirement>
|
||||
{
|
||||
private:
|
||||
Pimp<VersionRequirement> _imp;
|
||||
|
||||
VersionRequirement(const VersionRequirement &) = delete;
|
||||
|
||||
public:
|
||||
/* not pooled for now, since VersionSpec gives equality for 1 and 1-r0 */
|
||||
VersionRequirement(const VersionSpec &, const VersionOperator &, const VersionRequirementCombiner);
|
||||
|
||||
~VersionRequirement();
|
||||
|
||||
const VersionSpec version_spec() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
const VersionOperator version_operator() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
VersionRequirementCombiner combiner() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE InRepositoryRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, InRepositoryRequirement>
|
||||
{
|
||||
friend class Pool<InRepositoryRequirement>;
|
||||
|
||||
private:
|
||||
RepositoryName _name;
|
||||
|
||||
InRepositoryRequirement(const RepositoryName &);
|
||||
|
||||
InRepositoryRequirement(const InRepositoryRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~InRepositoryRequirement();
|
||||
|
||||
const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE FromRepositoryRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, FromRepositoryRequirement>
|
||||
{
|
||||
friend class Pool<FromRepositoryRequirement>;
|
||||
|
||||
private:
|
||||
RepositoryName _name;
|
||||
|
||||
FromRepositoryRequirement(const RepositoryName &);
|
||||
|
||||
FromRepositoryRequirement(const FromRepositoryRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~FromRepositoryRequirement();
|
||||
|
||||
const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE InstalledAtPathRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, InstalledAtPathRequirement>
|
||||
{
|
||||
friend class Pool<InstalledAtPathRequirement>;
|
||||
|
||||
private:
|
||||
FSPath _path;
|
||||
|
||||
InstalledAtPathRequirement(const FSPath &);
|
||||
|
||||
InstalledAtPathRequirement(const InstalledAtPathRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~InstalledAtPathRequirement();
|
||||
|
||||
const FSPath path() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE InstallableToPathRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, InstallableToPathRequirement>
|
||||
{
|
||||
friend class Pool<InstallableToPathRequirement>;
|
||||
|
||||
private:
|
||||
FSPath _path;
|
||||
bool _include_masked;
|
||||
|
||||
InstallableToPathRequirement(const FSPath &, const bool);
|
||||
|
||||
InstallableToPathRequirement(const InstallableToPathRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~InstallableToPathRequirement();
|
||||
|
||||
const FSPath path() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
bool include_masked() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE InstallableToRepositoryRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, InstallableToRepositoryRequirement>
|
||||
{
|
||||
friend class Pool<InstallableToRepositoryRequirement>;
|
||||
|
||||
private:
|
||||
RepositoryName _name;
|
||||
bool _include_masked;
|
||||
|
||||
InstallableToRepositoryRequirement(const RepositoryName &, const bool);
|
||||
|
||||
InstallableToRepositoryRequirement(const InstallableToRepositoryRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~InstallableToRepositoryRequirement();
|
||||
|
||||
const RepositoryName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
bool include_masked() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE ExactSlotRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, ExactSlotRequirement>
|
||||
{
|
||||
friend class Pool<ExactSlotRequirement>;
|
||||
|
||||
private:
|
||||
SlotName _name;
|
||||
bool _locked;
|
||||
|
||||
ExactSlotRequirement(const SlotName &, const bool);
|
||||
|
||||
ExactSlotRequirement(const ExactSlotRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~ExactSlotRequirement();
|
||||
|
||||
const SlotName name() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE AnySlotRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, AnySlotRequirement>
|
||||
{
|
||||
friend class Pool<AnySlotRequirement>;
|
||||
|
||||
private:
|
||||
bool _locking;
|
||||
|
||||
AnySlotRequirement(const bool);
|
||||
|
||||
AnySlotRequirement(const AnySlotRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~AnySlotRequirement();
|
||||
|
||||
bool locking() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE KeyRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, KeyRequirement>
|
||||
{
|
||||
friend class Pool<KeyRequirement>;
|
||||
|
||||
private:
|
||||
KeyRequirementKeyType _key_type;
|
||||
std::string _key;
|
||||
KeyRequirementOperation _operation;
|
||||
std::string _pattern;
|
||||
|
||||
KeyRequirement(const KeyRequirementKeyType, const std::string &, const KeyRequirementOperation, const std::string &);
|
||||
|
||||
KeyRequirement(const KeyRequirement &) = delete;
|
||||
|
||||
public:
|
||||
~KeyRequirement();
|
||||
|
||||
KeyRequirementKeyType key_type() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
const std::string key() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
KeyRequirementOperation operation() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
const std::string pattern() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
bool matches(
|
||||
const Environment * const env,
|
||||
const std::shared_ptr<const PackageID> & id) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/**
|
||||
* Return a raw string representation of ourself.
|
||||
*/
|
||||
const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE ChoiceRequirement :
|
||||
public PackageDepSpecRequirement,
|
||||
public ImplementAcceptMethods<PackageDepSpecRequirement, ChoiceRequirement>
|
||||
{
|
||||
private:
|
||||
ChoiceRequirement(const ChoiceRequirement &) = delete;
|
||||
|
||||
protected:
|
||||
ChoiceRequirement();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Is our requirement met for a given PackageID?
|
||||
*
|
||||
* The string in the return type might be a description of why the
|
||||
* requirement was not met. Sometimes better messages can be given
|
||||
* than simply the return value of as_human_string() when the ID to
|
||||
* be matched is known. If the bool is false, the string is
|
||||
* meaningless.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.61 is in ChoiceRequirement
|
||||
*/
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const std::shared_ptr<const PackageID> & target_id,
|
||||
const std::shared_ptr<const PackageID> & spec_id,
|
||||
const ChangedChoices * const maybe_changes_to_target) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* If possible, indicate which choices to change to make our
|
||||
* requirement met for a particular ID.
|
||||
*
|
||||
* Verifies that the ID has the appropriate choice, and that that
|
||||
* choice isn't locked.
|
||||
*
|
||||
* Returns true for changes made, false for not possible,
|
||||
* indeterminate for nothing needs changing.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.61 is in ChoiceRequirement
|
||||
*/
|
||||
virtual Tribool accumulate_changes_to_make_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const maybe_changes_to_owner,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> & spec_id,
|
||||
ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* Return a human readable string representation of ourself.
|
||||
*
|
||||
* \param spec_id The PackageID the spec comes from. May be null. Used for
|
||||
* [use=] style dependencies.
|
||||
*
|
||||
* \since 0.61 is in ChoiceRequirement
|
||||
*/
|
||||
virtual const std::string as_human_string(
|
||||
const std::shared_ptr<const PackageID> & spec_id) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
|
||||
/**
|
||||
* Return a raw string representation of ourself.
|
||||
*/
|
||||
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
};
|
||||
|
||||
extern template class Pool<NameRequirement>;
|
||||
extern template class Pool<PackageNamePartRequirement>;
|
||||
extern template class Pool<CategoryNamePartRequirement>;
|
||||
extern template class Pool<VersionRequirement>;
|
||||
extern template class Pool<InRepositoryRequirement>;
|
||||
extern template class Pool<FromRepositoryRequirement>;
|
||||
extern template class Pool<InstalledAtPathRequirement>;
|
||||
extern template class Pool<InstallableToPathRequirement>;
|
||||
extern template class Pool<InstallableToRepositoryRequirement>;
|
||||
extern template class Pool<ExactSlotRequirement>;
|
||||
extern template class Pool<AnySlotRequirement>;
|
||||
extern template class Pool<KeyRequirement>;
|
||||
|
||||
extern template class Pimp<VersionRequirement>;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: set sw=4 sts=4 et ft=sh :
|
||||
|
||||
make_enum_KeyRequirementOperation()
|
||||
{
|
||||
prefix kro
|
||||
|
||||
key kro_equals "An = requirement"
|
||||
key kro_tilde "A ~ requirement"
|
||||
key kro_less_than "A less than requirement"
|
||||
key kro_greater_than "A greater than requirement"
|
||||
key kro_question "A question requirement"
|
||||
}
|
||||
|
||||
make_enum_KeyRequirementKeyType()
|
||||
{
|
||||
prefix krkt
|
||||
|
||||
key krkt_id "A regular [.key] requirement"
|
||||
key krkt_id_role "A role [.\$key] requirement"
|
||||
key krkt_id_mask "A role [.(mask)] requirement"
|
||||
key krkt_repo "A [.::repo] requirement"
|
||||
key krkt_repo_role "A [.::\$repo] requirement"
|
||||
}
|
||||
|
||||
make_enum_VersionRequirementCombiner()
|
||||
{
|
||||
prefix vrc
|
||||
|
||||
key vrc_and "And with previous value"
|
||||
key vrc_or "Or with previons value"
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <paludis/paludislike_options_conf.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/hashes.hh>
|
||||
#include <paludis/util/named_value.hh>
|
||||
@ -34,7 +33,6 @@
|
||||
#include <paludis/util/active_object_ptr.hh>
|
||||
#include <paludis/util/deferred_construction_ptr.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/name.hh>
|
||||
@ -44,8 +42,6 @@
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <list>
|
||||
@ -204,22 +200,7 @@ PaludisLikeOptionsConf::add_file(const FSPath & f)
|
||||
tokens.at(0), _imp->params.environment(),
|
||||
{ updso_allow_wildcards, updso_no_disambiguation, updso_throw_if_set })));
|
||||
|
||||
if (package_dep_spec_has_properties(*d, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = true,
|
||||
n::has_exact_slot_requirement() = indeterminate,
|
||||
n::has_from_repository() = indeterminate,
|
||||
n::has_in_repository() = indeterminate,
|
||||
n::has_installable_to_path() = indeterminate,
|
||||
n::has_installable_to_repository() = indeterminate,
|
||||
n::has_installed_at_path() = indeterminate,
|
||||
n::has_key_requirements() = indeterminate,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_tag() = indeterminate,
|
||||
n::has_version_requirements() = indeterminate
|
||||
)))
|
||||
if (d->additional_requirements_ptr())
|
||||
{
|
||||
Log::get_instance()->message("paludislike_options_conf.bad_spec", ll_warning, lc_context)
|
||||
<< "Dependency specification '" << stringify(*d)
|
||||
@ -227,10 +208,10 @@ PaludisLikeOptionsConf::add_file(const FSPath & f)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d->package_name_requirement())
|
||||
if (d->package_ptr())
|
||||
{
|
||||
SpecificSpecs::iterator i(_imp->specific_specs.insert(std::make_pair(
|
||||
d->package_name_requirement()->name(),
|
||||
*d->package_ptr(),
|
||||
SpecsWithValuesGroups())).first);
|
||||
values_groups = &i->second.insert(i->second.end(),
|
||||
make_named_values<SpecWithValuesGroups>(
|
||||
@ -356,18 +337,16 @@ namespace
|
||||
bool match_anything(const PackageDepSpec & spec)
|
||||
{
|
||||
return package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_additional_requirements() = false,
|
||||
n::has_category_name_part() = false,
|
||||
n::has_choice_requirements() = false,
|
||||
n::has_exact_slot_requirement() = false,
|
||||
n::has_from_repository() = false,
|
||||
n::has_in_repository() = false,
|
||||
n::has_installable_to_path() = false,
|
||||
n::has_installable_to_repository() = false,
|
||||
n::has_installed_at_path() = false,
|
||||
n::has_key_requirements() = false,
|
||||
n::has_package() = false,
|
||||
n::has_package_name_part() = false,
|
||||
n::has_slot_requirement() = false,
|
||||
n::has_tag() = false,
|
||||
n::has_version_requirements() = false
|
||||
));
|
||||
|
53
paludis/partially_made_package_dep_spec-fwd.hh
Normal file
53
paludis/partially_made_package_dep_spec-fwd.hh
Normal file
@ -0,0 +1,53 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 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_PARTIALLY_MADE_PACKAGE_DEP_SPEC_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_PARTIALLY_MADE_PACKAGE_DEP_SPEC_FWD_HH 1
|
||||
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/util/options-fwd.hh>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec-se.hh>
|
||||
|
||||
/**
|
||||
* Options for PartiallyMadePackageDepSpec.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.38
|
||||
*/
|
||||
typedef Options<PartiallyMadePackageDepSpecOption> PartiallyMadePackageDepSpecOptions;
|
||||
|
||||
class PartiallyMadePackageDepSpec;
|
||||
|
||||
/**
|
||||
* Create a PackageDepSpec from various rules.
|
||||
*
|
||||
* Note the return type is a PartiallyMadePackageDepSpec, which is implicitly convertible to
|
||||
* a PackageDepSpec.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.26
|
||||
*/
|
||||
PartiallyMadePackageDepSpec make_package_dep_spec(const PartiallyMadePackageDepSpecOptions &) PALUDIS_VISIBLE;
|
||||
}
|
||||
|
||||
#endif
|
567
paludis/partially_made_package_dep_spec.cc
Normal file
567
paludis/partially_made_package_dep_spec.cc
Normal file
@ -0,0 +1,567 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/wrapped_output_iterator-impl.hh>
|
||||
#include <paludis/util/iterator_funcs.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/sequence-impl.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec-se.cc>
|
||||
|
||||
PartiallyMadePackageDepSpec
|
||||
paludis::make_package_dep_spec(const PartiallyMadePackageDepSpecOptions & o)
|
||||
{
|
||||
return PartiallyMadePackageDepSpec(o);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct PartiallyMadePackageDepSpecData :
|
||||
PackageDepSpecData
|
||||
{
|
||||
std::shared_ptr<const QualifiedPackageName> package;
|
||||
std::shared_ptr<const PackageNamePart> package_name_part;
|
||||
std::shared_ptr<const CategoryNamePart> category_name_part;
|
||||
std::shared_ptr<VersionRequirements> version_requirements;
|
||||
VersionRequirementsMode version_requirements_mode_v;
|
||||
std::shared_ptr<const SlotRequirement> slot;
|
||||
std::shared_ptr<const RepositoryName> in_repository;
|
||||
std::shared_ptr<const RepositoryName> from_repository;
|
||||
std::shared_ptr<const InstallableToRepository> installable_to_repository;
|
||||
std::shared_ptr<const FSPath> installed_at_path;
|
||||
std::shared_ptr<const InstallableToPath> installable_to_path;
|
||||
std::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
|
||||
PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec_v;
|
||||
|
||||
PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecOptions & o) :
|
||||
PackageDepSpecData(),
|
||||
version_requirements_mode_v(vr_and),
|
||||
options_for_partially_made_package_dep_spec_v(o)
|
||||
{
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpecData(const PackageDepSpecData & other) :
|
||||
PackageDepSpecData(other),
|
||||
package(other.package_ptr()),
|
||||
package_name_part(other.package_name_part_ptr()),
|
||||
category_name_part(other.category_name_part_ptr()),
|
||||
version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
|
||||
version_requirements_mode_v(other.version_requirements_mode()),
|
||||
slot(other.slot_requirement_ptr()),
|
||||
in_repository(other.in_repository_ptr()),
|
||||
from_repository(other.from_repository_ptr()),
|
||||
installable_to_repository(other.installable_to_repository_ptr()),
|
||||
installed_at_path(other.installed_at_path_ptr()),
|
||||
installable_to_path(other.installable_to_path_ptr()),
|
||||
additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
|
||||
options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec())
|
||||
{
|
||||
if (version_requirements)
|
||||
std::copy(other.version_requirements_ptr()->begin(), other.version_requirements_ptr()->end(),
|
||||
version_requirements->back_inserter());
|
||||
|
||||
if (additional_requirements)
|
||||
std::copy(other.additional_requirements_ptr()->begin(), other.additional_requirements_ptr()->end(),
|
||||
additional_requirements->back_inserter());
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecData & other) :
|
||||
PackageDepSpecData(other),
|
||||
package(other.package),
|
||||
package_name_part(other.package_name_part),
|
||||
category_name_part(other.category_name_part),
|
||||
version_requirements(other.version_requirements),
|
||||
version_requirements_mode_v(other.version_requirements_mode_v),
|
||||
slot(other.slot),
|
||||
in_repository(other.in_repository),
|
||||
from_repository(other.from_repository),
|
||||
installable_to_repository(other.installable_to_repository),
|
||||
installed_at_path(other.installed_at_path),
|
||||
installable_to_path(other.installable_to_path),
|
||||
additional_requirements(other.additional_requirements),
|
||||
options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec_v)
|
||||
{
|
||||
}
|
||||
|
||||
virtual std::string as_string() const
|
||||
{
|
||||
std::ostringstream s;
|
||||
|
||||
if (version_requirements_ptr())
|
||||
{
|
||||
if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
|
||||
{
|
||||
}
|
||||
else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
|
||||
! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
|
||||
{
|
||||
if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
|
||||
s << "=";
|
||||
else
|
||||
s << version_requirements_ptr()->begin()->version_operator();
|
||||
}
|
||||
}
|
||||
|
||||
if (package_ptr())
|
||||
s << *package_ptr();
|
||||
else
|
||||
{
|
||||
if (category_name_part_ptr())
|
||||
s << *category_name_part_ptr();
|
||||
else
|
||||
s << "*";
|
||||
|
||||
s << "/";
|
||||
|
||||
if (package_name_part_ptr())
|
||||
s << *package_name_part_ptr();
|
||||
else
|
||||
s << "*";
|
||||
}
|
||||
|
||||
if (version_requirements_ptr())
|
||||
{
|
||||
if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
|
||||
{
|
||||
}
|
||||
else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
|
||||
! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
|
||||
{
|
||||
s << "-" << version_requirements_ptr()->begin()->version_spec();
|
||||
if (version_requirements_ptr()->begin()->version_operator() == vo_stupid_equal_star || version_requirements_ptr()->begin()->version_operator() == vo_nice_equal_star)
|
||||
s << "*";
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_requirement_ptr())
|
||||
s << stringify(*slot_requirement_ptr());
|
||||
|
||||
std::string left, right;
|
||||
bool need_arrow(false);
|
||||
|
||||
if (from_repository_ptr())
|
||||
left = stringify(*from_repository_ptr());
|
||||
|
||||
if (in_repository_ptr())
|
||||
right = stringify(*in_repository_ptr());
|
||||
|
||||
if (installed_at_path_ptr())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
right.append(stringify(*installed_at_path_ptr()));
|
||||
}
|
||||
|
||||
if (installable_to_repository_ptr())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
if (installable_to_repository_ptr()->include_masked())
|
||||
right.append(stringify(installable_to_repository_ptr()->repository()) + "??");
|
||||
else
|
||||
right.append(stringify(installable_to_repository_ptr()->repository()) + "?");
|
||||
}
|
||||
|
||||
if (installable_to_path_ptr())
|
||||
{
|
||||
if (! right.empty())
|
||||
{
|
||||
need_arrow = true;
|
||||
right.append("->");
|
||||
}
|
||||
if (installable_to_path_ptr()->include_masked())
|
||||
right.append(stringify(installable_to_path_ptr()->path()) + "??");
|
||||
else
|
||||
right.append(stringify(installable_to_path_ptr()->path()) + "?");
|
||||
}
|
||||
|
||||
if (need_arrow || ((! left.empty()) && (! right.empty())))
|
||||
s << "::" << left << "->" << right;
|
||||
else if (! right.empty())
|
||||
s << "::" << right;
|
||||
else if (! left.empty())
|
||||
s << "::" << left << "->";
|
||||
|
||||
if (version_requirements_ptr())
|
||||
{
|
||||
if (version_requirements_ptr()->begin() == version_requirements_ptr()->end())
|
||||
{
|
||||
}
|
||||
else if (next(version_requirements_ptr()->begin()) == version_requirements_ptr()->end() &&
|
||||
! options_for_partially_made_package_dep_spec_v[pmpdso_always_use_ranged_deps])
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
bool need_op(false);
|
||||
s << "[";
|
||||
for (VersionRequirements::ConstIterator r(version_requirements_ptr()->begin()),
|
||||
r_end(version_requirements_ptr()->end()) ; r != r_end ; ++r)
|
||||
{
|
||||
if (need_op)
|
||||
{
|
||||
do
|
||||
{
|
||||
switch (version_requirements_mode())
|
||||
{
|
||||
case vr_and:
|
||||
s << "&";
|
||||
continue;
|
||||
|
||||
case vr_or:
|
||||
s << "|";
|
||||
continue;
|
||||
|
||||
case last_vr:
|
||||
;
|
||||
}
|
||||
throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
|
||||
} while (false);
|
||||
}
|
||||
|
||||
if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
|
||||
s << "=";
|
||||
else
|
||||
s << r->version_operator();
|
||||
|
||||
s << r->version_spec();
|
||||
|
||||
if (r->version_operator() == vo_stupid_equal_star || r->version_operator() == vo_nice_equal_star)
|
||||
s << "*";
|
||||
|
||||
need_op = true;
|
||||
}
|
||||
s << "]";
|
||||
}
|
||||
}
|
||||
|
||||
if (additional_requirements_ptr())
|
||||
for (AdditionalPackageDepSpecRequirements::ConstIterator u(additional_requirements_ptr()->begin()),
|
||||
u_end(additional_requirements_ptr()->end()) ; u != u_end ; ++u)
|
||||
s << (*u)->as_raw_string();
|
||||
|
||||
return s.str();
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const QualifiedPackageName> package_ptr() const
|
||||
{
|
||||
return package;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const PackageNamePart> package_name_part_ptr() const
|
||||
{
|
||||
return package_name_part;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const
|
||||
{
|
||||
return category_name_part;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const VersionRequirements> version_requirements_ptr() const
|
||||
{
|
||||
return version_requirements;
|
||||
}
|
||||
|
||||
virtual VersionRequirementsMode version_requirements_mode() const
|
||||
{
|
||||
return version_requirements_mode_v;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const RepositoryName> in_repository_ptr() const
|
||||
{
|
||||
return in_repository;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const InstallableToRepository> installable_to_repository_ptr() const
|
||||
{
|
||||
return installable_to_repository;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const RepositoryName> from_repository_ptr() const
|
||||
{
|
||||
return from_repository;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const FSPath> installed_at_path_ptr() const
|
||||
{
|
||||
return installed_at_path;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const InstallableToPath> installable_to_path_ptr() const
|
||||
{
|
||||
return installable_to_path;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const
|
||||
{
|
||||
return additional_requirements;
|
||||
}
|
||||
|
||||
virtual const PartiallyMadePackageDepSpecOptions options_for_partially_made_package_dep_spec() const
|
||||
{
|
||||
return options_for_partially_made_package_dep_spec_v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <>
|
||||
struct Imp<PartiallyMadePackageDepSpec>
|
||||
{
|
||||
std::shared_ptr<PartiallyMadePackageDepSpecData> data;
|
||||
|
||||
Imp(const PartiallyMadePackageDepSpecOptions & o) :
|
||||
data(std::make_shared<PartiallyMadePackageDepSpecData>(o))
|
||||
{
|
||||
}
|
||||
|
||||
Imp(const Imp & other) :
|
||||
data(std::make_shared<PartiallyMadePackageDepSpecData>(*other.data))
|
||||
{
|
||||
}
|
||||
|
||||
Imp(const PackageDepSpec & other) :
|
||||
data(std::make_shared<PartiallyMadePackageDepSpecData>(*other.data()))
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions & o) :
|
||||
_imp(o)
|
||||
{
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec & other) :
|
||||
_imp(*other._imp.get())
|
||||
{
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PackageDepSpec & other) :
|
||||
_imp(other)
|
||||
{
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec::~PartiallyMadePackageDepSpec()
|
||||
{
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::package(const QualifiedPackageName & name)
|
||||
{
|
||||
_imp->data->package = std::make_shared<QualifiedPackageName>(name);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_package()
|
||||
{
|
||||
_imp->data->package.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::slot_requirement(const std::shared_ptr<const SlotRequirement> & s)
|
||||
{
|
||||
_imp->data->slot = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_slot_requirement()
|
||||
{
|
||||
_imp->data->slot.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::in_repository(const RepositoryName & s)
|
||||
{
|
||||
_imp->data->in_repository = std::make_shared<RepositoryName>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_in_repository()
|
||||
{
|
||||
_imp->data->in_repository.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::from_repository(const RepositoryName & s)
|
||||
{
|
||||
_imp->data->from_repository = std::make_shared<RepositoryName>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_from_repository()
|
||||
{
|
||||
_imp->data->from_repository.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::installable_to_repository(const InstallableToRepository & s)
|
||||
{
|
||||
_imp->data->installable_to_repository = std::make_shared<InstallableToRepository>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_installable_to_repository()
|
||||
{
|
||||
_imp->data->installable_to_repository.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::installed_at_path(const FSPath & s)
|
||||
{
|
||||
_imp->data->installed_at_path = std::make_shared<FSPath>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_installed_at_path()
|
||||
{
|
||||
_imp->data->installed_at_path.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::installable_to_path(const InstallableToPath & s)
|
||||
{
|
||||
_imp->data->installable_to_path = std::make_shared<InstallableToPath>(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_installable_to_path()
|
||||
{
|
||||
_imp->data->installable_to_path.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::package_name_part(const PackageNamePart & part)
|
||||
{
|
||||
_imp->data->package_name_part = std::make_shared<PackageNamePart>(part);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_package_name_part()
|
||||
{
|
||||
_imp->data->package_name_part.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::category_name_part(const CategoryNamePart & part)
|
||||
{
|
||||
_imp->data->category_name_part = std::make_shared<CategoryNamePart>(part);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_category_name_part()
|
||||
{
|
||||
_imp->data->category_name_part.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::version_requirement(const VersionRequirement & req)
|
||||
{
|
||||
if (! _imp->data->version_requirements)
|
||||
_imp->data->version_requirements = std::make_shared<VersionRequirements>();
|
||||
_imp->data->version_requirements->push_back(req);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_version_requirements()
|
||||
{
|
||||
_imp->data->version_requirements.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::version_requirements_mode(const VersionRequirementsMode & mode)
|
||||
{
|
||||
_imp->data->version_requirements_mode_v = mode;
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::additional_requirement(const std::shared_ptr<const AdditionalPackageDepSpecRequirement> & req)
|
||||
{
|
||||
if (! _imp->data->additional_requirements)
|
||||
_imp->data->additional_requirements = std::make_shared<AdditionalPackageDepSpecRequirements>();
|
||||
_imp->data->additional_requirements->push_back(req);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec &
|
||||
PartiallyMadePackageDepSpec::clear_additional_requirements()
|
||||
{
|
||||
_imp->data->additional_requirements.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
PartiallyMadePackageDepSpec::operator const PackageDepSpec() const
|
||||
{
|
||||
return PackageDepSpec(_imp->data);
|
||||
}
|
||||
|
||||
const PackageDepSpec
|
||||
PartiallyMadePackageDepSpec::to_package_dep_spec() const
|
||||
{
|
||||
return operator const PackageDepSpec();
|
||||
}
|
||||
|
||||
template class Pimp<PartiallyMadePackageDepSpec>;
|
||||
|
211
paludis/partially_made_package_dep_spec.hh
Normal file
211
paludis/partially_made_package_dep_spec.hh
Normal file
@ -0,0 +1,211 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_PARTIALLY_MADE_PACKAGE_DEP_SPEC_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_PARTIALLY_MADE_PACKAGE_DEP_SPEC_HH 1
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec-fwd.hh>
|
||||
#include <paludis/util/pimp.hh>
|
||||
#include <paludis/name-fwd.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
/**
|
||||
* A PartiallyMadePackageDepSpec is returned by make_package_dep_spec()
|
||||
* and is used to incrementally build a PackageDepSpec.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.26
|
||||
*/
|
||||
class PALUDIS_VISIBLE PartiallyMadePackageDepSpec
|
||||
{
|
||||
private:
|
||||
Pimp<PartiallyMadePackageDepSpec> _imp;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpecOptions &);
|
||||
~PartiallyMadePackageDepSpec();
|
||||
PartiallyMadePackageDepSpec(const PackageDepSpec &);
|
||||
PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
|
||||
|
||||
///\}
|
||||
|
||||
/**
|
||||
* Set our package requirements, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & package(const QualifiedPackageName &);
|
||||
|
||||
/**
|
||||
* Clear our package requirements, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_package();
|
||||
|
||||
/**
|
||||
* Set our slot requirements, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & slot_requirement(const std::shared_ptr<const SlotRequirement> &);
|
||||
|
||||
/**
|
||||
* Clear our slot requirements, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_slot_requirement();
|
||||
|
||||
/**
|
||||
* Set our in-repository requirement, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & in_repository(const RepositoryName &);
|
||||
|
||||
/**
|
||||
* Clear our in-repository requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_in_repository();
|
||||
|
||||
/**
|
||||
* Set our from-repository requirement, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & from_repository(const RepositoryName &);
|
||||
|
||||
/**
|
||||
* Clear our from-repository requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_from_repository();
|
||||
|
||||
/**
|
||||
* Set our installable-to-repository requirement, return ourself.
|
||||
*
|
||||
* \since 0.32
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & installable_to_repository(const InstallableToRepository &);
|
||||
|
||||
/**
|
||||
* Clear our installable-to-repository requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_installable_to_repository();
|
||||
|
||||
/**
|
||||
* Set our installed-at-path requirement, return ourself.
|
||||
*
|
||||
* \since 0.32
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & installed_at_path(const FSPath &);
|
||||
|
||||
/**
|
||||
* Clear our installed-at-path requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_installed_at_path();
|
||||
|
||||
/**
|
||||
* Set our installable-to-path requirement, return ourself.
|
||||
*
|
||||
* \since 0.32
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & installable_to_path(const InstallableToPath &);
|
||||
|
||||
/**
|
||||
* Clear our installable-to-path requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_installable_to_path();
|
||||
|
||||
/**
|
||||
* Set our package name part requirements, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & package_name_part(const PackageNamePart &);
|
||||
|
||||
/**
|
||||
* Clear our package name part requirements, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_package_name_part();
|
||||
|
||||
/**
|
||||
* Set our category name part requirements, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & category_name_part(const CategoryNamePart &);
|
||||
|
||||
/**
|
||||
* Clear our category name part requirements, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_category_name_part();
|
||||
|
||||
/**
|
||||
* Add a version requirement, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & version_requirement(const VersionRequirement &);
|
||||
|
||||
/**
|
||||
* Clear all version requirement, return ourself.
|
||||
*
|
||||
* \since 0.55
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_version_requirements();
|
||||
|
||||
/**
|
||||
* Set our version requirements mode, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & version_requirements_mode(const VersionRequirementsMode &);
|
||||
|
||||
/**
|
||||
* Add an additional requirement, return ourself.
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & additional_requirement(
|
||||
const std::shared_ptr<const AdditionalPackageDepSpecRequirement> &);
|
||||
|
||||
/**
|
||||
* Clear additional requirements, return ourself.
|
||||
*
|
||||
* \since 0.41
|
||||
*/
|
||||
PartiallyMadePackageDepSpec & clear_additional_requirements();
|
||||
|
||||
/**
|
||||
* Turn ourselves into a PackageDepSpec.
|
||||
*/
|
||||
operator const PackageDepSpec() const;
|
||||
|
||||
/**
|
||||
* Explicitly turn ourselves into a PackageDepSpec.
|
||||
*/
|
||||
const PackageDepSpec to_package_dep_spec() const;
|
||||
};
|
||||
|
||||
extern template class Pimp<PartiallyMadePackageDepSpec>;
|
||||
}
|
||||
|
||||
#endif
|
19
paludis/partially_made_package_dep_spec.se
Normal file
19
paludis/partially_made_package_dep_spec.se
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim: set sw=4 sts=4 et ft=sh :
|
||||
|
||||
make_enum_PartiallyMadePackageDepSpecOption()
|
||||
{
|
||||
prefix pmpdso
|
||||
|
||||
key pmpdso_always_use_ranged_deps "Always write [>=1] style dependencies"
|
||||
|
||||
doxygen_comment << "END"
|
||||
/**
|
||||
* Options for PartiallyMadePackageDepSpec.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.38
|
||||
*/
|
||||
END
|
||||
}
|
||||
|
@ -18,23 +18,20 @@
|
||||
*/
|
||||
|
||||
#include <paludis/repositories/accounts/accounts_dep_key.hh>
|
||||
|
||||
#include <paludis/util/set-impl.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator.hh>
|
||||
#include <paludis/util/return_literal_function.hh>
|
||||
#include <paludis/util/singleton-impl.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/always_enabled_dependency_label.hh>
|
||||
#include <paludis/pretty_printer.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
@ -74,9 +71,8 @@ namespace paludis
|
||||
for (Set<std::string>::ConstIterator i(s->begin()), i_end(s->end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package(CategoryNamePart("group") + PackageNamePart(*i))));
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(make_package_dep_spec({ })
|
||||
.package(CategoryNamePart("group") + PackageNamePart(*i))));
|
||||
specs->push_back(spec);
|
||||
tree->top()->append(spec);
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ noinst_HEADERS = \
|
||||
required_use_verifier.hh \
|
||||
source_uri_finder.hh \
|
||||
spec_tree_pretty_printer.hh \
|
||||
split_pn_v.hh \
|
||||
traditional_layout.hh \
|
||||
traditional_mask_file.hh \
|
||||
traditional_mask_store.hh \
|
||||
@ -171,7 +170,6 @@ libpaludiserepository_la_SOURCES = \
|
||||
required_use_verifier.cc \
|
||||
source_uri_finder.cc \
|
||||
spec_tree_pretty_printer.cc \
|
||||
split_pn_v.cc \
|
||||
traditional_layout.cc \
|
||||
traditional_mask_file.cc \
|
||||
traditional_mask_store.cc \
|
||||
|
@ -26,17 +26,19 @@
|
||||
|
||||
#include <paludis/action-fwd.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/set_file.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
|
||||
#include <paludis/util/config_file.hh>
|
||||
#include <paludis/util/is_file_with_extension.hh>
|
||||
@ -293,10 +295,12 @@ ERepositorySets::security_set(bool insecurity) const
|
||||
if (insecurity)
|
||||
{
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package((*c)->name())
|
||||
.require_version(vrc_and, vo_equal, (*c)->version())
|
||||
.require_in_repository((*c)->repository_name())));
|
||||
make_package_dep_spec({ })
|
||||
.package((*c)->name())
|
||||
.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = vo_equal,
|
||||
n::version_spec() = (*c)->version()))
|
||||
.in_repository((*c)->repository_name())));
|
||||
security_packages->top()->append(spec);
|
||||
}
|
||||
else
|
||||
@ -323,10 +327,12 @@ ERepositorySets::security_set(bool insecurity) const
|
||||
continue;
|
||||
}
|
||||
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(MutablePackageDepSpecData({ })
|
||||
.require_package((*r)->name())
|
||||
.require_version(vrc_and, vo_equal, (*r)->version())
|
||||
.require_in_repository((*r)->repository_name())));
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(make_package_dep_spec({ })
|
||||
.package((*r)->name())
|
||||
.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = vo_equal,
|
||||
n::version_spec() = (*r)->version()))
|
||||
.in_repository((*r)->repository_name())));
|
||||
security_packages->top()->append(spec);
|
||||
ok = true;
|
||||
break;
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/dep_spec_flattener.hh>
|
||||
#include <paludis/dep_spec_annotations.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
@ -164,8 +163,8 @@ ExheresMaskStore::_populate()
|
||||
for (auto s(flat_specs.begin()), s_end(flat_specs.end()) ;
|
||||
s != s_end ; ++s)
|
||||
{
|
||||
if ((*s)->package_name_requirement())
|
||||
_imp->repo_mask[(*s)->package_name_requirement()->name()].push_back(std::make_pair(**s, make_mask_info(**s, *f)));
|
||||
if ((*s)->package_ptr())
|
||||
_imp->repo_mask[*(*s)->package_ptr()].push_back(std::make_pair(**s, make_mask_info(**s, *f)));
|
||||
else
|
||||
Log::get_instance()->message("e.package_mask.bad_spec", ll_warning, lc_context)
|
||||
<< "Loading package mask spec '" << **s << "' failed because specification does not restrict to a "
|
||||
|
@ -19,25 +19,22 @@
|
||||
|
||||
#include <paludis/repositories/e/fix_locked_dependencies.hh>
|
||||
#include <paludis/repositories/e/eapi.hh>
|
||||
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
@ -102,7 +99,11 @@ namespace
|
||||
|
||||
do
|
||||
{
|
||||
if ((! node.spec()->any_slot_requirement()) || (! node.spec()->any_slot_requirement()->locking()))
|
||||
if (! node.spec()->slot_requirement_ptr())
|
||||
break;
|
||||
|
||||
const SlotAnyLockedRequirement * const r(visitor_cast<const SlotAnyLockedRequirement>(*node.spec()->slot_requirement_ptr()));
|
||||
if (! r)
|
||||
break;
|
||||
|
||||
std::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted(
|
||||
@ -112,9 +113,8 @@ namespace
|
||||
|
||||
if ((*matches->last())->slot_key())
|
||||
{
|
||||
PackageDepSpec new_s(MutablePackageDepSpecData(*node.spec()->data())
|
||||
.unrequire_any_slot()
|
||||
.require_exact_slot((*matches->last())->slot_key()->parse_value(), true));
|
||||
PackageDepSpec new_s(PartiallyMadePackageDepSpec(*node.spec()).slot_requirement(
|
||||
std::make_shared<ELikeSlotExactRequirement>((*matches->last())->slot_key()->parse_value(), true)));
|
||||
c = std::make_shared<PackageDepSpec>(new_s);
|
||||
}
|
||||
} while (false);
|
||||
|
@ -1,91 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 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/split_pn_v.hh>
|
||||
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::erepository;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct BitsFinder
|
||||
{
|
||||
std::pair<PackageNamePart, VersionSpec> result;
|
||||
bool had_package, had_version;
|
||||
|
||||
BitsFinder() :
|
||||
result(PackageNamePart("x"), VersionSpec("0", { })),
|
||||
had_package(false),
|
||||
had_version(false)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const PackageNamePartRequirement & r)
|
||||
{
|
||||
if (had_package)
|
||||
throw InternalError(PALUDIS_HERE, "got multiple /p parts");
|
||||
had_package = true;
|
||||
result.first = r.name_part();
|
||||
}
|
||||
|
||||
void visit(const VersionRequirement & r)
|
||||
{
|
||||
if (had_version)
|
||||
throw InternalError(PALUDIS_HERE, "got multiple v parts");
|
||||
had_version = true;
|
||||
result.second = r.version_spec();
|
||||
}
|
||||
|
||||
void visit(const CategoryNamePartRequirement &)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(const PackageDepSpecRequirement &)
|
||||
{
|
||||
throw InternalError(PALUDIS_HERE, "got unexpected requirement");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
std::pair<PackageNamePart, VersionSpec>
|
||||
paludis::erepository::split_pn_v(const Environment * const env, const std::string & s)
|
||||
{
|
||||
PackageDepSpec spec(parse_user_package_dep_spec("=*/" + s, env, { updso_allow_wildcards }));
|
||||
BitsFinder f;
|
||||
std::for_each(indirect_iterator(spec.requirements()->begin()),
|
||||
indirect_iterator(spec.requirements()->end()),
|
||||
accept_visitor(f));
|
||||
|
||||
if (! (f.had_package && f.had_version))
|
||||
throw InternalError(PALUDIS_HERE, "didn't get p/v");
|
||||
|
||||
return f.result;
|
||||
}
|
||||
|
@ -21,18 +21,15 @@
|
||||
#include <paludis/repositories/e/traditional_profile_file.hh>
|
||||
#include <paludis/repositories/e/traditional_mask_file.hh>
|
||||
#include <paludis/repositories/e/eapi.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/hashes.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
@ -101,8 +98,8 @@ TraditionalMaskStore::_populate()
|
||||
auto a(parse_elike_package_dep_spec(
|
||||
line->second.first, line->first->supported()->package_dep_spec_parse_options(),
|
||||
line->first->supported()->version_spec_options()));
|
||||
if (a.package_name_requirement())
|
||||
_imp->repo_mask[a.package_name_requirement()->name()].push_back(std::make_pair(a, line->second.second));
|
||||
if (a.package_ptr())
|
||||
_imp->repo_mask[*a.package_ptr()].push_back(std::make_pair(a, line->second.second));
|
||||
else
|
||||
Log::get_instance()->message("e.package_mask.bad_spec", ll_warning, lc_context)
|
||||
<< "Loading package mask spec '" << line->second.first << "' failed because specification does not restrict to a "
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include <paludis/distribution.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
@ -361,8 +360,8 @@ namespace
|
||||
line->first->supported()->package_dep_spec_parse_options(),
|
||||
line->first->supported()->version_spec_options())));
|
||||
|
||||
if (a->package_name_requirement())
|
||||
_imp->package_mask[a->package_name_requirement()->name()].push_back(std::make_pair(a, line->second.second));
|
||||
if (a->package_ptr())
|
||||
_imp->package_mask[*a->package_ptr()].push_back(std::make_pair(a, line->second.second));
|
||||
else
|
||||
Log::get_instance()->message("e.profile.package_mask.bad_spec", ll_warning, lc_context)
|
||||
<< "Loading package.mask spec '" << line->second.first << "' failed because specification does not restrict to a "
|
||||
|
@ -28,7 +28,6 @@
|
||||
#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/repositories/e/split_pn_v.hh>
|
||||
|
||||
#include <paludis/action.hh>
|
||||
#include <paludis/util/config_file.hh>
|
||||
@ -46,15 +45,15 @@
|
||||
#include <paludis/repository_name_cache.hh>
|
||||
#include <paludis/set_file.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/output_manager.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/dep_spec_annotations.hh>
|
||||
#include <paludis/unformatted_pretty_printer.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/mutex.hh>
|
||||
@ -1111,14 +1110,13 @@ VDBRepository::need_package_ids(const CategoryNamePart & c) const
|
||||
if (std::string::npos == s.rfind('-'))
|
||||
continue;
|
||||
|
||||
auto pn_v(split_pn_v(_imp->params.environment(), s));
|
||||
auto qpn(c + pn_v.first);
|
||||
q->insert(qpn);
|
||||
IDMap::iterator i(_imp->ids.find(qpn));
|
||||
PackageDepSpec p(parse_user_package_dep_spec("=" + stringify(c) + "/" + s,
|
||||
_imp->params.environment(), { }));
|
||||
q->insert(*p.package_ptr());
|
||||
IDMap::iterator i(_imp->ids.find(*p.package_ptr()));
|
||||
if (_imp->ids.end() == i)
|
||||
i = _imp->ids.insert(std::make_pair(qpn, std::make_shared<PackageIDSequence>())).first;
|
||||
|
||||
i->second->push_back(make_id(qpn, pn_v.second, *d));
|
||||
i = _imp->ids.insert(std::make_pair(*p.package_ptr(), std::make_shared<PackageIDSequence>())).first;
|
||||
i->second->push_back(make_id(*p.package_ptr(), p.version_requirements_ptr()->begin()->version_spec(), *d));
|
||||
}
|
||||
catch (const InternalError &)
|
||||
{
|
||||
@ -1276,12 +1274,11 @@ namespace
|
||||
|
||||
void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
|
||||
{
|
||||
if (node.spec()->package_name_requirement() && rewrites.end() != rewrites.find(node.spec()->package_name_requirement()->name()))
|
||||
if (node.spec()->package_ptr() && rewrites.end() != rewrites.find(*node.spec()->package_ptr()))
|
||||
{
|
||||
changed = true;
|
||||
str << f.prettify(MutablePackageDepSpecData(*node.spec()->data())
|
||||
.unrequire_package()
|
||||
.require_package(rewrites.find(node.spec()->package_name_requirement()->name())->second)) << " ";
|
||||
str << f.prettify(PartiallyMadePackageDepSpec(*node.spec())
|
||||
.package(rewrites.find(*node.spec()->package_ptr())->second)) << " ";
|
||||
}
|
||||
else
|
||||
str << f.prettify(*node.spec()) << " ";
|
||||
@ -1618,9 +1615,7 @@ VDBRepository::perform_updates()
|
||||
for (DepRewrites::const_iterator i(dep_rewrites.begin()), i_end(dep_rewrites.end()) ;
|
||||
i != i_end ; ++i)
|
||||
_imp->params.environment()->update_config_files_for_package_move(
|
||||
MutablePackageDepSpecData({ })
|
||||
.unrequire_package()
|
||||
.require_package(i->first),
|
||||
make_package_dep_spec({ }).package(i->first),
|
||||
i->second
|
||||
);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <paludis/repositories/gemcutter/gemcutter_dependencies_key.hh>
|
||||
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
@ -28,20 +27,19 @@
|
||||
#include <paludis/util/make_shared_copy.hh>
|
||||
#include <paludis/util/tokeniser.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
|
||||
#include <paludis/always_enabled_dependency_label.hh>
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/pretty_printer.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@ -175,9 +173,12 @@ namespace
|
||||
|
||||
VersionSpec ver(tokens[1], { });
|
||||
|
||||
return make_shared_copy(PackageDepSpec(MutablePackageDepSpecData({ pdsdo_always_use_ranged_deps })
|
||||
.require_package(QualifiedPackageName("gem/" + dep.name()))
|
||||
.require_version(vrc_and, op, ver)
|
||||
return make_shared_copy(PackageDepSpec(make_package_dep_spec({ pmpdso_always_use_ranged_deps })
|
||||
.package(QualifiedPackageName("gem/" + dep.name()))
|
||||
.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = op,
|
||||
n::version_spec() = ver
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <paludis/repositories/virtuals/package_id.hh>
|
||||
#include <paludis/repositories/virtuals/installed_virtuals_repository.hh>
|
||||
#include <paludis/repositories/virtuals/virtuals_repository.hh>
|
||||
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/mutex.hh>
|
||||
@ -29,12 +28,11 @@
|
||||
#include <paludis/util/return_literal_function.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/singleton-impl.hh>
|
||||
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/action.hh>
|
||||
#include <paludis/mask.hh>
|
||||
@ -44,9 +42,9 @@
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/always_enabled_dependency_label.hh>
|
||||
#include <paludis/pretty_printer.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::virtuals;
|
||||
@ -72,15 +70,18 @@ namespace paludis
|
||||
labels(l),
|
||||
spec(exact ?
|
||||
std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package(v->name())
|
||||
.require_version(vrc_and, vo_equal, v->version())
|
||||
.require_exact_slot(v->slot_key() ? v->slot_key()->parse_value() : SlotName("UNKNOWN"), false)
|
||||
.require_in_repository(v->repository_name()))
|
||||
make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
|
||||
.package(v->name())
|
||||
.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = vo_equal,
|
||||
n::version_spec() = v->version()))
|
||||
.slot_requirement(std::make_shared<UserSlotExactRequirement>(
|
||||
v->slot_key() ? v->slot_key()->parse_value() : SlotName("UNKNOWN")))
|
||||
.in_repository(v->repository_name()))
|
||||
:
|
||||
std::make_shared<PackageDepSpec>(
|
||||
MutablePackageDepSpecData({ })
|
||||
.require_package(v->name())
|
||||
make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
|
||||
.package(v->name())
|
||||
)
|
||||
),
|
||||
raw_name(r),
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/hook.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/operators.hh>
|
||||
@ -160,7 +160,7 @@ VirtualsRepository::need_names() const
|
||||
for (RepositoryProvidesInterface::ProvidesSequence::ConstIterator p(provides->begin()),
|
||||
p_end(provides->end()) ; p != p_end ; ++p)
|
||||
_imp->names.push_back(std::make_pair((*p).virtual_name(), std::shared_ptr<const PackageDepSpec>(
|
||||
std::make_shared<PackageDepSpec>(MutablePackageDepSpecData({ }).require_package((*p).provided_by()->name())))));
|
||||
std::make_shared<PackageDepSpec>(make_package_dep_spec(PartiallyMadePackageDepSpecOptions()).package((*p).provided_by()->name())))));
|
||||
}
|
||||
|
||||
std::sort(_imp->names.begin(), _imp->names.end(), NamesSortComparator());
|
||||
|
@ -19,23 +19,20 @@
|
||||
|
||||
#include <paludis/resolver/collect_depped_upon.hh>
|
||||
#include <paludis/resolver/change_by_resolvent.hh>
|
||||
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/wrapped_output_iterator.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace paludis;
|
||||
@ -111,17 +108,16 @@ namespace
|
||||
{
|
||||
auto spec(s.spec());
|
||||
|
||||
if (s.spec()->any_slot_requirement() && ! s.spec()->any_slot_requirement()->locking())
|
||||
if (s.spec()->slot_requirement_ptr() && visitor_cast<const SlotAnyUnlockedRequirement>(
|
||||
*s.spec()->slot_requirement_ptr()))
|
||||
{
|
||||
auto best_eventual_id(best_eventual(env, *s.spec(), id_for_specs, newly_available));
|
||||
if (! best_eventual_id)
|
||||
best_eventual_id = best_eventual(env, *s.spec(), id_for_specs, not_changing_slots);
|
||||
if (best_eventual_id && best_eventual_id->slot_key())
|
||||
{
|
||||
MutablePackageDepSpecData part_spec(*s.spec()->data());
|
||||
part_spec
|
||||
.unrequire_exact_slot()
|
||||
.require_exact_slot(best_eventual_id->slot_key()->parse_value(), false);
|
||||
PartiallyMadePackageDepSpec part_spec(*s.spec());
|
||||
part_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(best_eventual_id->slot_key()->parse_value(), false));
|
||||
spec = std::make_shared<PackageDepSpec>(part_spec);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <paludis/resolver/reason_utils.hh>
|
||||
#include <paludis/resolver/make_uninstall_blocker.hh>
|
||||
#include <paludis/resolver/has_behaviour-fwd.hh>
|
||||
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
@ -55,7 +54,6 @@
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/notifier_callback.hh>
|
||||
#include <paludis/repository.hh>
|
||||
@ -65,15 +63,16 @@
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/slot_requirement.hh>
|
||||
#include <paludis/choice.hh>
|
||||
#include <paludis/action.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/changed_choices.hh>
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/dep_spec_annotations.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
|
||||
@ -998,15 +997,15 @@ const PackageDepSpec
|
||||
Decider::_make_spec_for_preloading(const PackageDepSpec & spec,
|
||||
const std::shared_ptr<const ChangedChoices> & changed_choices) const
|
||||
{
|
||||
MutablePackageDepSpecData result(*spec.data());
|
||||
PartiallyMadePackageDepSpec result(spec);
|
||||
|
||||
/* we don't want to copy use deps from the constraint, since things like
|
||||
* [foo?] start to get weird when there's no longer an associated ID. */
|
||||
result.unrequire_choices();
|
||||
result.clear_additional_requirements();
|
||||
|
||||
/* but we do want to impose our own ChangedChoices if necessary. */
|
||||
if (changed_choices)
|
||||
changed_choices->add_requirements_to(result);
|
||||
changed_choices->add_additional_requirements_to(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1186,21 +1185,16 @@ Decider::find_any_score(
|
||||
// AnyDepSpecChildHandler::commit in satitised_dependencies.cc
|
||||
// matches this logic
|
||||
OperatorScore operator_bias(os_worse_than_worst);
|
||||
bool any_version_requirements(false);
|
||||
|
||||
if (spec.version_requirements_ptr() && ! spec.version_requirements_ptr()->empty())
|
||||
{
|
||||
OperatorScore score(os_worse_than_worst);
|
||||
for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
|
||||
for (VersionRequirements::ConstIterator v(spec.version_requirements_ptr()->begin()),
|
||||
v_end(spec.version_requirements_ptr()->end()) ;
|
||||
v != v_end ; ++v)
|
||||
{
|
||||
auto v_ver(visitor_cast<const VersionRequirement>(**v));
|
||||
if (! v_ver)
|
||||
continue;
|
||||
any_version_requirements = true;
|
||||
|
||||
OperatorScore local_score(os_worse_than_worst);
|
||||
|
||||
switch (v_ver->version_operator().value())
|
||||
switch (v->version_operator().value())
|
||||
{
|
||||
case vo_greater:
|
||||
case vo_greater_equal:
|
||||
@ -1228,24 +1222,23 @@ Decider::find_any_score(
|
||||
if (score == os_worse_than_worst)
|
||||
score = local_score;
|
||||
else
|
||||
switch (v_ver->combiner())
|
||||
switch (spec.version_requirements_mode())
|
||||
{
|
||||
case vrc_and:
|
||||
case vr_and:
|
||||
score = is_block ? std::max(score, local_score) : std::min(score, local_score);
|
||||
break;
|
||||
|
||||
case vrc_or:
|
||||
case vr_or:
|
||||
score = is_block ? std::min(score, local_score) : std::max(score, local_score);
|
||||
break;
|
||||
|
||||
case last_vrc:
|
||||
case last_vr:
|
||||
break;
|
||||
}
|
||||
}
|
||||
operator_bias = score;
|
||||
}
|
||||
|
||||
if (! any_version_requirements)
|
||||
else
|
||||
{
|
||||
/* don't bias no operator over a >= operator, so || ( >=foo-2 bar )
|
||||
* still likes foo. */
|
||||
@ -1253,9 +1246,9 @@ Decider::find_any_score(
|
||||
}
|
||||
|
||||
/* explicit preferences come first */
|
||||
if (spec.package_name_requirement())
|
||||
if (spec.package_ptr())
|
||||
{
|
||||
Tribool prefer_or_avoid(_imp->fns.prefer_or_avoid_fn()(spec.package_name_requirement()->name()));
|
||||
Tribool prefer_or_avoid(_imp->fns.prefer_or_avoid_fn()(*spec.package_ptr()));
|
||||
if (prefer_or_avoid.is_true())
|
||||
return std::make_pair(is_block ? acs_avoid : acs_prefer, operator_bias);
|
||||
else if (prefer_or_avoid.is_false())
|
||||
@ -1268,7 +1261,7 @@ Decider::find_any_score(
|
||||
Context sub_context("When working out whether it's acs_vacuous_blocker:");
|
||||
|
||||
const std::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::BestVersionOnly(
|
||||
generator::Matches(spec, our_id, { mpo_ignore_choice_requirements })
|
||||
generator::Matches(spec, our_id, { mpo_ignore_additional_requirements })
|
||||
| filter::SupportsAction<InstallAction>() | filter::NotMasked()
|
||||
)]);
|
||||
if (ids->empty())
|
||||
@ -1353,6 +1346,27 @@ Decider::find_any_score(
|
||||
return std::make_pair(acs_not_installable, operator_bias);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct SlotNameFinder
|
||||
{
|
||||
std::shared_ptr<SlotName> visit(const SlotExactRequirement & s)
|
||||
{
|
||||
return std::make_shared<SlotName>(s.slot());
|
||||
}
|
||||
|
||||
std::shared_ptr<SlotName> visit(const SlotAnyUnlockedRequirement &)
|
||||
{
|
||||
return make_null_shared_ptr();
|
||||
}
|
||||
|
||||
std::shared_ptr<SlotName> visit(const SlotAnyLockedRequirement &)
|
||||
{
|
||||
return make_null_shared_ptr();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::shared_ptr<const Resolvents>
|
||||
Decider::_get_resolvents_for_blocker(const BlockDepSpec & spec,
|
||||
const std::shared_ptr<const Reason> & reason) const
|
||||
@ -1360,8 +1374,11 @@ Decider::_get_resolvents_for_blocker(const BlockDepSpec & spec,
|
||||
Context context("When finding slots for '" + stringify(spec) + "':");
|
||||
|
||||
std::shared_ptr<SlotName> exact_slot;
|
||||
if (spec.blocking().exact_slot_requirement())
|
||||
exact_slot = make_shared_copy(spec.blocking().exact_slot_requirement()->name());
|
||||
if (spec.blocking().slot_requirement_ptr())
|
||||
{
|
||||
SlotNameFinder f;
|
||||
exact_slot = spec.blocking().slot_requirement_ptr()->accept_returning<std::shared_ptr<SlotName> >(f);
|
||||
}
|
||||
|
||||
DestinationTypes destination_types(_imp->fns.get_destination_types_for_blocker_fn()(spec, reason));
|
||||
std::shared_ptr<Resolvents> result(std::make_shared<Resolvents>());
|
||||
@ -1374,7 +1391,7 @@ Decider::_get_resolvents_for_blocker(const BlockDepSpec & spec,
|
||||
else
|
||||
{
|
||||
const std::shared_ptr<const PackageIDSequence> ids((*_imp->env)[selection::BestVersionInEachSlot(
|
||||
generator::Package(spec.blocking().package_name_requirement()->name())
|
||||
generator::Package(*spec.blocking().package_ptr())
|
||||
)]);
|
||||
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
|
||||
i != i_end ; ++i)
|
||||
@ -1395,8 +1412,11 @@ Decider::_get_resolvents_for(
|
||||
|
||||
std::shared_ptr<SlotName> exact_slot;
|
||||
|
||||
if (spec.exact_slot_requirement())
|
||||
exact_slot = make_shared_copy(spec.exact_slot_requirement()->name());
|
||||
if (spec.slot_requirement_ptr())
|
||||
{
|
||||
SlotNameFinder f;
|
||||
exact_slot = spec.slot_requirement_ptr()->accept_returning<std::shared_ptr<SlotName> >(f);
|
||||
}
|
||||
|
||||
return _imp->fns.get_resolvents_for_fn()(spec, maybe_from_package_id_from_reason(reason), exact_slot, reason);
|
||||
}
|
||||
@ -1419,7 +1439,7 @@ Decider::_get_error_resolvents_for(
|
||||
),
|
||||
*t);
|
||||
|
||||
auto ids(_find_installable_id_candidates_for(spec.package_name_requirement()->name(), filter::All(), true, true));
|
||||
auto ids(_find_installable_id_candidates_for(*spec.package_ptr(), filter::All(), true, true));
|
||||
if (! ids->empty())
|
||||
resolvent.slot() = make_named_values<SlotNameOrNull>(
|
||||
n::name_or_null() = (*ids->rbegin())->slot_key() ?
|
||||
@ -1750,7 +1770,7 @@ Decider::_find_id_for_from(
|
||||
{
|
||||
MatchPackageOptions opts;
|
||||
if (trying_changing_choices)
|
||||
opts += mpo_ignore_choice_requirements;
|
||||
opts += mpo_ignore_additional_requirements;
|
||||
|
||||
std::shared_ptr<const PackageID> best_version;
|
||||
for (PackageIDSequence::ReverseConstIterator i(ids->rbegin()), i_end(ids->rend()) ;
|
||||
@ -1790,22 +1810,8 @@ Decider::_find_id_for_from(
|
||||
|
||||
if (! (*c)->spec().if_package())
|
||||
{
|
||||
if (package_dep_spec_has_properties((*c)->spec().if_block()->blocking(), make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = true,
|
||||
n::has_exact_slot_requirement() = indeterminate,
|
||||
n::has_from_repository() = indeterminate,
|
||||
n::has_in_repository() = indeterminate,
|
||||
n::has_installable_to_path() = indeterminate,
|
||||
n::has_installable_to_repository() = indeterminate,
|
||||
n::has_installed_at_path() = indeterminate,
|
||||
n::has_key_requirements() = indeterminate,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_tag() = indeterminate,
|
||||
n::has_version_requirements() = indeterminate
|
||||
)))
|
||||
if ((*c)->spec().if_block()->blocking().additional_requirements_ptr() &&
|
||||
! (*c)->spec().if_block()->blocking().additional_requirements_ptr()->empty())
|
||||
{
|
||||
/* too complicated for now */
|
||||
ok = false;
|
||||
@ -1813,15 +1819,17 @@ Decider::_find_id_for_from(
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto a((*c)->spec().if_package()->requirements()->begin()),
|
||||
a_end((*c)->spec().if_package()->requirements()->end()) ;
|
||||
if (! (*c)->spec().if_package()->additional_requirements_ptr())
|
||||
{
|
||||
/* no additional requirements, so no tinkering required */
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto a((*c)->spec().if_package()->additional_requirements_ptr()->begin()),
|
||||
a_end((*c)->spec().if_package()->additional_requirements_ptr()->end()) ;
|
||||
a != a_end ; ++a)
|
||||
{
|
||||
auto a_choice(visitor_cast<const ChoiceRequirement>(**a));
|
||||
if (! a_choice)
|
||||
continue;
|
||||
|
||||
auto b(a_choice->accumulate_changes_to_make_met(_imp->env,
|
||||
auto b((*a)->accumulate_changes_to_make_met(_imp->env,
|
||||
get_changed_choices_for(*c).get(), *i, (*c)->from_id(),
|
||||
*why_changed_choices->changed_choices()));
|
||||
if (b.is_false())
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/repository.hh>
|
||||
#include <paludis/environment.hh>
|
||||
|
@ -24,19 +24,18 @@
|
||||
#include <paludis/resolver/resolution.hh>
|
||||
#include <paludis/resolver/decision.hh>
|
||||
#include <paludis/resolver/make_uninstall_blocker.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/make_shared_copy.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_collection.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::resolver;
|
||||
@ -83,10 +82,10 @@ GetConstraintsForDependentHelper::operator() (
|
||||
spec = make_shared_copy(id->uniquely_identifying_spec());
|
||||
else
|
||||
{
|
||||
MutablePackageDepSpecData partial_spec({ });
|
||||
partial_spec.require_package(id->name());
|
||||
PartiallyMadePackageDepSpec partial_spec({ });
|
||||
partial_spec.package(id->name());
|
||||
if (id->slot_key())
|
||||
partial_spec.require_exact_slot(id->slot_key()->parse_value(), false);
|
||||
partial_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(id->slot_key()->parse_value(), false));
|
||||
spec = std::make_shared<PackageDepSpec>(partial_spec);
|
||||
}
|
||||
|
||||
|
@ -24,19 +24,18 @@
|
||||
#include <paludis/resolver/resolution.hh>
|
||||
#include <paludis/resolver/decision.hh>
|
||||
#include <paludis/resolver/make_uninstall_blocker.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/make_shared_copy.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_collection.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::resolver;
|
||||
@ -78,10 +77,10 @@ GetConstraintsForPurgeHelper::operator() (
|
||||
{
|
||||
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
|
||||
|
||||
MutablePackageDepSpecData partial_spec({ });
|
||||
partial_spec.require_package(id->name());
|
||||
PartiallyMadePackageDepSpec partial_spec({ });
|
||||
partial_spec.package(id->name());
|
||||
if (id->slot_key())
|
||||
partial_spec.require_exact_slot(id->slot_key()->parse_value(), false);
|
||||
partial_spec.slot_requirement(std::make_shared<ELikeSlotExactRequirement>(id->slot_key()->parse_value(), false));
|
||||
PackageDepSpec spec(partial_spec);
|
||||
|
||||
const std::shared_ptr<WasUsedByReason> reason(std::make_shared<WasUsedByReason>(was_used_by_ids));
|
||||
|
@ -23,16 +23,14 @@
|
||||
#include <paludis/resolver/resolvent.hh>
|
||||
#include <paludis/resolver/resolution.hh>
|
||||
#include <paludis/resolver/decision.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/make_shared_copy.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::resolver;
|
||||
@ -65,8 +63,8 @@ GetConstraintsForViaBinaryHelper::operator() (
|
||||
{
|
||||
auto result(std::make_shared<ConstraintSequence>());
|
||||
|
||||
MutablePackageDepSpecData partial_spec({ });
|
||||
partial_spec.require_package(resolution->resolvent().package());
|
||||
PartiallyMadePackageDepSpec partial_spec({ });
|
||||
partial_spec.package(resolution->resolvent().package());
|
||||
PackageDepSpec spec(partial_spec);
|
||||
|
||||
auto reason(std::make_shared<ViaBinaryReason>(other_resolution->resolvent()));
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_collection.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
|
||||
using namespace paludis;
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/package_dep_spec_collection.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
|
||||
using namespace paludis;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <paludis/resolver/destination_utils.hh>
|
||||
#include <paludis/resolver/match_qpns.hh>
|
||||
#include <paludis/resolver/suggest_restart.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/make_shared_copy.hh>
|
||||
@ -36,7 +35,6 @@
|
||||
#include <paludis/util/timestamp.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/enum_iterator.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/selection.hh>
|
||||
@ -46,8 +44,7 @@
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
|
||||
@ -243,7 +240,7 @@ GetInitialConstraintsForHelper::_make_initial_constraints_for(
|
||||
n::from_id() = make_null_shared_ptr(),
|
||||
n::nothing_is_fine_too() = true,
|
||||
n::reason() = std::make_shared<PresetReason>("is scm", make_null_shared_ptr()),
|
||||
n::spec() = MutablePackageDepSpecData({ }).require_package(resolvent.package()),
|
||||
n::spec() = make_package_dep_spec({ }).package(resolvent.package()),
|
||||
n::untaken() = false,
|
||||
n::use_existing() = ue_only_if_transient
|
||||
)));
|
||||
|
@ -283,18 +283,16 @@ namespace
|
||||
bool can_use_cache(const PackageDepSpec & spec)
|
||||
{
|
||||
return package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = indeterminate,
|
||||
n::has_additional_requirements() = false,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = false,
|
||||
n::has_exact_slot_requirement() = indeterminate,
|
||||
n::has_from_repository() = indeterminate,
|
||||
n::has_in_repository() = indeterminate,
|
||||
n::has_installable_to_path() = indeterminate,
|
||||
n::has_installable_to_repository() = indeterminate,
|
||||
n::has_installed_at_path() = indeterminate,
|
||||
n::has_key_requirements() = indeterminate,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_slot_requirement() = indeterminate,
|
||||
n::has_tag() = indeterminate,
|
||||
n::has_version_requirements() = indeterminate
|
||||
));
|
||||
@ -330,7 +328,7 @@ GetResolventsForHelper::operator() (
|
||||
std::shared_ptr<const PackageID> best;
|
||||
|
||||
auto ids((*_imp->env)[selection::BestVersionOnly(
|
||||
generator::Matches(spec, from_id, { mpo_ignore_choice_requirements }) |
|
||||
generator::Matches(spec, from_id, { mpo_ignore_additional_requirements }) |
|
||||
filter::SupportsAction<InstallAction>() |
|
||||
filter::NotMasked() |
|
||||
(maybe_slot ? Filter(filter::Slot(*maybe_slot)) : Filter(filter::All())))]);
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <list>
|
||||
|
||||
using namespace paludis;
|
||||
@ -217,11 +216,11 @@ GetUseExistingNothingHelper::operator() (
|
||||
{
|
||||
Context context("When determining use existing for '" + stringify(spec) + "':");
|
||||
|
||||
if (spec.package_name_requirement())
|
||||
if (spec.package_ptr())
|
||||
{
|
||||
if (use_existing_from_withish(_imp->env, spec.package_name_requirement()->name(), _imp->without_specs))
|
||||
if (use_existing_from_withish(_imp->env, *spec.package_ptr(), _imp->without_specs))
|
||||
return std::make_pair(ue_if_possible, true);
|
||||
if (use_existing_from_withish(_imp->env, spec.package_name_requirement()->name(), _imp->with_specs))
|
||||
if (use_existing_from_withish(_imp->env, *spec.package_ptr(), _imp->with_specs))
|
||||
return std::make_pair(ue_never, false);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/dep_spec_annotations.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
@ -270,7 +269,7 @@ InterestInSpecHelper::operator() (
|
||||
{
|
||||
for (auto l(_imp->take_specs.begin()), l_end(_imp->take_specs.end()) ;
|
||||
l != l_end ; ++l)
|
||||
if (match_qpns(*_imp->env, *l, dep.spec().if_package()->package_name_requirement()->name()))
|
||||
if (match_qpns(*_imp->env, *l, *dep.spec().if_package()->package_ptr()))
|
||||
return si_take;
|
||||
}
|
||||
|
||||
@ -299,7 +298,7 @@ InterestInSpecHelper::operator() (
|
||||
{
|
||||
for (auto l(_imp->ignore_specs.begin()), l_end(_imp->ignore_specs.end()) ;
|
||||
l != l_end ; ++l)
|
||||
if (match_qpns(*_imp->env, *l, dep.spec().if_package()->package_name_requirement()->name()))
|
||||
if (match_qpns(*_imp->env, *l, *dep.spec().if_package()->package_ptr()))
|
||||
return si_ignore;
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,11 @@
|
||||
*/
|
||||
|
||||
#include <paludis/resolver/match_qpns.hh>
|
||||
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/package_dep_spec_properties.hh>
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::resolver;
|
||||
@ -41,28 +38,26 @@ paludis::resolver::match_qpns(
|
||||
* either can be wildcards (we could work for :slot too,
|
||||
* but we're lazy) */
|
||||
if (! package_dep_spec_has_properties(spec, make_named_values<PackageDepSpecProperties>(
|
||||
n::has_any_slot_requirement() = false,
|
||||
n::has_additional_requirements() = false,
|
||||
n::has_category_name_part() = indeterminate,
|
||||
n::has_choice_requirements() = false,
|
||||
n::has_exact_slot_requirement() = false,
|
||||
n::has_from_repository() = false,
|
||||
n::has_in_repository() = false,
|
||||
n::has_installable_to_path() = false,
|
||||
n::has_installable_to_repository() = false,
|
||||
n::has_installed_at_path() = false,
|
||||
n::has_key_requirements() = false,
|
||||
n::has_package() = indeterminate,
|
||||
n::has_package_name_part() = indeterminate,
|
||||
n::has_slot_requirement() = false,
|
||||
n::has_tag() = false,
|
||||
n::has_version_requirements() = false
|
||||
)))
|
||||
return false;
|
||||
|
||||
if (spec.package_name_requirement() && spec.package_name_requirement()->name() != package)
|
||||
if (spec.package_ptr() && *spec.package_ptr() != package)
|
||||
return false;
|
||||
if (spec.package_name_part_requirement() && spec.package_name_part_requirement()->name_part() != package.package())
|
||||
if (spec.package_name_part_ptr() && *spec.package_name_part_ptr() != package.package())
|
||||
return false;
|
||||
if (spec.category_name_part_requirement() && spec.category_name_part_requirement()->name_part() != package.category())
|
||||
if (spec.category_name_part_ptr() && *spec.category_name_part_ptr() != package.category())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include <paludis/resolver/orderer_notes.hh>
|
||||
#include <paludis/resolver/change_by_resolvent.hh>
|
||||
#include <paludis/resolver/labels_classifier.hh>
|
||||
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/exception.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
@ -46,12 +45,10 @@
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
#include <paludis/util/tribool.hh>
|
||||
#include <paludis/util/enum_iterator.hh>
|
||||
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/notifier_callback.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
@ -819,12 +816,10 @@ namespace
|
||||
{
|
||||
PackageDepSpec make_origin_spec(const ChangesToMakeDecision & changes_to_make_decision)
|
||||
{
|
||||
MutablePackageDepSpecData result(*changes_to_make_decision.origin_id()->uniquely_identifying_spec().data());
|
||||
PartiallyMadePackageDepSpec result(changes_to_make_decision.origin_id()->uniquely_identifying_spec());
|
||||
|
||||
if (changes_to_make_decision.if_via_new_binary_in())
|
||||
result
|
||||
.unrequire_in_repository()
|
||||
.require_in_repository(*changes_to_make_decision.if_via_new_binary_in());
|
||||
result.in_repository(*changes_to_make_decision.if_via_new_binary_in());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2009, 2010 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
|
||||
@ -29,7 +29,6 @@
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/serialise-impl.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
|
||||
using namespace paludis;
|
||||
using namespace paludis::resolver;
|
||||
@ -84,7 +83,7 @@ Resolvent::Resolvent(
|
||||
const SlotName & s,
|
||||
const DestinationType t) :
|
||||
destination_type(n::destination_type() = t),
|
||||
package(n::package() = spec.package_name_requirement()->name()),
|
||||
package(n::package() = *spec.package_ptr()),
|
||||
slot(make_named_values<SlotNameOrNull>(
|
||||
n::name_or_null() = std::make_shared<SlotName>(s),
|
||||
n::null_means_unknown() = false
|
||||
@ -97,7 +96,7 @@ Resolvent::Resolvent(
|
||||
const SlotNameOrNull & s,
|
||||
const DestinationType t) :
|
||||
destination_type(n::destination_type() = t),
|
||||
package(n::package() = spec.package_name_requirement()->name()),
|
||||
package(n::package() = *spec.package_ptr()),
|
||||
slot(s)
|
||||
{
|
||||
}
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/selection.hh>
|
||||
#include <paludis/elike_slot_requirement.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
|
||||
#include <paludis/repositories/fake/fake_installed_repository.hh>
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <paludis/util/map.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/slot_requirement.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/elike_package_dep_spec.hh>
|
||||
@ -168,7 +169,7 @@ namespace
|
||||
|
||||
void visit_package_spec(const PackageDepSpec & spec)
|
||||
{
|
||||
if (spec.package_name_requirement())
|
||||
if (spec.package_ptr())
|
||||
visit_package_or_block_spec(PackageOrBlockDepSpec(spec));
|
||||
else
|
||||
super_complicated = true;
|
||||
@ -176,7 +177,7 @@ namespace
|
||||
|
||||
void visit_block_spec(const BlockDepSpec & spec)
|
||||
{
|
||||
if (spec.blocking().package_name_requirement())
|
||||
if (spec.blocking().package_ptr())
|
||||
visit_package_or_block_spec(PackageOrBlockDepSpec(spec));
|
||||
else
|
||||
super_complicated = true;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
|
||||
#include <paludis/spec_tree.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
@ -37,10 +36,8 @@
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/elike_blocker.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
@ -95,13 +92,13 @@ SpecRewriter::~SpecRewriter() = default;
|
||||
const std::shared_ptr<const RewrittenSpec>
|
||||
SpecRewriter::rewrite_if_special(const PackageOrBlockDepSpec & s, const std::shared_ptr<const Resolvent> & maybe_our_resolvent) const
|
||||
{
|
||||
if (s.if_package() && s.if_package()->package_name_requirement())
|
||||
if (s.if_package() && s.if_package()->package_ptr())
|
||||
{
|
||||
if (s.if_package()->package_name_requirement()->name().category() != CategoryNamePart("virtual"))
|
||||
if (s.if_package()->package_ptr()->category() != CategoryNamePart("virtual"))
|
||||
return make_null_shared_ptr();
|
||||
_need_rewrites();
|
||||
|
||||
Rewrites::const_iterator r(_imp->rewrites.find(s.if_package()->package_name_requirement()->name()));
|
||||
Rewrites::const_iterator r(_imp->rewrites.find(*s.if_package()->package_ptr()));
|
||||
if (r == _imp->rewrites.end())
|
||||
return make_null_shared_ptr();
|
||||
|
||||
@ -111,19 +108,17 @@ SpecRewriter::rewrite_if_special(const PackageOrBlockDepSpec & s, const std::sha
|
||||
|
||||
for (std::set<QualifiedPackageName>::const_iterator n(r->second.begin()), n_end(r->second.end()) ;
|
||||
n != n_end ; ++n)
|
||||
result->specs()->push_back(PackageOrBlockDepSpec(MutablePackageDepSpecData(*s.if_package()->data())
|
||||
.unrequire_package()
|
||||
.require_package(*n)));
|
||||
result->specs()->push_back(PackageOrBlockDepSpec(PartiallyMadePackageDepSpec(*s.if_package()).package(*n)));
|
||||
|
||||
return result;
|
||||
}
|
||||
else if (s.if_block() && s.if_block()->blocking().package_name_requirement())
|
||||
else if (s.if_block() && s.if_block()->blocking().package_ptr())
|
||||
{
|
||||
if (s.if_block()->blocking().package_name_requirement()->name().category() != CategoryNamePart("virtual"))
|
||||
if (s.if_block()->blocking().package_ptr()->category() != CategoryNamePart("virtual"))
|
||||
return make_null_shared_ptr();
|
||||
_need_rewrites();
|
||||
|
||||
Rewrites::const_iterator r(_imp->rewrites.find(s.if_block()->blocking().package_name_requirement()->name()));
|
||||
Rewrites::const_iterator r(_imp->rewrites.find(*s.if_block()->blocking().package_ptr()));
|
||||
if (r == _imp->rewrites.end())
|
||||
return make_null_shared_ptr();
|
||||
|
||||
@ -137,9 +132,7 @@ SpecRewriter::rewrite_if_special(const PackageOrBlockDepSpec & s, const std::sha
|
||||
if (maybe_our_resolvent && (*n == maybe_our_resolvent->package()))
|
||||
continue;
|
||||
|
||||
PackageDepSpec spec(MutablePackageDepSpecData(*s.if_block()->blocking().data())
|
||||
.unrequire_package()
|
||||
.require_package(*n));
|
||||
PackageDepSpec spec(PartiallyMadePackageDepSpec(s.if_block()->blocking()).package(*n));
|
||||
auto p(split_elike_blocker(s.if_block()->text()));
|
||||
BlockDepSpec b(std::get<1>(p) + stringify(spec), spec);
|
||||
b.set_annotations(s.if_block()->maybe_annotations());
|
||||
|
@ -37,9 +37,8 @@
|
||||
#include <paludis/generator.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/filtered_generator.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -169,18 +168,6 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
PackageDepSpec name_and_slot(const PackageDepSpec & spec)
|
||||
{
|
||||
if (spec.exact_slot_requirement())
|
||||
return MutablePackageDepSpecData({ })
|
||||
.require_package(spec.package_name_requirement()->name())
|
||||
.require_exact_slot(spec.exact_slot_requirement()->name(), spec.exact_slot_requirement()->locked())
|
||||
;
|
||||
else
|
||||
return MutablePackageDepSpecData({ })
|
||||
.require_package(spec.package_name_requirement()->name());
|
||||
}
|
||||
|
||||
void
|
||||
do_one_conf_line(const std::string & line, std::shared_ptr<SetSpecTree> result,
|
||||
const SetFileParams & params)
|
||||
@ -251,13 +238,13 @@ namespace
|
||||
}
|
||||
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(params.parser()(tokens.at(1))));
|
||||
if (spec->package_name_requirement())
|
||||
if (spec->package_ptr())
|
||||
{
|
||||
if (! params.environment())
|
||||
Log::get_instance()->message("set_file.bad_operator", ll_warning, lc_context)
|
||||
<< "Line '" << line << "' uses ? operator but no environment is available";
|
||||
else if (! (*params.environment())[selection::SomeArbitraryVersion(
|
||||
generator::Package(spec->package_name_requirement()->name()) |
|
||||
generator::Package(*spec->package_ptr()) |
|
||||
filter::InstalledAtRoot(params.environment()->preferred_root_key()->parse_value()))]->empty())
|
||||
result->top()->append(spec);
|
||||
}
|
||||
@ -275,13 +262,16 @@ namespace
|
||||
}
|
||||
|
||||
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(params.parser()(tokens.at(1))));
|
||||
if (spec->package_name_requirement())
|
||||
if (spec->package_ptr())
|
||||
{
|
||||
if (! params.environment())
|
||||
Log::get_instance()->message("set_file.bad_operator", ll_warning, lc_context)
|
||||
<< "Line '" << line << "' uses ?: operator but no environment is available";
|
||||
else if (! (*params.environment())[selection::SomeArbitraryVersion(generator::Matches(
|
||||
name_and_slot(*spec), make_null_shared_ptr(), { }) |
|
||||
make_package_dep_spec({ })
|
||||
.package(*spec->package_ptr())
|
||||
.slot_requirement(spec->slot_requirement_ptr()),
|
||||
make_null_shared_ptr(), { }) |
|
||||
filter::InstalledAtRoot(params.environment()->preferred_root_key()->parse_value()))]->empty())
|
||||
result->top()->append(spec);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Ciaran McCreesh
|
||||
* 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
|
||||
@ -17,23 +17,20 @@
|
||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SPLIT_PN_V_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SPLIT_PN_V_HH 1
|
||||
#ifndef PALUDIS_GUARD_PALUDIS_SLOT_REQUIREMENT_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_SLOT_REQUIREMENT_FWD_HH 1
|
||||
|
||||
#include <paludis/name.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/environment-fwd.hh>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <iosfwd>
|
||||
#include <paludis/util/attributes.hh>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
namespace erepository
|
||||
{
|
||||
std::pair<PackageNamePart, VersionSpec> split_pn_v(
|
||||
const Environment * const, const std::string &);
|
||||
}
|
||||
struct SlotRequirement;
|
||||
struct SlotExactRequirement;
|
||||
struct SlotAnyLockedRequirement;
|
||||
struct SlotAnyUnlockedRequirement;
|
||||
|
||||
std::ostream & operator<< (std::ostream &, const SlotRequirement &) PALUDIS_VISIBLE;
|
||||
}
|
||||
|
||||
#endif
|
31
paludis/slot_requirement.cc
Normal file
31
paludis/slot_requirement.cc
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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/slot_requirement.hh>
|
||||
#include <ostream>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
std::ostream &
|
||||
paludis::operator<< (std::ostream & s, const SlotRequirement & r)
|
||||
{
|
||||
s << r.as_string();
|
||||
return s;
|
||||
}
|
||||
|
59
paludis/slot_requirement.hh
Normal file
59
paludis/slot_requirement.hh
Normal file
@ -0,0 +1,59 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, 2011 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_SLOT_REQUIREMENT_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_SLOT_REQUIREMENT_HH 1
|
||||
|
||||
#include <paludis/slot_requirement-fwd.hh>
|
||||
#include <paludis/name-fwd.hh>
|
||||
#include <paludis/util/visitor.hh>
|
||||
#include <paludis/util/type_list.hh>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class PALUDIS_VISIBLE SlotRequirement :
|
||||
public virtual DeclareAbstractAcceptMethods<SlotRequirement, MakeTypeList<
|
||||
SlotExactRequirement, SlotAnyLockedRequirement, SlotAnyUnlockedRequirement>::Type>
|
||||
{
|
||||
public:
|
||||
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE SlotExactRequirement :
|
||||
public SlotRequirement,
|
||||
public ImplementAcceptMethods<SlotRequirement, SlotExactRequirement>
|
||||
{
|
||||
public:
|
||||
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE SlotAnyLockedRequirement :
|
||||
public SlotRequirement,
|
||||
public ImplementAcceptMethods<SlotRequirement, SlotAnyLockedRequirement>
|
||||
{
|
||||
};
|
||||
|
||||
class PALUDIS_VISIBLE SlotAnyUnlockedRequirement :
|
||||
public SlotRequirement,
|
||||
public ImplementAcceptMethods<SlotRequirement, SlotAnyUnlockedRequirement>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2005, 2006, 2007, 2008, 2009 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
|
||||
@ -63,6 +63,10 @@ namespace paludis
|
||||
///\}
|
||||
};
|
||||
|
||||
struct UserSlotExactRequirement;
|
||||
|
||||
struct UserKeyRequirement;
|
||||
|
||||
/**
|
||||
* The VersionSpecOptions to use for parsing a user spec.
|
||||
*
|
||||
|
@ -23,17 +23,19 @@
|
||||
#include <paludis/elike_use_requirement.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/package_id.hh>
|
||||
#include <paludis/metadata_key.hh>
|
||||
#include <paludis/dep_label.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/contents.hh>
|
||||
#include <paludis/repository.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
|
||||
#include <paludis/util/options.hh>
|
||||
#include <paludis/util/log.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
#include <paludis/util/pimp-impl.hh>
|
||||
#include <paludis/util/set.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
@ -43,7 +45,6 @@
|
||||
#include <paludis/util/tribool.hh>
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
#include <paludis/util/return_literal_function.hh>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -53,7 +54,7 @@ using namespace paludis;
|
||||
|
||||
namespace
|
||||
{
|
||||
void user_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result,
|
||||
void user_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
const Environment * const env, const UserPackageDepSpecOptions & options,
|
||||
const Filter & filter)
|
||||
{
|
||||
@ -63,43 +64,43 @@ namespace
|
||||
throw PackageDepSpecError("Wildcard '*' not allowed");
|
||||
|
||||
if (0 != s.compare(s.length() - 2, 2, "/*"))
|
||||
result.require_package_name_part(PackageNamePart(s.substr(2)));
|
||||
result.package_name_part(PackageNamePart(s.substr(2)));
|
||||
}
|
||||
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
|
||||
{
|
||||
if (! options[updso_allow_wildcards])
|
||||
throw PackageDepSpecError("Wildcard '*' not allowed in '" + stringify(s) + "'");
|
||||
|
||||
result.require_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
}
|
||||
else if (s == "*")
|
||||
throw PackageDepSpecError("Use '*/*' not '*' to match everything");
|
||||
else if (std::string::npos != s.find('/'))
|
||||
result.require_package(QualifiedPackageName(s));
|
||||
result.package(QualifiedPackageName(s));
|
||||
else
|
||||
{
|
||||
if (options[updso_no_disambiguation])
|
||||
throw PackageDepSpecError("Need an explicit category specified");
|
||||
result.require_package(env->fetch_unique_qualified_package_name(PackageNamePart(s),
|
||||
result.package(env->fetch_unique_qualified_package_name(PackageNamePart(s),
|
||||
filter::And(filter, filter::Matches(result, make_null_shared_ptr(), { }))));
|
||||
}
|
||||
}
|
||||
|
||||
void envless_add_package_requirement(const std::string & s, MutablePackageDepSpecData & result)
|
||||
void envless_add_package_requirement(const std::string & s, PartiallyMadePackageDepSpec & result)
|
||||
{
|
||||
if (s.length() >= 3 && (0 == s.compare(0, 2, "*/")))
|
||||
{
|
||||
if (0 != s.compare(s.length() - 2, 2, "/*"))
|
||||
result.require_package_name_part(PackageNamePart(s.substr(2)));
|
||||
result.package_name_part(PackageNamePart(s.substr(2)));
|
||||
}
|
||||
else if (s.length() >= 3 && (0 == s.compare(s.length() - 2, 2, "/*")))
|
||||
{
|
||||
result.require_category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
result.category_name_part(CategoryNamePart(s.substr(0, s.length() - 2)));
|
||||
}
|
||||
else if (s == "*")
|
||||
throw PackageDepSpecError("Use '*/*' not '*' to match everything");
|
||||
else if (std::string::npos != s.find('/'))
|
||||
result.require_package(QualifiedPackageName(s));
|
||||
result.package(QualifiedPackageName(s));
|
||||
else
|
||||
{
|
||||
throw PackageDepSpecError("Need an explicit category specified");
|
||||
@ -130,7 +131,7 @@ namespace
|
||||
throw PackageDepSpecError("Got empty dep spec");
|
||||
}
|
||||
|
||||
bool user_remove_trailing_square_bracket_if_exists(std::string & s, MutablePackageDepSpecData & result,
|
||||
bool user_remove_trailing_square_bracket_if_exists(std::string & s, PartiallyMadePackageDepSpec & result,
|
||||
bool & had_bracket_version_requirements)
|
||||
{
|
||||
std::string::size_type use_group_p;
|
||||
@ -155,18 +156,81 @@ namespace
|
||||
case '>':
|
||||
case '=':
|
||||
case '~':
|
||||
parse_elike_version_range(flag, result, { epdso_nice_equal_star }, user_version_spec_options(), had_bracket_version_requirements);
|
||||
{
|
||||
char needed_mode(0);
|
||||
|
||||
while (! flag.empty())
|
||||
{
|
||||
Context cc("When parsing [] segment '" + flag + "':");
|
||||
|
||||
std::string op;
|
||||
std::string::size_type opos(0);
|
||||
while (opos < flag.length())
|
||||
if (std::string::npos == std::string("><=~").find(flag.at(opos)))
|
||||
break;
|
||||
else
|
||||
++opos;
|
||||
|
||||
op = flag.substr(0, opos);
|
||||
flag.erase(0, opos);
|
||||
|
||||
if (op.empty())
|
||||
throw PackageDepSpecError("Missing operator inside []");
|
||||
|
||||
VersionOperator vop(op);
|
||||
|
||||
std::string ver;
|
||||
opos = flag.find_first_of("|&");
|
||||
if (std::string::npos == opos)
|
||||
{
|
||||
ver = flag;
|
||||
flag.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == needed_mode)
|
||||
needed_mode = flag.at(opos);
|
||||
else if (needed_mode != flag.at(opos))
|
||||
throw PackageDepSpecError("Mixed & and | inside []");
|
||||
|
||||
result.version_requirements_mode((flag.at(opos) == '|' ? vr_or : vr_and));
|
||||
ver = flag.substr(0, opos++);
|
||||
flag.erase(0, opos);
|
||||
}
|
||||
|
||||
if (ver.empty())
|
||||
throw PackageDepSpecError("Missing version after operator '" + stringify(vop) + " inside []");
|
||||
|
||||
if ('*' == ver.at(ver.length() - 1))
|
||||
{
|
||||
ver.erase(ver.length() - 1);
|
||||
if (vop == vo_equal)
|
||||
vop = vo_nice_equal_star;
|
||||
else
|
||||
throw PackageDepSpecError("Invalid use of * with operator '" + stringify(vop) + " inside []");
|
||||
}
|
||||
|
||||
VersionSpec vs(ver, user_version_spec_options());
|
||||
result.version_requirement(make_named_values<VersionRequirement>(
|
||||
n::version_operator() = vop,
|
||||
n::version_spec() = vs));
|
||||
had_bracket_version_requirements = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '.':
|
||||
{
|
||||
auto k(parse_user_key_requirement(flag.substr(1)));
|
||||
result.require_key(std::get<0>(k), std::get<1>(k), std::get<2>(k), std::get<3>(k));
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(std::make_shared<UserKeyRequirement>(flag.substr(1)));
|
||||
result.additional_requirement(req);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
result.require_choice(parse_elike_use_requirement(flag, { }));
|
||||
{
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirement> req(parse_elike_use_requirement(flag, { }));
|
||||
result.additional_requirement(req);
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
@ -176,18 +240,18 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
user_remove_trailing_slot_if_exists(std::string & s, MutablePackageDepSpecData & result)
|
||||
user_remove_trailing_slot_if_exists(std::string & s, PartiallyMadePackageDepSpec & result)
|
||||
{
|
||||
std::string::size_type slot_p(s.rfind(':'));
|
||||
if (std::string::npos != slot_p)
|
||||
{
|
||||
result.require_exact_slot(SlotName(s.substr(slot_p + 1)), false);
|
||||
result.slot_requirement(std::make_shared<UserSlotExactRequirement>(SlotName(s.substr(slot_p + 1))));
|
||||
s.erase(slot_p);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
parse_rhs(MutablePackageDepSpecData & reqs, const std::string & req)
|
||||
parse_rhs(PartiallyMadePackageDepSpec & reqs, const std::string & req)
|
||||
{
|
||||
if (req.empty())
|
||||
throw PackageDepSpecError("Invalid empty :: requirement");
|
||||
@ -197,29 +261,37 @@ namespace
|
||||
if ('?' == req.at(req.length() - 1))
|
||||
{
|
||||
if (req.length() >= 2 && '?' == req.at(req.length() - 2))
|
||||
reqs.require_installable_to_path(FSPath(req.substr(0, req.length() - 2)), true);
|
||||
reqs.installable_to_path(make_named_values<InstallableToPath>(
|
||||
n::include_masked() = true,
|
||||
n::path() = FSPath(req.substr(0, req.length() - 2))));
|
||||
else
|
||||
reqs.require_installable_to_path(FSPath(req.substr(0, req.length() - 1)), false);
|
||||
reqs.installable_to_path(make_named_values<InstallableToPath>(
|
||||
n::include_masked() = false,
|
||||
n::path() = FSPath(req.substr(0, req.length() - 1))));
|
||||
}
|
||||
else
|
||||
reqs.require_installed_at_path(FSPath(req));
|
||||
reqs.installed_at_path(FSPath(req));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ('?' == req.at(req.length() - 1))
|
||||
{
|
||||
if (req.length() >= 3 && '?' == req.at(req.length() - 2))
|
||||
reqs.require_installable_to_repository(RepositoryName(req.substr(0, req.length() - 2)), true);
|
||||
reqs.installable_to_repository(make_named_values<InstallableToRepository>(
|
||||
n::include_masked() = true,
|
||||
n::repository() = RepositoryName(req.substr(0, req.length() - 2))));
|
||||
else
|
||||
reqs.require_installable_to_repository(RepositoryName(req.substr(0, req.length() - 1)), false);
|
||||
reqs.installable_to_repository(make_named_values<InstallableToRepository>(
|
||||
n::include_masked() = false,
|
||||
n::repository() = RepositoryName(req.substr(0, req.length() - 1))));
|
||||
}
|
||||
else
|
||||
reqs.require_in_repository(RepositoryName(req));
|
||||
reqs.in_repository(RepositoryName(req));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
user_remove_trailing_repo_if_exists(std::string & s, MutablePackageDepSpecData & result)
|
||||
user_remove_trailing_repo_if_exists(std::string & s, PartiallyMadePackageDepSpec & result)
|
||||
{
|
||||
std::string::size_type repo_p;
|
||||
if (std::string::npos == ((repo_p = s.rfind("::"))))
|
||||
@ -245,9 +317,14 @@ namespace
|
||||
parse_rhs(result, right);
|
||||
|
||||
if (! left.empty())
|
||||
result.require_from_repository(RepositoryName(left));
|
||||
result.from_repository(RepositoryName(left));
|
||||
}
|
||||
}
|
||||
|
||||
const PartiallyMadePackageDepSpecOptions fixed_options_for_partially_made_package_dep_spec(PartiallyMadePackageDepSpecOptions o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
PackageDepSpec
|
||||
@ -259,10 +336,11 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
|
||||
Context context("When parsing user package dep spec '" + ss + "':");
|
||||
|
||||
bool had_bracket_version_requirements(false);
|
||||
PartiallyMadePackageDepSpecOptions o;
|
||||
|
||||
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
|
||||
n::add_package_requirement() = std::bind(&user_add_package_requirement, _1, _2, env, options, filter),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3, _4),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3),
|
||||
n::check_sanity() = std::bind(&user_check_sanity, _1, options, env),
|
||||
n::get_remove_trailing_version() = std::bind(&elike_get_remove_trailing_version, _1,
|
||||
user_version_spec_options()),
|
||||
@ -270,7 +348,7 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
|
||||
ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star),
|
||||
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
|
||||
std::cref(had_bracket_version_requirements), ELikePackageDepSpecOptions()),
|
||||
n::options_for_partially_made_package_dep_spec() = return_literal_function(PackageDepSpecDataOptions()),
|
||||
n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
|
||||
n::remove_trailing_repo_if_exists() = std::bind(&user_remove_trailing_repo_if_exists, _1, _2),
|
||||
n::remove_trailing_slot_if_exists() = std::bind(&user_remove_trailing_slot_if_exists, _1, _2),
|
||||
n::remove_trailing_square_bracket_if_exists() = std::bind(&user_remove_trailing_square_bracket_if_exists,
|
||||
@ -286,10 +364,11 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
|
||||
Context context("When parsing test package dep spec '" + ss + "':");
|
||||
|
||||
bool had_bracket_version_requirements(false);
|
||||
PartiallyMadePackageDepSpecOptions o;
|
||||
|
||||
return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
|
||||
n::add_package_requirement() = std::bind(&envless_add_package_requirement, _1, _2),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3, _4),
|
||||
n::add_version_requirement() = std::bind(&elike_add_version_requirement, _1, _2, _3),
|
||||
n::check_sanity() = std::bind(&test_check_sanity, _1),
|
||||
n::get_remove_trailing_version() = std::bind(&elike_get_remove_trailing_version, _1,
|
||||
user_version_spec_options()),
|
||||
@ -297,7 +376,7 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
|
||||
ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star),
|
||||
n::has_version_operator() = std::bind(&elike_has_version_operator, _1,
|
||||
std::cref(had_bracket_version_requirements), ELikePackageDepSpecOptions()),
|
||||
n::options_for_partially_made_package_dep_spec() = return_literal_function(PackageDepSpecDataOptions()),
|
||||
n::options_for_partially_made_package_dep_spec() = std::bind(&fixed_options_for_partially_made_package_dep_spec, std::cref(o)),
|
||||
n::remove_trailing_repo_if_exists() = std::bind(&user_remove_trailing_repo_if_exists, _1, _2),
|
||||
n::remove_trailing_slot_if_exists() = std::bind(&user_remove_trailing_slot_if_exists, _1, _2),
|
||||
n::remove_trailing_square_bracket_if_exists() = std::bind(&user_remove_trailing_square_bracket_if_exists,
|
||||
@ -305,11 +384,606 @@ paludis::envless_parse_package_dep_spec_for_tests(const std::string & ss)
|
||||
));
|
||||
}
|
||||
|
||||
UserSlotExactRequirement::UserSlotExactRequirement(const SlotName & s) :
|
||||
_s(s)
|
||||
{
|
||||
}
|
||||
const SlotName
|
||||
UserSlotExactRequirement::slot() const
|
||||
{
|
||||
return _s;
|
||||
}
|
||||
|
||||
const std::string
|
||||
UserSlotExactRequirement::as_string() const
|
||||
{
|
||||
return ":" + stringify(_s);
|
||||
}
|
||||
|
||||
GotASetNotAPackageDepSpec::GotASetNotAPackageDepSpec(const std::string & s) throw () :
|
||||
Exception("'" + s + "' is a set, not a package")
|
||||
{
|
||||
}
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
template <>
|
||||
struct Imp<UserKeyRequirement>
|
||||
{
|
||||
std::string key;
|
||||
std::string value;
|
||||
char op;
|
||||
|
||||
Imp(const std::string & s)
|
||||
{
|
||||
std::string::size_type p(s.find_first_of("=<>?"));
|
||||
if (std::string::npos == p)
|
||||
throw PackageDepSpecError("Expected an =, a <, a > or a ? inside '[." + s + "]'");
|
||||
|
||||
key = s.substr(0, p);
|
||||
value = s.substr(p + 1);
|
||||
op = s.at(p);
|
||||
|
||||
if (op == '?' && ! value.empty())
|
||||
throw PackageDepSpecError("Operator '?' takes no value inside '[." + s + "]'");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
UserKeyRequirement::UserKeyRequirement(const std::string & s) :
|
||||
_imp(s)
|
||||
{
|
||||
}
|
||||
|
||||
UserKeyRequirement::~UserKeyRequirement()
|
||||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string stringify_contents_entry(const ContentsEntry & e)
|
||||
{
|
||||
return stringify(e.location_key()->parse_value());
|
||||
}
|
||||
|
||||
struct StringifyEqual
|
||||
{
|
||||
const std::string pattern;
|
||||
|
||||
StringifyEqual(const std::string & p) :
|
||||
pattern(p)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T_>
|
||||
bool operator() (const T_ & t) const
|
||||
{
|
||||
return stringify(t) == pattern;
|
||||
}
|
||||
|
||||
bool operator() (const ContentsEntry & e) const
|
||||
{
|
||||
return stringify_contents_entry(e) == pattern;
|
||||
}
|
||||
};
|
||||
|
||||
struct SpecTreeSearcher
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
const std::string pattern;
|
||||
|
||||
SpecTreeSearcher(const Environment * const e, const std::shared_ptr<const PackageID> & i, const std::string & p) :
|
||||
env(e),
|
||||
id(i),
|
||||
pattern(p)
|
||||
{
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & n) const
|
||||
{
|
||||
if (n.spec()->condition_met(env, id))
|
||||
return indirect_iterator(n.end()) != std::find_if(indirect_iterator(n.begin()), indirect_iterator(n.end()),
|
||||
accept_visitor_returning<bool>(*this));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.spec()->end()) != std::find_if(indirect_iterator(n.spec()->begin()),
|
||||
indirect_iterator(n.spec()->end()), StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & n) const
|
||||
{
|
||||
return indirect_iterator(n.spec()->end()) != std::find_if(indirect_iterator(n.spec()->begin()),
|
||||
indirect_iterator(n.spec()->end()), StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
bool visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & n) const
|
||||
{
|
||||
return stringify(*n.spec()) == pattern;
|
||||
}
|
||||
};
|
||||
|
||||
struct KeyComparator
|
||||
{
|
||||
const Environment * const env;
|
||||
const std::shared_ptr<const PackageID> id;
|
||||
const std::string pattern;
|
||||
const char op;
|
||||
|
||||
KeyComparator(const Environment * const e, const std::shared_ptr<const PackageID> & i,
|
||||
const std::string & p, const char o) :
|
||||
env(e),
|
||||
id(i),
|
||||
pattern(p),
|
||||
op(o)
|
||||
{
|
||||
}
|
||||
|
||||
bool visit(const MetadataSectionKey &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataTimeKey & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == stringify(k.parse_value().seconds());
|
||||
case '<':
|
||||
return k.parse_value().seconds() < destringify<time_t>(pattern);
|
||||
case '>':
|
||||
return k.parse_value().seconds() > destringify<time_t>(pattern);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::string> & k) const
|
||||
{
|
||||
return pattern == stringify(k.parse_value());
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<SlotName> & k) const
|
||||
{
|
||||
return pattern == stringify(k.parse_value());
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<FSPath> & k) const
|
||||
{
|
||||
return pattern == stringify(k.parse_value());
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<bool> & k) const
|
||||
{
|
||||
return pattern == stringify(k.parse_value());
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<long> & k) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == stringify(k.parse_value());
|
||||
case '<':
|
||||
return k.parse_value() < destringify<long>(pattern);
|
||||
case '>':
|
||||
return k.parse_value() > destringify<long>(pattern);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const Contents> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ",
|
||||
stringify_contents_entry);
|
||||
case '<':
|
||||
return indirect_iterator(v->end()) != std::find_if(
|
||||
indirect_iterator(v->begin()),
|
||||
indirect_iterator(v->end()),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) const
|
||||
{
|
||||
return pattern == stringify(*k.parse_value());
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<DependencySpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<SetSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<PlainTextSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<ProvideSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<SimpleURISpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<FetchableURISpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataSpecTreeKey<LicenseSpecTree> & s) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return false;
|
||||
case '<':
|
||||
return s.parse_value()->top()->accept_returning<bool>(SpecTreeSearcher(env, id, pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<FSPathSequence> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case '<':
|
||||
return v->end() != std::find_if(v->begin(), v->end(),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<PackageIDSequence> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ");
|
||||
case '<':
|
||||
return indirect_iterator(v->end()) != std::find_if(
|
||||
indirect_iterator(v->begin()),
|
||||
indirect_iterator(v->end()),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Sequence<std::string> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case '<':
|
||||
return v->end() != std::find_if(v->begin(), v->end(),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Set<std::string> > & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case '<':
|
||||
return v->end() != std::find_if(v->begin(), v->end(),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<Map<std::string, std::string> > &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visit(const MetadataCollectionKey<KeywordNameSet> & s) const
|
||||
{
|
||||
auto v(s.parse_value());
|
||||
switch (op)
|
||||
{
|
||||
case '=':
|
||||
return pattern == join(v->begin(), v->end(), " ");
|
||||
case '<':
|
||||
return v->end() != std::find_if(v->begin(), v->end(),
|
||||
StringifyEqual(pattern));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::pair<bool, std::string>
|
||||
UserKeyRequirement::requirement_met(
|
||||
const Environment * const env,
|
||||
const ChangedChoices * const,
|
||||
const std::shared_ptr<const PackageID> & id,
|
||||
const std::shared_ptr<const PackageID> & from_id,
|
||||
const ChangedChoices * const) const
|
||||
{
|
||||
Context context("When working out whether '" + stringify(*id) + "' matches " + as_raw_string() + ":");
|
||||
|
||||
const MetadataKey * key(0);
|
||||
|
||||
auto repo(env->fetch_repository(id->repository_name()));
|
||||
if (0 == _imp->key.compare(0, 3, "::$"))
|
||||
{
|
||||
if (_imp->key == "::$format")
|
||||
key = repo->format_key().get();
|
||||
else if (_imp->key == "::$location")
|
||||
key = repo->location_key().get();
|
||||
else if (_imp->key == "::$installed_root")
|
||||
key = repo->installed_root_key().get();
|
||||
else if (_imp->key == "::$accept_keywords")
|
||||
key = repo->accept_keywords_key().get();
|
||||
else if (_imp->key == "::$sync_host")
|
||||
key = repo->sync_host_key().get();
|
||||
}
|
||||
else if (0 == _imp->key.compare(0, 1, "$"))
|
||||
{
|
||||
if (_imp->key == "$behaviours")
|
||||
key = id->behaviours_key().get();
|
||||
else if (_imp->key == "$build_dependencies")
|
||||
key = id->build_dependencies_key().get();
|
||||
else if (_imp->key == "$choices")
|
||||
key = id->choices_key().get();
|
||||
else if (_imp->key == "$contained_in")
|
||||
key = id->contained_in_key().get();
|
||||
else if (_imp->key == "$contains")
|
||||
key = id->contains_key().get();
|
||||
else if (_imp->key == "$contents")
|
||||
key = id->contents_key().get();
|
||||
else if (_imp->key == "$dependencies")
|
||||
key = id->dependencies_key().get();
|
||||
else if (_imp->key == "$fetches")
|
||||
key = id->fetches_key().get();
|
||||
else if (_imp->key == "$from_repositories")
|
||||
key = id->from_repositories_key().get();
|
||||
else if (_imp->key == "$fs_location")
|
||||
key = id->fs_location_key().get();
|
||||
else if (_imp->key == "$homepage")
|
||||
key = id->homepage_key().get();
|
||||
else if (_imp->key == "$installed_time")
|
||||
key = id->installed_time_key().get();
|
||||
else if (_imp->key == "$keywords")
|
||||
key = id->keywords_key().get();
|
||||
else if (_imp->key == "$long_description")
|
||||
key = id->long_description_key().get();
|
||||
else if (_imp->key == "$post_dependencies")
|
||||
key = id->post_dependencies_key().get();
|
||||
else if (_imp->key == "$provide")
|
||||
key = id->provide_key().get();
|
||||
else if (_imp->key == "$run_dependencies")
|
||||
key = id->run_dependencies_key().get();
|
||||
else if (_imp->key == "$short_description")
|
||||
key = id->short_description_key().get();
|
||||
else if (_imp->key == "$slot")
|
||||
key = id->slot_key().get();
|
||||
else if (_imp->key == "$suggested_dependencies")
|
||||
key = id->suggested_dependencies_key().get();
|
||||
else if (_imp->key == "$virtual_for")
|
||||
key = id->virtual_for_key().get();
|
||||
}
|
||||
else if (0 == _imp->key.compare(0, 2, "::"))
|
||||
{
|
||||
Repository::MetadataConstIterator m(repo->find_metadata(_imp->key.substr(2)));
|
||||
if (m != repo->end_metadata())
|
||||
key = m->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
PackageID::MetadataConstIterator m(id->find_metadata(_imp->key));
|
||||
if (m != id->end_metadata())
|
||||
key = m->get();
|
||||
}
|
||||
|
||||
if (! key)
|
||||
return std::make_pair(false, as_human_string(from_id));
|
||||
|
||||
if (_imp->op == '?')
|
||||
return std::make_pair(true, as_human_string(from_id));
|
||||
else
|
||||
{
|
||||
KeyComparator c(env, id, _imp->value, _imp->op);
|
||||
return std::make_pair(key->accept_returning<bool>(c), as_human_string(from_id));
|
||||
}
|
||||
}
|
||||
|
||||
const std::string
|
||||
UserKeyRequirement::as_human_string(const std::shared_ptr<const PackageID> &) const
|
||||
{
|
||||
std::string key_str;
|
||||
if ((! _imp->key.empty()) && (_imp->key.at(0) == '$'))
|
||||
key_str = "with role '" + _imp->key.substr(1) + "'";
|
||||
else
|
||||
key_str = "'" + _imp->key + "'";
|
||||
|
||||
switch (_imp->op)
|
||||
{
|
||||
case '=':
|
||||
return "Key " + key_str + " has simple string value '" + _imp->value + "'";
|
||||
case '<':
|
||||
return "Key " + key_str + " contains or is less than '" + _imp->value + "'";
|
||||
case '>':
|
||||
return "Key " + key_str + " is greater than '" + _imp->value + "'";
|
||||
case '?':
|
||||
return "Key " + key_str + " exists";
|
||||
}
|
||||
|
||||
throw InternalError(PALUDIS_HERE, "unknown op");
|
||||
}
|
||||
|
||||
const std::string
|
||||
UserKeyRequirement::as_raw_string() const
|
||||
{
|
||||
return "[." + _imp->key + std::string(1, _imp->op) + _imp->value + "]";
|
||||
}
|
||||
|
||||
Tribool
|
||||
UserKeyRequirement::accumulate_changes_to_make_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
ChangedChoices &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
VersionSpecOptions
|
||||
paludis::user_version_spec_options()
|
||||
{
|
||||
@ -317,64 +991,5 @@ paludis::user_version_spec_options()
|
||||
vso_ignore_case, vso_letters_anywhere, vso_dotted_suffixes };
|
||||
}
|
||||
|
||||
std::tuple<KeyRequirementKeyType, std::string, KeyRequirementOperation, std::string>
|
||||
paludis::parse_user_key_requirement(const std::string & s)
|
||||
{
|
||||
std::string::size_type p(s.find_first_of("=<>?~"));
|
||||
if (std::string::npos == p)
|
||||
throw PackageDepSpecError("[." + s + "] contains no operator");
|
||||
|
||||
std::string key, value;
|
||||
KeyRequirementOperation op(last_kro);
|
||||
|
||||
if (s.at(p) == '?')
|
||||
{
|
||||
if (s.length() - 1 != p)
|
||||
throw PackageDepSpecError("[." + s + "] uses a key with operator '?'");
|
||||
else
|
||||
{
|
||||
key = s.substr(0, p);
|
||||
op = kro_question;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (s.at(p))
|
||||
{
|
||||
case '=': op = kro_equals; break;
|
||||
case '~': op = kro_tilde; break;
|
||||
case '<': op = kro_less_than; break;
|
||||
case '>': op = kro_greater_than; break;
|
||||
default:
|
||||
throw PackageDepSpecError("[." + s + "] unknown operator");
|
||||
}
|
||||
key = s.substr(0, p);
|
||||
value = s.substr(p + 1);
|
||||
}
|
||||
|
||||
KeyRequirementKeyType type(krkt_id);
|
||||
if (0 == key.compare(0, 3, "::$", 0, 3))
|
||||
{
|
||||
type = krkt_repo_role;
|
||||
key.erase(0, 3);
|
||||
}
|
||||
else if (0 == key.compare(0, 2, "::2", 0, 2))
|
||||
{
|
||||
type = krkt_repo;
|
||||
key.erase(0, 2);
|
||||
}
|
||||
else if (0 == key.compare(0, 1, "$", 0, 1))
|
||||
{
|
||||
type = krkt_id_role;
|
||||
key.erase(0, 1);
|
||||
}
|
||||
else if (0 == key.compare(0, 1, "(", 0, 1) && ')' == key.at(key.length() - 1))
|
||||
{
|
||||
type = krkt_id_mask;
|
||||
key.erase(0, 1);
|
||||
key.erase(key.length() - 1);
|
||||
}
|
||||
|
||||
return std::make_tuple(type, key, op, value);
|
||||
}
|
||||
template class Pimp<UserKeyRequirement>;
|
||||
|
||||
|
@ -22,13 +22,11 @@
|
||||
|
||||
#include <paludis/user_dep_spec-fwd.hh>
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/slot_requirement.hh>
|
||||
#include <paludis/filter.hh>
|
||||
#include <paludis/package_dep_spec_requirement-fwd.hh>
|
||||
|
||||
#include <paludis/additional_package_dep_spec_requirement.hh>
|
||||
#include <paludis/util/pimp.hh>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
/**
|
||||
@ -55,14 +53,65 @@ namespace paludis
|
||||
PackageDepSpec envless_parse_package_dep_spec_for_tests(
|
||||
const std::string &) PALUDIS_VISIBLE;
|
||||
|
||||
class PALUDIS_VISIBLE UserSlotExactRequirement :
|
||||
public SlotExactRequirement
|
||||
{
|
||||
private:
|
||||
const SlotName _s;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
UserSlotExactRequirement(const SlotName &);
|
||||
|
||||
///\}
|
||||
|
||||
virtual const SlotName slot() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
virtual const std::string as_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
/**
|
||||
* Split up a [.key=value] into its component parts.
|
||||
* A key requirement for a user PackageDepSpec.
|
||||
*
|
||||
* \since 0.36
|
||||
* \ingroup g_dep_spec
|
||||
* \since 0.61
|
||||
*/
|
||||
std::tuple<KeyRequirementKeyType, std::string, KeyRequirementOperation, std::string> parse_user_key_requirement(
|
||||
const std::string &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
class PALUDIS_VISIBLE UserKeyRequirement :
|
||||
public AdditionalPackageDepSpecRequirement
|
||||
{
|
||||
private:
|
||||
Pimp<UserKeyRequirement> _imp;
|
||||
|
||||
public:
|
||||
///\name Basic operations
|
||||
///\{
|
||||
|
||||
UserKeyRequirement(const std::string &);
|
||||
~UserKeyRequirement();
|
||||
|
||||
///\}
|
||||
|
||||
virtual const std::pair<bool, std::string> requirement_met(
|
||||
const Environment * const, const ChangedChoices *,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const ChangedChoices * const) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::string as_human_string(
|
||||
const std::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual const std::string as_raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
virtual Tribool accumulate_changes_to_make_met(
|
||||
const Environment * const,
|
||||
const ChangedChoices * const,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
const std::shared_ptr<const PackageID> &,
|
||||
ChangedChoices &) const PALUDIS_ATTRIBUTE((warn_unused_result));
|
||||
};
|
||||
|
||||
extern template class Pimp<UserKeyRequirement>;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -20,8 +20,7 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/match_package.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
|
||||
#include <paludis/util/clone-impl.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
@ -33,7 +32,6 @@
|
||||
#include <paludis/util/make_null_shared_ptr.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/join.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
|
||||
#include <paludis/environments/test/test_environment.hh>
|
||||
|
||||
@ -52,16 +50,6 @@ namespace
|
||||
return stringify(v.version_operator()) + stringify(v.version_spec());
|
||||
}
|
||||
|
||||
std::string stringify_key_requirement(const KeyRequirement & k)
|
||||
{
|
||||
return k.as_raw_string();
|
||||
}
|
||||
|
||||
std::string stringify_choice_requirement(const ChoiceRequirement & k)
|
||||
{
|
||||
return k.as_raw_string();
|
||||
}
|
||||
|
||||
class UserDepSpecTest :
|
||||
public testing::Test
|
||||
{
|
||||
@ -102,136 +90,90 @@ UserDepSpecTest::check_spec(
|
||||
{
|
||||
|
||||
if (package.empty())
|
||||
EXPECT_TRUE(! spec.package_name_requirement());
|
||||
EXPECT_TRUE(! spec.package_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.package_name_requirement()));
|
||||
EXPECT_EQ(package, stringify(spec.package_name_requirement()->name()));
|
||||
EXPECT_TRUE(bool(spec.package_ptr()));
|
||||
EXPECT_EQ(package, stringify(*spec.package_ptr()));
|
||||
}
|
||||
|
||||
if (category_name_part.empty())
|
||||
EXPECT_TRUE(! spec.category_name_part_requirement());
|
||||
EXPECT_TRUE(! spec.category_name_part_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.category_name_part_requirement()));
|
||||
EXPECT_EQ(category_name_part, stringify(spec.category_name_part_requirement()->name_part()));
|
||||
EXPECT_TRUE(bool(spec.category_name_part_ptr()));
|
||||
EXPECT_EQ(category_name_part, stringify(*spec.category_name_part_ptr()));
|
||||
}
|
||||
|
||||
if (package_name_part.empty())
|
||||
EXPECT_TRUE(! spec.package_name_part_requirement());
|
||||
EXPECT_TRUE(! spec.package_name_part_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.package_name_part_requirement()));
|
||||
EXPECT_EQ(package_name_part, stringify(spec.package_name_part_requirement()->name_part()));
|
||||
EXPECT_TRUE(bool(spec.package_name_part_ptr()));
|
||||
EXPECT_EQ(package_name_part, stringify(*spec.package_name_part_ptr()));
|
||||
}
|
||||
|
||||
if (! version_requirement_mode.empty())
|
||||
EXPECT_EQ(version_requirement_mode, stringify(spec.version_requirements_mode()));
|
||||
|
||||
if (version_requirements.empty())
|
||||
EXPECT_TRUE((! spec.version_requirements_ptr()) || spec.version_requirements_ptr()->empty());
|
||||
else
|
||||
{
|
||||
int n(0);
|
||||
for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
|
||||
v != v_end ; ++v)
|
||||
{
|
||||
auto v_ver(visitor_cast<const VersionRequirement>(**v));
|
||||
if (! v_ver)
|
||||
continue;
|
||||
++n;
|
||||
|
||||
if (1 != n)
|
||||
EXPECT_EQ(version_requirement_mode, stringify(v_ver->combiner()));
|
||||
}
|
||||
|
||||
EXPECT_GT(n, 0);
|
||||
}
|
||||
|
||||
{
|
||||
std::string v_str;
|
||||
|
||||
for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
|
||||
v != v_end ; ++v)
|
||||
{
|
||||
auto v_ver(visitor_cast<const VersionRequirement>(**v));
|
||||
if (! v_ver)
|
||||
continue;
|
||||
|
||||
if (! v_str.empty())
|
||||
v_str.append(", ");
|
||||
v_str.append(dump_version_requirement(*v_ver));
|
||||
}
|
||||
|
||||
if (version_requirements.empty())
|
||||
EXPECT_TRUE(v_str.empty());
|
||||
else
|
||||
EXPECT_EQ(version_requirements, v_str);
|
||||
EXPECT_TRUE(bool(spec.version_requirements_ptr()));
|
||||
EXPECT_EQ(version_requirements, stringify(join(
|
||||
spec.version_requirements_ptr()->begin(), spec.version_requirements_ptr()->end(), ", ", &dump_version_requirement)));
|
||||
}
|
||||
|
||||
if (slot_requirement.empty())
|
||||
EXPECT_TRUE(! spec.exact_slot_requirement());
|
||||
EXPECT_TRUE(! spec.slot_requirement_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.exact_slot_requirement()));
|
||||
EXPECT_EQ(slot_requirement, ":" + stringify(spec.exact_slot_requirement()->name()));
|
||||
EXPECT_TRUE(bool(spec.slot_requirement_ptr()));
|
||||
EXPECT_EQ(slot_requirement, stringify(*spec.slot_requirement_ptr()));
|
||||
}
|
||||
|
||||
if (from_repository.empty())
|
||||
EXPECT_TRUE(! spec.from_repository_requirement());
|
||||
EXPECT_TRUE(! spec.from_repository_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.from_repository_requirement()));
|
||||
EXPECT_EQ(from_repository, stringify(spec.from_repository_requirement()->name()));
|
||||
EXPECT_TRUE(bool(spec.from_repository_ptr()));
|
||||
EXPECT_EQ(from_repository, stringify(*spec.from_repository_ptr()));
|
||||
}
|
||||
|
||||
if (in_repository.empty())
|
||||
EXPECT_TRUE(! spec.in_repository_requirement());
|
||||
EXPECT_TRUE(! spec.in_repository_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.in_repository_requirement()));
|
||||
EXPECT_EQ(in_repository, stringify(spec.in_repository_requirement()->name()));
|
||||
EXPECT_TRUE(bool(spec.in_repository_ptr()));
|
||||
EXPECT_EQ(in_repository, stringify(*spec.in_repository_ptr()));
|
||||
}
|
||||
|
||||
if (additional_requirement.empty())
|
||||
EXPECT_TRUE((! spec.additional_requirements_ptr()) || spec.additional_requirements_ptr()->empty());
|
||||
else
|
||||
{
|
||||
std::string c_str;
|
||||
|
||||
for (auto v(spec.requirements()->begin()), v_end(spec.requirements()->end()) ;
|
||||
v != v_end ; ++v)
|
||||
{
|
||||
auto v_choice(visitor_cast<const ChoiceRequirement>(**v));
|
||||
if (v_choice)
|
||||
{
|
||||
if (! c_str.empty())
|
||||
c_str.append(", ");
|
||||
c_str.append(stringify_choice_requirement(*v_choice));
|
||||
}
|
||||
|
||||
auto v_key(visitor_cast<const KeyRequirement>(**v));
|
||||
if (v_key)
|
||||
{
|
||||
if (! c_str.empty())
|
||||
c_str.append(", ");
|
||||
c_str.append(stringify_key_requirement(*v_key));
|
||||
}
|
||||
}
|
||||
|
||||
if (additional_requirement.empty())
|
||||
EXPECT_TRUE(c_str.empty());
|
||||
else
|
||||
EXPECT_EQ(additional_requirement, c_str);
|
||||
EXPECT_TRUE(bool(spec.additional_requirements_ptr()));
|
||||
EXPECT_EQ(additional_requirement, stringify(join(
|
||||
indirect_iterator(spec.additional_requirements_ptr()->begin()),
|
||||
indirect_iterator(spec.additional_requirements_ptr()->end()), ", ")));
|
||||
}
|
||||
|
||||
if (installed_at_path.empty())
|
||||
EXPECT_TRUE(! spec.installed_at_path_requirement());
|
||||
EXPECT_TRUE(! spec.installed_at_path_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.installed_at_path_requirement()));
|
||||
EXPECT_EQ(installed_at_path, stringify(spec.installed_at_path_requirement()->path()));
|
||||
EXPECT_TRUE(bool(spec.installed_at_path_ptr()));
|
||||
EXPECT_EQ(installed_at_path, stringify(*spec.installed_at_path_ptr()));
|
||||
}
|
||||
|
||||
if (installable_to_path_f.empty())
|
||||
EXPECT_TRUE(! spec.installable_to_path_requirement());
|
||||
EXPECT_TRUE(! spec.installable_to_path_ptr());
|
||||
else
|
||||
{
|
||||
ASSERT_TRUE(bool(spec.installable_to_path_requirement()));
|
||||
EXPECT_EQ(installable_to_path_f, stringify(spec.installable_to_path_requirement()->path()));
|
||||
EXPECT_EQ(installable_to_path_s, spec.installable_to_path_requirement()->include_masked());
|
||||
EXPECT_TRUE(bool(spec.installable_to_path_ptr()));
|
||||
EXPECT_EQ(installable_to_path_f, stringify(spec.installable_to_path_ptr()->path()));
|
||||
EXPECT_EQ(installable_to_path_s, spec.installable_to_path_ptr()->include_masked());
|
||||
}
|
||||
|
||||
}
|
||||
@ -302,9 +244,6 @@ TEST_F(UserDepSpecTest, Parsing)
|
||||
|
||||
PackageDepSpec r(parse_user_package_dep_spec("foo/bar[.$short_description=value]", &env, { }));
|
||||
check_spec(r, "foo/bar", "", "", "", "", "", "", "", "[.$short_description=value]");
|
||||
|
||||
PackageDepSpec s(parse_user_package_dep_spec("=foo/bar-1-r0", &env, { }));
|
||||
check_spec(s, "foo/bar", "", "", "=1-r0", "", "", "", "", "");
|
||||
}
|
||||
|
||||
TEST_F(UserDepSpecTest, Unspecified)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007, 2010, 2011 Ciaran McCreesh
|
||||
* Copyright (c) 2005, 2006, 2007, 2010 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
|
||||
@ -119,11 +119,6 @@ namespace paludis
|
||||
return _v == other._v;
|
||||
}
|
||||
|
||||
std::size_t hash() const
|
||||
{
|
||||
return static_cast<std::size_t>(_v);
|
||||
}
|
||||
|
||||
///\}
|
||||
};
|
||||
|
||||
|
71
paludis/version_requirements-fwd.hh
Normal file
71
paludis/version_requirements-fwd.hh
Normal file
@ -0,0 +1,71 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 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
|
||||
* 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_VERSION_REQUIREMENTS_FWD_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_VERSION_REQUIREMENTS_FWD_HH 1
|
||||
|
||||
#include <paludis/util/sequence-fwd.hh>
|
||||
#include <paludis/util/attributes.hh>
|
||||
#include <paludis/version_spec-fwd.hh>
|
||||
#include <memory>
|
||||
#include <iosfwd>
|
||||
|
||||
/** \file
|
||||
* Forward declarations for paludis/version_requirements.hh .
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
class VersionRequirement;
|
||||
|
||||
/**
|
||||
* A collection of VersionRequirement instances, usually for a
|
||||
* PackageDepSpec.
|
||||
*
|
||||
* \see PackageDepSpec
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
typedef Sequence<VersionRequirement> VersionRequirements;
|
||||
|
||||
/**
|
||||
* Whether our version requirements are an 'and' or an 'or' set.
|
||||
*
|
||||
* \see PackageDepSpec
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
enum VersionRequirementsMode
|
||||
{
|
||||
vr_or, ///\< Must match one
|
||||
vr_and, ///\< Must match all
|
||||
last_vr
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a VersionRequirementsMode to a stream.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
*/
|
||||
std::ostream &
|
||||
operator<< (std::ostream &, const VersionRequirementsMode &) PALUDIS_VISIBLE;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
58
paludis/version_requirements.cc
Normal file
58
paludis/version_requirements.cc
Normal file
@ -0,0 +1,58 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 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
|
||||
* 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/version_requirements.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
#include <paludis/util/sequence.hh>
|
||||
#include <paludis/util/sequence-impl.hh>
|
||||
#include <paludis/util/wrapped_forward_iterator-impl.hh>
|
||||
#include <paludis/util/wrapped_output_iterator-impl.hh>
|
||||
#include <paludis/util/make_named_values.hh>
|
||||
|
||||
using namespace paludis;
|
||||
|
||||
template class Sequence<VersionRequirement>;
|
||||
template class WrappedForwardIterator<Sequence<VersionRequirement>::ConstIteratorTag, const VersionRequirement>;
|
||||
template class WrappedOutputIterator<Sequence<VersionRequirement>::InserterTag, VersionRequirement>;
|
||||
|
||||
std::ostream &
|
||||
paludis::operator<< (std::ostream & o, const VersionRequirementsMode & s)
|
||||
{
|
||||
do
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case vr_and:
|
||||
o << "and";
|
||||
continue;
|
||||
|
||||
case vr_or:
|
||||
o << "or";
|
||||
continue;
|
||||
|
||||
case last_vr:
|
||||
;
|
||||
}
|
||||
|
||||
throw InternalError(PALUDIS_HERE, "Bad VersionRequirementsMode");
|
||||
} while (false);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
64
paludis/version_requirements.hh
Normal file
64
paludis/version_requirements.hh
Normal file
@ -0,0 +1,64 @@
|
||||
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007, 2008, 2010 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_VERSION_REQUIREMENTS_HH
|
||||
#define PALUDIS_GUARD_PALUDIS_VERSION_REQUIREMENTS_HH 1
|
||||
|
||||
#include <paludis/version_requirements-fwd.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/util/named_value.hh>
|
||||
|
||||
/** \file
|
||||
* Declarations for version requirements classes.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
*
|
||||
* \section Examples
|
||||
*
|
||||
* - \ref example_dep_spec.cc "example_dep_spec.cc" (for specifications)
|
||||
*/
|
||||
|
||||
namespace paludis
|
||||
{
|
||||
namespace n
|
||||
{
|
||||
typedef Name<struct name_version_operator> version_operator;
|
||||
typedef Name<struct name_version_spec> version_spec;
|
||||
}
|
||||
|
||||
/**
|
||||
* A requirement for a version, consisting of a VersionOperator and an associated
|
||||
* VersionSpec.
|
||||
*
|
||||
* \ingroup g_dep_spec
|
||||
* \see PackageDepSpec
|
||||
* \see VersionSpec
|
||||
* \see VersionOperator
|
||||
* \see VersionRequirements
|
||||
* \nosubgrouping
|
||||
*/
|
||||
struct VersionRequirement
|
||||
{
|
||||
NamedValue<n::version_operator, VersionOperator> version_operator;
|
||||
NamedValue<n::version_spec, VersionSpec> version_spec;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -42,6 +42,7 @@ IF_PYTHON_TESTS = \
|
||||
repository_TEST.py \
|
||||
selection_TEST.py \
|
||||
version_operator_TEST.py \
|
||||
version_requirements_TEST.py \
|
||||
version_spec_TEST.py
|
||||
|
||||
IF_PYTHON_SOURCES = \
|
||||
@ -69,10 +70,10 @@ IF_PYTHON_SOURCES = \
|
||||
nice_names-nn.hh nice_names-nn.cc \
|
||||
log.cc \
|
||||
package_id.cc \
|
||||
package_dep_spec_constraint.cc \
|
||||
repository.cc \
|
||||
selection.cc \
|
||||
version_operator.cc \
|
||||
version_requirements.cc \
|
||||
version_spec.cc
|
||||
|
||||
BUILT_SOURCES = \
|
||||
|
@ -26,10 +26,9 @@
|
||||
#include <paludis/dep_spec.hh>
|
||||
#include <paludis/environment.hh>
|
||||
#include <paludis/user_dep_spec.hh>
|
||||
#include <paludis/version_requirements.hh>
|
||||
#include <paludis/partially_made_package_dep_spec.hh>
|
||||
#include <paludis/dep_spec_data.hh>
|
||||
#include <paludis/package_dep_spec_requirement.hh>
|
||||
#include <paludis/version_spec.hh>
|
||||
#include <paludis/version_operator.hh>
|
||||
|
||||
#include <paludis/util/save.hh>
|
||||
#include <paludis/util/stringify.hh>
|
||||
@ -40,7 +39,6 @@
|
||||
#include <paludis/util/sequence-impl.hh>
|
||||
#include <paludis/util/indirect_iterator-impl.hh>
|
||||
#include <paludis/util/accept_visitor.hh>
|
||||
#include <paludis/util/visitor_cast.hh>
|
||||
|
||||
#include <type_traits>
|
||||
#include <list>
|
||||
@ -74,40 +72,37 @@ namespace paludis
|
||||
template<>
|
||||
struct Imp<PythonPackageDepSpec>
|
||||
{
|
||||
std::shared_ptr<const NameRequirement> package_name_requirement;
|
||||
std::shared_ptr<const CategoryNamePartRequirement> category_name_part_requirement;
|
||||
std::shared_ptr<const PackageNamePartRequirement> package_name_part_requirement;
|
||||
std::shared_ptr<const VersionRequirementSequence> all_versions;
|
||||
std::shared_ptr<const AnySlotRequirement> any_slot;
|
||||
std::shared_ptr<const ExactSlotRequirement> exact_slot;
|
||||
std::shared_ptr<const InRepositoryRequirement> in_repository;
|
||||
std::shared_ptr<const FromRepositoryRequirement> from_repository;
|
||||
std::shared_ptr<const KeyRequirementSequence> all_keys;
|
||||
std::shared_ptr<const ChoiceRequirementSequence> all_choices;
|
||||
std::shared_ptr<const QualifiedPackageName> package_ptr;
|
||||
std::shared_ptr<const CategoryNamePart> category_name_part_ptr;
|
||||
std::shared_ptr<const PackageNamePart> package_name_part_ptr;
|
||||
std::shared_ptr<VersionRequirements> version_requirements;
|
||||
VersionRequirementsMode version_requirements_mode;
|
||||
std::shared_ptr<const SlotRequirement> slot;
|
||||
std::shared_ptr<const RepositoryName> in_repository;
|
||||
std::shared_ptr<const RepositoryName> from_repository;
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements;
|
||||
const std::string str;
|
||||
|
||||
Imp(
|
||||
const std::shared_ptr<const NameRequirement> & q,
|
||||
const std::shared_ptr<const CategoryNamePartRequirement> & c,
|
||||
const std::shared_ptr<const PackageNamePartRequirement> & p,
|
||||
const std::shared_ptr<const VersionRequirementSequence> & v,
|
||||
const std::shared_ptr<const AnySlotRequirement> & s,
|
||||
const std::shared_ptr<const ExactSlotRequirement> & xs,
|
||||
const std::shared_ptr<const InRepositoryRequirement> & ri,
|
||||
const std::shared_ptr<const FromRepositoryRequirement> & rf,
|
||||
const std::shared_ptr<const KeyRequirementSequence> & k,
|
||||
const std::shared_ptr<const ChoiceRequirementSequence> & a,
|
||||
const std::shared_ptr<const QualifiedPackageName> & q,
|
||||
const std::shared_ptr<const CategoryNamePart> & c,
|
||||
const std::shared_ptr<const PackageNamePart> & p,
|
||||
const std::shared_ptr<VersionRequirements> & v,
|
||||
const VersionRequirementsMode m,
|
||||
const std::shared_ptr<const SlotRequirement> & s,
|
||||
const std::shared_ptr<const RepositoryName> & ri,
|
||||
const std::shared_ptr<const RepositoryName> & rf,
|
||||
const std::shared_ptr<const AdditionalPackageDepSpecRequirements> & u,
|
||||
const std::string & st) :
|
||||
package_name_requirement(q),
|
||||
category_name_part_requirement(c),
|
||||
package_name_part_requirement(p),
|
||||
all_versions(v),
|
||||
any_slot(s),
|
||||
exact_slot(xs),
|
||||
package_ptr(q),
|
||||
category_name_part_ptr(c),
|
||||
package_name_part_ptr(p),
|
||||
version_requirements(v),
|
||||
version_requirements_mode(m),
|
||||
slot(s),
|
||||
in_repository(ri),
|
||||
from_repository(rf),
|
||||
all_keys(k),
|
||||
all_choices(a),
|
||||
additional_requirements(u),
|
||||
str(st)
|
||||
{
|
||||
}
|
||||
@ -224,58 +219,43 @@ deep_copy(const std::shared_ptr<const T_> & x)
|
||||
return std::shared_ptr<T_>();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T_>
|
||||
std::shared_ptr<Sequence<std::shared_ptr<const T_> > > get_requirements(const std::shared_ptr<const PackageDepSpecRequirementSequence> & s)
|
||||
{
|
||||
auto result(std::make_shared<Sequence<std::shared_ptr<const T_> > >());
|
||||
for (auto i(s->begin()), i_end(s->end()) ;
|
||||
i != i_end ; ++i)
|
||||
{
|
||||
auto v(visitor_cast<const T_>(**i));
|
||||
if (! v)
|
||||
continue;
|
||||
|
||||
result->push_back(std::static_pointer_cast<const T_>(*i));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
PythonPackageDepSpec::PythonPackageDepSpec(const PackageDepSpec & p) :
|
||||
PythonStringDepSpec(p.text()),
|
||||
_imp(
|
||||
p.package_name_requirement(),
|
||||
p.category_name_part_requirement(),
|
||||
p.package_name_part_requirement(),
|
||||
get_requirements<VersionRequirement>(p.requirements()),
|
||||
p.any_slot_requirement(),
|
||||
p.exact_slot_requirement(),
|
||||
p.in_repository_requirement(),
|
||||
p.from_repository_requirement(),
|
||||
get_requirements<KeyRequirement>(p.requirements()),
|
||||
get_requirements<ChoiceRequirement>(p.requirements()),
|
||||
deep_copy(p.package_ptr()),
|
||||
deep_copy(p.category_name_part_ptr()),
|
||||
deep_copy(p.package_name_part_ptr()),
|
||||
std::make_shared<VersionRequirements>(),
|
||||
p.version_requirements_mode(),
|
||||
p.slot_requirement_ptr(),
|
||||
deep_copy(p.in_repository_ptr()),
|
||||
deep_copy(p.from_repository_ptr()),
|
||||
p.additional_requirements_ptr(),
|
||||
stringify(p))
|
||||
{
|
||||
if (p.version_requirements_ptr())
|
||||
{
|
||||
std::copy(p.version_requirements_ptr()->begin(), p.version_requirements_ptr()->end(),
|
||||
_imp->version_requirements->back_inserter());
|
||||
}
|
||||
}
|
||||
|
||||
PythonPackageDepSpec::PythonPackageDepSpec(const PythonPackageDepSpec & p) :
|
||||
PythonStringDepSpec(p.text()),
|
||||
_imp(
|
||||
p.package_name_requirement(),
|
||||
p.category_name_part_requirement(),
|
||||
p.package_name_part_requirement(),
|
||||
p.all_version_requirements(),
|
||||
p.any_slot_requirement(),
|
||||
p.exact_slot_requirement(),
|
||||
p.in_repository_requirement(),
|
||||
p.from_repository_requirement(),
|
||||
p.all_key_requirements(),
|
||||
p.all_choice_requirements(),
|
||||
deep_copy(p.package_ptr()),
|
||||
deep_copy(p.category_name_part_ptr()),
|
||||
deep_copy(p.package_name_part_ptr()),
|
||||
std::make_shared<VersionRequirements>(),
|
||||
p.version_requirements_mode(),
|
||||
p.slot_requirement_ptr(),
|
||||
deep_copy(p.in_repository_ptr()),
|
||||
deep_copy(p.from_repository_ptr()),
|
||||
p.additional_requirements_ptr(),
|
||||
p.py_str())
|
||||
{
|
||||
std::copy(p.version_requirements_ptr()->begin(), p.version_requirements_ptr()->end(),
|
||||
_imp->version_requirements->back_inserter());
|
||||
}
|
||||
|
||||
PythonPackageDepSpec::~PythonPackageDepSpec()
|
||||
@ -284,51 +264,43 @@ PythonPackageDepSpec::~PythonPackageDepSpec()
|
||||
|
||||
PythonPackageDepSpec::operator PackageDepSpec() const
|
||||
{
|
||||
MutablePackageDepSpecData p({ });
|
||||
PartiallyMadePackageDepSpec p((PartiallyMadePackageDepSpecOptions()));
|
||||
|
||||
if (package_name_requirement())
|
||||
p.require_package(package_name_requirement()->name());
|
||||
if (package_ptr())
|
||||
p.package(*package_ptr());
|
||||
|
||||
if (category_name_part_requirement())
|
||||
p.require_category_name_part(category_name_part_requirement()->name_part());
|
||||
if (category_name_part_ptr())
|
||||
p.category_name_part(*category_name_part_ptr());
|
||||
|
||||
if (package_name_part_requirement())
|
||||
p.require_package_name_part(package_name_part_requirement()->name_part());
|
||||
if (package_name_part_ptr())
|
||||
p.package_name_part(*package_name_part_ptr());
|
||||
|
||||
if (all_version_requirements())
|
||||
p.version_requirements_mode(version_requirements_mode());
|
||||
|
||||
if (slot_requirement_ptr())
|
||||
p.slot_requirement(slot_requirement_ptr());
|
||||
|
||||
if (in_repository_ptr())
|
||||
p.in_repository(*in_repository_ptr());
|
||||
|
||||
if (from_repository_ptr())
|
||||
p.from_repository(*from_repository_ptr());
|
||||
|
||||
if (additional_requirements_ptr())
|
||||
{
|
||||
for (auto i(all_version_requirements()->begin()), i_end(all_version_requirements()->end()) ;
|
||||
i != i_end ; ++i)
|
||||
p.require_version((*i)->combiner(), (*i)->version_operator(), (*i)->version_spec());
|
||||
for (AdditionalPackageDepSpecRequirements::ConstIterator i(additional_requirements_ptr()->begin()),
|
||||
i_end(additional_requirements_ptr()->end()) ; i != i_end ; ++i)
|
||||
p.additional_requirement(*i);
|
||||
}
|
||||
|
||||
if (any_slot_requirement())
|
||||
p.require_any_slot(any_slot_requirement()->locking());
|
||||
|
||||
if (exact_slot_requirement())
|
||||
p.require_exact_slot(exact_slot_requirement()->name(), exact_slot_requirement()->locked());
|
||||
|
||||
if (in_repository_requirement())
|
||||
p.require_in_repository(in_repository_requirement()->name());
|
||||
|
||||
if (from_repository_requirement())
|
||||
p.require_from_repository(from_repository_requirement()->name());
|
||||
|
||||
if (all_choice_requirements())
|
||||
if (version_requirements_ptr())
|
||||
{
|
||||
for (ChoiceRequirementSequence::ConstIterator i(all_choice_requirements()->begin()),
|
||||
i_end(all_choice_requirements()->end()) ; i != i_end ; ++i)
|
||||
p.require_choice(*i);
|
||||
for (VersionRequirements::ConstIterator i(version_requirements_ptr()->begin()),
|
||||
i_end(version_requirements_ptr()->end()) ; i != i_end ; ++i)
|
||||
p.version_requirement(*i);
|
||||
}
|
||||
|
||||
if (all_key_requirements())
|
||||
{
|
||||
for (auto i(all_key_requirements()->begin()), i_end(all_key_requirements()->end()) ;
|
||||
i != i_end ; ++i)
|
||||
p.require_key((*i)->key_type(), (*i)->key(), (*i)->operation(), (*i)->pattern());
|
||||
}
|
||||
|
||||
return PackageDepSpec(p);
|
||||
return p.to_package_dep_spec();
|
||||
}
|
||||
|
||||
|
||||
@ -337,64 +309,64 @@ PythonPackageDepSpec::operator std::shared_ptr<PackageDepSpec>() const
|
||||
return std::make_shared<PackageDepSpec>(*this);
|
||||
}
|
||||
|
||||
const std::shared_ptr<const NameRequirement>
|
||||
PythonPackageDepSpec::package_name_requirement() const
|
||||
std::shared_ptr<const QualifiedPackageName>
|
||||
PythonPackageDepSpec::package_ptr() const
|
||||
{
|
||||
return _imp->package_name_requirement;
|
||||
return _imp->package_ptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const PackageNamePartRequirement>
|
||||
PythonPackageDepSpec::package_name_part_requirement() const
|
||||
std::shared_ptr<const PackageNamePart>
|
||||
PythonPackageDepSpec::package_name_part_ptr() const
|
||||
{
|
||||
return _imp->package_name_part_requirement;
|
||||
return _imp->package_name_part_ptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const CategoryNamePartRequirement>
|
||||
PythonPackageDepSpec::category_name_part_requirement() const
|
||||
std::shared_ptr<const CategoryNamePart>
|
||||
PythonPackageDepSpec::category_name_part_ptr() const
|
||||
{
|
||||
return _imp->category_name_part_requirement;
|
||||
return _imp->category_name_part_ptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const VersionRequirementSequence>
|
||||
PythonPackageDepSpec::all_version_requirements() const
|
||||
std::shared_ptr<const VersionRequirements>
|
||||
PythonPackageDepSpec::version_requirements_ptr() const
|
||||
{
|
||||
return _imp->all_versions;
|
||||
return _imp->version_requirements;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const AnySlotRequirement>
|
||||
PythonPackageDepSpec::any_slot_requirement() const
|
||||
VersionRequirementsMode
|
||||
PythonPackageDepSpec::version_requirements_mode() const
|
||||
{
|
||||
return _imp->any_slot;
|
||||
return _imp->version_requirements_mode;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const ExactSlotRequirement>
|
||||
PythonPackageDepSpec::exact_slot_requirement() const
|
||||
void
|
||||
PythonPackageDepSpec::set_version_requirements_mode(const VersionRequirementsMode m)
|
||||
{
|
||||
return _imp->exact_slot;
|
||||
_imp->version_requirements_mode = m;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const InRepositoryRequirement>
|
||||
PythonPackageDepSpec::in_repository_requirement() const
|
||||
std::shared_ptr<const SlotRequirement>
|
||||
PythonPackageDepSpec::slot_requirement_ptr() const
|
||||
{
|
||||
return _imp->slot;
|
||||
}
|
||||
|
||||
std::shared_ptr<const RepositoryName>
|
||||
PythonPackageDepSpec::in_repository_ptr() const
|
||||
{
|
||||
return _imp->in_repository;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const FromRepositoryRequirement>
|
||||
PythonPackageDepSpec::from_repository_requirement() const
|
||||
std::shared_ptr<const RepositoryName>
|
||||
PythonPackageDepSpec::from_repository_ptr() const
|
||||
{
|
||||
return _imp->from_repository;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const ChoiceRequirementSequence>
|
||||
PythonPackageDepSpec::all_choice_requirements() const
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirements>
|
||||
PythonPackageDepSpec::additional_requirements_ptr() const
|
||||
{
|
||||
return _imp->all_choices;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const KeyRequirementSequence>
|
||||
PythonPackageDepSpec::all_key_requirements() const
|
||||
{
|
||||
return _imp->all_keys;
|
||||
return _imp->additional_requirements;
|
||||
}
|
||||
|
||||
std::string
|
||||
@ -1228,40 +1200,47 @@ void expose_dep_spec()
|
||||
bp::no_init
|
||||
)
|
||||
|
||||
.add_property("package_name_requirement", &PythonPackageDepSpec::package_name_requirement,
|
||||
"[ro] NameRequirement\n"
|
||||
"Qualified package name requirement (may be None)."
|
||||
.add_property("package", &PythonPackageDepSpec::package_ptr,
|
||||
"[ro] QualifiedPackageName\n"
|
||||
"Qualified package name."
|
||||
)
|
||||
|
||||
.add_property("package_name_part_requirement", &PythonPackageDepSpec::package_name_part_requirement,
|
||||
"[ro] CategoryNamePartRequirement\n"
|
||||
"Package name part requirement (may be None)"
|
||||
.add_property("package_name_part", &PythonPackageDepSpec::package_name_part_ptr,
|
||||
"[ro] PackageNamePart\n"
|
||||
"Package name part (may be None)"
|
||||
)
|
||||
|
||||
.add_property("category_name_part_requirement", &PythonPackageDepSpec::category_name_part_requirement,
|
||||
"[ro] CategoryNamePartRequirement\n"
|
||||
"Category name part requirement (may be None)."
|
||||
.add_property("category_name_part", &PythonPackageDepSpec::category_name_part_ptr,
|
||||
"[ro] CategoryNamePart\n"
|
||||
"Category name part (may be None)."
|
||||
)
|
||||
|
||||
.add_property("exact_slot", &PythonPackageDepSpec::exact_slot_requirement,
|
||||
"[ro] ExactSlotRequirement\n"
|
||||
"Exact slot requirement (may be None)."
|
||||
.add_property("version_requirements", &PythonPackageDepSpec::version_requirements_ptr,
|
||||
"[ro] VersionRequirements\n"
|
||||
"Version requirements (may be None)."
|
||||
)
|
||||
|
||||
.add_property("any_slot", &PythonPackageDepSpec::any_slot_requirement,
|
||||
"[ro] AnySlotRequirement\n"
|
||||
"Any slot requirement (may be None)."
|
||||
.add_property("version_requirements_mode", &PythonPackageDepSpec::version_requirements_mode,
|
||||
"[ro] VersionRequirementsMode\n"
|
||||
"Version requirements mode."
|
||||
)
|
||||
|
||||
.add_property("in_repository_requirement", &PythonPackageDepSpec::in_repository_requirement,
|
||||
"[ro] InRepositoryRequirement\n"
|
||||
"In repository requirement (may be None)."
|
||||
#if 0
|
||||
.add_property("slot", &PythonPackageDepSpec::slot_ptr,
|
||||
"[ro] SlotName\n"
|
||||
"Slot name (may be None)."
|
||||
)
|
||||
#endif
|
||||
|
||||
.add_property("in_repository", &PythonPackageDepSpec::in_repository_ptr,
|
||||
"[ro] RepositoryName\n"
|
||||
"In repository name (may be None)."
|
||||
|
||||
)
|
||||
|
||||
.add_property("from_repository_requirement", &PythonPackageDepSpec::from_repository_requirement,
|
||||
"[ro] FromRepositoryRequirement\n"
|
||||
"From repository requirement (may be None)."
|
||||
.add_property("from_repository", &PythonPackageDepSpec::from_repository_ptr,
|
||||
"[ro] RepositoryName\n"
|
||||
"From repository name (may be None)."
|
||||
)
|
||||
|
||||
#if 0
|
||||
|
@ -172,16 +172,16 @@ namespace paludis
|
||||
operator PackageDepSpec() const;
|
||||
operator std::shared_ptr<PackageDepSpec>() const;
|
||||
|
||||
const std::shared_ptr<const NameRequirement> package_name_requirement() const;
|
||||
const std::shared_ptr<const PackageNamePartRequirement> package_name_part_requirement() const;
|
||||
const std::shared_ptr<const CategoryNamePartRequirement> category_name_part_requirement() const;
|
||||
const std::shared_ptr<const VersionRequirementSequence> all_version_requirements() const;
|
||||
const std::shared_ptr<const InRepositoryRequirement> in_repository_requirement() const;
|
||||
const std::shared_ptr<const FromRepositoryRequirement> from_repository_requirement() const;
|
||||
const std::shared_ptr<const ExactSlotRequirement> exact_slot_requirement() const;
|
||||
const std::shared_ptr<const AnySlotRequirement> any_slot_requirement() const;
|
||||
const std::shared_ptr<const KeyRequirementSequence> all_key_requirements() const;
|
||||
const std::shared_ptr<const ChoiceRequirementSequence> all_choice_requirements() const;
|
||||
std::shared_ptr<const QualifiedPackageName> package_ptr() const;
|
||||
std::shared_ptr<const PackageNamePart> package_name_part_ptr() const;
|
||||
std::shared_ptr<const CategoryNamePart> category_name_part_ptr() const;
|
||||
std::shared_ptr<const VersionRequirements> version_requirements_ptr() const;
|
||||
VersionRequirementsMode version_requirements_mode() const;
|
||||
void set_version_requirements_mode(const VersionRequirementsMode m);
|
||||
std::shared_ptr<const SlotRequirement> slot_requirement_ptr() const;
|
||||
std::shared_ptr<const RepositoryName> in_repository_ptr() const;
|
||||
std::shared_ptr<const RepositoryName> from_repository_ptr() const;
|
||||
std::shared_ptr<const AdditionalPackageDepSpecRequirements> additional_requirements_ptr() const;
|
||||
|
||||
std::string py_str() const;
|
||||
};
|
||||
|
@ -64,12 +64,24 @@ class TestCase_1_DepSpecs(unittest.TestCase):
|
||||
|
||||
def test_05_package(self):
|
||||
self.get_depspecs()
|
||||
self.assertEqual(str(self.pds.package_name_requirement.name), "foo/bar")
|
||||
self.assertEqual(str(self.pds.package), "foo/bar")
|
||||
|
||||
def test_06_in_from_repository(self):
|
||||
self.get_depspecs()
|
||||
self.assertEqual(str(self.pds.in_repository_requirement.name), "testrepo")
|
||||
self.assertEqual(self.pds.from_repository_requirement, None)
|
||||
self.assertEqual(str(self.pds.in_repository), "testrepo")
|
||||
self.assertEqual(self.pds.from_repository, None)
|
||||
|
||||
def test_07_version_requirements(self):
|
||||
self.get_depspecs()
|
||||
vrc = self.pds.version_requirements
|
||||
|
||||
self.assertEquals(len(list(vrc)), 1)
|
||||
self.assertEquals(iter(vrc).next().version_spec, VersionSpec("1"))
|
||||
self.assertEquals(iter(vrc).next().version_operator.value, VersionOperator(">=").value)
|
||||
|
||||
def test_08_version_requirements_mode(self):
|
||||
self.get_depspecs()
|
||||
self.assertEquals(self.pds.version_requirements_mode, VersionRequirementsMode.AND)
|
||||
|
||||
### def test_09_additional_requirements(self):
|
||||
### spec = parse_user_package_dep_spec("foo/monkey[foo]", UserPackageDepSpecOptions())
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user