aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-22 12:00:43 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-22 12:00:43 +0000
commit7bca36310de46b08f3148faca204a8ba834117fe (patch)
tree7f62f2d4fc31182aef9fefb2397bd55c20d9569a
parenta99e07b9dba05623954fd6e98b5de450050fc49c (diff)
downloadpaludis-7bca36310de46b08f3148faca204a8ba834117fe.tar.gz
paludis-7bca36310de46b08f3148faca204a8ba834117fe.tar.xz
Replace portage_compatible in environment.conf with accept_breaks_portage, and add a similar PALUDIS_IGNORE_BREAKS_PORTAGE for PortageEnvironment.
-rw-r--r--NEWS8
-rw-r--r--doc/configuration/environment.html.part.in24
-rw-r--r--doc/overview/gettingstarted.html.part9
-rw-r--r--paludis/environments/paludis/paludis_config.cc34
-rw-r--r--paludis/environments/paludis/paludis_config.hh9
-rw-r--r--paludis/environments/paludis/paludis_environment.cc48
-rw-r--r--paludis/environments/portage/portage_environment.cc64
-rw-r--r--paludis/package_id.hh4
-rw-r--r--paludis/repositories/cran/cran_package_id.cc6
-rw-r--r--paludis/repositories/cran/cran_package_id.hh2
-rw-r--r--paludis/repositories/e/e_repository_id.cc11
-rw-r--r--paludis/repositories/e/e_repository_id.hh2
-rw-r--r--paludis/repositories/fake/fake_package_id.cc4
-rw-r--r--paludis/repositories/fake/fake_package_id.hh2
-rw-r--r--paludis/repositories/gems/gem_specification.cc6
-rw-r--r--paludis/repositories/gems/gem_specification.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc6
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh2
-rw-r--r--paludis/repositories/virtuals/package_id.cc4
-rw-r--r--paludis/repositories/virtuals/package_id.hh2
-rw-r--r--paludis/version_spec.cc6
-rw-r--r--paludis/version_spec.hh5
-rw-r--r--paludis/version_spec_TEST.cc29
-rw-r--r--ruby/package_id.cc32
-rw-r--r--ruby/package_id_TEST.rb4
27 files changed, 253 insertions, 80 deletions
diff --git a/NEWS b/NEWS
index b678e0c..368f4c0 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,14 @@ News for Paludis
This file lists the major changes between versions. For a more detailed list
of every change, see the ChangeLog.
+trunk/:
+ * portage_compatible in environment.conf is deprecated in favour of the new,
+ more fine-grained accept_breaks_portage. When using Portage configuration
+ files, this is also supported as PALUDIS_IGNORE_BREAKS_PORTAGE in
+ make.conf, for the convenience of users who prefer to use
+ Portage-compatible configuration files without caring about Portage
+ compatibility.
+
0.26.0_pre3:
* reconcilio no longer accepts the --verbose switch; verbose display is
now turned on unconditionally.
diff --git a/doc/configuration/environment.html.part.in b/doc/configuration/environment.html.part.in
index b3f096c..54275c9 100644
--- a/doc/configuration/environment.html.part.in
+++ b/doc/configuration/environment.html.part.in
@@ -8,26 +8,34 @@
key=value configuration file, and may optionally be in bash format. Recognised keys are as follows:</p>
<dl>
- <dt>world</dt>
+ <dt><code>world</code></dt>
<dd>The location of the world file.</dd>
- <dt>reduced_username</dt>
+ <dt><code>reduced_username</code></dt>
<dd>If set, Paludis will use this username rather than <code>paludisbuild</code> when a reduced privilege user is
required.</dd>
- <dt>portage_compatible</dt>
- <dd>If set to a non-empty string, Paludis will automatically mask any packages that would break Portage. This can be
- used if Paludis and Portage are to be used on the same machine. This does <em>not</em> disable cache options that
- would cause interoperability problems.</dd>
+ <dt><code>accept_breaks_portage</code></dt>
+ <dd>Possibly-empty list of characteristics that can cause a package to be incompatible
+ with Portage, but that should <em>not</em> cause the package to be masked, or
+ <code>*</code> (the default) to ignore Portage compatibility entirely. Currently
+ available characteristics are:
+ <dl><dt><code>eapi</code></dt><dd>ebuilds with an EAPI that is not supported by Portage</dd>
+ <dt><code>version</code></dt><dd>ebuilds that use Paludis-specific features of the package version syntax</dd>
+ <dt><code>format</code></dt><dd>packages other than ebuilds</dd></dl>
+ Note that this does <em>not</em> disable cache options that would cause interoperability problems.</dd>
- <dt>distribution</dt>
+ <dt><code>portage_compatible</code></dt>
+ <dd>If set to a non-empty string, deprecated equivalent of <code>accept_breaks_portage =</code>.</dd>
+
+ <dt><code>distribution</code></dt>
<dd>If set, overrides the distribution used when distribution-specific defaults are used.</dd>
</dl>
<p>The following keys are predefined. They should not be modified.</p>
<dl>
- <dt>root</dt>
+ <dt><code>root</code></dt>
<dd>The filesystem root. Relevant if <code>specpath.conf</code> is in use. Using this variable can create a
configuration system that works both inside and outside of a chroot (e.g. <code>world =
${root}/var/db/pkg/world</code>).</dd>
diff --git a/doc/overview/gettingstarted.html.part b/doc/overview/gettingstarted.html.part
index 65ed60a..0351963 100644
--- a/doc/overview/gettingstarted.html.part
+++ b/doc/overview/gettingstarted.html.part
@@ -18,9 +18,6 @@
is less widely used, and so may not support all Portage options perfectly.</li>
<li>It is only available on Gentoo and Gentoo-derived distributions.</li>
-
- <li>You will be unable to use packages that use EAPIs that Portage does not support. The packages in the Paludis
- overlay fall into this category.</li>
</ul>
</li>
@@ -45,6 +42,12 @@ All Paludis clients that use configuration can also be told explicitly to use Po
<code>--environment portage</code> (or <code>--environment portage:/other/root</code> to use configuration files in
another filesystem root).</p>
+<p>By default, will be unable to use packages that use EAPIs that Portage does not support. The packages in the Paludis
+overlay fall into this category. You may override this by setting the <code>PALUDIS_IGNORE_BREAKS_PORTAGE</code>
+in <code>make.conf</code>; the allowed values are the same as for the <code>accept_breaks_portage</code>
+key in Paludis's <a href="../configuration/environment.html"><code>environment.conf</code></a>,
+except that the default is an empty string.</p>
+
<p>Next, proceed to <a href="#testing">Testing a configuration</a>.</p>
<h2 id="automatic">Automatically migrating</h2>
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 5a03fb2..26bab0e 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -109,7 +109,8 @@ namespace paludis
mutable Mutex environment_conf_mutex;
mutable bool has_environment_conf;
- mutable bool accept_breaks_portage;
+ mutable bool accept_all_breaks_portage;
+ mutable Set<std::string> accept_breaks_portage;
mutable std::string reduced_username;
Implementation(PaludisEnvironment * const);
@@ -129,7 +130,7 @@ namespace paludis
package_unmask_conf(new PackageMaskConf(e)),
mirrors_conf(new MirrorsConf(e)),
has_environment_conf(false),
- accept_breaks_portage(true),
+ accept_all_breaks_portage(false),
reduced_username(getenv_with_default("PALUDIS_REDUCED_USERNAME", "paludisbuild"))
{
}
@@ -149,6 +150,7 @@ namespace paludis
new Map<std::string, std::string>);
conf_vars->insert("ROOT", root);
conf_vars->insert("root", root);
+ conf_vars->insert("accept_breaks_portage", "*");
tr1::shared_ptr<FSEntry> world_file;
if ((FSEntry(config_dir) / "environment.conf").exists())
@@ -181,7 +183,25 @@ namespace paludis
if (! kv->get("reduced_username").empty())
reduced_username = kv->get("reduced_username");
- accept_breaks_portage = kv->get("portage_compatible").empty();
+ if (! kv->get("portage_compatible").empty())
+ Log::get_instance()->message("paludis_environment.portage_compatible.deprecated", ll_warning, lc_context)
+ << "The 'portage_compatible' variable in environment.conf is deprecated,"
+ << " set 'accept_breaks_portage' to empty instead.";
+ else
+ {
+ std::list<std::string> breakages;
+ tokenise_whitespace(kv->get("accept_breaks_portage"), std::back_inserter(breakages));
+ for (std::list<std::string>::const_iterator it(breakages.begin()),
+ it_end(breakages.end()); it_end != it; ++it)
+ if ("*" == *it)
+ {
+ accept_all_breaks_portage = true;
+ break;
+ }
+ else
+ accept_breaks_portage.insert(*it);
+ }
+
distribution = kv->get("distribution");
if (! kv->get("world").empty())
@@ -678,6 +698,14 @@ PaludisConfig::reduced_username() const
}
bool
+PaludisConfig::accept_all_breaks_portage() const
+{
+ _imp->need_environment_conf();
+
+ return _imp->accept_all_breaks_portage;
+}
+
+const Set<std::string> &
PaludisConfig::accept_breaks_portage() const
{
_imp->need_environment_conf();
diff --git a/paludis/environments/paludis/paludis_config.hh b/paludis/environments/paludis/paludis_config.hh
index 93d901f..a5260ac 100644
--- a/paludis/environments/paludis/paludis_config.hh
+++ b/paludis/environments/paludis/paludis_config.hh
@@ -147,9 +147,14 @@ namespace paludis
std::string root() const;
/**
- * Whether it's ok to unmask things that break Portage.
+ * Whether it's ok to unmask things that break Portage, regardless of the reason.
*/
- bool accept_breaks_portage() const;
+ bool accept_all_breaks_portage() const;
+
+ /**
+ * Specific reasons why a package might break Portage that it's ok to ignore.
+ */
+ const Set<std::string> & accept_breaks_portage() const;
///\name Userpriv
///\{
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index cd26154..3f0f6ea 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -506,20 +506,29 @@ namespace
class BreaksPortageMask :
public UnsupportedMask
{
- char key() const
- {
- return 'B';
- }
+ private:
+ std::string breakages;
- const std::string description() const
- {
- return "breaks Portage";
- }
+ public:
+ BreaksPortageMask(const std::string & b) :
+ breakages(b)
+ {
+ }
- const std::string explanation() const
- {
- return "";
- }
+ char key() const
+ {
+ return 'B';
+ }
+
+ const std::string description() const
+ {
+ return "breaks Portage";
+ }
+
+ const std::string explanation() const
+ {
+ return breakages;
+ }
};
class UserConfigMask :
@@ -540,8 +549,19 @@ namespace
const tr1::shared_ptr<const Mask>
PaludisEnvironment::mask_for_breakage(const PackageID & id) const
{
- if ((! _imp->config->accept_breaks_portage()) && id.breaks_portage())
- return make_shared_ptr(new BreaksPortageMask);
+ if (! _imp->config->accept_all_breaks_portage())
+ {
+ tr1::shared_ptr<const Set<std::string> > breakages(id.breaks_portage());
+ if (breakages)
+ {
+ std::list<std::string> bad_breakages;
+ std::set_difference(breakages->begin(), breakages->end(),
+ _imp->config->accept_breaks_portage().begin(), _imp->config->accept_breaks_portage().end(),
+ std::back_inserter(bad_breakages));
+ if (! bad_breakages.empty())
+ return make_shared_ptr(new BreaksPortageMask(join(breakages->begin(), breakages->end(), " ")));
+ }
+ }
return tr1::shared_ptr<const Mask>();
}
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 7fa3bf6..5651214 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -89,6 +89,9 @@ namespace paludis
PackageMask package_mask;
PackageUnmask package_unmask;
+ std::set<std::string> ignore_breaks_portage;
+ bool ignore_all_breaks_portage;
+
mutable Mutex hook_mutex;
mutable bool done_hooks;
mutable tr1::shared_ptr<Hooker> hooker;
@@ -104,6 +107,7 @@ namespace paludis
Implementation(Environment * const e, const std::string & s) :
conf_dir(FSEntry(s.empty() ? "/" : s) / SYSCONFDIR),
paludis_command("paludis"),
+ ignore_all_breaks_portage(false),
done_hooks(false),
overlay_importance(10),
package_database(new PackageDatabase(e)),
@@ -264,6 +268,18 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
_imp->mirrors.insert(std::make_pair(tokens.at(0), *t));
}
}
+
+ std::list<std::string> ignore_breaks_portage;
+ tokenise_whitespace(_imp->vars->get("PALUDIS_IGNORE_BREAKS_PORTAGE"), std::back_inserter(ignore_breaks_portage));
+ for (std::list<std::string>::const_iterator it(ignore_breaks_portage.begin()),
+ it_end(ignore_breaks_portage.end()); it_end != it; ++it)
+ if ("*" == *it)
+ {
+ _imp->ignore_all_breaks_portage = true;
+ break;
+ }
+ else
+ _imp->ignore_breaks_portage.insert(*it);
}
template<typename I_>
@@ -683,20 +699,29 @@ namespace
class BreaksPortageMask :
public UnsupportedMask
{
- char key() const
- {
- return 'B';
- }
+ private:
+ std::string breakages;
- const std::string description() const
- {
- return "breaks Portage";
- }
+ public:
+ BreaksPortageMask(const std::string & b) :
+ breakages(b)
+ {
+ }
- const std::string explanation() const
- {
- return "";
- }
+ char key() const
+ {
+ return 'B';
+ }
+
+ const std::string description() const
+ {
+ return "breaks Portage";
+ }
+
+ const std::string explanation() const
+ {
+ return breakages;
+ }
};
class UserConfigMask :
@@ -717,8 +742,19 @@ namespace
const tr1::shared_ptr<const Mask>
PortageEnvironment::mask_for_breakage(const PackageID & id) const
{
- if (id.breaks_portage())
- return make_shared_ptr(new BreaksPortageMask);
+ if (! _imp->ignore_all_breaks_portage)
+ {
+ tr1::shared_ptr<const Set<std::string> > breakages(id.breaks_portage());
+ if (breakages)
+ {
+ std::set<std::string> bad_breakages;
+ std::set_difference(breakages->begin(), breakages->end(),
+ _imp->ignore_breaks_portage.begin(), _imp->ignore_breaks_portage.end(),
+ std::inserter(bad_breakages, bad_breakages.end()));
+ if (! bad_breakages.empty())
+ return make_shared_ptr(new BreaksPortageMask(join(breakages->begin(), breakages->end(), " ")));
+ }
+ }
return tr1::shared_ptr<const Mask>();
}
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index af4867d..7c77923 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -325,12 +325,12 @@ namespace paludis
virtual void invalidate_masks() const;
/**
- * Do we break Portage?
+ * Do we break Portage, and if so, why?
*
* This method may be used by Environment implementations to apply a "we don't
* want packages that break Portage" mask.
*/
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index e5e5a8e..7726dca 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -434,10 +434,12 @@ CRANPackageID::arbitrary_less_than_comparison(const PackageID &) const
return false;
}
-bool
+tr1::shared_ptr<const Set<std::string> >
CRANPackageID::breaks_portage() const
{
- return true;
+ tr1::shared_ptr<Set<std::string> > why(new Set<std::string>);
+ why->insert("format");
+ return why;
}
const std::string
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index 758adce..026603e 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -82,7 +82,7 @@ namespace paludis
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const PALUDIS_ATTRIBUTE((noreturn));
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/e_repository_id.cc b/paludis/repositories/e/e_repository_id.cc
index 7975bdd..b97c3c0 100644
--- a/paludis/repositories/e/e_repository_id.cc
+++ b/paludis/repositories/e/e_repository_id.cc
@@ -21,14 +21,19 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/util/kc.hh>
+#include <paludis/util/set.hh>
using namespace paludis;
using namespace paludis::erepository;
-bool
+tr1::shared_ptr<const Set<std::string> >
ERepositoryID::breaks_portage() const
{
- return (version().has_try_part() || version().has_scm_part()
- || (! (*eapi())[k::supported()]) || (*((*eapi())[k::supported()]))[k::breaks_portage()]);
+ tr1::shared_ptr<Set<std::string> > why(new Set<std::string>);
+ if (version().has_try_part() || version().has_scm_part() || version().has_local_revision())
+ why->insert("version");
+ if ((! (*eapi())[k::supported()]) || (*((*eapi())[k::supported()]))[k::breaks_portage()])
+ why->insert("eapi");
+ return why;
}
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index d75921f..18f353c 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.hh
@@ -38,7 +38,7 @@ namespace paludis
virtual const tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const = 0;
virtual const tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > eclass_keywords_key() const = 0;
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index f785e0d..77d17bf 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -920,10 +920,10 @@ FakePackageID::perform_action(Action & a) const
a.accept(b);
}
-bool
+tr1::shared_ptr<const Set<std::string> >
FakePackageID::breaks_portage() const
{
- return (version().has_try_part() || version().has_scm_part());
+ return tr1::shared_ptr<const Set<std::string> >();
}
const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 880a01d..4933821 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -265,7 +265,7 @@ namespace paludis
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void invalidate_masks() const;
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index d7d829c..d750394 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -624,9 +624,11 @@ GemSpecification::invalidate_masks() const
PackageID::invalidate_masks();
}
-bool
+tr1::shared_ptr<const Set<std::string> >
GemSpecification::breaks_portage() const
{
- return true;
+ tr1::shared_ptr<Set<std::string> > why(new Set<std::string>);
+ why->insert("format");
+ return why;
}
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index cbdca80..cd6b7ee 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -119,7 +119,7 @@ namespace paludis
virtual bool arbitrary_less_than_comparison(const PackageID &) const;
virtual std::size_t extra_hash_value() const;
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void invalidate_masks() const;
};
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 0ceb9ec..aa1fe69 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -660,10 +660,12 @@ InstalledUnpackagedID::invalidate_masks() const
{
}
-bool
+tr1::shared_ptr<const Set<std::string> >
InstalledUnpackagedID::breaks_portage() const
{
- return true;
+ tr1::shared_ptr<Set<std::string> > why(new Set<std::string>);
+ why->insert("format");
+ return why;
}
bool
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index caa4e36..3e3de85 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -82,7 +82,7 @@ namespace paludis
virtual void perform_action(Action &) const;
virtual void invalidate_masks() const;
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::size_t extra_hash_value() const
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 6dc04e2..22c5824 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -336,10 +336,12 @@ UnpackagedID::invalidate_masks() const
{
}
-bool
+tr1::shared_ptr<const Set<std::string> >
UnpackagedID::breaks_portage() const
{
- return true;
+ tr1::shared_ptr<Set<std::string> > why(new Set<std::string>);
+ why->insert("format");
+ return why;
}
bool
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index 47232da..dd306fa 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -80,7 +80,7 @@ namespace paludis
virtual void perform_action(Action &) const;
virtual void invalidate_masks() const;
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool arbitrary_less_than_comparison(const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::size_t extra_hash_value() const
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index eef070c..d53c554 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -498,10 +498,10 @@ VirtualsPackageID::invalidate_masks() const
PackageID::invalidate_masks();
}
-bool
+tr1::shared_ptr<const Set<std::string> >
VirtualsPackageID::breaks_portage() const
{
- return (version().has_try_part() || version().has_scm_part());
+ return tr1::shared_ptr<const Set<std::string> >();
}
const tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index b3b101b..2217d36 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -113,7 +113,7 @@ namespace paludis
virtual std::size_t extra_hash_value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual bool breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void invalidate_masks() const;
};
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 4024ad1..9dbb4e3 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -649,6 +649,12 @@ VersionSpec::has_scm_part() const
return _imp->parts.end() != std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<scm>());
}
+bool
+VersionSpec::has_local_revision() const
+{
+ return 1 < std::count_if(_imp->parts.begin(), _imp->parts.end(), IsPart<revision>());
+}
+
VersionSpec
VersionSpec::bump() const
{
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index 357d4f4..6525db8 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -167,6 +167,11 @@ namespace paludis
* Use is_scm() if -9999 etc is desired.
*/
bool has_scm_part() const;
+
+ /**
+ * Do we have a local revision (-r1.2...)?
+ */
+ bool has_local_revision() const;
};
}
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 2adfc5d..01045fb 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -283,6 +283,35 @@ namespace test_cases
}
} test_version_is_scm;
+ /**
+ * \test VersionSpec has_*
+ *
+ */
+ struct VersionHasStuffTest : TestCase
+ {
+ VersionHasStuffTest() : TestCase("version spec has_*") {}
+
+ void run()
+ {
+ TEST_CHECK(! VersionSpec("1.2").has_scm_part());
+ TEST_CHECK(VersionSpec("1.2-scm").has_scm_part());
+ TEST_CHECK(VersionSpec("1.2-scm-r99").has_scm_part());
+ TEST_CHECK(! VersionSpec("9999").has_scm_part());
+ TEST_CHECK(VersionSpec("scm").has_scm_part());
+
+ TEST_CHECK(! VersionSpec("1").has_try_part());
+ TEST_CHECK(VersionSpec("1-try2").has_try_part());
+ TEST_CHECK(VersionSpec("1.2-try3-r4").has_try_part());
+
+ TEST_CHECK(! VersionSpec("1.2").has_local_revision());
+ TEST_CHECK(! VersionSpec("1.2-r0").has_local_revision());
+ TEST_CHECK(! VersionSpec("1.2-r3").has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.0").has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.4").has_local_revision());
+ TEST_CHECK(VersionSpec("1.2-r3.4.5").has_local_revision());
+ }
+ } test_version_has_stuff;
+
struct VersionSpecHashTest : TestCase
{
VersionSpecHashTest() : TestCase("version spec hash_value()") { }
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 108fa61..b092c85 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -230,22 +230,34 @@ namespace
}
/*
- * Document-method: masked?
- *
* call-seq:
- * masked? -> true or false
+ * breaks_portage -> [:reason, :reason, ...]
*
- * Do we have any masks?
+ * Do we break Portage, and if so, why?
+ *
+ * This method may be used by Environment implementations to apply a "we don't want packages that break Portage" mask.
*/
+ VALUE
+ package_id_breaks_portage(VALUE self)
+ {
+ VALUE result(rb_ary_new());
+ tr1::shared_ptr<const PackageID> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<const PackageID>, self_ptr);
+ tr1::shared_ptr<const Set<std::string> > breakages((*self_ptr)->breaks_portage());
+ if (breakages)
+ for (Set<std::string>::ConstIterator it(breakages->begin()),
+ it_end(breakages->end()); it_end != it; ++it)
+ rb_ary_push(result, ID2SYM(rb_intern(it->c_str())));
+ return result;
+ }
+
/*
- * Document-method: breaks_portage?
+ * Document-method: masked?
*
* call-seq:
- * breaks_portage? -> true or false
- *
- * Do we break Portage?
+ * masked? -> true or false
*
- * This method may be used by Environment implementations to apply a "we don't want packages that break Portage" mask.
+ * Do we have any masks?
*/
template <bool (PackageID::* m_) () const>
struct PackageIDBool
@@ -431,7 +443,7 @@ namespace
rb_define_method(c_package_id, "masks", RUBY_FUNC_CAST(&package_id_masks), 0);
rb_define_method(c_package_id, "masked?", RUBY_FUNC_CAST((&PackageIDBool<&PackageID::masked>::fetch)), 0);
rb_define_method(c_package_id, "invalidate_masks", RUBY_FUNC_CAST(&package_id_invalidate_masks), 0);
- rb_define_method(c_package_id, "breaks_portage?", RUBY_FUNC_CAST((&PackageIDBool<&PackageID::breaks_portage>::fetch)), 0);
+ rb_define_method(c_package_id, "breaks_portage", RUBY_FUNC_CAST(&package_id_breaks_portage), 0);
rb_define_method(c_package_id, "virtual_for_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<tr1::shared_ptr<const PackageID> > , &PackageID::virtual_for_key>::fetch)), 0);
rb_define_method(c_package_id, "keywords_key", RUBY_FUNC_CAST((&KeyValue<MetadataCollectionKey<KeywordNameSet>,&PackageID::keywords_key>::fetch)), 0);
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index d1a11f6..19a2683 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -172,8 +172,8 @@ module Paludis
assert !pid_installed.masked?
end
- def test_breaks_portage?
- assert !pid_testrepo.breaks_portage?
+ def test_breaks_portage
+ assert pid_testrepo.breaks_portage.empty?
end
def test_masks