diff options
author | 2007-08-29 19:27:50 +0000 | |
---|---|---|
committer | 2007-08-29 19:27:50 +0000 | |
commit | c211600956d0997be222c267f52e6cd6ad3fe1cc (patch) | |
tree | ebb71cca79ffd1c9516d82a142c96a6a38cb3911 | |
parent | 9033da5d261f0b7d3ce5034b4130f8c0f8c6e33e (diff) | |
download | paludis-c211600956d0997be222c267f52e6cd6ad3fe1cc.tar.gz paludis-c211600956d0997be222c267f52e6cd6ad3fe1cc.tar.xz |
Add accerso, a mirror client
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | doc/Makefile.am | 11 | ||||
-rw-r--r-- | doc/index.html.skel | 1 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.cc | 17 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.hh | 1 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment.sr | 1 | ||||
-rw-r--r-- | paludis/environments/no_config/no_config_environment_TEST.cc | 1 | ||||
-rw-r--r-- | python/environment.cc | 2 | ||||
-rw-r--r-- | ruby/environment.cc | 1 | ||||
-rw-r--r-- | src/clients/accerso/Makefile.am | 82 | ||||
-rw-r--r-- | src/clients/accerso/accerso.cc | 276 | ||||
-rw-r--r-- | src/clients/accerso/command_line.cc | 80 | ||||
-rw-r--r-- | src/clients/accerso/command_line.hh | 64 | ||||
-rwxr-xr-x | src/clients/accerso/help_TEST | 4 | ||||
-rw-r--r-- | src/clients/accerso/man_accerso.cc | 79 | ||||
-rwxr-xr-x | src/clients/accerso/version_TEST | 4 | ||||
-rw-r--r-- | src/clients/adjutrix/adjutrix.cc | 1 | ||||
-rw-r--r-- | src/clients/qualudis/qualudis.cc | 1 |
19 files changed, 624 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index 7a8999d60..75dceef42 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-qa --enable-ruby --enable-glsa --enable-vim --with-ruby-install-dir='$${DESTDIR}$${prefix}/ruby_dir' \ --with-repositories=default \ --with-environments=default,portage \ - --with-clients=default,contrarius,inquisitio \ + --with-clients=default,accerso,contrarius,inquisitio \ --with-default-distribution=giant-space-monkey automake-deps-built-hack.tmp : built-sources-subdirs @@ -29,6 +29,7 @@ automake-deps-dist-hack.tmp : built-sources-subdirs $(MAKE) -C src/clients/contrarius contrarius.1 contrarius.html $(MAKE) -C src/clients/adjutrix adjutrix.1 adjutrix.html $(MAKE) -C src/clients/inquisitio inquisitio.1 inquisitio.html + $(MAKE) -C src/clients/accerso accerso.1 accerso.html touch $@ dist-hook : diff --git a/configure.ac b/configure.ac index 96e6bed2f..50b878eea 100644 --- a/configure.ac +++ b/configure.ac @@ -983,7 +983,7 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis dnl }}} dnl {{{ clients -ALL_CLIENTS="adjutrix contrarius gtkpaludis inquisitio paludis qualudis" +ALL_CLIENTS="accerso adjutrix contrarius gtkpaludis inquisitio paludis qualudis" DEFAULT_CLIENTS="adjutrix paludis" if test x"$ENABLE_QA" = "xyes" ; then DEFAULT_CLIENTS="$DEFAULT_CLIENTS qualudis" @@ -996,6 +996,7 @@ AC_ARG_WITH([clients], default Equivalent to adjutrix,paludis Also includes qualudis if --enable-qa + accerso A fetch / mirror client adjutrix A tool for tree querying contrarius The cross toolchain creator gtkpaludis GUI client (experimental) @@ -1270,6 +1271,7 @@ AC_OUTPUT( ruby/demos/Makefile src/Makefile src/clients/Makefile + src/clients/accerso/Makefile src/clients/adjutrix/Makefile src/clients/contrarius/Makefile src/clients/gtkpaludis/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index 1d6eb600a..a656c242a 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -33,6 +33,7 @@ htmlfiles = \ man-qualudis.html \ man-contrarius.html \ man-adjutrix.html \ + man-accerso.html \ man-inquisitio.html EXTRA_DIST = doxygen.conf.in header.html footer.html paludis.css epydoc.css \ @@ -45,6 +46,7 @@ EXTRA_DIST = doxygen.conf.in header.html footer.html paludis.css epydoc.css \ CLEANFILES = *~ news.html index.html changelog.html licence.html authors.html faq.html \ migration.html cachefiles.html configuration.html portagedifferences.html programmingwithpaludis.html \ sets.html hooks.html man-paludis.html man-qualudis.html man-contrarius.html man-adjutrix.html man-inquisitio.html \ + man-accerso.html \ cleannews cleanrecentnews cleanchangelog cleanauthors cleanfaqtoc cleanbasiccppapp cleanbasicrubyapp MAINTAINERCLEANFILES = Makefile.in $(tagfiles) @@ -269,6 +271,15 @@ man-adjutrix.html : $(top_builddir)/src/clients/adjutrix/adjutrix.html man.html. -e '/@MAN@/d' \ < $(srcdir)/man.html.skel > man-adjutrix.html +man-accerso.html : $(top_builddir)/src/clients/accerso/accerso.html man.html.skel + sed -e '/@HEADER@/r htmlheader.html' \ + -e '/@HEADER@/d' \ + -e '/@FOOTER@/r htmlfooter.html' \ + -e '/@FOOTER@/d' \ + -e '/@MAN@/r $(top_builddir)/src/clients/accerso/accerso.html' \ + -e '/@MAN@/d' \ + < $(srcdir)/man.html.skel > man-accerso.html + man-inquisitio.html : $(top_builddir)/src/clients/inquisitio/inquisitio.html man.html.skel sed -e '/@HEADER@/r htmlheader.html' \ -e '/@HEADER@/d' \ diff --git a/doc/index.html.skel b/doc/index.html.skel index 74cc14532..36b04927c 100644 --- a/doc/index.html.skel +++ b/doc/index.html.skel @@ -54,6 +54,7 @@ <li>Manual pages: <ul> + <li><a href="man-accerso.html">accerso</a></li> <li><a href="man-adjutrix.html">adjutrix</a></li> <li><a href="man-contrarius.html">contrarius</a></li> <li><a href="man-inquisitio.html">inquisitio</a></li> diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc index 3c294db9c..4edc81276 100644 --- a/paludis/environments/no_config/no_config_environment.cc +++ b/paludis/environments/no_config/no_config_environment.cc @@ -145,8 +145,10 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) { if (FSEntry("/var/empty") != params.master_repository_dir) { - tr1::shared_ptr<Map<std::string, std::string> > keys( - new Map<std::string, std::string>); + tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); + + if (params.extra_params) + std::copy(params.extra_params->begin(), params.extra_params->end(), keys->inserter()); keys->insert("format", "ebuild"); keys->insert("location", stringify(params.master_repository_dir)); @@ -160,8 +162,10 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) RepositoryMaker::get_instance()->find_maker("ebuild")(env, keys)))); } - tr1::shared_ptr<Map<std::string, std::string> > keys( - new Map<std::string, std::string>); + tr1::shared_ptr<Map<std::string, std::string> > keys( new Map<std::string, std::string>); + + if (params.extra_params) + std::copy(params.extra_params->begin(), params.extra_params->end(), keys->inserter()); keys->insert("format", "ebuild"); keys->insert("location", stringify(params.repository_dir)); @@ -189,8 +193,9 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) { Log::get_instance()->message(ll_debug, lc_context, "VDB, using vdb_db"); - tr1::shared_ptr<Map<std::string, std::string> > keys( - new Map<std::string, std::string>); + tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); + if (params.extra_params) + std::copy(params.extra_params->begin(), params.extra_params->end(), keys->inserter()); keys->insert("format", "vdb"); keys->insert("names_cache", "/var/empty"); diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh index eee39ea89..b25b772e2 100644 --- a/paludis/environments/no_config/no_config_environment.hh +++ b/paludis/environments/no_config/no_config_environment.hh @@ -24,6 +24,7 @@ #include <paludis/util/fs_entry.hh> #include <paludis/util/private_implementation_pattern.hh> #include <paludis/util/sr.hh> +#include <paludis/util/map-fwd.hh> #include <libwrapiter/libwrapiter_forward_iterator-fwd.hh> namespace paludis diff --git a/paludis/environments/no_config/no_config_environment.sr b/paludis/environments/no_config/no_config_environment.sr index ac5f514f8..b5934fec8 100644 --- a/paludis/environments/no_config/no_config_environment.sr +++ b/paludis/environments/no_config/no_config_environment.sr @@ -11,6 +11,7 @@ make_class_Params() key accept_unstable bool key repository_type no_config_environment::RepositoryType key master_repository_dir "FSEntry" + key extra_params "tr1::shared_ptr<Map<std::string, std::string> >" allow_named_args doxygen_comment << "END" diff --git a/paludis/environments/no_config/no_config_environment_TEST.cc b/paludis/environments/no_config/no_config_environment_TEST.cc index 75c26bddd..5f5fdef6f 100644 --- a/paludis/environments/no_config/no_config_environment_TEST.cc +++ b/paludis/environments/no_config/no_config_environment_TEST.cc @@ -38,6 +38,7 @@ namespace test_cases .accept_unstable(false) .repository_type(no_config_environment::ncer_auto) .disable_metadata_cache(false) + .extra_params(tr1::shared_ptr<Map<std::string, std::string> >()) .master_repository_dir(FSEntry("/var/empty"))); TEST_CHECK(e.package_database()); diff --git a/python/environment.cc b/python/environment.cc index 4632674f3..480ff99fd 100644 --- a/python/environment.cc +++ b/python/environment.cc @@ -351,7 +351,7 @@ struct NoConfigEnvironmentWrapper : NoConfigEnvironmentWrapper(const FSEntry & env_dir, const FSEntry & cache_dir, const FSEntry & master_repo_dir) : NoConfigEnvironment(no_config_environment::Params(env_dir, cache_dir, false, false, - no_config_environment::ncer_auto, master_repo_dir) + no_config_environment::ncer_auto, master_repo_dir, tr1::shared_ptr<Map<std::string, std::string> >()) ) { } diff --git a/ruby/environment.cc b/ruby/environment.cc index 6fc36296c..20a6c7b9b 100644 --- a/ruby/environment.cc +++ b/ruby/environment.cc @@ -312,6 +312,7 @@ namespace .accept_unstable(false) .disable_metadata_cache(false) .repository_type(no_config_environment::ncer_auto) + .extra_params(tr1::shared_ptr<Map<std::string, std::string> >()) .master_repository_dir(FSEntry(master_repository_dir)))); VALUE tdata(Data_Wrap_Struct(self, 0, &Common<tr1::shared_ptr<NoConfigEnvironment> >::free, e)); rb_obj_call_init(tdata, argc, argv); diff --git a/src/clients/accerso/Makefile.am b/src/clients/accerso/Makefile.am new file mode 100644 index 000000000..4051bfd4b --- /dev/null +++ b/src/clients/accerso/Makefile.am @@ -0,0 +1,82 @@ +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 = accerso +noinst_PROGRAMS = man-accerso +noinst_DATA = accerso.html +man_MANS = accerso.1 + +accerso.1 : man-accerso + ./man-accerso > $@ + +accerso.html : man-accerso + ./man-accerso --html > $@ + +man_accerso_SOURCES = \ + man_accerso.cc \ + command_line.hh \ + command_line.cc + +man_accerso_LDADD = \ + $(top_builddir)/paludis/args/libpaludisargs.la \ + $(top_builddir)/paludis/args/libpaludisman.a \ + $(top_builddir)/paludis/util/libpaludisutil.la \ + $(top_builddir)/paludis/libpaludismanpagethings.la \ + $(top_builddir)/src/common_args/libcommonargs.a \ + $(top_builddir)/src/output/liboutput.a \ + $(DYNAMIC_LD_LIBS) + +accerso_SOURCES = \ + command_line.hh command_line.cc \ + accerso.cc + +accerso_LDADD = \ + $(top_builddir)/paludis/tasks/libpaludistasks.la \ + $(top_builddir)/paludis/libpaludis.la \ + $(top_builddir)/paludis/args/libpaludisargs.la \ + $(top_builddir)/paludis/util/libpaludisutil.la \ + $(top_builddir)/paludis/environments/no_config/libpaludisnoconfigenvironment.la \ + $(top_builddir)/src/output/liboutput.a \ + $(top_builddir)/src/common_args/libcommonargs.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_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 +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 + diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc new file mode 100644 index 000000000..4d5660a75 --- /dev/null +++ b/src/clients/accerso/accerso.cc @@ -0,0 +1,276 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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 <src/common_args/do_help.hh> +#include "command_line.hh" +#include <paludis/about.hh> +#include <paludis/action.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/tr1_functional.hh> +#include <paludis/environments/no_config/no_config_environment.hh> +#include <paludis/package_database.hh> +#include <paludis/query.hh> +#include <iostream> +#include <fstream> +#include <map> + +using namespace paludis; +using std::cout; +using std::cerr; +using std::endl; + +int +main(int argc, char *argv[]) +{ + Context context("In program " + join(argv, argv + argc, " ") + ":"); + + try + { + CommandLine::get_instance()->run(argc, argv, "accerso", "ACCERSO_OPTIONS", "ACCERSO_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_fetch.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_master_repository_dir.specified()) + CommandLine::get_instance()->a_master_repository_dir.set_argument("/var/empty"); + + if (CommandLine::get_instance()->a_version.specified()) + { + cout << "accerso " << PALUDIS_VERSION_MAJOR << "." + << PALUDIS_VERSION_MINOR << "." << PALUDIS_VERSION_MICRO; + if (! std::string(PALUDIS_SUBVERSION_REVISION).empty()) + cout << " svn " << PALUDIS_SUBVERSION_REVISION; + cout << endl << endl; + cout << "Built by " << PALUDIS_BUILD_USER << "@" << PALUDIS_BUILD_HOST + << " on " << PALUDIS_BUILD_DATE << endl; + cout << "CXX: " << PALUDIS_BUILD_CXX +#if defined(__ICC) + << " " << __ICC +#elif defined(__VERSION__) + << " " << __VERSION__ +#endif + << endl; + cout << "CXXFLAGS: " << PALUDIS_BUILD_CXXFLAGS << endl; + cout << "LDFLAGS: " << PALUDIS_BUILD_LDFLAGS << endl; + cout << "DATADIR: " << DATADIR << endl; + cout << "LIBDIR: " << LIBDIR << endl; + cout << "LIBEXECDIR: " << LIBEXECDIR << endl; + cout << "SYSCONFDIR: " << SYSCONFDIR << endl; + cout << "stdlib: " +#if defined(__GLIBCXX__) +# define XSTRINGIFY(x) #x +# define STRINGIFY(x) XSTRINGIFY(x) + << "GNU libstdc++ " << STRINGIFY(__GLIBCXX__) +#endif + << endl; + + cout << 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 + { + 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(no_config_environment::Params::create() + .repository_dir(CommandLine::get_instance()->a_repository_directory.argument()) + .write_cache(CommandLine::get_instance()->a_write_cache_dir.argument()) + .accept_unstable(true) + .repository_type(no_config_environment::ncer_ebuild) + .disable_metadata_cache(false) + .extra_params(keys) + .master_repository_dir(FSEntry(CommandLine::get_instance()->a_master_repository_dir.argument()))); + + tr1::shared_ptr<const PackageIDSequence> ids( + env.package_database()->query(query::Repository(env.main_repository()->name()), qo_order_by_version)); + PackageIDComparator comparator(env.package_database().get()); + std::multimap<tr1::shared_ptr<const PackageID>, std::string, tr1::reference_wrapper<const PackageIDComparator> > + results(tr1::cref(comparator)); + unsigned success(0), total(0); + + for (PackageIDSequence::Iterator 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 + { + FetchAction a(FetchActionOptions::create() + .safe_resume(true) + .fetch_unneeded(true) + ); + if ((*i)->supports_action(SupportsActionTest<FetchAction>())) + { + (*i)->perform_action(a); + ++success; + } + else + results.insert(std::make_pair(*i, "Does not support fetching")); + } + catch (const FetchActionError & e) + { + for (Sequence<FetchActionFailure>::Iterator 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)); + } + } + catch (const Exception & e) + { + results.insert(std::make_pair(*i, "Uncaught exception '" + e.message() + "' (" + e.what() + ")")); + } + } + + std::cout << std::endl; + + tr1::shared_ptr<std::ofstream> outf; + if (CommandLine::get_instance()->a_report_file.specified()) + { + outf.reset(new std::ofstream(CommandLine::get_instance()->a_report_file.argument().c_str())); + if (! *outf) + { + std::cerr << "Cannot write to " << CommandLine::get_instance()->a_report_file.argument() << std::endl; + return EXIT_FAILURE; + } + } + + std::ostream & out(outf ? *outf : cout); + + char t[255]; + time_t tt(time(0)); + if (0 == strftime(t, 255, "%c", gmtime(&tt))) + throw InternalError(PALUDIS_HERE, "strftime failed"); + + out << colour(cl_heading, "Accerso results for ") << colour(cl_repository_name, env.main_repository()->name()) + << colour(cl_heading, " on " + stringify(t) + ":") << endl << endl + << total << " IDs, " << success << " successes, " << (total - success) << " failures" << endl << endl; + + int exit_status(0); + tr1::shared_ptr<const PackageID> old_id; + for (std::multimap<tr1::shared_ptr<const PackageID>, std::string, tr1::reference_wrapper<const PackageIDComparator> >::const_iterator + r(results.begin()), r_end(results.end()) ; r != r_end ; ++r) + { + exit_status |= 1; + if ((! old_id) || (*old_id != *r->first)) + { + out << colour(cl_package_name, stringify(*r->first)) << ":" << endl; + old_id = r->first; + } + out << " " << r->second << endl; + } + out << endl; + + return exit_status; + } + } + catch (const paludis::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/accerso/command_line.cc b/src/clients/accerso/command_line.cc new file mode 100644 index 000000000..ce016bd59 --- /dev/null +++ b/src/clients/accerso/command_line.cc @@ -0,0 +1,80 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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 paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>; + +CommandLine::CommandLine() : + ArgsHandler(), + + action_args(this, "Actions", + "Selects which basic action to perform. Exactly one action should " + "be specified."), + a_fetch(&action_args, "fetch", 'f', "Fetch necessary distfiles"), + a_version(&action_args, "version", 'V', "Display program version"), + a_help(&action_args, "help", 'h', "Display program help"), + + 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"), + 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_dir(&general_args, "master-repository-dir", '\0', + "Use the specified location for the master repository"), + 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") +{ + add_usage_line("--fetch"); +} + +std::string +CommandLine::app_name() const +{ + return "accerso"; +} + +std::string +CommandLine::app_synopsis() const +{ + return "Mirror client for Paludis"; +} + +std::string +CommandLine::app_description() const +{ + return + "accerso is a mirror client for Paludis. It fetches every distfile for every package in the " + "given repository and produces a report of any failures."; +} + +CommandLine::~CommandLine() +{ +} + + diff --git a/src/clients/accerso/command_line.hh b/src/clients/accerso/command_line.hh new file mode 100644 index 000000000..8ad998c77 --- /dev/null +++ b/src/clients/accerso/command_line.hh @@ -0,0 +1,64 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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_ACCERSO_COMMAND_LINE_HH +#define PALUDIS_GUARD_SRC_CLIENTS_ACCERSO_COMMAND_LINE_HH 1 + +#include <paludis/args/args.hh> +#include <paludis/util/instantiation_policy.hh> +#include <src/common_args/debug_build_arg.hh> +#include <src/common_args/checks_arg.hh> +#include <src/common_args/log_level_arg.hh> +#include <src/common_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_fetch; + 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_dir; + paludis::args::StringArg a_write_cache_dir; + paludis::args::StringArg a_report_file; +}; + + +#endif diff --git a/src/clients/accerso/help_TEST b/src/clients/accerso/help_TEST new file mode 100755 index 000000000..324e7b8f3 --- /dev/null +++ b/src/clients/accerso/help_TEST @@ -0,0 +1,4 @@ +#!/bin/bash + +./accerso --help + diff --git a/src/clients/accerso/man_accerso.cc b/src/clients/accerso/man_accerso.cc new file mode 100644 index 000000000..a74af7815 --- /dev/null +++ b/src/clients/accerso/man_accerso.cc @@ -0,0 +1,79 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * 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 + * 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', "") + { + } + + 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/accerso/version_TEST b/src/clients/accerso/version_TEST new file mode 100755 index 000000000..8b7fdd891 --- /dev/null +++ b/src/clients/accerso/version_TEST @@ -0,0 +1,4 @@ +#!/bin/bash + +./accerso --version + diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc index 611b013d1..82ab44f95 100644 --- a/src/clients/adjutrix/adjutrix.cc +++ b/src/clients/adjutrix/adjutrix.cc @@ -153,6 +153,7 @@ main(int argc, char *argv[]) (CommandLine::get_instance()->a_reverse_deps.specified()) ? no_config_environment::ncer_auto : no_config_environment::ncer_ebuild) .disable_metadata_cache(false) + .extra_params(tr1::shared_ptr<Map<std::string, std::string> >()) .master_repository_dir(FSEntry("/var/empty"))); if (CommandLine::get_instance()->a_find_stable_candidates.specified()) diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc index ad5d661c0..ca736c9ce 100644 --- a/src/clients/qualudis/qualudis.cc +++ b/src/clients/qualudis/qualudis.cc @@ -162,6 +162,7 @@ int main(int argc, char *argv[]) .repository_type(no_config_environment::ncer_ebuild) .master_repository_dir(QualudisCommandLine::get_instance()->a_master_repository_dir.argument()) .disable_metadata_cache(! QualudisCommandLine::get_instance()->a_use_repository_cache.specified()) + .extra_params(tr1::shared_ptr<Map<std::string, std::string> >()) )); if (! env->main_repository()->qa_interface) |