aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-21 15:57:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-21 15:57:24 +0000
commit329a205da526486f7edbf367bfef38d9cfd71e5a (patch)
treef9b8cbaef310087a0db7f35e8ae4a9e44db682cf
parent7461853e51afe298b2c2fcb85bc2882079fd11b7 (diff)
downloadpaludis-329a205da526486f7edbf367bfef38d9cfd71e5a.tar.gz
paludis-329a205da526486f7edbf367bfef38d9cfd71e5a.tar.xz
Add profile package.mask support
-rw-r--r--paludis/repositories/portage/portage_repository.cc7
-rw-r--r--paludis/repositories/portage/portage_repository_profile.cc47
-rw-r--r--paludis/repositories/portage/portage_repository_profile.hh8
3 files changed, 59 insertions, 3 deletions
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 26511fc..b3856c3 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -755,10 +755,11 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
}
bool
-PortageRepository::do_query_profile_masks(const QualifiedPackageName &,
- const VersionSpec &) const
+PortageRepository::do_query_profile_masks(const QualifiedPackageName & n,
+ const VersionSpec & v) const
{
- return false;
+ _imp->need_profiles();
+ return _imp->profile_ptr->profile_masked(n, v, name());
}
UseFlagState
diff --git a/paludis/repositories/portage/portage_repository_profile.cc b/paludis/repositories/portage/portage_repository_profile.cc
index 2960cbc..746549f 100644
--- a/paludis/repositories/portage/portage_repository_profile.cc
+++ b/paludis/repositories/portage/portage_repository_profile.cc
@@ -61,6 +61,7 @@ namespace paludis
typedef MakeHashedMap<QualifiedPackageName,
std::list<std::pair<PackageDepAtom::ConstPointer, UseFlagName> > >::Type PackageUseMaskMap;
typedef MakeHashedMap<QualifiedPackageName, PackageDepAtom::ConstPointer>::Type VirtualsMap;
+ typedef MakeHashedMap<QualifiedPackageName, std::list<PackageDepAtom::ConstPointer> >::Type PackageMaskMap;
///\}
@@ -74,6 +75,7 @@ namespace paludis
const std::string & mask_or_force, PackageUseMaskMap & set);
void load_profile_packages(const FSEntry & dir);
void load_profile_virtuals(const FSEntry & dir);
+ void load_profile_package_mask(const FSEntry & dir);
void add_use_expand_to_use();
void load_system_packages();
@@ -124,6 +126,13 @@ namespace paludis
///\}
+ ///\name Masks
+ ///\{
+
+ PackageMaskMap package_mask;
+
+ ///\}
+
///\name Queries
///\{
@@ -178,6 +187,7 @@ Implementation<PortageRepositoryProfile>::load_profile_directory_recursively(con
load_profile_package_use_mask_or_force(dir, "force", package_use_force);
load_profile_packages(dir);
load_profile_virtuals(dir);
+ load_profile_package_mask(dir);
}
void
@@ -393,6 +403,23 @@ Implementation<PortageRepositoryProfile>::load_profile_virtuals(const FSEntry &
}
}
+void
+Implementation<PortageRepositoryProfile>::load_profile_package_mask(const FSEntry & dir)
+{
+ Context context("When loading package.mask file in '" + stringify(dir) + "':");
+
+ if (! (dir / "package.mask").exists())
+ return;
+
+ LineConfigFile file(dir / "package.mask");
+ for (LineConfigFile::Iterator line(file.begin()), line_end(file.end()) ;
+ line != line_end ; ++line)
+ {
+ PackageDepAtom::ConstPointer a(new PackageDepAtom(*line));
+ package_mask[a->package()].push_back(a);
+ }
+}
+
bool
Implementation<PortageRepositoryProfile>::use_mask_or_force(
const UseFlagName & u, const PackageDatabaseEntry * const e, const std::string & mask_or_force,
@@ -583,3 +610,23 @@ PortageRepositoryProfile::end_virtuals() const
return VirtualsIterator(_imp->virtuals.end());
}
+bool
+PortageRepositoryProfile::profile_masked(const QualifiedPackageName & n,
+ const VersionSpec & v, const RepositoryName & r) const
+{
+ Implementation<PortageRepositoryProfile>::PackageMaskMap::const_iterator rr(
+ _imp->package_mask.find(n));
+ if (_imp->package_mask.end() == rr)
+ return false;
+ else
+ {
+ PackageDatabaseEntry dbe(n, v, r);
+ for (std::list<PackageDepAtom::ConstPointer>::const_iterator k(rr->second.begin()),
+ k_end(rr->second.end()) ; k != k_end ; ++k)
+ if (match_package(_imp->env, **k, dbe))
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/paludis/repositories/portage/portage_repository_profile.hh b/paludis/repositories/portage/portage_repository_profile.hh
index bb7578d..396c819 100644
--- a/paludis/repositories/portage/portage_repository_profile.hh
+++ b/paludis/repositories/portage/portage_repository_profile.hh
@@ -93,6 +93,14 @@ namespace paludis
///\}
+ ///\name Masks
+ ///\{
+
+ bool profile_masked(const QualifiedPackageName &, const VersionSpec &,
+ const RepositoryName &) const;
+
+ ///\}
+
///\name System package set
///\{