summaryrefslogtreecommitdiff
path: root/sys-apps/paludis/files/news_v2.patch
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-01-09 01:32:02 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-01-09 01:32:02 +0300
commit11d2cb6aef4c3cca7eb1971ffb94e33c9f2d6617 (patch)
tree40106122028f49feb7390db6e11abd40fae1a27b /sys-apps/paludis/files/news_v2.patch
parent8c57303e4a28571726d56083500456cbb606fd45 (diff)
paludis: news format patch
samba: build fix
Diffstat (limited to 'sys-apps/paludis/files/news_v2.patch')
-rw-r--r--sys-apps/paludis/files/news_v2.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/sys-apps/paludis/files/news_v2.patch b/sys-apps/paludis/files/news_v2.patch
new file mode 100644
index 0000000..f630203
--- /dev/null
+++ b/sys-apps/paludis/files/news_v2.patch
@@ -0,0 +1,122 @@
+diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
+index 8a16893..647ce8d 100644
+--- a/paludis/repositories/e/e_repository_news.cc
++++ b/paludis/repositories/e/e_repository_news.cc
+@@ -161,13 +161,14 @@ ERepositoryNews::update_news() const
+ NewsFile news(*d / (d->basename() + ".en.txt"));
+ bool show(true);
+
+- const EAPI & eapi(*erepository::EAPIData::get_instance()->eapi_from_string(
+- _imp->e_repository->params().profile_eapi_when_unspecified()));
+-
+ if (news.begin_display_if_installed() != news.end_display_if_installed())
+ {
+ Context header_context("When checking Display-If-Installed headers:");
+
++ const EAPI & eapi(*erepository::EAPIData::get_instance()->eapi_from_string(
++ (news.version().compare(0, 2, "2.",0, 2) == 0 ) ? "5" :
++ (news.version().compare(0, 2, "1.",0, 2) == 0 ) ? "0" :
++ _imp->e_repository->params().profile_eapi_when_unspecified()));
+ bool local_show(false);
+ for (NewsFile::DisplayIfInstalledConstIterator i(news.begin_display_if_installed()),
+ i_end(news.end_display_if_installed()) ; i != i_end ; ++i)
+@@ -206,9 +207,23 @@ ERepositoryNews::update_news() const
+ Log::get_instance()->message("e.news.profile_path", ll_debug, lc_no_context) <<
+ "Profile path is '" << profile << "'";
+ for (NewsFile::DisplayIfProfileConstIterator i(news.begin_display_if_profile()),
+- i_end(news.end_display_if_profile()) ; i != i_end ; ++i)
+- if (profile == *i)
+- local_show = true;
++ i_end(news.end_display_if_profile()) ; i != i_end ; ++i){
++ if ( 0 == news.version().compare(0, 2, "1.", 0, 2))
++ {
++ if (profile == *i)
++ local_show = true;
++ }
++ else if ( 0 == news.version().compare(0, 2, "2.", 0, 2))
++ {
++ // Check wildcard ( "/*" ) profile paths
++ if ( 0 == (*i).compare((*i).length() - 2, 2, "/*")){
++ if ( 0 == (profile.compare(0, (*i).length()-2, *i, 0, (*i).length() -2 )))
++ local_show = true;
++ }
++ else if ( profile == *i )
++ local_show = true;
++ }
++ }
+ }
+ show &= local_show;
+ }
+@@ -263,6 +278,7 @@ namespace paludis
+ DisplayIfList display_if_installed;
+ DisplayIfList display_if_keyword;
+ DisplayIfList display_if_profile;
++ std::string version;
+ };
+ }
+
+@@ -318,12 +334,27 @@ NewsFile::NewsFile(const FSPath & our_filename) :
+ throw NewsError(our_filename, "Multiple News-Item-Format headers specified");
+
+ seen_news_item_format = true;
+- if (0 != v.compare(0, 2, "1.", 0, 2))
++ if ( 0 == v.compare(0, 2, "1.",0, 2) )
++ {
++ if ( v != "1.0" )
++ {
++ Log::get_instance()->message("e.news.format", ll_warning, lc_context) <<
++ "News file '" << our_filename << "' uses news item format '" << v << "', but we only support "
++ "version 1 news up to 1.0.";
++ }
++ }
++ else if ( 0 == v.compare(0, 2, "2.", 0, 2))
++ {
++ if ( v != "2.0")
++ {
++ Log::get_instance()->message("e.news.format", ll_warning, lc_context) <<
++ "News file '" << our_filename << "' uses news item format '" << v << "', but we only support "
++ "version 2 news items up to 2.0.";
++ }
++ }
++ else
+ throw NewsError(our_filename, "Unsupported News-Item-Format '" + v + "'");
+- if (v != "1.0")
+- Log::get_instance()->message("e.news.format", ll_warning, lc_context) <<
+- "News file '" << our_filename << "' uses news item format '" << v << "', but we only support "
+- "versions up to 1.0.";
++ _imp->version = v;
+ }
+ else if (k == "Posted")
+ seen_posted = true;
+@@ -338,7 +369,7 @@ NewsFile::NewsFile(const FSPath & our_filename) :
+ throw NewsError(our_filename, "No News-Item-Format header specified");
+ if (! seen_author)
+ throw NewsError(our_filename, "No Author header specified");
+- if (! seen_content_type)
++ if ( _imp->version == "1.0" && ! seen_content_type)
+ throw NewsError(our_filename, "No Content-Type header specified");
+ if (! seen_title)
+ throw NewsError(our_filename, "No Title header specified");
+@@ -391,6 +422,10 @@ NewsError::NewsError(const FSPath & f, const std::string & m) noexcept :
+ {
+ }
+
++std::string NewsFile::version() const{
++ return _imp->version;
++}
++
+ namespace paludis
+ {
+ template class WrappedForwardIterator<NewsFile::DisplayIfInstalledConstIteratorTag, const std::string>;
+diff --git a/paludis/repositories/e/e_repository_news.hh b/paludis/repositories/e/e_repository_news.hh
+index 55beb3f..d3cd860 100644
+--- a/paludis/repositories/e/e_repository_news.hh
++++ b/paludis/repositories/e/e_repository_news.hh
+@@ -93,6 +93,7 @@ namespace paludis
+
+ ///\}
+
++ std::string version() const;
+ ///\name Iterate over our Display-If-Installed headers
+ ///\{
+