aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-15 23:45:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-15 23:45:57 +0000
commitcae890cf10b6336d9439a298ac103f458f301a6b (patch)
tree860b69232ae5212a0b6f9930ff87cc84e9d7bc86
parentb1ee21df5734924cefee340ab39c4e52490a4758 (diff)
downloadpaludis-cae890cf10b6336d9439a298ac103f458f301a6b.tar.gz
paludis-cae890cf10b6336d9439a298ac103f458f301a6b.tar.xz
Add ::repo dep support
-rw-r--r--paludis/dep_atom.cc15
-rw-r--r--paludis/dep_atom.hh10
-rw-r--r--paludis/match_package.cc9
-rw-r--r--src/query.cc2
4 files changed, 33 insertions, 3 deletions
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index 5de2097..f1b1f2d 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -76,7 +76,8 @@ PackageDepAtom::PackageDepAtom(const QualifiedPackageName & package) :
_package(package),
_version_operator("="),
_version_spec(0),
- _slot(0)
+ _slot(0),
+ _repository(0)
{
}
@@ -85,7 +86,8 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
_package(CategoryNamePart("later"), PackageNamePart("later")),
_version_operator("="),
_version_spec(0),
- _slot(0)
+ _slot(0),
+ _repository(0)
{
Context context("When parsing package dep atom '" + ss + "':");
@@ -96,6 +98,13 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
if (s.empty())
throw PackageDepAtomError("Got empty dep atom");
+ std::string::size_type repo_p;
+ if (std::string::npos != ((repo_p = s.rfind("::"))))
+ {
+ _repository.assign(new RepositoryName(s.substr(repo_p + 2)));
+ s.erase(repo_p);
+ }
+
std::string::size_type slot_p;
if (std::string::npos != ((slot_p = s.rfind(':'))))
{
@@ -190,6 +199,8 @@ paludis::operator<< (std::ostream & s, const PackageDepAtom & a)
if (a.slot_ptr())
s << ":" << *a.slot_ptr();
+ if (a.repository_ptr())
+ s << "::" << *a.repository_ptr();
return s;
}
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index bd3db6f..77840c0 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -234,6 +234,7 @@ namespace paludis
VersionOperator _version_operator;
CountedPtr<VersionSpec, count_policy::ExternalCountTag> _version_spec;
CountedPtr<SlotName, count_policy::ExternalCountTag> _slot;
+ CountedPtr<RepositoryName, count_policy::ExternalCountTag> _repository;
std::string _tag;
public:
@@ -284,6 +285,15 @@ namespace paludis
return _slot;
}
+ /**
+ * Fetch the repo name (may be a zero pointer).
+ */
+ CountedPtr<RepositoryName, count_policy::ExternalCountTag> repository_ptr() const
+ {
+ return _repository;
+ }
+
+
typedef CountedPtr<PackageDepAtom, count_policy::InternalCountTag> Pointer;
typedef CountedPtr<const PackageDepAtom, count_policy::InternalCountTag> ConstPointer;
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 30fcadb..78d31a8 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -18,6 +18,10 @@ match_package_internals::do_match(
(*atom->version_spec_ptr())))
return false;
+ if (atom->repository_ptr())
+ if (*atom->repository_ptr() != entry->get<pde_repository>())
+ return false;
+
if (atom->slot_ptr())
{
VersionMetadata::ConstPointer metadata(db->fetch_metadata(*entry));
@@ -42,9 +46,12 @@ match_package_internals::do_match(
(*atom->version_spec_ptr())))
return false;
+ if (atom->repository_ptr() && (*atom->repository_ptr() != entry->get<dle_repository>()))
+ return false;
+
if (atom->slot_ptr() && (atom->slot_ptr()->data() != entry->get<dle_metadata>()->get(vmk_slot)))
return false;
return true;
-
}
+
diff --git a/src/query.cc b/src/query.cc
index 83db604..6acdef9 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -58,6 +58,8 @@ void do_one_query(
cout << " (" << atom->version_operator() << *atom->version_spec_ptr() << ")";
if (atom->slot_ptr())
cout << " (:" << *atom->slot_ptr() << ")";
+ if (atom->repository_ptr())
+ cout << " (::" << *atom->repository_ptr() << ")";
cout << endl;
/* find all repository names. */