aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
Diffstat (limited to 'paludis')
-rw-r--r--paludis/action.cc129
-rw-r--r--paludis/action.hh47
-rw-r--r--paludis/create_output_manager_info.cc165
-rw-r--r--paludis/create_output_manager_info.hh52
-rw-r--r--paludis/environments/paludis/Makefile.am1
-rw-r--r--paludis/environments/paludis/action_to_string.cc72
-rw-r--r--paludis/environments/paludis/action_to_string.hh34
-rw-r--r--paludis/environments/paludis/output_conf.cc17
-rw-r--r--paludis/repositories/accounts/accounts_id.cc2
-rw-r--r--paludis/repositories/accounts/installed_accounts_id.cc4
-rw-r--r--paludis/repositories/cran/cran_package_id.cc4
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc10
-rw-r--r--paludis/repositories/e/ebuild_id.cc6
-rw-r--r--paludis/repositories/fake/fake_package_id.cc16
-rw-r--r--paludis/repositories/gems/gem_specification.cc16
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc4
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc14
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc2
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc4
-rw-r--r--paludis/repositories/virtuals/package_id.cc16
-rw-r--r--paludis/sync_task.cc4
21 files changed, 375 insertions, 244 deletions
diff --git a/paludis/action.cc b/paludis/action.cc
index c130391df..05f966e35 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -222,67 +222,104 @@ SupportsActionTestBase::~SupportsActionTestBase()
{
}
-namespace
+ActionFailedError::ActionFailedError(const std::string & msg) throw () :
+ Exception(msg)
{
- struct ActionStringifier
- {
- std::string visit(const InstallAction & a)
- {
- std::string s("install to ");
- if (a.options.destination())
- s.append(stringify(a.options.destination()->name()));
- else
- s.append("nowhere");
- return s;
- }
+}
- std::string visit(const UninstallAction &)
- {
- return "uninstall";
- }
+ActionAbortedError::ActionAbortedError(const std::string & msg) throw () :
+ Exception(msg)
+{
+}
- std::string visit(const PretendAction &)
- {
- return "pretend";
- }
+const std::string
+FetchAction::simple_name() const
+{
+ return FetchAction::class_simple_name();
+}
- std::string visit(const ConfigAction &)
- {
- return "config";
- }
+const std::string
+InstallAction::simple_name() const
+{
+ return InstallAction::class_simple_name();
+}
- std::string visit(const InfoAction &)
- {
- return "info";
- }
+const std::string
+UninstallAction::simple_name() const
+{
+ return UninstallAction::class_simple_name();
+}
- std::string visit(const FetchAction &)
- {
- return "fetch";
- }
+const std::string
+PretendAction::simple_name() const
+{
+ return PretendAction::class_simple_name();
+}
- std::string visit(const PretendFetchAction &)
- {
- return "pretend fetch";
- }
- };
+const std::string
+PretendFetchAction::simple_name() const
+{
+ return PretendFetchAction::class_simple_name();
}
-std::ostream &
-paludis::operator<< (std::ostream & s, const Action & a)
+const std::string
+ConfigAction::simple_name() const
{
- ActionStringifier t;
- return s << a.accept_returning<std::string>(t);
+ return ConfigAction::class_simple_name();
}
-ActionFailedError::ActionFailedError(const std::string & msg) throw () :
- Exception(msg)
+const std::string
+InfoAction::simple_name() const
{
+ return InfoAction::class_simple_name();
}
-ActionAbortedError::ActionAbortedError(const std::string & msg) throw () :
- Exception(msg)
+const std::string
+FetchAction::class_simple_name()
+{
+ return "fetch";
+}
+
+const std::string
+FetchAction::ignore_unfetched_flag_name()
+{
+ return "ignore_unfetched";
+}
+
+const std::string
+InstallAction::class_simple_name()
+{
+ return "install";
+}
+
+const std::string
+UninstallAction::class_simple_name()
+{
+ return "uninstall";
+}
+
+const std::string
+PretendAction::class_simple_name()
+{
+ return "pretend";
+}
+
+const std::string
+PretendFetchAction::class_simple_name()
+{
+ return "pretend-fetch";
+}
+
+const std::string
+InfoAction::class_simple_name()
+{
+ return "info";
+}
+
+const std::string
+ConfigAction::class_simple_name()
{
+ return "config";
}
template class PrivateImplementationPattern<FetchAction>;
diff --git a/paludis/action.hh b/paludis/action.hh
index 853753828..f0c2ead58 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -242,6 +242,13 @@ namespace paludis
virtual ~Action() = 0;
///\}
+
+ /**
+ * A simple string name (install, uninstall, pretend-fetch etc).
+ *
+ * \since 0.44
+ */
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
};
/**
@@ -268,6 +275,10 @@ namespace paludis
/// Options for the action.
const InstallActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -294,6 +305,11 @@ namespace paludis
/// Options for the action.
const FetchActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const std::string ignore_unfetched_flag_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -319,6 +335,10 @@ namespace paludis
/// Options for the action.
const UninstallActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -375,6 +395,10 @@ namespace paludis
* \since 0.36
*/
const PretendActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -404,6 +428,10 @@ namespace paludis
/// Signal that we will fetch a particular file.
virtual void will_fetch(const FSEntry & destination, const unsigned long size_in_bytes) = 0;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -455,6 +483,10 @@ namespace paludis
* \since 0.36
*/
const ConfigActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -511,6 +543,10 @@ namespace paludis
* \since 0.36
*/
const InfoActionOptions & options;
+
+ virtual const std::string simple_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const std::string class_simple_name() PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -554,15 +590,6 @@ namespace paludis
};
/**
- * An Action can be written to a std::ostream.
- *
- * \since 0.26
- * \ingroup g_actions
- * \nosubgrouping
- */
- std::ostream & operator<< (std::ostream &, const Action &) PALUDIS_VISIBLE;
-
- /**
* Thrown if an action fails.
*
* \ingroup g_actions
diff --git a/paludis/create_output_manager_info.cc b/paludis/create_output_manager_info.cc
index f78474233..46fa0f382 100644
--- a/paludis/create_output_manager_info.cc
+++ b/paludis/create_output_manager_info.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 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
@@ -21,25 +21,84 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/serialise-impl.hh>
+#include <paludis/action.hh>
+#include <paludis/name.hh>
#include <ostream>
using namespace paludis;
#include <paludis/create_output_manager_info-se.cc>
+namespace
+{
+ struct GetFlagsVisitor
+ {
+ std::tr1::shared_ptr<Set<std::string> > visit(const InstallAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const UninstallAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const PretendAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const FetchAction & a) const
+ {
+ std::tr1::shared_ptr<Set<std::string> > result(new Set<std::string>);
+ if (a.options.ignore_unfetched())
+ result->insert(FetchAction::ignore_unfetched_flag_name());
+ return result;
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const PretendFetchAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const ConfigAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+
+ std::tr1::shared_ptr<Set<std::string> > visit(const InfoAction &) const
+ {
+ return make_shared_ptr(new Set<std::string>);
+ }
+ };
+
+ std::tr1::shared_ptr<Set<std::string> > get_flags(const Action & a)
+ {
+ return a.accept_returning<std::tr1::shared_ptr<Set<std::string> > >(GetFlagsVisitor());
+ }
+}
+
namespace paludis
{
template <>
struct Implementation<CreateOutputManagerForPackageIDActionInfo>
{
const std::tr1::shared_ptr<const PackageID> id;
- const Action & action;
+ const std::string action_name;
+ const std::tr1::shared_ptr<const Set<std::string> > action_flags;
const OutputExclusivity output_exclusivity;
Implementation(const std::tr1::shared_ptr<const PackageID> & i,
- const Action & a, const OutputExclusivity e) :
+ const std::string & a,
+ const std::tr1::shared_ptr<const Set<std::string> > & f,
+ const OutputExclusivity e) :
id(i),
- action(a),
+ action_name(a),
+ action_flags(f),
output_exclusivity(e)
{
}
@@ -48,23 +107,45 @@ namespace paludis
template <>
struct Implementation<CreateOutputManagerForRepositorySyncInfo>
{
- const Repository & repo;
+ const RepositoryName repo_name;
const OutputExclusivity output_exclusivity;
- Implementation(const Repository & r, const OutputExclusivity e) :
- repo(r),
+ Implementation(const RepositoryName & r, const OutputExclusivity e) :
+ repo_name(r),
output_exclusivity(e)
{
}
};
}
+const std::tr1::shared_ptr<CreateOutputManagerInfo>
+CreateOutputManagerInfo::deserialise(Deserialisation & d)
+{
+ if (d.class_name() == "CreateOutputManagerForPackageIDActionInfo")
+ return CreateOutputManagerForPackageIDActionInfo::deserialise(d);
+ else if (d.class_name() == "CreateOutputManagerForRepositorySyncInfo")
+ return CreateOutputManagerForRepositorySyncInfo::deserialise(d);
+ else
+ throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'");
+}
+
CreateOutputManagerForPackageIDActionInfo::CreateOutputManagerForPackageIDActionInfo(
const std::tr1::shared_ptr<const PackageID> & i,
const Action & a,
const OutputExclusivity e) :
PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>(
- new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a, e))
+ new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a.simple_name(),
+ get_flags(a), e))
+{
+}
+
+CreateOutputManagerForPackageIDActionInfo::CreateOutputManagerForPackageIDActionInfo(
+ const std::tr1::shared_ptr<const PackageID> & i,
+ const std::string & a,
+ const std::tr1::shared_ptr<const Set<std::string> > & f,
+ const OutputExclusivity e) :
+ PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>(
+ new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a, f, e))
{
}
@@ -78,10 +159,16 @@ CreateOutputManagerForPackageIDActionInfo::package_id() const
return _imp->id;
}
-const Action &
-CreateOutputManagerForPackageIDActionInfo::action() const
+const std::string
+CreateOutputManagerForPackageIDActionInfo::action_name() const
+{
+ return _imp->action_name;
+}
+
+const std::tr1::shared_ptr<const Set<std::string> >
+CreateOutputManagerForPackageIDActionInfo::action_flags() const
{
- return _imp->action;
+ return _imp->action_flags;
}
OutputExclusivity
@@ -90,8 +177,37 @@ CreateOutputManagerForPackageIDActionInfo::output_exclusivity() const
return _imp->output_exclusivity;
}
+void
+CreateOutputManagerForPackageIDActionInfo::serialise(Serialiser & s) const
+{
+ s.object("CreateOutputManagerForPackageIDActionInfo")
+ .member(SerialiserFlags<serialise::might_be_null, serialise::container>(), "action_flags", action_flags())
+ .member(SerialiserFlags<>(), "action_name", action_name())
+ .member(SerialiserFlags<>(), "output_exclusivity", stringify(output_exclusivity()))
+ .member(SerialiserFlags<serialise::might_be_null>(), "package_id", package_id())
+ ;
+}
+
+const std::tr1::shared_ptr<CreateOutputManagerForPackageIDActionInfo>
+CreateOutputManagerForPackageIDActionInfo::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "CreateOutputManagerForPackageIDActionInfo");
+
+ std::tr1::shared_ptr<Set<std::string> > action_flags(new Set<std::string>);
+ Deserialisator vv(*v.find_remove_member("action_flags"), "c");
+ for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
+ action_flags->insert(vv.member<std::string>(stringify(n)));
+
+ return make_shared_ptr(new CreateOutputManagerForPackageIDActionInfo(
+ v.member<std::tr1::shared_ptr<const PackageID> >("package_id"),
+ v.member<std::string>("action_name"),
+ action_flags,
+ destringify<OutputExclusivity>(v.member<std::string>("output_exclusivity"))
+ ));
+}
+
CreateOutputManagerForRepositorySyncInfo::CreateOutputManagerForRepositorySyncInfo(
- const Repository & r, const OutputExclusivity e) :
+ const RepositoryName & r, const OutputExclusivity e) :
PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>(
new Implementation<CreateOutputManagerForRepositorySyncInfo>(r, e))
{
@@ -101,10 +217,10 @@ CreateOutputManagerForRepositorySyncInfo::~CreateOutputManagerForRepositorySyncI
{
}
-const Repository &
-CreateOutputManagerForRepositorySyncInfo::repository() const
+const RepositoryName
+CreateOutputManagerForRepositorySyncInfo::repository_name() const
{
- return _imp->repo;
+ return _imp->repo_name;
}
OutputExclusivity
@@ -113,6 +229,25 @@ CreateOutputManagerForRepositorySyncInfo::output_exclusivity() const
return _imp->output_exclusivity;
}
+void
+CreateOutputManagerForRepositorySyncInfo::serialise(Serialiser & s) const
+{
+ s.object("CreateOutputManagerForRepositorySyncInfo")
+ .member(SerialiserFlags<>(), "repository_name", stringify(repository_name()))
+ .member(SerialiserFlags<>(), "output_exclusivity", stringify(output_exclusivity()))
+ ;
+}
+
+const std::tr1::shared_ptr<CreateOutputManagerForRepositorySyncInfo>
+CreateOutputManagerForRepositorySyncInfo::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "CreateOutputManagerForRepositorySyncInfo");
+ return make_shared_ptr(new CreateOutputManagerForRepositorySyncInfo(
+ RepositoryName(v.member<std::string>("repo_name")),
+ destringify<OutputExclusivity>(v.member<std::string>("output_exclusivity"))
+ ));
+}
+
template class PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>;
template class PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>;
diff --git a/paludis/create_output_manager_info.hh b/paludis/create_output_manager_info.hh
index 99d361989..ac10c7e85 100644
--- a/paludis/create_output_manager_info.hh
+++ b/paludis/create_output_manager_info.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 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
@@ -25,9 +25,11 @@
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/type_list.hh>
-#include <paludis/action-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/repository-fwd.hh>
+#include <paludis/serialise-fwd.hh>
+#include <paludis/action-fwd.hh>
+#include <paludis/name-fwd.hh>
namespace paludis
{
@@ -44,6 +46,11 @@ namespace paludis
CreateOutputManagerForRepositorySyncInfo
>::Type>
{
+ public:
+ static const std::tr1::shared_ptr<CreateOutputManagerInfo> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const = 0;
};
/**
@@ -60,16 +67,40 @@ namespace paludis
public ImplementAcceptMethods<CreateOutputManagerInfo, CreateOutputManagerForPackageIDActionInfo>
{
public:
+ /**
+ * \since 0.44
+ */
+ CreateOutputManagerForPackageIDActionInfo(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::string & action_name,
+ const std::tr1::shared_ptr<const Set<std::string> > & action_flags,
+ const OutputExclusivity output_exclusivity);
+
CreateOutputManagerForPackageIDActionInfo(
const std::tr1::shared_ptr<const PackageID> & id,
- const Action & action,
+ const Action &,
const OutputExclusivity output_exclusivity);
~CreateOutputManagerForPackageIDActionInfo();
const std::tr1::shared_ptr<const PackageID> package_id() const PALUDIS_ATTRIBUTE((warn_unused_result));
- const Action & action() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * \since 0.44
+ */
+ const std::string action_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * \since 0.44
+ */
+ const std::tr1::shared_ptr<const Set<std::string> > action_flags() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
OutputExclusivity output_exclusivity() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+
+ static const std::tr1::shared_ptr<CreateOutputManagerForPackageIDActionInfo> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -87,13 +118,22 @@ namespace paludis
{
public:
CreateOutputManagerForRepositorySyncInfo(
- const Repository & repo,
+ const RepositoryName & repo_name,
const OutputExclusivity);
~CreateOutputManagerForRepositorySyncInfo();
- const Repository & repository() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ /**
+ * \since 0.44
+ */
+ const RepositoryName repository_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
OutputExclusivity output_exclusivity() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void serialise(Serialiser &) const;
+
+ static const std::tr1::shared_ptr<CreateOutputManagerForRepositorySyncInfo> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/environments/paludis/Makefile.am b/paludis/environments/paludis/Makefile.am
index c32a93990..bf0ddc01f 100644
--- a/paludis/environments/paludis/Makefile.am
+++ b/paludis/environments/paludis/Makefile.am
@@ -10,7 +10,6 @@ DEFS= \
-DSHAREDIR=\"$(datarootdir)\"
libpaludispaludisenvironment_la_SOURCES = \
- action_to_string.cc action_to_string.hh \
bashable_conf.cc bashable_conf.hh \
keywords_conf.cc keywords_conf.hh \
licenses_conf.cc licenses_conf.hh \
diff --git a/paludis/environments/paludis/action_to_string.cc b/paludis/environments/paludis/action_to_string.cc
deleted file mode 100644
index dc38c1be2..000000000
--- a/paludis/environments/paludis/action_to_string.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2009 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/environments/paludis/action_to_string.hh>
-#include <paludis/action.hh>
-
-using namespace paludis;
-
-namespace
-{
- struct ActionToString
- {
- std::string visit(const InstallAction &) const
- {
- return "install";
- }
-
- std::string visit(const PretendFetchAction &) const
- {
- return "pretend-fetch";
- }
-
- std::string visit(const UninstallAction &) const
- {
- return "uninstall";
- }
-
- std::string visit(const FetchAction &) const
- {
- return "fetch";
- }
-
- std::string visit(const PretendAction &) const
- {
- return "pretend";
- }
-
- std::string visit(const InfoAction &) const
- {
- return "info";
- }
-
- std::string visit(const ConfigAction &) const
- {
- return "config";
- }
- };
-}
-
-const std::string
-paludis::paludis_environment::action_to_string(const Action & a)
-{
- ActionToString v;
- return a.accept_returning<std::string>(v);
-}
-
diff --git a/paludis/environments/paludis/action_to_string.hh b/paludis/environments/paludis/action_to_string.hh
deleted file mode 100644
index a2049efef..000000000
--- a/paludis/environments/paludis/action_to_string.hh
+++ /dev/null
@@ -1,34 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2009 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENTS_PALUDIS_ACTION_TO_STRING_HH
-#define PALUDIS_GUARD_PALUDIS_ENVIRONMENTS_PALUDIS_ACTION_TO_STRING_HH 1
-
-#include <string>
-#include <paludis/action-fwd.hh>
-
-namespace paludis
-{
- namespace paludis_environment
- {
- const std::string action_to_string(const Action & a);
- }
-}
-
-#endif
diff --git a/paludis/environments/paludis/output_conf.cc b/paludis/environments/paludis/output_conf.cc
index 29cce1d23..177d459f2 100644
--- a/paludis/environments/paludis/output_conf.cc
+++ b/paludis/environments/paludis/output_conf.cc
@@ -21,7 +21,6 @@
#include <paludis/environments/paludis/bashable_conf.hh>
#include <paludis/environments/paludis/paludis_config.hh>
#include <paludis/environments/paludis/paludis_environment.hh>
-#include <paludis/environments/paludis/action_to_string.hh>
#include <paludis/util/log.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/tokeniser.hh>
@@ -157,7 +156,7 @@ namespace
if (rule.type_requirement() != "*" && rule.type_requirement() != "repository")
return false;
- if (rule.name_requirement() != "*" && rule.name_requirement() != stringify(i.repository().name()))
+ if (rule.name_requirement() != "*" && rule.name_requirement() != stringify(i.repository_name()))
return false;
if (rule.action_requirement() != "*" && rule.action_requirement() != "sync")
@@ -184,7 +183,7 @@ namespace
if (rule.name_requirement() != "*" && rule.name_requirement() != stringify(i.package_id()->name()))
return false;
- if (rule.action_requirement() != "*" && rule.action_requirement() != action_to_string(i.action()))
+ if (rule.action_requirement() != "*" && rule.action_requirement() != i.action_name())
return false;
if (-1 != rule.output_exclusivity_requirement() &&
@@ -197,10 +196,10 @@ namespace
if (! rule.ignore_unfetched_requirement().is_indeterminate())
{
- const FetchAction * const fetch_action(simple_visitor_cast<const FetchAction>(i.action()));
- if (! fetch_action)
+ if (i.action_name() != FetchAction::class_simple_name())
return false;
- if (fetch_action->options.ignore_unfetched() != rule.ignore_unfetched_requirement().is_true())
+ if ((i.action_flags()->end() != i.action_flags()->find(FetchAction::ignore_unfetched_flag_name())) !=
+ rule.ignore_unfetched_requirement().is_true())
return false;
}
@@ -244,14 +243,14 @@ namespace
{
m->insert("type", "repository");
m->insert("action", "sync");
- m->insert("name", stringify(i.repository().name()));
- m->insert("full_name", stringify(i.repository().name()));
+ m->insert("name", stringify(i.repository_name()));
+ m->insert("full_name", stringify(i.repository_name()));
}
void visit(const CreateOutputManagerForPackageIDActionInfo & i)
{
m->insert("type", "package");
- m->insert("action", action_to_string(i.action()));
+ m->insert("action", i.action_name());
m->insert("name", stringify(i.package_id()->name()));
m->insert("id", escape(stringify(*i.package_id())));
m->insert("full_name", escape(stringify(*i.package_id())));
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index ac2da8467..9ef44c9d1 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -467,7 +467,7 @@ AccountsID::perform_action(Action & action) const
const InstallAction * const install_action(simple_visitor_cast<const InstallAction>(action));
if (! install_action)
- throw ActionFailedError("Unsupported action: " + stringify(action));
+ throw ActionFailedError("Unsupported action: " + action.simple_name());
if (! (*install_action->options.destination()).destination_interface())
throw ActionFailedError("Can't install '" + stringify(*this)
diff --git a/paludis/repositories/accounts/installed_accounts_id.cc b/paludis/repositories/accounts/installed_accounts_id.cc
index c239a0743..188bc8f23 100644
--- a/paludis/repositories/accounts/installed_accounts_id.cc
+++ b/paludis/repositories/accounts/installed_accounts_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 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
@@ -362,6 +362,6 @@ InstalledAccountsID::supports_action(const SupportsActionTestBase &) const
void
InstalledAccountsID::perform_action(Action & action) const
{
- throw ActionFailedError("Unsupported action: " + stringify(action));
+ throw ActionFailedError("Unsupported action: " + action.simple_name());
}
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 762c46418..ab57a8533 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006, 2007 Danny van Dyk
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -522,7 +522,7 @@ CRANPackageID::supports_action(const SupportsActionTestBase & b) const
void
CRANPackageID::perform_action(Action & a) const
{
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 6432b755b..b51155517 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -954,22 +954,22 @@ namespace
void PerformAction::visit(const InstallAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void PerformAction::visit(const PretendAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void PerformAction::visit(const FetchAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void PerformAction::visit(const PretendFetchAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index d6f17c564..958a07045 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -1174,12 +1174,12 @@ namespace
void PerformAction::visit(UninstallAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void PerformAction::visit(ConfigAction & a)
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index c6be2bf37..e2e5a6773 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -1123,49 +1123,49 @@ namespace
{
SupportsActionTest<InstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
};
}
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index a05d45741..c22daccfc 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -527,49 +527,49 @@ namespace
{
SupportsActionTest<InstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action '" + stringify(a) + "'");
+ throw ActionFailedError("Unsupported action '" + a.simple_name() + "'");
}
};
}
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index e0cdfe99a..dab149853 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010 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
@@ -162,7 +162,7 @@ UnavailableID::supports_action(const SupportsActionTestBase & a) const
void
UnavailableID::perform_action(Action & a) const
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
std::tr1::shared_ptr<const Set<std::string> >
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index eff03a4bd..b9e131821 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -744,32 +744,32 @@ namespace
void visit(InstallAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(FetchAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(ConfigAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(PretendAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(PretendFetchAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(InfoAction & a) PALUDIS_ATTRIBUTE((noreturn))
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(UninstallAction & a)
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 8d40a5183..9f8b1d5f9 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -340,7 +340,7 @@ UnpackagedID::perform_action(Action & action) const
const InstallAction * const install_action(simple_visitor_cast<const InstallAction>(action));
if (! install_action)
- throw ActionFailedError("Unsupported action: " + stringify(action));
+ throw ActionFailedError("Unsupported action: " + action.simple_name());
if (! (*install_action->options.destination()).destination_interface())
throw ActionFailedError("Can't install '" + stringify(*this)
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index 360ace9f5..d6cacb21a 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010 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
@@ -168,7 +168,7 @@ UnwrittenID::supports_action(const SupportsActionTestBase & a) const
void
UnwrittenID::perform_action(Action & a) const
{
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
std::tr1::shared_ptr<const Set<std::string> >
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index ab07b7990..9e3d3e26e 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010 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
@@ -392,49 +392,49 @@ namespace
{
SupportsActionTest<InstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const UninstallAction & a)
{
SupportsActionTest<UninstallAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const FetchAction & a)
{
SupportsActionTest<FetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const InfoAction & a)
{
SupportsActionTest<InfoAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
void visit(const PretendFetchAction & a)
{
SupportsActionTest<PretendFetchAction> t;
if (! id->repository()->some_ids_might_support_action(t))
- throw ActionFailedError("Unsupported action: " + stringify(a));
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
}
};
}
diff --git a/paludis/sync_task.cc b/paludis/sync_task.cc
index 3fcc8a9b6..17aebee51 100644
--- a/paludis/sync_task.cc
+++ b/paludis/sync_task.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010 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
@@ -119,7 +119,7 @@ namespace
}
std::tr1::shared_ptr<const Repository> rr(env->package_database()->fetch_repository(r));
- CreateOutputManagerForRepositorySyncInfo info(*rr, oe_exclusive);
+ CreateOutputManagerForRepositorySyncInfo info(rr->name(), oe_exclusive);
std::tr1::shared_ptr<OutputManager> output_manager(env->create_output_manager(info));
if (rr->sync(output_manager))
{