aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Kim Højgaard-Hansen <kimrhh@exherbo.org> 2009-01-29 23:52:10 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2009-02-02 20:01:54 +0000
commit76de0bab2143e1ac4beb3e9d419b3f0c508e86a3 (patch)
treee883dccedb30383f7f16458c6689071d975196f1
parent6495cff03b28792bd5ef8bdb7d97d77a7666a67e (diff)
downloadpaludis-76de0bab2143e1ac4beb3e9d419b3f0c508e86a3.tar.gz
paludis-76de0bab2143e1ac4beb3e9d419b3f0c508e86a3.tar.xz
add manifest generation client
-rw-r--r--configure.ac4
-rw-r--r--doc/clients/Makefile.am10
-rw-r--r--src/clients/appareo/Makefile.am86
-rw-r--r--src/clients/appareo/appareo.cc330
-rw-r--r--src/clients/appareo/command_line.cc92
-rw-r--r--src/clients/appareo/command_line.hh68
-rwxr-xr-xsrc/clients/appareo/help_TEST4
-rw-r--r--src/clients/appareo/man_appareo.cc79
-rwxr-xr-xsrc/clients/appareo/version_TEST4
9 files changed, 676 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index edf0f48..fd94c1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1339,7 +1339,7 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis
dnl }}}
dnl {{{ clients
-ALL_CLIENTS="accerso adjutrix cave importare inquisitio instruo paludis qualudis reconcilio"
+ALL_CLIENTS="accerso adjutrix appareo cave importare inquisitio instruo paludis qualudis reconcilio"
ALL_CLIENTS_HTML=""
for a in $ALL_CLIENTS ; do
if test x$a = xcave ; then
@@ -1362,6 +1362,7 @@ AC_ARG_WITH([clients],
accerso A fetch / mirror client
adjutrix A tool for tree querying
+ appareo A tool for generating manifests
cave The modular Paludis client
importare On-the-fly unpackaged installer
inquisitio A search client
@@ -1561,6 +1562,7 @@ AC_OUTPUT(
src/clients/Makefile
src/clients/accerso/Makefile
src/clients/adjutrix/Makefile
+ src/clients/appareo/Makefile
src/clients/cave/Makefile
src/clients/importare/Makefile
src/clients/inquisitio/Makefile
diff --git a/doc/clients/Makefile.am b/doc/clients/Makefile.am
index f08720b..93dcb11 100644
--- a/doc/clients/Makefile.am
+++ b/doc/clients/Makefile.am
@@ -62,6 +62,16 @@ adjutrix.html : header.html.part footer.html.part
fi ; } && \
cat footer.html.part ; } > $@
+appareo.html : header.html.part footer.html.part
+ { cat header.html.part && { \
+ if test -x $(top_builddir)/src/clients/appareo/man-appareo ; then \
+ $(top_builddir)/src/clients/appareo/man-appareo --html ; \
+ else \
+ echo "<h1>appareo</h1>"; \
+ echo "<p>Sorry, documentation was generated without support for the appareo client.</p>" ; \
+ fi ; } && \
+ cat footer.html.part ; } > $@
+
inquisitio.html : header.html.part footer.html.part
{ cat header.html.part && { \
if test -x $(top_builddir)/src/clients/inquisitio/man-inquisitio ; then \
diff --git a/src/clients/appareo/Makefile.am b/src/clients/appareo/Makefile.am
new file mode 100644
index 0000000..b6c34b4
--- /dev/null
+++ b/src/clients/appareo/Makefile.am
@@ -0,0 +1,86 @@
+AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src \
+ @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
+DEFS= \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DLIBDIR=\"$(libdir)\"
+
+SUBDIRS = .
+
+bin_PROGRAMS = appareo
+noinst_PROGRAMS = man-appareo
+man_MANS = appareo.1
+
+appareo.1 : man-appareo
+ ./man-appareo > $@
+
+man_appareo_SOURCES = \
+ man_appareo.cc \
+ command_line.hh \
+ command_line.cc
+
+man_appareo_LDADD = \
+ $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/args/libpaludisman_@PALUDIS_PC_SLOT@.a \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/libpaludismanpagethings_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/src/output/liboutput.a \
+ $(DYNAMIC_LD_LIBS)
+
+appareo_SOURCES = \
+ command_line.hh command_line.cc \
+ appareo.cc
+
+appareo_LDADD = \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/environments/no_config/libpaludisnoconfigenvironment_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/src/output/liboutput.a \
+ $(DYNAMIC_LD_LIBS)
+
+TESTS_ENVIRONMENT = env \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ PALUDIS_NO_GLOBAL_HOOKS="yes" \
+ PALUDIS_NO_XTERM_TITLES="yes" \
+ PALUDIS_OPTIONS="" \
+ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EXTRA_EBUILD_MODULES_DIRS="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
+ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \
+ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
+ PALUDIS_DISTRIBUTION="gentoo" \
+ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \
+ PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \
+ PALUDIS_NO_CHOWN="yupyup" \
+ PALUDIS_REDUCED_USERNAME="`id -un`" \
+ PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
+ TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
+ SYSCONFDIR="$(sysconfdir)" \
+ bash $(top_srcdir)/test/run_test.sh bash
+
+TESTS = version_TEST \
+ help_TEST
+
+EXTRA_DIST = \
+ $(man_MANS) \
+ $(TESTS)
+
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail
+DISTCLEANFILES = $(man_MANS) $(noinst_DATA)
+MAINTAINERCLEANFILES = Makefile.in
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
+DISTCHECK_DEPS = appareo.1
+
+distcheck-deps-local : $(DISTCHECK_DEPS)
+
+distcheck-deps : distcheck-deps-subdirs
+
+distcheck-deps-subdirs :
+ for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
+ else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/src/clients/appareo/appareo.cc b/src/clients/appareo/appareo.cc
new file mode 100644
index 0000000..524b2a0
--- /dev/null
+++ b/src/clients/appareo/appareo.cc
@@ -0,0 +1,330 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Kim Højgaard-Hansen
+ * Copyright (c) 2007, 2008 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 <output/colour.hh>
+#include <paludis/args/do_help.hh>
+#include "command_line.hh"
+#include <paludis/about.hh>
+#include <paludis/action.hh>
+#include <paludis/package_id.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/environments/no_config/no_config_environment.hh>
+#include <paludis/selection.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/util/set.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/package_database.hh>
+#include <tr1/functional>
+#include <iostream>
+#include <fstream>
+#include <map>
+
+using namespace paludis;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+typedef std::multimap<std::tr1::shared_ptr<const PackageID>, std::string, PackageIDComparator> IDMap;
+
+namespace
+{
+ FSEntry get_location_and_add_filters()
+ {
+ Context context("When determining tree location:");
+
+ if (CommandLine::get_instance()->a_repository_directory.specified())
+ return FSEntry(CommandLine::get_instance()->a_repository_directory.argument());
+
+ if ((FSEntry::cwd() / "profiles").is_directory())
+ return FSEntry::cwd();
+
+ if ((FSEntry::cwd().dirname() / "profiles").is_directory())
+ {
+ CommandLine::get_instance()->a_category.add_argument(FSEntry::cwd().basename());
+ CommandLine::get_instance()->a_category.set_specified(true);
+ return FSEntry::cwd().dirname();
+ }
+
+ if ((FSEntry::cwd().dirname().dirname() / "profiles").is_directory())
+ {
+ CommandLine::get_instance()->a_package.add_argument(FSEntry::cwd().basename());
+ CommandLine::get_instance()->a_package.set_specified(true);
+ CommandLine::get_instance()->a_category.add_argument(FSEntry::cwd().dirname().basename());
+ CommandLine::get_instance()->a_category.set_specified(true);
+ return FSEntry::cwd().dirname().dirname();
+ }
+
+ throw ConfigurationError("Cannot find tree location (try specifying --repository-dir)");
+ }
+
+ void fetch_ids(const std::tr1::shared_ptr<const PackageIDSequence> & ids, IDMap & results, unsigned & success, unsigned & total)
+ {
+ for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ {
+ Context i_context("When fetching ID '" + stringify(**i) + "':");
+
+ cout << "Processing " << colour(cl_package_name, stringify(**i)) << "..." << endl;
+ ++total;
+
+ try
+ {
+ if ((*i)->supports_action(SupportsActionTest<FetchAction>()))
+ {
+ FetchAction a(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
+ value_for<n::fetch_unneeded>(true),
+ value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
+ value_for<n::safe_resume>(true)
+ ));
+ (*i)->perform_action(a);
+ ++success;
+ }
+ else
+ results.insert(std::make_pair(*i, "Does not support fetching"));
+ }
+ catch (const FetchActionError & e)
+ {
+ if (e.failures())
+ {
+ for (Sequence<FetchActionFailure>::ConstIterator f(e.failures()->begin()), f_end(e.failures()->end()) ; f != f_end ; ++f)
+ {
+ std::string r;
+ if (f->requires_manual_fetching())
+ r = "manual";
+
+ if (f->failed_automatic_fetching())
+ {
+ if (! r.empty())
+ r.append(", ");
+ r.append("could not fetch");
+ }
+
+ if (! f->failed_integrity_checks().empty())
+ {
+ if (! r.empty())
+ r.append(", ");
+ r.append(f->failed_integrity_checks());
+ }
+
+ results.insert(std::make_pair(*i, f->target_file() + ": " + r));
+ }
+ }
+ else
+ results.insert(std::make_pair(*i, "Unknown fetch error"));
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & e)
+ {
+ results.insert(std::make_pair(*i, "Uncaught exception '" + e.message() + "' (" + e.what() + ")"));
+ }
+ }
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ std::string options(getenv_with_default("APPAREO_OPTIONS", ""));
+ if (! options.empty())
+ options = "(" + options + ") ";
+ options += join(argv + 1, argv + argc, " ");
+
+ Context context(std::string("In program ") + argv[0] + " " + options + ":");
+
+ try
+ {
+ CommandLine::get_instance()->run(argc, argv, "appareo", "APPAREO_OPTIONS", "APPAREO_CMDLINE");
+ set_use_colour(
+ (! CommandLine::get_instance()->a_no_color.specified()) &&
+ (! CommandLine::get_instance()->a_report_file.specified()));
+
+ if (CommandLine::get_instance()->a_help.specified())
+ throw args::DoHelp();
+
+ if (CommandLine::get_instance()->a_log_level.specified())
+ Log::get_instance()->set_log_level(CommandLine::get_instance()->a_log_level.option());
+ else
+ Log::get_instance()->set_log_level(ll_qa);
+
+ if (1 < (
+ CommandLine::get_instance()->a_manifest.specified() +
+ CommandLine::get_instance()->a_version.specified()
+ ))
+ throw args::DoHelp("you should specify exactly one action");
+
+ if (! CommandLine::get_instance()->a_write_cache_dir.specified())
+ CommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty");
+
+ if (! CommandLine::get_instance()->a_repository_directory.specified())
+ CommandLine::get_instance()->a_repository_directory.set_argument(stringify(FSEntry::cwd()));
+
+ if (CommandLine::get_instance()->a_version.specified())
+ {
+ cout << "appareo, part of " << PALUDIS_PACKAGE << " " << PALUDIS_VERSION_MAJOR << "."
+ << PALUDIS_VERSION_MINOR << "." << PALUDIS_VERSION_MICRO << PALUDIS_VERSION_SUFFIX;
+ if (! std::string(PALUDIS_GIT_HEAD).empty())
+ cout << " git " << PALUDIS_GIT_HEAD;
+ cout << endl << endl;
+ cout << "Paludis comes with ABSOLUTELY NO WARRANTY. Paludis is free software, and you" << endl;
+ cout << "are welcome to redistribute it under the terms of the GNU General Public" << endl;
+ cout << "License, version 2." << endl;
+
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ for (args::StringSequenceArg::ConstIterator d(CommandLine::get_instance()->a_extra_repository_dir.begin_args()),
+ d_end(CommandLine::get_instance()->a_extra_repository_dir.end_args()) ;
+ d != d_end ; ++d)
+ extra_repository_dirs->push_back(*d);
+
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("distdir", CommandLine::get_instance()->a_download_directory.argument());
+
+ NoConfigEnvironment env(make_named_values<no_config_environment::Params>(
+ value_for<n::accept_unstable>(true),
+ value_for<n::disable_metadata_cache>(false),
+ value_for<n::extra_accept_keywords>(""),
+ value_for<n::extra_params>(keys),
+ value_for<n::extra_repository_dirs>(extra_repository_dirs),
+ value_for<n::master_repository_name>(CommandLine::get_instance()->a_master_repository_name.argument()),
+ value_for<n::repository_dir>(get_location_and_add_filters()),
+ value_for<n::repository_type>(no_config_environment::ncer_ebuild),
+ value_for<n::write_cache>(CommandLine::get_instance()->a_write_cache_dir.argument())
+ ));
+
+ IDMap results(PackageIDComparator(env.package_database().get()));
+
+ unsigned success(0), total(0);
+
+ std::tr1::shared_ptr<const CategoryNamePartSet> cat_names(env.main_repository()->category_names());
+ for (CategoryNamePartSet::ConstIterator c(cat_names->begin()), c_end(cat_names->end()) ;
+ c != c_end ; ++c)
+ {
+ if (CommandLine::get_instance()->a_category.specified())
+ if (CommandLine::get_instance()->a_category.end_args() == std::find(
+ CommandLine::get_instance()->a_category.begin_args(),
+ CommandLine::get_instance()->a_category.end_args(),
+ stringify(*c)))
+ continue;
+
+ std::tr1::shared_ptr<const QualifiedPackageNameSet> pkg_names(env.main_repository()->package_names(*c));
+ for (QualifiedPackageNameSet::ConstIterator p(pkg_names->begin()), p_end(pkg_names->end()) ;
+ p != p_end ; ++p)
+ {
+ if (CommandLine::get_instance()->a_package.specified())
+ if (CommandLine::get_instance()->a_package.end_args() == std::find(
+ CommandLine::get_instance()->a_package.begin_args(),
+ CommandLine::get_instance()->a_package.end_args(),
+ stringify(p->package())))
+ continue;
+
+ const std::tr1::shared_ptr<const PackageIDSequence> ids(env[selection::AllVersionsSorted(
+ generator::Package(*p) & generator::InRepository(env.main_repository()->name()))]);
+
+ fetch_ids(ids,results, success, total);
+ cout << "Making manifest for: " << colour(cl_package_name, stringify(*p)) << "..." << endl;
+ if (env.main_repository()->manifest_interface())
+ env.main_repository()->manifest_interface()->make_manifest(*p);
+ else
+ cerr << "Cannot make manifest for: " << colour(cl_package_name, stringify(*p)) << endl;
+ }
+
+ }
+
+ cout << colour(cl_heading, "Appareo results for ") << colour(cl_repository_name, env.main_repository()->name())
+ << total << " IDs, " << success << " successes, " << (total - success) << " failures" << endl << endl;
+
+ int exit_status(0);
+ std::tr1::shared_ptr<const PackageID> old_id;
+ for (IDMap::const_iterator r(results.begin()), r_end(results.end()) ; r != r_end ; ++r)
+ {
+ exit_status |= 1;
+ if ((! old_id) || (*old_id != *r->first))
+ {
+ cout << colour(cl_package_name, stringify(*r->first)) << ":" << endl;
+ old_id = r->first;
+ }
+ cout << " " << r->second << endl;
+ }
+ cout << endl;
+
+ return exit_status;
+ }
+ }
+ catch (const args::ArgsError & e)
+ {
+ cerr << "Usage error: " << e.message() << endl;
+ cerr << "Try " << argv[0] << " --help" << endl;
+ return EXIT_FAILURE;
+ }
+ catch (const args::DoHelp & h)
+ {
+ if (h.message.empty())
+ {
+ cout << "Usage: " << argv[0] << " [options]" << endl;
+ cout << endl;
+ cout << *CommandLine::get_instance();
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ cerr << "Usage error: " << h.message << endl;
+ cerr << "Try " << argv[0] << " --help" << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ catch (const Exception & e)
+ {
+ cout << endl;
+ cerr << "Unhandled exception:" << endl
+ << " * " << e.backtrace("\n * ")
+ << e.message() << " (" << e.what() << ")" << endl;
+ return EXIT_FAILURE;
+ }
+ catch (const std::exception & e)
+ {
+ cout << endl;
+ cerr << "Unhandled exception:" << endl
+ << " * " << e.what() << endl;
+ return EXIT_FAILURE;
+ }
+ catch (...)
+ {
+ cout << endl;
+ cerr << "Unhandled exception:" << endl
+ << " * Unknown exception type. Ouch..." << endl;
+ return EXIT_FAILURE;
+ }
+}
+
diff --git a/src/clients/appareo/command_line.cc b/src/clients/appareo/command_line.cc
new file mode 100644
index 0000000..b3267e3
--- /dev/null
+++ b/src/clients/appareo/command_line.cc
@@ -0,0 +1,92 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Kim Højgaard-Hansen
+ * Copyright (c) 2007, 2008 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 "command_line.hh"
+#include <paludis/util/instantiation_policy-impl.hh>
+
+using namespace paludis;
+
+template class InstantiationPolicy<CommandLine, instantiation_method::SingletonTag>;
+
+CommandLine::CommandLine() :
+ ArgsHandler(),
+
+ action_args(this, "Actions",
+ "Selects which basic action to perform. Exactly one action should "
+ "be specified."),
+ a_manifest(&action_args, "manifest", 'm', "Create manifest file", false),
+ a_version(&action_args, "version", 'V', "Display program version", false),
+ a_help(&action_args, "help", 'h', "Display program help", false),
+
+ general_args(this, "General options",
+ "Options which are relevant for most or all actions."),
+ a_log_level(&general_args, "log-level", '\0'),
+ a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false),
+ a_no_color(&a_no_colour, "no-color"),
+ a_repository_directory(&general_args, "repository-dir", 'D',
+ "Where to find the repository (default: current directory)"),
+ a_download_directory(&general_args, "download-dir", 'd',
+ "Where to place downloaded files"),
+ a_master_repository_name(&general_args, "master-repository-name", '\0',
+ "Use the specified name for the master repository. Specify the location using --extra-repository-dir. "
+ "Only for repositories with no metadata/layout.conf."),
+ a_extra_repository_dir(&general_args, "extra-repository-dir", '\0',
+ "Also include the repository at this location. May be specified multiple times, in creation order."),
+ a_write_cache_dir(&general_args, "write-cache-dir", '\0',
+ "Use a subdirectory named for the repository name under the specified directory for repository write cache"),
+ a_report_file(&general_args, "report-file", 'r',
+ "Write report to the specified file, rather than stdout"),
+ tree_args(this, "Tree action options",
+ "Options which are relevant for tree actions."),
+ a_category(&tree_args, "category", 'C',
+ "Matches with this category name only (may be specified multiple times)",
+ args::StringSetArg::StringSetArgOptions(), &CategoryNamePartValidator::validate),
+ a_package(&tree_args, "package", 'P',
+ "Matches with this package name only (may be specified multiple times)",
+ args::StringSetArg::StringSetArgOptions(), &PackageNamePartValidator::validate)
+{
+ add_usage_line("--manifest");
+}
+
+std::string
+CommandLine::app_name() const
+{
+ return "appareo";
+}
+
+std::string
+CommandLine::app_synopsis() const
+{
+ return "Manifest client for Paludis";
+}
+
+std::string
+CommandLine::app_description() const
+{
+ return
+ "Appareo is a manifest creation client for Paludis. It fetches the distfile(s) for the specified package(s), "
+ "category or categories or repository, creates manifest files for these and produces a report of any failures.";
+}
+
+CommandLine::~CommandLine()
+{
+}
+
+
diff --git a/src/clients/appareo/command_line.hh b/src/clients/appareo/command_line.hh
new file mode 100644
index 0000000..0537f59
--- /dev/null
+++ b/src/clients/appareo/command_line.hh
@@ -0,0 +1,68 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Kim Højgaard-Hansen
+ * Copyright (c) 2007, 2008 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_SRC_CLIENTS_APPAREO_COMMAND_LINE_HH
+#define PALUDIS_GUARD_SRC_CLIENTS_APPAREO_COMMAND_LINE_HH 1
+
+#include <paludis/args/args.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/args/log_level_arg.hh>
+#include <paludis/args/deps_option_arg.hh>
+
+class CommandLine :
+ public paludis::args::ArgsHandler,
+ public paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>
+{
+ friend class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>;
+
+ private:
+ CommandLine();
+ ~CommandLine();
+
+ public:
+ virtual std::string app_name() const;
+ virtual std::string app_synopsis() const;
+ virtual std::string app_description() const;
+
+ paludis::args::ArgsGroup action_args;
+
+ paludis::args::SwitchArg a_manifest;
+ paludis::args::SwitchArg a_version;
+ paludis::args::SwitchArg a_help;
+
+ paludis::args::ArgsGroup general_args;
+
+ paludis::args::LogLevelArg a_log_level;
+ paludis::args::SwitchArg a_no_colour;
+ paludis::args::AliasArg a_no_color;
+ paludis::args::StringArg a_repository_directory;
+ paludis::args::StringArg a_download_directory;
+ paludis::args::StringArg a_master_repository_name;
+ paludis::args::StringSequenceArg a_extra_repository_dir;
+ paludis::args::StringArg a_write_cache_dir;
+ paludis::args::StringArg a_report_file;
+
+ paludis::args::ArgsGroup tree_args;
+ paludis::args::StringSetArg a_category;
+ paludis::args::StringSetArg a_package;
+};
+
+
+#endif
diff --git a/src/clients/appareo/help_TEST b/src/clients/appareo/help_TEST
new file mode 100755
index 0000000..73bf9ee
--- /dev/null
+++ b/src/clients/appareo/help_TEST
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+./appareo --help
+
diff --git a/src/clients/appareo/man_appareo.cc b/src/clients/appareo/man_appareo.cc
new file mode 100644
index 0000000..6def4b7
--- /dev/null
+++ b/src/clients/appareo/man_appareo.cc
@@ -0,0 +1,79 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Kim Højgaard-Hansen
+ *
+ * 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 "command_line.hh"
+#include <paludis/args/man.hh>
+
+#include <iostream>
+#include <cstdlib>
+
+using std::cout;
+using std::endl;
+
+namespace
+{
+ struct ManCommandLine :
+ paludis::args::ArgsHandler
+ {
+ paludis::args::ArgsGroup group;
+ paludis::args::SwitchArg a_html;
+
+ ManCommandLine() :
+ group(this, "", ""),
+ a_html(&group, "html", '\0', "", false)
+ {
+ }
+
+ virtual std::string app_name() const
+ {
+ return "";
+ }
+
+ virtual std::string app_description() const
+ {
+ return "";
+ }
+
+ virtual std::string app_synopsis() const
+ {
+ return "";
+ }
+ };
+}
+
+int
+main(int argc, char * argv[])
+{
+ ManCommandLine cmdline;
+ cmdline.run(argc, argv, "", "", "");
+
+ if (cmdline.a_html.specified())
+ {
+ paludis::args::HtmlWriter hw(cout);
+ paludis::args::generate_doc(hw, CommandLine::get_instance());
+ }
+ else
+ {
+ paludis::args::ManWriter mw(cout);
+ paludis::args::generate_doc(mw, CommandLine::get_instance());
+ }
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/src/clients/appareo/version_TEST b/src/clients/appareo/version_TEST
new file mode 100755
index 0000000..bf22c14
--- /dev/null
+++ b/src/clients/appareo/version_TEST
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+./appareo --version
+