aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 16:30:05 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-26 16:30:05 +0000
commit0c8eeda99a0bbef95e7729369ee293f526cd76a0 (patch)
tree252559b1863b3c03b7f3e3271045c61f84b2fd3e
parentf1b121f3054eff3e048ee516b7f9e9aecdd26fad (diff)
downloadpaludis-0c8eeda99a0bbef95e7729369ee293f526cd76a0.tar.gz
paludis-0c8eeda99a0bbef95e7729369ee293f526cd76a0.tar.xz
Allow tokens in mask files
-rw-r--r--paludis/repositories/e/e_repository_mask_file.cc33
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf1
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf1
6 files changed, 35 insertions, 4 deletions
diff --git a/paludis/repositories/e/e_repository_mask_file.cc b/paludis/repositories/e/e_repository_mask_file.cc
index af33ac4..aa20fe7 100644
--- a/paludis/repositories/e/e_repository_mask_file.cc
+++ b/paludis/repositories/e/e_repository_mask_file.cc
@@ -17,7 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "e_repository_mask_file.hh"
+#include <paludis/repositories/e/e_repository_mask_file.hh>
+#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/util/sequence.hh>
@@ -27,8 +28,11 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/log.hh>
#include <paludis/mask.hh>
+#include <vector>
#include <list>
using namespace paludis;
@@ -51,7 +55,7 @@ namespace paludis
};
}
-MaskFile::MaskFile(const FSPath & f, const LineConfigFileOptions & opts, const EAPI &) :
+MaskFile::MaskFile(const FSPath & f, const LineConfigFileOptions & opts, const EAPI & eapi) :
_imp()
{
LineConfigFileOptions myopts(opts);
@@ -83,11 +87,32 @@ MaskFile::MaskFile(const FSPath & f, const LineConfigFileOptions & opts, const E
continue;
}
- _imp->lines.push_back(std::make_pair(*it, std::shared_ptr<RepositoryMaskInfo>(std::make_shared<RepositoryMaskInfo>(
+ std::vector<std::string> tokens;
+ tokenise_whitespace(*it, std::back_inserter(tokens));
+
+ if (tokens.size() == 0)
+ continue;
+ else if (tokens.size() == 1)
+ {
+ }
+ else if (tokens.size() == 2 && ! eapi.supported()->allow_tokens_in_mask_files())
+ {
+ Log::get_instance()->message("e.mask.malformed", ll_qa, lc_context)
+ << "Line '" << *it << "' in '" << f << "' contains tokens after the spec; ignoring";
+ continue;
+ }
+ else
+ {
+ Log::get_instance()->message("e.mask.malformed", ll_qa, lc_context)
+ << "Line '" << *it << "' in '" << f << "' contains multiple tokens; ignoring";
+ continue;
+ }
+
+ _imp->lines.push_back(std::make_pair(tokens.at(0), std::shared_ptr<RepositoryMaskInfo>(std::make_shared<RepositoryMaskInfo>(
make_named_values<RepositoryMaskInfo>(
n::comment() = comment,
n::mask_file() = f,
- n::token() = ""
+ n::token() = tokens.size() < 2 ? "" : tokens.at(1)
)))));
comment_used = true;
}
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 8ff7137..401da27 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -332,6 +332,7 @@ namespace
}
return std::make_shared<SupportedEAPI>(make_named_values<SupportedEAPI>(
+ n::allow_tokens_in_mask_files() = destringify_key<bool>(k, "allow_tokens_in_mask_files"),
n::annotations() = make_annotations(k),
n::breaks_portage() = destringify_key<bool>(k, "breaks_portage"),
n::can_be_pbin() = destringify_key<bool>(k, "can_be_pbin"),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 29f35e5..7a1f57e 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -37,6 +37,7 @@ namespace paludis
{
namespace n
{
+ typedef Name<struct name_allow_tokens_in_mask_files> allow_tokens_in_mask_files;
typedef Name<struct name_annotations> annotations;
typedef Name<struct name_binary_from_env_variables> binary_from_env_variables;
typedef Name<struct name_blocker_resolution> blocker_resolution;
@@ -281,6 +282,7 @@ namespace paludis
struct SupportedEAPI
{
+ NamedValue<n::allow_tokens_in_mask_files, bool> allow_tokens_in_mask_files;
NamedValue<n::annotations, std::shared_ptr<const EAPIAnnotations> > annotations;
NamedValue<n::breaks_portage, bool> breaks_portage;
NamedValue<n::can_be_pbin, bool> can_be_pbin;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 844b0ed..55848ea 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -27,6 +27,7 @@ userpriv_cannot_use_root = false
fix_mtimes = false
fs_location_name = EBUILD
fs_location_description = Ebuild Location
+allow_tokens_in_mask_files = false
has_optional_tests = true
has_recommended_tests = false
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 3e6d3d2..34f5233 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -35,6 +35,7 @@ has_recommended_tests = true
has_expensive_tests = true
fs_location_name = EXHERES
fs_location_description = Exheres Location
+allow_tokens_in_mask_files = true
vdb_from_env_variables = \
CATEGORY CHOST DEPENDENCIES SUMMARY EAPI \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 6c7c73f..fef8b79 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -33,6 +33,7 @@ no_s_workdir_fallback = false
fix_mtimes = false
fs_location_name = EBUILD
fs_location_description = Ebuild Location
+allow_tokens_in_mask_files = false
vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \