aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-10 22:36:38 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-10 22:36:38 +0100
commitc73d224aab2ad843b9791351727c7e45e4b4b0d5 (patch)
tree6b4642ef13abaf9b3b6ff6e739d586057f858e78
parent8f0a81f559104cc2fb5019174a94ee876e5eec03 (diff)
downloadpaludis-c73d224aab2ad843b9791351727c7e45e4b4b0d5.tar.gz
paludis-c73d224aab2ad843b9791351727c7e45e4b4b0d5.tar.xz
Move use descriptions around for exheres.
Exheres now uses metadata/options/descriptions/*.{local,}.conf instead of use.desc, use.local.desc and desc/*.desc. Local descriptions for suboptions are now allowed as a side effect.
-rw-r--r--paludis/repositories/e/e_repository.cc6
-rw-r--r--paludis/repositories/e/exheres_layout.cc44
-rw-r--r--paludis/repositories/e/exheres_layout.hh2
-rw-r--r--paludis/repositories/e/layout.hh3
-rw-r--r--paludis/repositories/e/traditional_layout.cc38
-rw-r--r--paludis/repositories/e/traditional_layout.hh2
-rw-r--r--paludis/repositories/e/use_desc.cc17
-rw-r--r--paludis/repositories/e/use_desc.hh9
8 files changed, 88 insertions, 33 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 83d63ae..96e1a95 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1156,10 +1156,8 @@ ERepository::describe_use_flag(const UseFlagName & f,
{
std::string expand_sep(stringify((*(*erepository::EAPIData::get_instance()->eapi_from_string(
_imp->params.profile_eapi))[k::supported()])[k::ebuild_options()].use_expand_separator));
- std::tr1::shared_ptr<const FSEntrySequence> use_desc_dirs(_imp->layout->use_desc_dirs());
- for (FSEntrySequence::ConstIterator p(use_desc_dirs->begin()), p_end(use_desc_dirs->end()) ;
- p != p_end ; ++p)
- _imp->use_desc.push_back(std::tr1::shared_ptr<UseDesc>(new UseDesc(*p, expand_sep)));
+ std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_info(_imp->layout->use_desc_files());
+ _imp->use_desc.push_back(std::tr1::shared_ptr<UseDesc>(new UseDesc(use_desc_info, expand_sep)));
}
std::string result;
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index 2523e46..d76ca81 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -75,7 +75,7 @@ namespace paludis
std::tr1::shared_ptr<FSEntrySequence> repository_mask_files;
std::tr1::shared_ptr<FSEntrySequence> profiles_desc_files;
std::tr1::shared_ptr<FSEntrySequence> mirror_files;
- std::tr1::shared_ptr<FSEntrySequence> use_desc_dirs;
+ std::tr1::shared_ptr<UseDescFileInfoSequence> use_desc_files;
Implementation(const ERepository * const n, const FSEntry & t,
std::tr1::shared_ptr<const ERepositoryEntries> e) :
@@ -87,7 +87,7 @@ namespace paludis
repository_mask_files(new FSEntrySequence),
profiles_desc_files(new FSEntrySequence),
mirror_files(new FSEntrySequence),
- use_desc_dirs(new FSEntrySequence)
+ use_desc_files(new UseDescFileInfoSequence)
{
}
};
@@ -105,14 +105,44 @@ ExheresLayout::ExheresLayout(const ERepository * const r, const FSEntry & tree_r
_imp->repository_mask_files->push_back(*master_repository_location() / "metadata" / "repository_mask.conf");
_imp->profiles_desc_files->push_back(*master_repository_location() / "metadata" / "profiles_desc.conf");
_imp->mirror_files->push_back(*master_repository_location() / "metadata" / "mirrors.conf");
- _imp->use_desc_dirs->push_back(*master_repository_location() / "metadata" / "desc");
+
+ FSEntry descs(*master_repository_location() / "metadata" / "options" / "descriptions");
+ if (descs.is_directory_or_symlink_to_directory())
+ {
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".conf", IsFileWithOptions()))
+ continue;
+
+ std::string p(strip_trailing_string(strip_trailing_string(d->basename(), ".conf"), ".local"));
+ if (p == "options")
+ _imp->use_desc_files->push_back(std::make_pair(*d, ""));
+ else
+ _imp->use_desc_files->push_back(std::make_pair(*d, p));
+ }
+ }
}
_imp->arch_list_files->push_back(_imp->tree_root / "metadata" / "arch.conf");
_imp->repository_mask_files->push_back(_imp->tree_root / "metadata" / "repository_mask.conf");
_imp->profiles_desc_files->push_back(_imp->tree_root / "metadata" / "profiles_desc.conf");
_imp->mirror_files->push_back(_imp->tree_root / "metadata" / "mirrors.conf");
- _imp->use_desc_dirs->push_back(_imp->tree_root / "metadata" / "desc");
+
+ FSEntry descs(_imp->tree_root / "metadata" / "options" / "descriptions");
+ if (descs.is_directory_or_symlink_to_directory())
+ {
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".conf", IsFileWithOptions()))
+ continue;
+
+ std::string p(strip_trailing_string(strip_trailing_string(d->basename(), ".conf"), ".local"));
+ if (p == "options")
+ _imp->use_desc_files->push_back(std::make_pair(*d, ""));
+ else
+ _imp->use_desc_files->push_back(std::make_pair(*d, p));
+ }
+ }
}
ExheresLayout::~ExheresLayout()
@@ -419,10 +449,10 @@ ExheresLayout::mirror_files() const
return _imp->mirror_files;
}
-std::tr1::shared_ptr<const FSEntrySequence>
-ExheresLayout::use_desc_dirs() const
+std::tr1::shared_ptr<const UseDescFileInfoSequence>
+ExheresLayout::use_desc_files() const
{
- return _imp->use_desc_dirs;
+ return _imp->use_desc_files;
}
FSEntry
diff --git a/paludis/repositories/e/exheres_layout.hh b/paludis/repositories/e/exheres_layout.hh
index 6cda140..f6e9216 100644
--- a/paludis/repositories/e/exheres_layout.hh
+++ b/paludis/repositories/e/exheres_layout.hh
@@ -104,7 +104,7 @@ namespace paludis
virtual std::tr1::shared_ptr<const FSEntrySequence> mirror_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::tr1::shared_ptr<const FSEntrySequence> use_desc_dirs() const
+ virtual std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual FSEntry profiles_base_dir() const
diff --git a/paludis/repositories/e/layout.hh b/paludis/repositories/e/layout.hh
index 93b46db..b4d07da 100644
--- a/paludis/repositories/e/layout.hh
+++ b/paludis/repositories/e/layout.hh
@@ -29,6 +29,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/util/map-fwd.hh>
+#include <paludis/repositories/e/use_desc.hh>
#include <tr1/memory>
namespace paludis
@@ -124,7 +125,7 @@ namespace paludis
virtual std::tr1::shared_ptr<const FSEntrySequence> mirror_files() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- virtual std::tr1::shared_ptr<const FSEntrySequence> use_desc_dirs() const
+ virtual std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual FSEntry profiles_base_dir() const
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 2e92ecc..453596f 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -74,7 +74,7 @@ namespace paludis
std::tr1::shared_ptr<FSEntrySequence> repository_mask_files;
std::tr1::shared_ptr<FSEntrySequence> profiles_desc_files;
std::tr1::shared_ptr<FSEntrySequence> mirror_files;
- std::tr1::shared_ptr<FSEntrySequence> use_desc_dirs;
+ std::tr1::shared_ptr<UseDescFileInfoSequence> use_desc_files;
Implementation(const ERepository * const r, const FSEntry & t,
std::tr1::shared_ptr<const ERepositoryEntries> e) :
@@ -86,7 +86,7 @@ namespace paludis
repository_mask_files(new FSEntrySequence),
profiles_desc_files(new FSEntrySequence),
mirror_files(new FSEntrySequence),
- use_desc_dirs(new FSEntrySequence)
+ use_desc_files(new UseDescFileInfoSequence)
{
}
};
@@ -104,14 +104,38 @@ TraditionalLayout::TraditionalLayout(const ERepository * const repo, const FSEnt
_imp->repository_mask_files->push_back(*master_repository_location() / "profiles" / "package.mask");
_imp->profiles_desc_files->push_back(*master_repository_location() / "profiles" / "profiles.desc");
_imp->mirror_files->push_back(*master_repository_location() / "profiles" / "thirdpartymirrors");
- _imp->use_desc_dirs->push_back(*master_repository_location() / "profiles");
+
+ _imp->use_desc_files->push_back(std::make_pair(*master_repository_location() / "profiles" / "use.desc", ""));
+ _imp->use_desc_files->push_back(std::make_pair(*master_repository_location() / "profiles" / "use.local.desc", ""));
+ FSEntry descs(*master_repository_location() / "profiles" / "desc");
+ if (descs.is_directory_or_symlink_to_directory())
+ {
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
+ continue;
+ _imp->use_desc_files->push_back(std::make_pair(*d, strip_trailing_string(d->basename(), ".desc")));
+ }
+ }
}
_imp->arch_list_files->push_back(_imp->tree_root / "profiles" / "arch.list");
_imp->repository_mask_files->push_back(_imp->tree_root / "profiles" / "package.mask");
_imp->profiles_desc_files->push_back(_imp->tree_root / "profiles" / "profiles.desc");
_imp->mirror_files->push_back(_imp->tree_root / "profiles" / "thirdpartymirrors");
- _imp->use_desc_dirs->push_back(_imp->tree_root / "profiles");
+
+ _imp->use_desc_files->push_back(std::make_pair(_imp->tree_root / "profiles" / "use.desc", ""));
+ _imp->use_desc_files->push_back(std::make_pair(_imp->tree_root / "profiles" / "use.local.desc", ""));
+ FSEntry descs(_imp->tree_root / "profiles" / "desc");
+ if (descs.is_directory_or_symlink_to_directory())
+ {
+ for (DirIterator d(descs), d_end ; d != d_end ; ++d)
+ {
+ if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
+ continue;
+ _imp->use_desc_files->push_back(std::make_pair(*d, strip_trailing_string(d->basename(), ".desc")));
+ }
+ }
}
TraditionalLayout::~TraditionalLayout()
@@ -437,10 +461,10 @@ TraditionalLayout::mirror_files() const
return _imp->mirror_files;
}
-std::tr1::shared_ptr<const FSEntrySequence>
-TraditionalLayout::use_desc_dirs() const
+std::tr1::shared_ptr<const UseDescFileInfoSequence>
+TraditionalLayout::use_desc_files() const
{
- return _imp->use_desc_dirs;
+ return _imp->use_desc_files;
}
FSEntry
diff --git a/paludis/repositories/e/traditional_layout.hh b/paludis/repositories/e/traditional_layout.hh
index 06c47d6..855ab62 100644
--- a/paludis/repositories/e/traditional_layout.hh
+++ b/paludis/repositories/e/traditional_layout.hh
@@ -105,7 +105,7 @@ namespace paludis
virtual std::tr1::shared_ptr<const FSEntrySequence> mirror_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::tr1::shared_ptr<const FSEntrySequence> use_desc_dirs() const
+ virtual std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual FSEntry profiles_base_dir() const
diff --git a/paludis/repositories/e/use_desc.cc b/paludis/repositories/e/use_desc.cc
index 4f6a045..0ce503a 100644
--- a/paludis/repositories/e/use_desc.cc
+++ b/paludis/repositories/e/use_desc.cc
@@ -29,10 +29,13 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/sequence-impl.hh>
#include <tr1/unordered_map>
using namespace paludis;
+template class Sequence<UseDescFileInfo>;
+
namespace paludis
{
template<>
@@ -57,20 +60,16 @@ namespace paludis
}
}
- Implementation(const FSEntry & f, const std::string & expand_sep)
+ Implementation(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f, const std::string & expand_sep)
{
- add(f / "use.desc", "");
- add(f / "use.local.desc", "");
-
- if ((f / "desc").is_directory_or_symlink_to_directory())
- for (DirIterator d(f / "desc"), d_end ; d != d_end ; ++d)
- if (is_file_with_extension(*d, ".desc", IsFileWithOptions()))
- add(*d, strip_trailing_string(d->basename(), ".desc") + expand_sep);
+ for (UseDescFileInfoSequence::ConstIterator ff(f->begin()), ff_end(f->end()) ;
+ ff != ff_end ; ++ff)
+ add(ff->first, ff->second.empty() ? ff->second : ff->second + expand_sep);
}
};
}
-UseDesc::UseDesc(const FSEntry & f, const std::string & expand_sep) :
+UseDesc::UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f, const std::string & expand_sep) :
PrivateImplementationPattern<UseDesc>(new Implementation<UseDesc>(f, expand_sep))
{
}
diff --git a/paludis/repositories/e/use_desc.hh b/paludis/repositories/e/use_desc.hh
index f386d36..4190e24 100644
--- a/paludis/repositories/e/use_desc.hh
+++ b/paludis/repositories/e/use_desc.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * 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
@@ -22,12 +22,15 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <utility>
namespace paludis
{
- class FSEntry;
+ typedef std::pair<FSEntry, std::string> UseDescFileInfo;
+ typedef Sequence<UseDescFileInfo> UseDescFileInfoSequence;
/**
* Implements use.desc options for ERepository.
@@ -42,7 +45,7 @@ namespace paludis
///\name Basic operations
///\{
- UseDesc(const FSEntry &, const std::string & expand_sep);
+ UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> &, const std::string & expand_sep);
~UseDesc();
///\}