aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-11 22:41:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-11 22:41:14 +0000
commit337644c6c8c5251b6bb67b6d380cc11bbd3b4f31 (patch)
tree8965e5617a4ea56a4adfad7d7addc522326f4fae
parent8800d98a61b9d7d968ecd1747cad83272e56f38c (diff)
downloadpaludis-337644c6c8c5251b6bb67b6d380cc11bbd3b4f31.tar.gz
paludis-337644c6c8c5251b6bb67b6d380cc11bbd3b4f31.tar.xz
Bunch of new mask reasons
-rw-r--r--paludis/Makefile.am.m422
-rw-r--r--paludis/dep_list/dep_list.cc2
-rw-r--r--paludis/environment.cc24
-rw-r--r--paludis/environment.hh19
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/mask_reasons.cc55
-rw-r--r--paludis/mask_reasons.hh32
-rw-r--r--paludis/mask_reasons.se28
-rw-r--r--paludis/repositories/cran/cran_version_metadata.cc2
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc4
-rw-r--r--paludis/repositories/gems/gems_version_metadata.cc2
-rw-r--r--paludis/repositories/gentoo/ebin.cc2
-rw-r--r--paludis/repositories/gentoo/ebuild.cc2
-rw-r--r--paludis/repositories/gentoo/portage_virtual_version_metadata.cc2
-rw-r--r--paludis/repositories/gentoo/vdb_version_metadata.cc4
-rw-r--r--paludis/version_metadata.sr1
-rw-r--r--paludis/version_spec.cc12
-rw-r--r--paludis/version_spec.hh13
-rw-r--r--src/clients/paludis/query.cc8
-rw-r--r--src/output/console_query_task.cc9
20 files changed, 147 insertions, 98 deletions
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index aef7f7f..870a0d5 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -6,6 +6,9 @@ dnl vim: set ft=m4 noet :
define(`filelist', `')dnl
define(`testlist', `')dnl
define(`headerlist', `')dnl
+define(`selist', `')dnl
+define(`secleanlist', `')dnl
+define(`seheaderlist', `')dnl
define(`srlist', `')dnl
define(`srcleanlist', `')dnl
define(`srheaderlist', `')dnl
@@ -39,11 +42,22 @@ $1-sr.cc : $1.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --source $`'(srcdir)/$1.sr > $`'@
')dnl
+define(`addse', `define(`selist', selist `$1.se')dnl
+define(`secleanlist', secleanlist `$1-se.hh $1-se.cc')dnl
+define(`seheaderlist', seheaderlist `$1-se.hh')dnl
+$1-se.hh : $1.se $(top_srcdir)/misc/make_se.bash
+ $(top_srcdir)/misc/make_se.bash --header $`'(srcdir)/$1.se > $`'@
+
+$1-se.cc : $1.se $(top_srcdir)/misc/make_se.bash
+ $(top_srcdir)/misc/make_se.bash --source $`'(srcdir)/$1.se > $`'@
+
+')dnl
define(`addthis', `dnl
ifelse(`$2', `hh', `addhh(`$1')', `')dnl
ifelse(`$2', `hhx', `addhhx(`$1')', `')dnl
ifelse(`$2', `cc', `addcc(`$1')', `')dnl
ifelse(`$2', `sr', `addsr(`$1')', `')dnl
+ifelse(`$2', `se', `addse(`$1')', `')dnl
ifelse(`$2', `impl', `addimpl(`$1')', `')dnl
ifelse(`$2', `test', `addtest(`$1')', `')dnl
ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
@@ -55,7 +69,7 @@ include(`paludis/files.m4')
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda ihateautomake.cc ihateautomake.o
MAINTAINERCLEANFILES = Makefile.in Makefile.am about.hh paludis.hh \
hashed_containers.hh
-DISTCLEANFILES = srcleanlist
+DISTCLEANFILES = srcleanlist secleanlist
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
@@ -63,10 +77,10 @@ DEFS= \
-DDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\"
EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \
- hashed_containers.hh.in testscriptlist srlist srcleanlist \
+ hashed_containers.hh.in testscriptlist srlist srcleanlist selist secleanlist \
repository_blacklist.txt
SUBDIRS = digests fetchers syncers util selinux . dep_list merger repositories environments args qa tasks
-BUILT_SOURCES = srcleanlist
+BUILT_SOURCES = srcleanlist secleanlist
libpaludis_la_SOURCES = filelist
libpaludis_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
@@ -110,7 +124,7 @@ noinst_LTLIBRARIES = libpaludismanpagethings.la
endif
paludis_includedir = $(includedir)/paludis/
-paludis_include_HEADERS = headerlist srheaderlist
+paludis_include_HEADERS = headerlist srheaderlist seheaderlist
Makefile.am : Makefile.am.m4 files.m4
$(top_srcdir)/misc/do_m4.bash Makefile.am
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index bf796fb..077ab4a 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -118,7 +118,7 @@ namespace
public:
FakedVirtualVersionMetadata(const SlotName & s, const PackageDatabaseEntry & e) :
VersionMetadata(
- VersionMetadataBase(s, "", "", "paludis-1"),
+ VersionMetadataBase(s, "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.cran_interface(0)
.virtual_interface(this)
diff --git a/paludis/environment.cc b/paludis/environment.cc
index bf8185f..30a449a 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -136,6 +136,12 @@ Environment::mask_reasons(const PackageDatabaseEntry & e, const bool override_ti
result.set(mr_eapi);
else
{
+ if (breaks_portage(e, *metadata) && ! accept_breaks_portage())
+ result.set(mr_breaks_portage);
+
+ if (metadata->interactive && ! accept_interactive())
+ result.set(mr_interactive);
+
if (metadata->virtual_interface)
{
result |= mask_reasons(metadata->virtual_interface->virtual_for);
@@ -629,6 +635,13 @@ Environment::reduced_gid() const
return getgid();
}
+bool
+Environment::breaks_portage(const PackageDatabaseEntry & e, const VersionMetadata & m) const
+{
+ return (e.version.has_try_part() || e.version.has_scm_part()
+ || std::string::npos != m.eapi.find("paludis"));
+}
+
Environment::WorldCallbacks::WorldCallbacks()
{
}
@@ -667,4 +680,15 @@ Environment::WorldCallbacks::remove_callback(const SetName &)
{
}
+bool
+Environment::accept_interactive() const
+{
+ return false;
+}
+
+bool
+Environment::accept_breaks_portage() const
+{
+ return true;
+}
diff --git a/paludis/environment.hh b/paludis/environment.hh
index d9a100a..733493f 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -175,6 +175,20 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
/**
+ * Accept packages that break Portage?
+ *
+ * Default behaviour: yes.
+ */
+ virtual bool accept_breaks_portage() const;
+
+ /**
+ * Accept interactive packages?
+ *
+ * Default behaviour: no.
+ */
+ virtual bool accept_interactive() const;
+
+ /**
* Fetch the masks for a particular package.
*/
MaskReasons mask_reasons(const PackageDatabaseEntry &,
@@ -419,6 +433,11 @@ namespace paludis
*/
virtual gid_t reduced_gid() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * Test whether a particular package will break Portage.
+ */
+ bool breaks_portage(const PackageDatabaseEntry &, const VersionMetadata &) const;
};
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index 8ed37b1..c58e294 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -18,7 +18,7 @@ add(`dep_tag', `hh', `cc', `sr')
add(`environment', `hh', `cc')
add(`hashed_containers', `hhx', `cc', `test')
add(`host_tuple_name', `hh', `cc', `sr', `test')
-add(`mask_reasons', `hh', `cc')
+add(`mask_reasons', `hh', `cc', `se')
add(`match_package', `hh', `cc')
add(`name', `hh', `cc', `test', `sr')
add(`package_database', `hh', `cc', `test')
diff --git a/paludis/mask_reasons.cc b/paludis/mask_reasons.cc
index 0f7aae2..842272f 100644
--- a/paludis/mask_reasons.cc
+++ b/paludis/mask_reasons.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -21,56 +21,5 @@
#include <paludis/mask_reasons.hh>
#include <paludis/util/exception.hh>
#include <ostream>
-
-/** \file
- * Implementation of MaskReason classes.
- *
- * \ingroup grpmaskreasons
- */
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const MaskReason & r)
-{
- do
- {
- switch (r)
- {
- case mr_keyword:
- s << "keyword";
- continue;
-
- case mr_user_mask:
- s << "user mask";
- continue;
-
- case mr_profile_mask:
- s << "profile mask";
- continue;
-
- case mr_repository_mask:
- s << "repository mask";
- continue;
-
- case mr_eapi:
- s << "EAPI";
- continue;
-
- case mr_license:
- s << "license";
- continue;
-
- case mr_by_association:
- s << "by association";
- continue;
-
- case last_mr:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "Bad MaskReason value");
- }
- while (false);
-
- return s;
-}
+#include <paludis/mask_reasons-se.cc>
diff --git a/paludis/mask_reasons.hh b/paludis/mask_reasons.hh
index c065475..d3338c0 100644
--- a/paludis/mask_reasons.hh
+++ b/paludis/mask_reasons.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -31,26 +31,8 @@
namespace paludis
{
- /**
- * Each value represents one reason for a package being
- * masked.
- *
- * \see MaskReasons
- *
- * \ingroup grpmaskreasons
- */
- enum MaskReason
- {
- mr_keyword, ///< no keyword match
- mr_user_mask, ///< user package.mask
- mr_profile_mask, ///< profile package.mask
- mr_repository_mask, ///< repository package.mask
- mr_eapi, ///< unknown eapi
- mr_by_association, ///< masked by association with another package (for virtuals)
- mr_license, ///< unaccepted license
- mr_licence = mr_license, ///< convenience alias for those who can spell,
- last_mr ///< number of entries
- };
+
+#include <paludis/mask_reasons-se.hh>
/**
* A collection of reasons for why a package is masked.
@@ -58,14 +40,6 @@ namespace paludis
* \ingroup grpmaskreasons
*/
typedef std::bitset<last_mr> MaskReasons;
-
- /**
- * Stringify a MaskReason.
- *
- * \ingroup grpmaskreasons
- */
- std::ostream &
- operator<< (std::ostream &, const MaskReason &);
}
#endif
diff --git a/paludis/mask_reasons.se b/paludis/mask_reasons.se
new file mode 100644
index 0000000..d0f5839
--- /dev/null
+++ b/paludis/mask_reasons.se
@@ -0,0 +1,28 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_MaskReason()
+{
+ prefix mr
+
+ key mr_keyword "no keyword match"
+ key mr_user_mask "user package.mask"
+ key mr_profile_mask "profile package.mask"
+ key mr_repository_mask "repository package.mask"
+ key mr_eapi "unknown eapi"
+ key mr_by_association "masked by association with another package (for virtuals)"
+ key mr_chost "masked by chost"
+ key mr_breaks_portage "masked because it will break portage"
+ key mr_interactive "interactive"
+ key mr_license "unaccepted license"
+
+ doxygen_comment << "END"
+ /**
+ * Each value represents one reason for a package being masked.
+ *
+ * \see MaskReasons
+ * \ingroup grpmaskreasons
+ */
+END
+}
+
diff --git a/paludis/repositories/cran/cran_version_metadata.cc b/paludis/repositories/cran/cran_version_metadata.cc
index bcfb525..fc8b4c9 100644
--- a/paludis/repositories/cran/cran_version_metadata.cc
+++ b/paludis/repositories/cran/cran_version_metadata.cc
@@ -24,7 +24,7 @@ using namespace paludis;
CRANVersionMetadata::CRANVersionMetadata(bool want_origins) :
VersionMetadata(
- VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN"),
+ VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN", false),
VersionMetadataCapabilities::create()
.cran_interface(this)
.ebuild_interface(0)
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 334f508..8dc1d55 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -304,7 +304,7 @@ FakeRepositoryBase::environment() const
FakeVersionMetadata::FakeVersionMetadata() :
VersionMetadata(
- VersionMetadataBase(SlotName("0"), "", "", "paludis-1"),
+ VersionMetadataBase(SlotName("0"), "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.ebuild_interface(this)
.deps_interface(this)
@@ -327,7 +327,7 @@ FakeVersionMetadata::~FakeVersionMetadata()
FakeVirtualVersionMetadata::FakeVirtualVersionMetadata(const SlotName & s, const PackageDatabaseEntry & p) :
VersionMetadata(
- VersionMetadataBase(s, "", "", "paludis-1"),
+ VersionMetadataBase(s, "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.ebuild_interface(0)
.deps_interface(this)
diff --git a/paludis/repositories/gems/gems_version_metadata.cc b/paludis/repositories/gems/gems_version_metadata.cc
index c07397d..40ffcdd 100644
--- a/paludis/repositories/gems/gems_version_metadata.cc
+++ b/paludis/repositories/gems/gems_version_metadata.cc
@@ -24,7 +24,7 @@ using namespace paludis;
GemsVersionMetadata::GemsVersionMetadata(const VersionSpec & v) :
VersionMetadata(
- VersionMetadataBase(SlotName(stringify(v)), "", "", "paludis-1"),
+ VersionMetadataBase(SlotName(stringify(v)), "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.deps_interface(this)
.ebuild_interface(0)
diff --git a/paludis/repositories/gentoo/ebin.cc b/paludis/repositories/gentoo/ebin.cc
index fc411bd..9a2411f 100644
--- a/paludis/repositories/gentoo/ebin.cc
+++ b/paludis/repositories/gentoo/ebin.cc
@@ -32,7 +32,7 @@ using namespace paludis;
EbinVersionMetadata::EbinVersionMetadata(const SlotName & s) :
VersionMetadata(
- VersionMetadataBase(s, "", "", "paludis-1"),
+ VersionMetadataBase(s, "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.ebin_interface(this)
.ebuild_interface(this)
diff --git a/paludis/repositories/gentoo/ebuild.cc b/paludis/repositories/gentoo/ebuild.cc
index e7d4d4e..ae184b3 100644
--- a/paludis/repositories/gentoo/ebuild.cc
+++ b/paludis/repositories/gentoo/ebuild.cc
@@ -446,7 +446,7 @@ EbuildUninstallCommand::EbuildUninstallCommand(const EbuildCommandParams & p,
EbuildVersionMetadata::EbuildVersionMetadata() :
VersionMetadata(
- VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN"),
+ VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN", false),
VersionMetadataCapabilities::create()
.ebuild_interface(this)
.cran_interface(0)
diff --git a/paludis/repositories/gentoo/portage_virtual_version_metadata.cc b/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
index 1532066..5e4ff7d 100644
--- a/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
+++ b/paludis/repositories/gentoo/portage_virtual_version_metadata.cc
@@ -25,7 +25,7 @@ using namespace paludis;
PortageVirtualVersionMetadata::PortageVirtualVersionMetadata(const SlotName & s,
const PackageDatabaseEntry & e) :
VersionMetadata(
- VersionMetadataBase(s, "", "", "paludis-1"),
+ VersionMetadataBase(s, "", "", "paludis-1", false),
VersionMetadataCapabilities::create()
.virtual_interface(this)
.ebuild_interface(0)
diff --git a/paludis/repositories/gentoo/vdb_version_metadata.cc b/paludis/repositories/gentoo/vdb_version_metadata.cc
index c1290b8..3ced16c 100644
--- a/paludis/repositories/gentoo/vdb_version_metadata.cc
+++ b/paludis/repositories/gentoo/vdb_version_metadata.cc
@@ -24,7 +24,7 @@ using namespace paludis;
VDBVersionMetadata::VDBVersionMetadata() :
VersionMetadata(
- VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN"),
+ VersionMetadataBase(SlotName("unset"), "", "", "UNKNOWN", false),
VersionMetadataCapabilities::create()
.deps_interface(this)
.origins_interface(this)
@@ -46,7 +46,7 @@ VDBVersionMetadata::~VDBVersionMetadata()
VDBVirtualVersionMetadata::VDBVirtualVersionMetadata(const SlotName & s,
const PackageDatabaseEntry & e) :
VersionMetadata(
- VersionMetadataBase(s, "", "", "UNKNOWN"),
+ VersionMetadataBase(s, "", "", "UNKNOWN", false),
VersionMetadataCapabilities::create()
.deps_interface(this)
.origins_interface(0)
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
index 0929dd8..e4b9cd0 100644
--- a/paludis/version_metadata.sr
+++ b/paludis/version_metadata.sr
@@ -121,6 +121,7 @@ make_class_VersionMetadataBase()
key homepage std::string
key description std::string
key eapi std::string
+ key interactive bool
allow_named_args
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 370a439..9919e1b 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -499,6 +499,18 @@ VersionSpec::is_scm() const
return result;
}
+bool
+VersionSpec::has_try_part() const
+{
+ return _imp->parts.end() != std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<trypart>());
+}
+
+bool
+VersionSpec::has_scm_part() const
+{
+ return _imp->parts.end() != std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<scm>());
+}
+
VersionSpec
VersionSpec::bump() const
{
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index 1aab313..82599b2 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* 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
@@ -135,6 +135,17 @@ namespace paludis
*/
bool is_scm() const;
+ /**
+ * Do we have a -try part?
+ */
+ bool has_try_part() const;
+
+ /**
+ * Do we have an -scm part?
+ *
+ * Use is_scm() if -9999 etc is desired.
+ */
+ bool has_scm_part() const;
};
/**
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index 513407a..6421ad4 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -197,6 +197,14 @@ int do_query(std::tr1::shared_ptr<Environment> env)
case mr_by_association:
cout << "* " << colour(cl_masked, "A") << ": by association";
break;
+ case mr_chost:
+ cout << "* " << colour(cl_masked, "A") << ": wrong CHOST";
+ break;
+ case mr_breaks_portage:
+ cout << "* " << colour(cl_masked, "B") << ": breaks Portage";
+ break;
+ case mr_interactive:
+ cout << "* " << colour(cl_masked, "B") << ": interactive";
case last_mr:
break;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index ba06725..f44175a 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -162,6 +162,15 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
case mr_by_association:
reasons.append("A");
break;
+ case mr_chost:
+ reasons.append("C");
+ break;
+ case mr_breaks_portage:
+ reasons.append("B");
+ break;
+ case mr_interactive:
+ reasons.append("I");
+ break;
case last_mr:
break;
}