aboutsummaryrefslogtreecommitdiff
path: root/0.6.3/src/paludis
diff options
context:
space:
mode:
Diffstat (limited to '0.6.3/src/paludis')
-rw-r--r--0.6.3/src/paludis/Makefile.am74
-rw-r--r--0.6.3/src/paludis/applets.cc196
-rw-r--r--0.6.3/src/paludis/applets.hh51
-rw-r--r--0.6.3/src/paludis/command_line.cc168
-rw-r--r--0.6.3/src/paludis/command_line.hh261
-rw-r--r--0.6.3/src/paludis/contents.cc154
-rw-r--r--0.6.3/src/paludis/contents.hh30
-rwxr-xr-x0.6.3/src/paludis/exception_TEST6
-rwxr-xr-x0.6.3/src/paludis/help_TEST3
-rw-r--r--0.6.3/src/paludis/install.cc725
-rw-r--r--0.6.3/src/paludis/install.hh32
-rwxr-xr-x0.6.3/src/paludis/install_TEST5
-rwxr-xr-x0.6.3/src/paludis/install_TEST_cleanup.sh11
-rwxr-xr-x0.6.3/src/paludis/install_TEST_setup.sh121
-rw-r--r--0.6.3/src/paludis/licence.cc66
-rw-r--r--0.6.3/src/paludis/licence.hh67
-rw-r--r--0.6.3/src/paludis/list.cc325
-rw-r--r--0.6.3/src/paludis/list.hh39
-rwxr-xr-x0.6.3/src/paludis/list_dep_tag_categories_TEST3
-rwxr-xr-x0.6.3/src/paludis/list_repository_formats_TEST3
-rwxr-xr-x0.6.3/src/paludis/list_sync_formats_TEST3
-rw-r--r--0.6.3/src/paludis/man_paludis.cc35
-rw-r--r--0.6.3/src/paludis/news.cc51
-rw-r--r--0.6.3/src/paludis/news.hh34
-rw-r--r--0.6.3/src/paludis/owner.cc132
-rw-r--r--0.6.3/src/paludis/owner.hh30
-rw-r--r--0.6.3/src/paludis/paludis.cc441
-rw-r--r--0.6.3/src/paludis/query.cc407
-rw-r--r--0.6.3/src/paludis/query.hh32
-rw-r--r--0.6.3/src/paludis/sync.cc129
-rw-r--r--0.6.3/src/paludis/sync.hh33
-rw-r--r--0.6.3/src/paludis/uninstall.cc185
-rw-r--r--0.6.3/src/paludis/uninstall.hh33
-rwxr-xr-x0.6.3/src/paludis/upgrade_TEST17
-rwxr-xr-x0.6.3/src/paludis/upgrade_TEST_cleanup.sh11
-rwxr-xr-x0.6.3/src/paludis/upgrade_TEST_setup.sh153
-rw-r--r--0.6.3/src/paludis/use.cc104
-rw-r--r--0.6.3/src/paludis/use.hh35
-rwxr-xr-x0.6.3/src/paludis/version_TEST3
39 files changed, 4208 insertions, 0 deletions
diff --git a/0.6.3/src/paludis/Makefile.am b/0.6.3/src/paludis/Makefile.am
new file mode 100644
index 000000000..fa6835fd3
--- /dev/null
+++ b/0.6.3/src/paludis/Makefile.am
@@ -0,0 +1,74 @@
+AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@
+DEFS= \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DLIBDIR=\"$(libdir)\"
+
+SUBDIRS = .
+
+bin_PROGRAMS = paludis
+noinst_PROGRAMS = man-paludis
+
+man_MANS = paludis.1
+
+paludis.1 : man-paludis
+ ./man-paludis | tee $@ | sed -e 's/^/ /'
+
+man_paludis_SOURCES = \
+ man_paludis.cc \
+ command_line.hh \
+ command_line.cc
+
+man_paludis_LDADD = \
+ $(top_builddir)/paludis/args/libpaludisargs.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/src/libcolour.a \
+ $(DYNAMIC_LD_LIBS)
+
+paludis_SOURCES = \
+ applets.hh applets.cc \
+ command_line.hh command_line.cc \
+ install.hh install.cc \
+ uninstall.hh uninstall.cc \
+ list.hh list.cc \
+ query.hh query.cc \
+ sync.hh sync.cc \
+ licence.hh licence.cc \
+ use.hh use.cc \
+ contents.hh contents.cc \
+ owner.hh owner.cc \
+ news.hh news.cc \
+ paludis.cc
+
+paludis_LDADD = \
+ $(top_builddir)/paludis/tasks/libpaludistasks.a \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/args/libpaludisargs.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/src/libcolour.a \
+ $(DYNAMIC_LD_LIBS)
+
+TESTS_ENVIRONMENT = env \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ PALUDIS_NO_GLOBAL_HOOKS="yes" \
+ PALUDIS_EBUILD_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_srcdir)/ebuild/`" \
+ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/ebuild/`" \
+ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \
+ SYSCONFDIR="$(sysconfdir)" \
+ bash $(top_srcdir)/test/run_test.sh bash
+
+TESTS = version_TEST help_TEST list_sync_formats_TEST \
+ list_repository_formats_TEST list_dep_tag_categories_TEST \
+ exception_TEST install_TEST upgrade_TEST
+
+EXTRA_DIST = \
+ $(man_MANS) \
+ $(TESTS) \
+ install_TEST_setup.sh install_TEST_cleanup.sh \
+ upgrade_TEST_setup.sh upgrade_TEST_cleanup.sh
+
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = $(man_MANS)
+MAINTAINERCLEANFILES = Makefile.in
+
diff --git a/0.6.3/src/paludis/applets.cc b/0.6.3/src/paludis/applets.cc
new file mode 100644
index 000000000..5252bec1a
--- /dev/null
+++ b/0.6.3/src/paludis/applets.cc
@@ -0,0 +1,196 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "applets.hh"
+#include "colour.hh"
+#include <functional>
+#include <iomanip>
+#include <iostream>
+#include <paludis/paludis.hh>
+#include <string>
+#include <set>
+
+/** \file
+ * Handle the --has-version, --best-version and various --list actions for the
+ * main paludis program.
+ */
+
+namespace p = paludis;
+
+int do_has_version()
+{
+ int return_code(0);
+
+ p::Context context("When performing has-version action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::string query(*CommandLine::get_instance()->begin_parameters());
+ p::PackageDepAtom::Pointer atom(new p::PackageDepAtom(query));
+ p::PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
+ atom, p::is_installed_only));
+ if (entries->empty())
+ return_code = 1;
+
+ return return_code;
+}
+
+int do_best_version()
+{
+ int return_code(0);
+
+ p::Context context("When performing best-version action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::string query(*CommandLine::get_instance()->begin_parameters());
+ p::PackageDepAtom::Pointer atom(new p::PackageDepAtom(query));
+ p::PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
+ atom, p::is_installed_only));
+ if (entries->empty())
+ return_code = 1;
+ else
+ {
+ // don't include repo, it breaks built_with_use and the like.
+ std::string entry(
+ stringify(entries->last()->name) + "-" +
+ stringify(entries->last()->version));
+ std::cout << entry << std::endl;
+ }
+
+ return return_code;
+}
+
+int do_environment_variable()
+{
+ int return_code(0);
+
+ p::Context context("When performing environment-variable action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::string atom_str(*CommandLine::get_instance()->begin_parameters());
+ std::string var_str(* p::next(CommandLine::get_instance()->begin_parameters()));
+ p::PackageDepAtom::Pointer atom(new p::PackageDepAtom(atom_str));
+
+ p::PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
+ atom, p::is_installed_only));
+
+ if (entries->empty())
+ entries = env->package_database()->query(atom, p::is_uninstalled_only);
+
+ if (entries->empty())
+ throw p::NoSuchPackageError(atom_str);
+
+ p::Repository::ConstPointer repo(env->package_database()->fetch_repository(
+ entries->begin()->repository));
+ p::RepositoryEnvironmentVariableInterface * env_if(
+ repo->environment_variable_interface);
+
+ if (! env_if)
+ {
+ std::cerr << "Repository '" << repo->name() <<
+ "' cannot be queried for environment variables" << std::endl;
+ return_code |= 1;
+ }
+ else
+ std::cout << env_if->get_environment_variable(*entries->begin(), var_str) << std::endl;
+
+ return return_code;
+}
+
+int do_configuration_variable()
+{
+ int return_code(0);
+
+ p::Context context("When performing configuration-variable action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::string repo_str(*CommandLine::get_instance()->begin_parameters());
+ std::string var_str(* p::next(CommandLine::get_instance()->begin_parameters()));
+
+ p::RepositoryInfo::ConstPointer info(env->package_database()->fetch_repository(
+ p::RepositoryName(repo_str))->info(false));
+
+ return_code = 1;
+ for (p::RepositoryInfo::SectionIterator s(info->begin_sections()),
+ s_end(info->end_sections()) ; s != s_end ; ++s)
+ for (p::RepositoryInfoSection::KeyValueIterator k((*s)->begin_kvs()),
+ k_end((*s)->end_kvs()) ; k != k_end ; ++k)
+ if (var_str == k->first)
+ {
+ std::cout << k->second << std::endl;
+ return_code = 0;
+ break;
+ }
+
+ return return_code;
+}
+
+int do_list_repository_formats()
+{
+ int return_code(1);
+
+ std::set<std::string> keys;
+ p::RepositoryMaker::get_instance()->copy_keys(std::inserter(keys, keys.begin()));
+
+ if (! keys.empty())
+ {
+ return_code = 0;
+ for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ;
+ k != k_end ; ++k)
+ std::cout << "* " << colour(cl_key_name, *k) << std::endl;
+ }
+
+ return return_code;
+}
+
+int do_list_sync_protocols()
+{
+ int return_code(1);
+
+ std::set<std::string> keys;
+ p::SyncerMaker::get_instance()->copy_keys(std::inserter(keys, keys.begin()));
+
+ if (! keys.empty())
+ {
+ return_code = 0;
+ for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ;
+ k != k_end ; ++k)
+ std::cout << "* " << colour(cl_key_name, *k) << std::endl;
+ }
+
+ return return_code;
+}
+
+int do_list_dep_tag_categories()
+{
+ int return_code(1);
+
+ std::set<std::string> keys;
+ p::DepTagCategoryMaker::get_instance()->copy_keys(std::inserter(keys, keys.begin()));
+
+ if (! keys.empty())
+ {
+ return_code = 0;
+ for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ;
+ k != k_end ; ++k)
+ std::cout << "* " << colour(cl_key_name, *k) << std::endl;
+ }
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/applets.hh b/0.6.3/src/paludis/applets.hh
new file mode 100644
index 000000000..108b962a7
--- /dev/null
+++ b/0.6.3/src/paludis/applets.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_APPLETS_HH
+#define PALUDIS_GUARD_SRC_APPLETS_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for small do_* functions.
+ */
+
+/// Handle --has-version.
+int do_has_version();
+
+/// Handle --best-version.
+int do_best_version();
+
+/// Handle --environment-variable.
+int do_environment_variable();
+
+/// Handle --configuration-variable.
+int do_configuration_variable();
+
+/// Handle --list-repository-formats
+int do_list_repository_formats();
+
+/// Handle --list-sync-protocols
+int do_list_sync_protocols();
+
+/// Handle --list-dep-tag-categories
+int do_list_dep_tag_categories();
+
+#endif
+
diff --git a/0.6.3/src/paludis/command_line.cc b/0.6.3/src/paludis/command_line.cc
new file mode 100644
index 000000000..b1da2189b
--- /dev/null
+++ b/0.6.3/src/paludis/command_line.cc
@@ -0,0 +1,168 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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"
+
+CommandLine::CommandLine() :
+ ArgsHandler(),
+
+ action_args(this, "Actions",
+ "Selects which basic action to perform. Exactly one action should "
+ "be specified."),
+ a_query(&action_args, "query", 'q', "Query for package information"),
+ a_install(&action_args, "install", 'i', "Install one or more packages"),
+ a_uninstall(&action_args, "uninstall", 'u', "Uninstall one or more packages"),
+ a_sync(&action_args, "sync", 's', "Sync all or specified repositories"),
+ a_contents(&action_args, "contents", 'k', "Display contents of a package"),
+ a_owner(&action_args, "owner", 'o', "Display the owner of a file"),
+ a_version(&action_args, "version", 'V', "Display program version"),
+ a_info(&action_args, "info", 'I', "Display program version and system information"),
+ a_help(&action_args, "help", 'h', "Display program help"),
+
+ action_args_internal(this, "More actions",
+ "Additional actions, mostly for script and internal use."),
+ a_has_version(&action_args_internal, "has-version", '\0', "Check whether the specified atom is installed"),
+ a_best_version(&action_args_internal, "best-version", '\0', "Display the best version of the specified atom"),
+ a_environment_variable(&action_args_internal, "environment-variable", '\0', "Display the value of an environment "
+ "variable for a particular package"),
+ a_configuration_variable(&action_args_internal, "configuration-variable", '\0', "Display the value of a "
+ "configuration variable for a particular package"),
+ a_list_repositories(&action_args_internal, "list-repositories", '\0', "List available repositories"),
+ a_list_categories(&action_args_internal, "list-categories", '\0', "List available categories"),
+ a_list_packages(&action_args_internal, "list-packages", '\0', "List available packages"),
+ a_list_sync_protocols(&action_args_internal, "list-sync-protocols", '\0', "List available sync protocols"),
+ a_list_repository_formats(&action_args_internal, "list-repository-formats", '\0',
+ "List available repository formats"),
+ a_list_dep_tag_categories(&action_args_internal, "list-dep-tag-categories", '\0', "List known dep tag categories"),
+ a_list_vulnerabilities(&action_args_internal, "list-vulnerabilities", '\0', "List known vulnerabilities"),
+ a_update_news(&action_args_internal, "update-news", '\0', "Regenerate news.unread files"),
+
+ general_args(this, "General options",
+ "Options which are relevant for most or all actions."),
+ a_log_level(&general_args, "log-level", '\0', "Specify the log level",
+ paludis::args::EnumArg::EnumArgOptions("debug", "Show debug output (noisy)")
+ ("qa", "Show QA messages and warnings only")
+ ("warning", "Show warnings only")
+ ("silent", "Suppress all log messages"),
+ "qa"),
+ a_no_colour(&general_args, "no-colour", '\0', "Do not use colour"),
+ a_no_color(&a_no_colour, "no-color"),
+ a_config_suffix(&general_args, "config-suffix", 'c', "Config directory suffix"),
+
+ query_args(this, "Query options",
+ "Options which are relevant for --query."),
+ a_show_slot(&query_args, "show-slot", 'S', "Show SLOTs"),
+ a_show_deps(&query_args, "show-deps", 'D', "Show dependencies"),
+ a_show_metadata(&query_args, "show-metadata", 'M', "Show raw metadata"),
+
+ install_args(this, "Install, Uninstall options",
+ "Options which are relevant for --install or --uninstall."),
+ a_pretend(&install_args, "pretend", 'p', "Pretend only"),
+ a_preserve_world(&install_args, "preserve-world", '1', "Don't modify the world file"),
+ a_no_config_protection(&install_args, "no-config-protection", '\0', "Disable config file protection (dangerous)"),
+ a_fetch(&install_args, "fetch", 'f', "Only fetch sources; don't install anything"),
+
+ dl_args(this, "DepList behaviour",
+ "Modify dependency list generation behaviour. Use with caution."),
+ a_dl_rdepend_post(&dl_args, "dl-rdepend-post", '\0', "Treat RDEPEND like PDEPEND",
+ paludis::args::EnumArg::EnumArgOptions("always", "Always")
+ ("never", "Never")
+ ("as-needed", "To resolve circular dependencies"),
+ "as-needed"),
+ a_dl_drop_self_circular(&dl_args, "dl-drop-self-circular", '\0', "Drop self-circular dependencies"),
+ a_dl_drop_circular(&dl_args, "dl-drop-circular", '\0', "Drop circular dependencies"),
+ a_dl_drop_all(&dl_args, "dl-drop-all", '0', "Drop all dependencies"),
+ a_dl_ignore_installed(&dl_args, "dl-ignore-installed", 'e', "Ignore installed packages"),
+ a_dl_no_recursive_deps(&dl_args, "dl-no-recursive-deps", '\0',
+ "Don't check runtime dependencies for installed packages"),
+ a_dl_max_stack_depth(&dl_args, "dl-max-stack-depth", '\0', "Maximum stack depth (default 100)"),
+ a_dl_no_unnecessary_upgrades(&dl_args, "dl-no-unnecessary-upgrades", 'U',
+ "Don't upgrade installed packages except where necessary as a dependency of another package"),
+
+ list_args(this, "List options",
+ "Options relevant for one or more of the --list actions."),
+ a_repository(&list_args, "repository", '\0', "Matches with this repository name only"),
+ a_category(&list_args, "category", '\0', "Matches with this category name only"),
+ a_package(&list_args, "package", '\0', "Matches with this package name only"),
+
+ owner_args(this, "Owner options",
+ "Options relevant for the --owner actions."),
+ a_full_match(&owner_args, "full-match", '\0', "Match whole filename")
+{
+ a_dl_max_stack_depth.set_argument(100);
+
+ add_usage_line("--query [query options] target ...");
+ add_usage_line("--install [install options] target ...");
+ add_usage_line("--sync [target (leave blank for all)]");
+ add_usage_line("--contents target ...");
+ add_usage_line("--owner [owner options] files ...");
+ add_usage_line("--version");
+ add_usage_line("--info");
+ add_usage_line("--help");
+
+ add_usage_line("--has-version atom");
+ add_usage_line("--best-version atom");
+ add_usage_line("--environment-variable atom variable");
+ add_usage_line("--configuration-variable repository variable");
+ add_usage_line("--list-repositories [--repository repo1 --repository repo2 ...]");
+ add_usage_line("--list-categories [--repository repo1 ... --category cat1 --category cat2 ...]");
+ add_usage_line("--list-packages [--repository repo1 ... --category cat1 ... --package pkg1 --package pkg2 ...]");
+ add_usage_line("--list-sync-protocols");
+ add_usage_line("--list-repository-formats");
+ add_usage_line("--list-dep-tag-categories");
+ add_usage_line("--list-vulnerabilities [--repository repo1 ...]");
+ add_usage_line("--update-news");
+
+ add_enviromnent_variable("PALUDIS_HOME", "Overrides the home directory used when searching "
+ "for configuration files etc.");
+ add_enviromnent_variable("PALUDIS_NO_GLOBAL_HOOKS", "Don't use global hooks. Mostly for "
+ "internal and test case use.");
+ add_enviromnent_variable("PALUDIS_SKIP_CONFIG", "Don't load configuration. Mostly for "
+ "internal and test case use.");
+ add_enviromnent_variable("PALUDIS_EBUILD_DIR", "Where to look for ebuild.bash and related "
+ "utilities.");
+ add_enviromnent_variable("PALUDIS_REPOSITORY_SO_DIR", "Where to look for repository .so "
+ "files.");
+}
+
+std::string
+CommandLine::app_name() const
+{
+ return "paludis";
+}
+
+std::string
+CommandLine::app_synopsis() const
+{
+ return "The other package mangler";
+}
+
+std::string
+CommandLine::app_description() const
+{
+ return
+ "paludis is the command line interface used to handle packages. It can query and "
+ "install packages, update repositories and display information about packages "
+ "already installed on a system.";
+}
+
+CommandLine::~CommandLine()
+{
+}
+
diff --git a/0.6.3/src/paludis/command_line.hh b/0.6.3/src/paludis/command_line.hh
new file mode 100644
index 000000000..5ba0bd63d
--- /dev/null
+++ b/0.6.3/src/paludis/command_line.hh
@@ -0,0 +1,261 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_COMMAND_LINE_HH
+#define PALUDIS_GUARD_SRC_COMMAND_LINE_HH 1
+
+#include <paludis/args/args.hh>
+#include <paludis/util/instantiation_policy.hh>
+
+/** \file
+ * Declarations for the CommandLine class.
+ */
+
+/**
+ * Our command line.
+ */
+class CommandLine :
+ public paludis::args::ArgsHandler,
+ public paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonAsNeededTag>
+{
+ friend class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonAsNeededTag>;
+
+ private:
+ /// Constructor.
+ CommandLine();
+
+ /// Destructor.
+ ~CommandLine();
+
+ public:
+ ///\name Program information
+ ///\{
+
+ virtual std::string app_name() const;
+ virtual std::string app_synopsis() const;
+ virtual std::string app_description() const;
+
+ ///\}
+
+ /// \name Action arguments
+ ///{
+
+ /// Action arguments.
+ paludis::args::ArgsGroup action_args;
+
+ /// --query
+ paludis::args::SwitchArg a_query;
+
+ /// --install
+ paludis::args::SwitchArg a_install;
+
+ /// --uninstall
+ paludis::args::SwitchArg a_uninstall;
+
+ /// --sync
+ paludis::args::SwitchArg a_sync;
+
+ /// --contents
+ paludis::args::SwitchArg a_contents;
+
+ /// --owner
+ paludis::args::SwitchArg a_owner;
+
+ /// --version
+ paludis::args::SwitchArg a_version;
+
+ /// --info
+ paludis::args::SwitchArg a_info;
+
+ /// --help
+ paludis::args::SwitchArg a_help;
+
+ /// Action arguments (internal).
+ paludis::args::ArgsGroup action_args_internal;
+
+ /// --has-version
+ paludis::args::SwitchArg a_has_version;
+
+ /// --best-version
+ paludis::args::SwitchArg a_best_version;
+
+ /// --environment-variable
+ paludis::args::SwitchArg a_environment_variable;
+
+ /// --configuration-variable
+ paludis::args::SwitchArg a_configuration_variable;
+
+ /// --list-repositories
+ paludis::args::SwitchArg a_list_repositories;
+
+ /// --list-categories
+ paludis::args::SwitchArg a_list_categories;
+
+ /// --list-packages
+ paludis::args::SwitchArg a_list_packages;
+
+ /// --list-sync-protocols
+ paludis::args::SwitchArg a_list_sync_protocols;
+
+ /// --list-repository-formats
+ paludis::args::SwitchArg a_list_repository_formats;
+
+ /// --list-dep-tag-categories
+ paludis::args::SwitchArg a_list_dep_tag_categories;
+
+ /// --list-vulnerabilities
+ paludis::args::SwitchArg a_list_vulnerabilities;
+
+ /// --update-news
+ paludis::args::SwitchArg a_update_news;
+
+ ///}
+
+ /// \name General arguments
+ ///{
+
+ /// General arguments.
+ paludis::args::ArgsGroup general_args;
+
+ /// --log-level
+ paludis::args::EnumArg a_log_level;
+
+ /// --no-colour
+ paludis::args::SwitchArg a_no_colour;
+
+ /// --no-color
+ paludis::args::AliasArg a_no_color;
+
+ /// --config-suffix
+ paludis::args::StringArg a_config_suffix;
+
+ ///}
+
+ /// \name Query arguments
+ ///{
+
+ /// Query arguments.
+ paludis::args::ArgsGroup query_args;
+
+ /// --show-slot
+ paludis::args::SwitchArg a_show_slot;
+
+ /// --show-deps
+ paludis::args::SwitchArg a_show_deps;
+
+ /// --show-metadata
+ paludis::args::SwitchArg a_show_metadata;
+
+ /// }
+
+ /// \name (Un)Install arguments
+ /// {
+
+ /// Install arguments.
+ paludis::args::ArgsGroup install_args;
+
+ /// --pretend
+ paludis::args::SwitchArg a_pretend;
+
+ /// --preserve-world
+ paludis::args::SwitchArg a_preserve_world;
+
+ /// --no-config-protection
+ paludis::args::SwitchArg a_no_config_protection;
+
+ /// --fetch
+ paludis::args::SwitchArg a_fetch;
+
+ /// }
+
+ /// \name DepList behaviour arguments
+ /// {
+
+ /// DepList behaviour arguments.
+ paludis::args::ArgsGroup dl_args;
+
+ /// --dl-rdepend-post
+ paludis::args::EnumArg a_dl_rdepend_post;
+
+ /// --dl-drop-self-circular
+ paludis::args::SwitchArg a_dl_drop_self_circular;
+
+ /// --dl-drop-circular
+ paludis::args::SwitchArg a_dl_drop_circular;
+
+ /// --dl-drop-all
+ paludis::args::SwitchArg a_dl_drop_all;
+
+ /// --dl-ignore-installed
+ paludis::args::SwitchArg a_dl_ignore_installed;
+
+ /// --dl-no-recursive-deps
+ paludis::args::SwitchArg a_dl_no_recursive_deps;
+
+ /// --dl-max-stack-depth
+ paludis::args::IntegerArg a_dl_max_stack_depth;
+
+ /// --dl-no-unnecessary-upgrades
+ paludis::args::SwitchArg a_dl_no_unnecessary_upgrades;
+
+ /// }
+
+ /// \name List arguments
+ /// {
+
+ /// List arguments.
+ paludis::args::ArgsGroup list_args;
+
+ /// --repository
+ paludis::args::StringSetArg a_repository;
+
+ /// --category
+ paludis::args::StringSetArg a_category;
+
+ /// --package
+ paludis::args::StringSetArg a_package;
+
+ /// }
+
+ /// \name Owner arguments
+ /// {
+
+ /// Owner arguments.
+ paludis::args::ArgsGroup owner_args;
+
+ /// --full-match
+ paludis::args::SwitchArg a_full_match;
+
+ /// }
+};
+
+/**
+ * Show the help message.
+ */
+struct DoHelp
+{
+ const std::string message;
+
+ DoHelp(const std::string & m = "") :
+ message(m)
+ {
+ }
+};
+
+#endif
diff --git a/0.6.3/src/paludis/contents.cc b/0.6.3/src/paludis/contents.cc
new file mode 100644
index 000000000..35fec9c1c
--- /dev/null
+++ b/0.6.3/src/paludis/contents.cc
@@ -0,0 +1,154 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "contents.hh"
+#include "colour.hh"
+#include "command_line.hh"
+#include <paludis/paludis.hh>
+#include <iostream>
+#include <algorithm>
+
+namespace p = paludis;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+namespace
+{
+ struct ContentsDisplayer :
+ p::ContentsVisitorTypes::ConstVisitor
+ {
+ void visit(const p::ContentsFileEntry * const e)
+ {
+ cout << " " << colour(cl_file, e->name()) << endl;
+ }
+
+ void visit(const p::ContentsDirEntry * const e)
+ {
+ cout << " " << colour(cl_dir, e->name()) << endl;
+ }
+
+ void visit(const p::ContentsSymEntry * const e)
+ {
+ cout << " " << colour(cl_sym, e->name()) << " -> " << e->target() << endl;
+ }
+
+ void visit(const p::ContentsMiscEntry * const e)
+ {
+ cout << " " << colour(cl_misc, e->name()) << endl;
+ }
+ };
+}
+
+void
+do_one_contents_entry(
+ const p::Environment * const env,
+ const p::PackageDatabaseEntry & e)
+{
+ cout << "* " << colour(cl_package_name, e) << endl;
+
+ const p::RepositoryInstalledInterface * const installed_interface(
+ env->package_database()->fetch_repository(e.repository)->
+ installed_interface);
+ if (installed_interface)
+ {
+ p::Contents::ConstPointer contents(installed_interface->contents(
+ e.name, e.version));
+ ContentsDisplayer d;
+ std::for_each(contents->begin(), contents->end(), accept_visitor(&d));
+ }
+ else
+ cout << " " << colour(cl_error, "(unknown)") << endl;
+
+ cout << endl;
+}
+
+void
+do_one_contents(
+ const p::Environment * const env,
+ const std::string & q)
+{
+ p::Context local_context("When handling query '" + q + "':");
+
+ /* we might have a dep atom, but we might just have a simple package name
+ * without a category. either should work. */
+ p::PackageDepAtom::Pointer atom(std::string::npos == q.find('/') ?
+ new p::PackageDepAtom(env->package_database()->fetch_unique_qualified_package_name(
+ p::PackageNamePart(q))) :
+ new p::PackageDepAtom(q));
+
+ p::PackageDatabaseEntryCollection::ConstPointer
+ entries(env->package_database()->query(atom, p::is_installed_only));
+
+ if (entries->empty())
+ throw p::NoSuchPackageError(q);
+
+ for (p::PackageDatabaseEntryCollection::Iterator i(entries->begin()),
+ i_end(entries->end()) ; i != i_end ; ++i)
+ do_one_contents_entry(env, *i);
+}
+
+int
+do_contents()
+{
+ int return_code(0);
+
+ p::Context context("When performing contents action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters());
+ for ( ; q != q_end ; ++q)
+ {
+ try
+ {
+ do_one_contents(env, *q);
+ }
+ catch (const p::AmbiguousPackageNameError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl;
+ for (p::AmbiguousPackageNameError::OptionsIterator o(e.begin_options()),
+ o_end(e.end_options()) ; o != o_end ; ++o)
+ cerr << " * " << colour(cl_package_name, *o) << endl;
+ cerr << endl;
+ }
+ catch (const p::NameError & e)
+ {
+ return_code |= 1;
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ }
+ catch (const p::PackageDatabaseLookupError & e)
+ {
+ return_code |= 1;
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ }
+ }
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/contents.hh b/0.6.3/src/paludis/contents.hh
new file mode 100644
index 000000000..5cf38e3b7
--- /dev/null
+++ b/0.6.3/src/paludis/contents.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_CONTENTS_HH
+#define PALUDIS_GUARD_SRC_CONTENTS_HH 1
+
+/** \file
+ * Declaration for the do_contents function.
+ */
+
+/// Handle --contents.
+int do_contents();
+
+#endif
diff --git a/0.6.3/src/paludis/exception_TEST b/0.6.3/src/paludis/exception_TEST
new file mode 100755
index 000000000..a3daaaf26
--- /dev/null
+++ b/0.6.3/src/paludis/exception_TEST
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+PALUDIS_HOME=./ \
+ ./paludis --config-suffix paludis-build-test -pi asdf 2>&1 \
+ | grep 'Default configuration error' >/dev/null
+
diff --git a/0.6.3/src/paludis/help_TEST b/0.6.3/src/paludis/help_TEST
new file mode 100755
index 000000000..3a0f5fbb5
--- /dev/null
+++ b/0.6.3/src/paludis/help_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --help
diff --git a/0.6.3/src/paludis/install.cc b/0.6.3/src/paludis/install.cc
new file mode 100644
index 000000000..5c8dd3b1c
--- /dev/null
+++ b/0.6.3/src/paludis/install.cc
@@ -0,0 +1,725 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006 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 "colour.hh"
+#include "install.hh"
+#include "licence.hh"
+#include "use.hh"
+
+#include <iostream>
+#include <set>
+
+#include <paludis/tasks/install_task.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/tokeniser.hh>
+
+/** \file
+ * Handle the --install action for the main paludis program.
+ */
+
+using namespace paludis;
+
+using std::cerr;
+using std::cout;
+using std::endl;
+
+namespace
+{
+ struct TagDisplayer :
+ DepTagVisitorTypes::ConstVisitor
+ {
+ void visit(const GLSADepTag * const tag)
+ {
+ cout << "* " << colour(cl_tag, tag->short_text()) << ": "
+ << tag->glsa_title() << endl;
+ }
+
+ void visit(const GeneralSetDepTag * const tag)
+ {
+ cout << "* " << colour(cl_tag, tag->short_text());
+ if (tag->short_text() == "world")
+ cout << ": " << "Packages that have been explicitly installed";
+ else if (tag->short_text() == "everything")
+ cout << ": " << "All installed packages";
+ else if (tag->short_text() == "system")
+ cout << ": " << "Packages that are part of the base system";
+ cout << endl;
+ }
+ };
+
+ class OurInstallTask :
+ public InstallTask
+ {
+ private:
+ int _current_count, _max_count, _new_count, _upgrade_count,
+ _downgrade_count, _new_slot_count, _rebuild_count,
+ _current_virtual_count, _max_virtual_count, _new_virtual_count,
+ _upgrade_virtual_count, _downgrade_virtual_count,
+ _new_slot_virtual_count, _rebuild_virtual_count;
+
+ std::set<DepTag::ConstPointer, DepTag::Comparator> _all_tags;
+
+ public:
+ OurInstallTask() :
+ InstallTask(DefaultEnvironment::get_instance()),
+ _current_count(0),
+ _max_count(0),
+ _new_count(0),
+ _upgrade_count(0),
+ _downgrade_count(0),
+ _new_slot_count(0),
+ _rebuild_count(0),
+ _current_virtual_count(0),
+ _max_virtual_count(0),
+ _new_virtual_count(0),
+ _upgrade_virtual_count(0),
+ _downgrade_virtual_count(0),
+ _new_slot_virtual_count(0),
+ _rebuild_virtual_count(0)
+ {
+ }
+
+ void on_build_deplist_pre()
+ {
+ cout << "Building dependency list... " << std::flush;
+ }
+
+ virtual void on_build_deplist_post()
+ {
+ cout << "done" << endl;
+ }
+
+ virtual void on_build_cleanlist_pre(const DepListEntry & d)
+ {
+ cout << endl << colour(cl_heading, "Cleaning stale versions after installing " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
+ }
+
+ virtual void on_build_cleanlist_post(const DepListEntry &)
+ {
+ }
+
+ virtual void on_clean_all_pre(const DepListEntry &,
+ const PackageDatabaseEntryCollection & c)
+ {
+ if (c.empty())
+ cout << "* No cleaning required" << endl;
+ else
+ {
+ for (PackageDatabaseEntryCollection::Iterator cc(c.begin()),
+ cc_end(c.end()) ; cc != cc_end ; ++cc)
+ cout << "* " << colour(cl_package_name, *cc) << endl;
+ }
+ cout << endl;
+ }
+
+ virtual void on_clean_pre(const DepListEntry &,
+ const PackageDatabaseEntry & c)
+ {
+ cout << colour(cl_heading, "Cleaning " + stringify(c)) << endl << endl;
+
+ cerr << xterm_title("(" + stringify(_current_count) + " of " +
+ stringify(_max_count + _max_virtual_count) + ") Cleaning " + stringify(c));
+ }
+
+ virtual void on_clean_post(const DepListEntry &,
+ const PackageDatabaseEntry &)
+ {
+ }
+
+ virtual void on_clean_all_post(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+ {
+ }
+
+ virtual void on_display_merge_list_pre()
+ {
+ cout << endl << colour(cl_heading, "These packages will be installed:")
+ << endl << endl;
+ }
+
+ virtual void on_display_merge_list_post();
+ virtual void on_display_merge_list_entry(const DepListEntry &);
+
+ virtual void on_fetch_all_pre()
+ {
+ }
+
+ virtual void on_fetch_pre(const DepListEntry & d)
+ {
+ cout << colour(cl_heading, "Fetching " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
+
+ cerr << xterm_title("(" + stringify(++_current_count) + " of " +
+ stringify(_max_count + _max_virtual_count) + ") Fetching " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
+ }
+
+ virtual void on_fetch_post(const DepListEntry &)
+ {
+ }
+
+ virtual void on_fetch_all_post()
+ {
+ }
+
+ virtual void on_install_all_pre()
+ {
+ }
+
+ virtual void on_install_pre(const DepListEntry & d)
+ {
+ cout << endl << colour(cl_heading, "Installing " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
+
+ cerr << xterm_title("(" + stringify(++_current_count) + " of " +
+ stringify(_max_count + _max_virtual_count) + ") Installing " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
+ }
+
+ virtual void on_install_post(const DepListEntry &)
+ {
+ }
+
+ virtual void on_install_all_post()
+ {
+ }
+
+ virtual void on_update_world_pre()
+ {
+ cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
+ }
+
+ virtual void on_update_world(const PackageDepAtom & a)
+ {
+ cout << "* adding " << colour(cl_package_name, a.package()) << endl;
+ }
+
+ virtual void on_update_world_skip(const PackageDepAtom & a, const std::string & s)
+ {
+ cout << "* skipping " << colour(cl_package_name, a.package()) << " ("
+ << s << ")" << endl;
+ }
+
+ virtual void on_update_world_post()
+ {
+ cout << endl;
+ }
+
+ virtual void on_preserve_world()
+ {
+ cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
+ cout << "* --preserve-world was specified, skipping world changes" << endl;
+ cout << endl;
+ }
+ };
+
+ void
+ OurInstallTask::on_display_merge_list_post()
+ {
+ if (_max_count != _new_count + _upgrade_count + _downgrade_count + _new_slot_count +
+ _rebuild_count)
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "Max count doesn't add up. This is a bug!");
+
+ if (_max_virtual_count != _new_virtual_count + _upgrade_virtual_count +
+ _downgrade_virtual_count + _new_slot_virtual_count + _rebuild_virtual_count)
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "Max virtuals count doesn't add up. This is a bug!");
+
+ cout << endl << "Total: " << _max_count << (_max_count == 1 ? " package" : " packages");
+ if (_max_count)
+ {
+ bool need_comma(false);
+ cout << " (";
+ if (_new_count)
+ {
+ cout << _new_count << " new";
+ need_comma = true;
+ }
+ if (_upgrade_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _upgrade_count << (_upgrade_count == 1 ? " upgrade" : " upgrades");
+ need_comma = true;
+ }
+ if (_downgrade_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _downgrade_count << (_downgrade_count == 1 ? " downgrade" : " downgrades");
+ need_comma = true;
+ }
+ if (_new_slot_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _new_slot_count << (_new_slot_count == 1 ? " in new slot" : " in new slots");
+ need_comma = true;
+ }
+ if (_rebuild_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _rebuild_count << (_rebuild_count == 1 ? " rebuild" : " rebuilds");
+ need_comma = true;
+ }
+ cout << ")";
+ }
+
+ if (_max_virtual_count)
+ {
+ cout << " and " << _max_virtual_count << (_max_virtual_count == 1
+ ? " virtual" : " virtuals");
+ bool need_comma(false);
+ cout << " (";
+ if (_new_virtual_count)
+ {
+ cout << _new_virtual_count << " new";
+ need_comma = true;
+ }
+ if (_upgrade_virtual_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _upgrade_virtual_count << (_upgrade_virtual_count == 1 ? " upgrade" : " upgrades");
+ need_comma = true;
+ }
+ if (_downgrade_virtual_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _downgrade_virtual_count << (_downgrade_virtual_count == 1 ?
+ " downgrade" : " downgrades");
+ need_comma = true;
+ }
+ if (_new_slot_virtual_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _new_slot_virtual_count << (_new_slot_virtual_count == 1 ?
+ " in new slot" : " in new slots");
+ need_comma = true;
+ }
+ if (_rebuild_virtual_count)
+ {
+ if (need_comma)
+ cout << ", ";
+ cout << _rebuild_virtual_count << (_rebuild_virtual_count == 1 ?
+ " rebuild" : " rebuilds");
+ need_comma = true;
+ }
+ cout << ")";
+ }
+ cout << endl << endl;
+
+ if (CommandLine::get_instance()->a_pretend.specified() && ! _all_tags.empty())
+ {
+ TagDisplayer tag_displayer;
+
+ std::set<std::string> tag_categories;
+ std::transform(
+ indirect_iterator<const DepTag>(_all_tags.begin()),
+ indirect_iterator<const DepTag>(_all_tags.end()),
+ std::inserter(tag_categories, tag_categories.begin()),
+ std::mem_fun_ref(&DepTag::category));
+
+ for (std::set<std::string>::iterator cat(tag_categories.begin()),
+ cat_end(tag_categories.end()) ; cat != cat_end ; ++cat)
+ {
+ DepTagCategory::ConstPointer c(DepTagCategoryMaker::get_instance()->
+ find_maker(*cat)());
+
+ if (! c->title().empty())
+ cout << colour(cl_heading, c->title()) << ":" << endl << endl;
+ if (! c->pre_text().empty())
+ cout << c->pre_text() << endl << endl;
+
+ for (std::set<DepTag::ConstPointer, DepTag::Comparator>::const_iterator
+ t(_all_tags.begin()), t_end(_all_tags.end()) ;
+ t != t_end ; ++t)
+ {
+ if ((*t)->category() != *cat)
+ continue;
+ (*t)->accept(&tag_displayer);
+ }
+ cout << endl;
+
+ if (! c->post_text().empty())
+ cout << c->post_text() << endl << endl;
+ }
+ }
+ }
+
+ void
+ OurInstallTask::on_display_merge_list_entry(const DepListEntry & d)
+ {
+ Context context("When displaying entry '" + stringify(d) + "':");
+
+ cout << "* " << colour(cl_package_name, d.name);
+
+ /* display version, unless it's 0 and our category is "virtual" */
+ if ((VersionSpec("0") != d.version) ||
+ CategoryNamePart("virtual") != d.name.category)
+ cout << "-" << d.version;
+
+ /* display repository, unless it's our main repository */
+ if (DefaultEnvironment::get_instance()->package_database()->favourite_repository() != d.repository)
+ cout << "::" << d.repository;
+
+ /* display slot name, unless it's 0 */
+ if (SlotName("0") != d.metadata->slot)
+ cout << colour(cl_slot, " {:" + stringify(
+ d.metadata->slot) + "}");
+
+ /* indicate [U], [S] or [N]. display existing version, if we're
+ * already installed */
+ PackageDatabaseEntryCollection::Pointer existing(DefaultEnvironment::get_instance()->package_database()->
+ query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
+ d.name))), is_installed_only));
+
+ if (existing->empty())
+ {
+ cout << colour(cl_updatemode, " [N]");
+ if (d.metadata->get_virtual_interface())
+ {
+ ++_new_virtual_count;
+ ++_max_virtual_count;
+ }
+ else
+ {
+ ++_new_count;
+ ++_max_count;
+ }
+ }
+ else
+ {
+ existing = DefaultEnvironment::get_instance()->package_database()->query(PackageDepAtom::Pointer(
+ new PackageDepAtom(stringify(d.name) + ":" +
+ stringify(d.metadata->slot))),
+ is_installed_only);
+ if (existing->empty())
+ {
+ cout << colour(cl_updatemode, " [S]");
+ if (d.metadata->get_virtual_interface())
+ {
+ ++_new_slot_virtual_count;
+ ++_max_virtual_count;
+ }
+ else
+ {
+ ++_new_slot_count;
+ ++_max_count;
+ }
+ }
+ else if (existing->last()->version < d.version)
+ {
+ cout << colour(cl_updatemode, " [U " + stringify(
+ existing->last()->version) + "]");
+ if (d.metadata->get_virtual_interface())
+ {
+ ++_upgrade_virtual_count;
+ ++_max_virtual_count;
+ }
+ else
+ {
+ ++_upgrade_count;
+ ++_max_count;
+ }
+ }
+ else if (existing->last()->version > d.version)
+ {
+ cout << colour(cl_updatemode, " [D " + stringify(
+ existing->last()->version) + "]");
+ if (d.metadata->get_virtual_interface())
+ {
+ ++_downgrade_virtual_count;
+ ++_max_virtual_count;
+ }
+ else
+ {
+ ++_downgrade_count;
+ ++_max_count;
+ }
+
+ }
+ else
+ {
+ cout << colour(cl_updatemode, " [R]");
+ if (d.metadata->get_virtual_interface())
+ {
+ ++_rebuild_virtual_count;
+ ++_max_virtual_count;
+ }
+ else
+ {
+ ++_rebuild_count;
+ ++_max_count;
+ }
+ }
+ }
+
+ /* fetch db entry */
+ PackageDatabaseEntry p(PackageDatabaseEntry(d.name,
+ d.version, d.repository));
+
+ /* display USE flags */
+ std::cout << make_pretty_use_flags_string(DefaultEnvironment::get_instance(), p, d.metadata);
+
+ /* display tag, add tag to our post display list */
+ if (! d.tag->empty())
+ {
+ std::string tag_titles;
+ for (SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Iterator
+ tag(d.tag->begin()),
+ tag_end(d.tag->end()) ;
+ tag != tag_end ; ++tag)
+ {
+ _all_tags.insert(*tag);
+ tag_titles.append((*tag)->short_text());
+ tag_titles.append(",");
+ }
+ tag_titles.erase(tag_titles.length() - 1);
+ cout << " " << colour(cl_tag, "<" + tag_titles + ">");
+ }
+
+ cout << endl;
+ }
+}
+
+int
+do_install()
+{
+ int return_code(0);
+
+ Context context("When performing install action from command line:");
+
+ OurInstallTask task;
+
+ task.set_drop_self_circular(CommandLine::get_instance()->a_dl_drop_self_circular.specified());
+ task.set_drop_circular(CommandLine::get_instance()->a_dl_drop_circular.specified());
+ task.set_drop_all(CommandLine::get_instance()->a_dl_drop_all.specified());
+ task.set_ignore_installed(CommandLine::get_instance()->a_dl_ignore_installed.specified());
+ task.set_recursive_deps(! CommandLine::get_instance()->a_dl_no_recursive_deps.specified());
+ task.set_max_stack_depth(CommandLine::get_instance()->a_dl_max_stack_depth.argument());
+ task.set_no_unnecessary_upgrades(CommandLine::get_instance()->a_dl_no_unnecessary_upgrades.specified());
+
+ if (CommandLine::get_instance()->a_dl_rdepend_post.argument() == "always")
+ task.set_rdepend_post(dlro_always);
+ else if (CommandLine::get_instance()->a_dl_rdepend_post.argument() == "never")
+ task.set_rdepend_post(dlro_never);
+ else
+ task.set_rdepend_post(dlro_as_needed);
+
+ task.set_no_config_protect(CommandLine::get_instance()->a_no_config_protection.specified());
+ task.set_fetch_only(CommandLine::get_instance()->a_fetch.specified());
+ task.set_pretend(CommandLine::get_instance()->a_pretend.specified());
+ task.set_preserve_world(CommandLine::get_instance()->a_preserve_world.specified());
+
+ try
+ {
+ for (CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q)
+ task.add_target(*q);
+
+ task.execute();
+
+ cout << endl;
+ }
+ catch (const AmbiguousPackageNameError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl;
+ for (AmbiguousPackageNameError::OptionsIterator o(e.begin_options()),
+ o_end(e.end_options()) ; o != o_end ; ++o)
+ cerr << " * " << colour(cl_package_name, *o) << endl;
+ cerr << endl;
+ return 1;
+ }
+ catch (const PackageInstallActionError & e)
+ {
+ cout << endl;
+ cerr << "Install error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << e.message() << endl;
+
+ return_code |= 1;
+ }
+ catch (const NoSuchPackageError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "No such package '" << e.name() << "'" << endl;
+ return 1;
+ }
+ catch (const AllMaskedError & e)
+ {
+ try
+ {
+ PackageDatabaseEntryCollection::ConstPointer p(
+ DefaultEnvironment::get_instance()->package_database()->query(
+ PackageDepAtom::ConstPointer(new PackageDepAtom(e.query())),
+ is_uninstalled_only));
+ if (p->empty())
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "All versions of '" << e.query() << "' are masked" << endl;
+ }
+ else
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "All versions of '" << e.query() << "' are masked. Candidates are:" << endl;
+ for (PackageDatabaseEntryCollection::Iterator pp(p->begin()), pp_end(p->end()) ;
+ pp != pp_end ; ++pp)
+ {
+ cerr << " * " << colour(cl_package_name, *pp) << ": Masked by ";
+
+ bool need_comma(false);
+ MaskReasons m(DefaultEnvironment::get_instance()->mask_reasons(*pp));
+ for (unsigned mm = 0 ; mm < m.size() ; ++mm)
+ if (m[mm])
+ {
+ if (need_comma)
+ cerr << ", ";
+ cerr << MaskReason(mm);
+
+ if (mr_eapi == mm)
+ {
+ std::string eapi_str(DefaultEnvironment::get_instance()->
+ package_database()->fetch_repository(
+ pp->repository)->version_metadata(
+ pp->name, pp->version)->eapi);
+
+ cerr << " ( " << colour(cl_masked, eapi_str) << " )";
+ }
+ else if (mr_license == mm)
+ {
+ cerr << " ";
+
+ LicenceDisplayer ld(cerr, DefaultEnvironment::get_instance(), &*pp);
+ DefaultEnvironment::get_instance()->package_database()->fetch_repository(
+ pp->repository)->version_metadata(
+ pp->name, pp->version)->license()->
+ accept(&ld);
+ }
+ else if (mr_keyword == mm)
+ {
+ VersionMetadata::ConstPointer m(DefaultEnvironment::get_instance()->
+ package_database()->fetch_repository(
+ pp->repository)->version_metadata(
+ pp->name, pp->version));
+ if (m->get_ebuild_interface())
+ {
+ std::set<KeywordName> keywords;
+ WhitespaceTokeniser::get_instance()->tokenise(
+ m->get_ebuild_interface()->keywords,
+ create_inserter<KeywordName>(
+ std::inserter(keywords, keywords.end())));
+
+ cerr << " ( " << colour(cl_masked, join(keywords.begin(),
+ keywords.end(), " ")) << " )";
+ }
+ }
+
+ need_comma = true;
+ }
+ cerr << endl;
+ }
+ }
+ }
+ catch (...)
+ {
+ throw e;
+ }
+
+ return 1;
+ }
+ catch (const UseRequirementsNotMetError & e)
+ {
+ cout << endl;
+ cerr << "DepList USE requirements not met error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ cerr << "This error usually indicates that one of the packages you are trying to" << endl;
+ cerr << "install requires that another package be built with particular USE flags" << endl;
+ cerr << "enabled or disabled. You may be able to work around this restriction by" << endl;
+ cerr << "adjusting your use.conf." << endl;
+ cerr << endl;
+
+ return_code |= 1;
+ }
+ catch (const DepListStackTooDeepError & e)
+ {
+ cout << endl;
+ cerr << "DepList stack too deep error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ cerr << "Try '--dl-max-stack-depth " << std::max(
+ CommandLine::get_instance()->a_dl_max_stack_depth.argument() * 2, 100)
+ << "'." << endl << endl;
+
+ return_code |= 1;
+ }
+ catch (const DepListError & e)
+ {
+ cout << endl;
+ cerr << "Dependency error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << " ("
+ << e.what() << ")" << endl;
+ cerr << endl;
+
+ return_code |= 1;
+ }
+ catch (const HadBothPackageAndSetTargets &)
+ {
+ cout << endl;
+ cerr << "Error: both package sets and packages were specified." << endl;
+ cerr << endl;
+ cerr << "Package sets (like 'system' and 'world') cannot be installed at the same time" << endl;
+ cerr << "as ordinary packages." << endl;
+
+ return_code |= 1;
+ }
+ catch (const MultipleSetTargetsSpecified &)
+ {
+ cout << endl;
+ cerr << "Error: multiple package sets were specified." << endl;
+ cerr << endl;
+ cerr << "Package sets (like 'system' and 'world') must be installed individually," << endl;
+ cerr << "without any other sets or packages." << endl;
+
+ return_code |= 1;
+ }
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/install.hh b/0.6.3/src/paludis/install.hh
new file mode 100644
index 000000000..693931bb1
--- /dev/null
+++ b/0.6.3/src/paludis/install.hh
@@ -0,0 +1,32 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_DEPGRAPH_HH
+#define PALUDIS_GUARD_SRC_DEPGRAPH_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for the do_install function.
+ */
+
+/// Handle --install.
+int do_install();
+
+#endif
diff --git a/0.6.3/src/paludis/install_TEST b/0.6.3/src/paludis/install_TEST
new file mode 100755
index 000000000..eab20a9d0
--- /dev/null
+++ b/0.6.3/src/paludis/install_TEST
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --config-suffix install-test --install target || exit 1
+./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null
+
diff --git a/0.6.3/src/paludis/install_TEST_cleanup.sh b/0.6.3/src/paludis/install_TEST_cleanup.sh
new file mode 100755
index 000000000..92bb92a5a
--- /dev/null
+++ b/0.6.3/src/paludis/install_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d install_TEST_dir ] ; then
+ rm -fr install_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/0.6.3/src/paludis/install_TEST_setup.sh b/0.6.3/src/paludis/install_TEST_setup.sh
new file mode 100755
index 000000000..b511e8ea9
--- /dev/null
+++ b/0.6.3/src/paludis/install_TEST_setup.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir install_TEST_dir || exit 1
+cd install_TEST_dir || exit 1
+
+mkdir -p config/.paludis-install-test
+cat <<END > config/.paludis-install-test/specpath
+root = `pwd`/root
+config-suffix =
+END
+
+mkdir -p root/${SYSCONFDIR}/paludis/repositories
+cat <<END > root/${SYSCONFDIR}/paludis/use.conf
+* foo
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf
+* *
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf
+* test
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/bashrc
+export CHOST="my-chost"
+export USER_BASHRC_WAS_USED=yes
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf
+location = `pwd`/repo1
+cache = /var/empty
+format = portage
+profiles = \${location}/profiles/testprofile \${location}/profiles/anothertestprofile
+buildroot = `pwd`/build
+END
+
+mkdir -p root/tmp
+touch root/${SYSCONFDIR}/ld.so.conf
+
+mkdir -p repo1/{eclass,distfiles,profiles/{testprofile,anothertestprofile},test-category/target/files} || exit 1
+
+mkdir -p src/target-2
+cat <<"END" > src/target-2/testbin
+#!/bin/bash
+echo "Test was a success"
+END
+chmod +x src/target-2/testbin
+cd src
+tar zcf target-2.tar.gz target-2/
+mv target-2.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+test-category
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+TESTPROFILE_WAS_SOURCED=yes
+PROFILE_ORDERING=1
+END
+cat <<END > profiles/anothertestprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+ANOTHERTESTPROFILE_WAS_SOURCED=yes
+PROFILE_ORDERING=2
+END
+
+cat <<"END" > eclass/foo.eclass
+inherit_was_ok() {
+ true
+}
+END
+
+cat <<"END" > test-category/target/target-2.ebuild || exit 1
+inherit foo
+
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz oink? ( http://example.com/foo.tar.gz )"
+SLOT="0"
+IUSE="oink"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -z "${USER_BASHRC_WAS_USED}" ]] && die "bad env"
+ [[ -z "${TESTPROFILE_WAS_SOURCED}" ]] && die "testprofile not sourced"
+ [[ -z "${ANOTHERTESTPROFILE_WAS_SOURCED}" ]] && die "anothertestprofile not sourced"
+ [[ ${PROFILE_ORDERING:-0} != 2 ]] && die "bad profile source ordering"
+}
+
+src_unpack() {
+ hasq "${P}.tar.gz" ${A} || die
+ hasq "${P}.tar.gz" ${AA} || die
+ hasq "foo.tar.gz" ${A} && die
+ hasq "foo.tar.gz" ${AA} || die
+ unpack ${A}
+}
+
+src_compile() {
+ inherit_was_ok || die "inherit didn't work"
+}
+
+src_test() {
+ ./testbin | grep success || die "failure"
+}
+
+src_install() {
+ dobin testbin
+}
+END
+cd ..
+
diff --git a/0.6.3/src/paludis/licence.cc b/0.6.3/src/paludis/licence.cc
new file mode 100644
index 000000000..a460a97cb
--- /dev/null
+++ b/0.6.3/src/paludis/licence.cc
@@ -0,0 +1,66 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "licence.hh"
+#include "colour.hh"
+#include <ostream>
+
+void
+LicenceDisplayer::visit(const paludis::AllDepAtom * atom)
+{
+ stream << "( ";
+ std::for_each(atom->begin(), atom->end(), paludis::accept_visitor(this));
+ stream << ") ";
+}
+
+void
+LicenceDisplayer::visit(const paludis::AnyDepAtom * atom)
+{
+ stream << "|| ( ";
+ std::for_each(atom->begin(), atom->end(), paludis::accept_visitor(this));
+ stream << ") ";
+}
+
+void
+LicenceDisplayer::visit(const paludis::UseDepAtom * atom)
+{
+ stream << atom->flag() << "? ( ";
+ std::for_each(atom->begin(), atom->end(), paludis::accept_visitor(this));
+ stream << ") ";
+}
+
+void
+LicenceDisplayer::visit(const paludis::PlainTextDepAtom * atom)
+{
+ if (env->accept_license(atom->text(), db_entry))
+ stream << colour(cl_not_masked, atom->text());
+ else
+ stream << colour(cl_masked, "(" + atom->text() + ")!");
+ stream << " ";
+}
+
+LicenceDisplayer::LicenceDisplayer(
+ std::ostream & s,
+ const paludis::Environment * const e,
+ const paludis::PackageDatabaseEntry * const d) :
+ stream(s),
+ env(e),
+ db_entry(d)
+{
+}
diff --git a/0.6.3/src/paludis/licence.hh b/0.6.3/src/paludis/licence.hh
new file mode 100644
index 000000000..38d902ea4
--- /dev/null
+++ b/0.6.3/src/paludis/licence.hh
@@ -0,0 +1,67 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_LICENCE_HH
+#define PALUDIS_GUARD_SRC_LICENCE_HH 1
+
+#include <paludis/paludis.hh>
+#include <iosfwd>
+
+/**
+ * Display licences.
+ */
+struct LicenceDisplayer :
+ paludis::DepAtomVisitorTypes::ConstVisitor
+{
+ /// Our stream.
+ std::ostream & stream;
+
+ /// Our environment.
+ const paludis::Environment * const env;
+
+ /// Our db entry.
+ const paludis::PackageDatabaseEntry * const db_entry;
+
+ /// Constructor.
+ LicenceDisplayer(
+ std::ostream & stream,
+ const paludis::Environment * const e,
+ const paludis::PackageDatabaseEntry * const d);
+
+ ///\name Visit methods
+ ///{
+ void visit(const paludis::AllDepAtom * atom);
+
+ void visit(const paludis::AnyDepAtom * atom);
+
+ void visit(const paludis::UseDepAtom * atom);
+
+ void visit(const paludis::PlainTextDepAtom * atom);
+
+ void visit(const paludis::PackageDepAtom *)
+ {
+ }
+
+ void visit(const paludis::BlockDepAtom *)
+ {
+ }
+ ///}
+};
+
+#endif
diff --git a/0.6.3/src/paludis/list.cc b/0.6.3/src/paludis/list.cc
new file mode 100644
index 000000000..85b808141
--- /dev/null
+++ b/0.6.3/src/paludis/list.cc
@@ -0,0 +1,325 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "colour.hh"
+#include "command_line.hh"
+#include "list.hh"
+#include <iomanip>
+#include <iostream>
+#include <list>
+#include <map>
+#include <paludis/paludis.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/visitor.hh>
+
+namespace p = paludis;
+
+int
+do_list_repositories()
+{
+ int ret_code(1);
+
+ p::Context context("When performing list-repositories action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
+ r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ if (CommandLine::get_instance()->a_repository.specified())
+ if (CommandLine::get_instance()->a_repository.args_end() == std::find(
+ CommandLine::get_instance()->a_repository.args_begin(),
+ CommandLine::get_instance()->a_repository.args_end(),
+ stringify(r->name())))
+ continue;
+
+ ret_code = 0;
+
+ std::cout << "* " << colour(cl_repository_name, r->name()) << std::endl;
+
+ p::RepositoryInfo::ConstPointer ii(r->info(false));
+ for (p::RepositoryInfo::SectionIterator i(ii->begin_sections()),
+ i_end(ii->end_sections()) ; i != i_end ; ++i)
+ {
+ std::cout << " " << colour(cl_heading, (*i)->heading() + ":") << std::endl;
+ for (p::RepositoryInfoSection::KeyValueIterator k((*i)->begin_kvs()),
+ k_end((*i)->end_kvs()) ; k != k_end ; ++k)
+ std::cout << " " << std::setw(22) << std::left << (p::stringify(k->first) + ":")
+ << std::setw(0) << " " << k->second << std::endl;
+ std::cout << std::endl;
+ }
+ }
+
+ return ret_code;
+}
+
+int
+do_list_categories()
+{
+ int ret_code(1);
+
+ p::Context context("When performing list-categories action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::map<p::CategoryNamePart, std::list<p::RepositoryName> > cats;
+
+ for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
+ r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ if (CommandLine::get_instance()->a_repository.specified())
+ if (CommandLine::get_instance()->a_repository.args_end() == std::find(
+ CommandLine::get_instance()->a_repository.args_begin(),
+ CommandLine::get_instance()->a_repository.args_end(),
+ stringify(r->name())))
+ continue;
+
+ p::CategoryNamePartCollection::ConstPointer cat_names(r->category_names());
+ for (p::CategoryNamePartCollection::Iterator c(cat_names->begin()), c_end(cat_names->end()) ;
+ c != c_end ; ++c)
+ cats[*c].push_back(r->name());
+ }
+
+ for (std::map<p::CategoryNamePart, std::list<p::RepositoryName > >::const_iterator
+ c(cats.begin()), c_end(cats.end()) ; c != c_end ; ++c)
+ {
+ if (CommandLine::get_instance()->a_category.specified())
+ if (CommandLine::get_instance()->a_category.args_end() == std::find(
+ CommandLine::get_instance()->a_category.args_begin(),
+ CommandLine::get_instance()->a_category.args_end(),
+ stringify(c->first)))
+ continue;
+
+ ret_code = 0;
+
+ std::cout << "* " << colour(cl_package_name, c->first) << std::endl;
+ std::cout << " " << std::setw(22) << std::left << "found in:" <<
+ std::setw(0) << " " << p::join(c->second.begin(), c->second.end(), ", ") << std::endl;
+ std::cout << std::endl;
+ }
+
+ return ret_code;
+}
+
+int
+do_list_packages()
+{
+ int ret_code(1);
+
+ p::Context context("When performing list-packages action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ std::map<p::QualifiedPackageName, std::list<p::RepositoryName> > pkgs;
+
+ for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
+ r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ if (CommandLine::get_instance()->a_repository.specified())
+ if (CommandLine::get_instance()->a_repository.args_end() == std::find(
+ CommandLine::get_instance()->a_repository.args_begin(),
+ CommandLine::get_instance()->a_repository.args_end(),
+ stringify(r->name())))
+ continue;
+
+ p::CategoryNamePartCollection::ConstPointer cat_names(r->category_names());
+ for (p::CategoryNamePartCollection::Iterator 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.args_end() == std::find(
+ CommandLine::get_instance()->a_category.args_begin(),
+ CommandLine::get_instance()->a_category.args_end(),
+ stringify(*c)))
+ continue;
+
+ p::QualifiedPackageNameCollection::ConstPointer pkg_names(r->package_names(*c));
+ for (p::QualifiedPackageNameCollection::Iterator p(pkg_names->begin()), p_end(pkg_names->end()) ;
+ p != p_end ; ++p)
+ pkgs[*p].push_back(r->name());
+ }
+ }
+
+ for (std::map<p::QualifiedPackageName, std::list<p::RepositoryName > >::const_iterator
+ p(pkgs.begin()), p_end(pkgs.end()) ; p != p_end ; ++p)
+ {
+ if (CommandLine::get_instance()->a_package.specified())
+ if (CommandLine::get_instance()->a_package.args_end() == std::find(
+ CommandLine::get_instance()->a_package.args_begin(),
+ CommandLine::get_instance()->a_package.args_end(),
+ stringify(p->first.package)))
+ continue;
+
+ ret_code = 0;
+
+ std::cout << "* " << colour(cl_package_name, p->first) << std::endl;
+ std::cout << " " << std::setw(22) << std::left << "found in:" <<
+ std::setw(0) << " " << p::join(p->second.begin(), p->second.end(), ", ") << std::endl;
+ std::cout << std::endl;
+ }
+
+ return ret_code;
+}
+
+namespace
+{
+ /**
+ * Print dependency atoms as returned by do_package_set("security").
+ *
+ * \ingroup grpvulnerabilitiesprinter
+ */
+ class VulnerabilitiesPrinter :
+ public p::DepAtomVisitorTypes::ConstVisitor
+ {
+ private:
+ unsigned _size;
+
+ public:
+ /**
+ * Constructor.
+ */
+ VulnerabilitiesPrinter() :
+ _size(0)
+ {
+ }
+
+ /// \name Visit functions
+ ///{
+ void visit(const p::AllDepAtom * const);
+
+ void visit(const p::AnyDepAtom * const);
+
+ void visit(const p::UseDepAtom * const);
+
+ void visit(const p::PackageDepAtom * const);
+
+ void visit(const p::PlainTextDepAtom * const);
+
+ void visit(const p::BlockDepAtom * const);
+ ///}
+
+ /**
+ * Return number of visited atoms.
+ */
+ unsigned size() const
+ {
+ return _size;
+ }
+ };
+
+ void
+ VulnerabilitiesPrinter::visit(const p::AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), p::accept_visitor(this));
+ }
+
+ void
+ VulnerabilitiesPrinter::visit(const p::AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), p::accept_visitor(this));
+ }
+
+ void
+ VulnerabilitiesPrinter::visit(const p::UseDepAtom * const a)
+ {
+ p::Log::get_instance()->message(p::ll_warning, p::lc_no_context,
+ "UseDepAtom encounter in do_package_set(\"security\").");
+ std::for_each(a->begin(), a->end(), p::accept_visitor(this));
+ }
+
+ void
+ VulnerabilitiesPrinter::visit(const p::PackageDepAtom * const a)
+ {
+ p::QualifiedPackageName q(a->package());
+
+ std::string c(p::stringify(q.category));
+ if (CommandLine::get_instance()->a_category.specified())
+ if (CommandLine::get_instance()->a_category.args_end() == std::find(
+ CommandLine::get_instance()->a_category.args_begin(),
+ CommandLine::get_instance()->a_category.args_end(),
+ c))
+ return;
+
+ std::string p(p::stringify(q.package));
+ if (CommandLine::get_instance()->a_package.specified())
+ if (CommandLine::get_instance()->a_package.args_end() == std::find(
+ CommandLine::get_instance()->a_package.args_begin(),
+ CommandLine::get_instance()->a_package.args_end(),
+ p))
+ return;
+
+ std::cout << "* " << colour(cl_package_name, p::stringify(q));
+ if (0 != a->tag())
+ std::cout << "-" << p::stringify(*a->version_spec_ptr());
+ if (0 != a->tag())
+ std::cout << " " << colour(cl_tag, "<" + a->tag()->short_text() + ">");
+ std::cout << std::endl;
+ ++_size;
+ }
+
+ void
+ VulnerabilitiesPrinter::visit(const p::PlainTextDepAtom * const)
+ {
+ }
+
+ void
+ VulnerabilitiesPrinter::visit(const p::BlockDepAtom * const)
+ {
+ }
+}
+
+int
+do_list_vulnerabilities()
+{
+ int ret_code = 0;
+
+ p::Context context("When performing list-vulnerabilities action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+ p::PackageSetOptions opts(true);
+
+ p::CompositeDepAtom::Pointer vulnerabilities(new p::AllDepAtom);
+
+ for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
+ r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ if (CommandLine::get_instance()->a_repository.specified())
+ if (CommandLine::get_instance()->a_repository.args_end() == std::find(
+ CommandLine::get_instance()->a_repository.args_begin(),
+ CommandLine::get_instance()->a_repository.args_end(),
+ stringify(r->name())))
+ continue;
+
+ if (! r->sets_interface)
+ continue;
+
+ p::DepAtom::Pointer dep = r->sets_interface->package_set("security", opts);
+ if (0 != dep)
+ vulnerabilities->add_child(dep);
+ }
+
+ VulnerabilitiesPrinter vp;
+ std::for_each(vulnerabilities->begin(), vulnerabilities->end(), p::accept_visitor(&vp));
+
+ if (vp.size() == 0)
+ ret_code = 1;
+
+ return ret_code;
+}
+
diff --git a/0.6.3/src/paludis/list.hh b/0.6.3/src/paludis/list.hh
new file mode 100644
index 000000000..6e0c45f0b
--- /dev/null
+++ b/0.6.3/src/paludis/list.hh
@@ -0,0 +1,39 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_LIST_REPOSITORIES_HH
+#define PALUDIS_GUARD_SRC_LIST_REPOSITORIES_HH 1
+
+/** \file
+ * Declaration for the do_list_repositories and do_list_categories functions.
+ */
+
+/// Handle --list-repositories.
+int do_list_repositories();
+
+/// Handle --list-categories.
+int do_list_categories();
+
+/// Handle --list-packages.
+int do_list_packages();
+
+/// Handle --list-vulnerabilities.
+int do_list_vulnerabilities();
+
+#endif
diff --git a/0.6.3/src/paludis/list_dep_tag_categories_TEST b/0.6.3/src/paludis/list_dep_tag_categories_TEST
new file mode 100755
index 000000000..40fa15c1a
--- /dev/null
+++ b/0.6.3/src/paludis/list_dep_tag_categories_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-dep-tag-categories
diff --git a/0.6.3/src/paludis/list_repository_formats_TEST b/0.6.3/src/paludis/list_repository_formats_TEST
new file mode 100755
index 000000000..487513c46
--- /dev/null
+++ b/0.6.3/src/paludis/list_repository_formats_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-repository-formats
diff --git a/0.6.3/src/paludis/list_sync_formats_TEST b/0.6.3/src/paludis/list_sync_formats_TEST
new file mode 100755
index 000000000..f638b2263
--- /dev/null
+++ b/0.6.3/src/paludis/list_sync_formats_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-sync-protocols
diff --git a/0.6.3/src/paludis/man_paludis.cc b/0.6.3/src/paludis/man_paludis.cc
new file mode 100644
index 000000000..9cab7e5d5
--- /dev/null
+++ b/0.6.3/src/paludis/man_paludis.cc
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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;
+
+int
+main(int, char *[])
+{
+ paludis::args::generate_man(cout, CommandLine::get_instance());
+ return EXIT_SUCCESS;
+}
+
diff --git a/0.6.3/src/paludis/news.cc b/0.6.3/src/paludis/news.cc
new file mode 100644
index 000000000..e3147f3d0
--- /dev/null
+++ b/0.6.3/src/paludis/news.cc
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "colour.hh"
+#include "news.hh"
+#include <functional>
+#include <iomanip>
+#include <iostream>
+#include <paludis/paludis.hh>
+#include <string>
+
+/** \file
+ * Handle the --update-news action for the main paludis program.
+ */
+
+namespace p = paludis;
+
+int
+do_update_news()
+{
+ int return_code(0);
+
+ p::Context context("When performing update-news action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
+ r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ if ((*r)->news_interface)
+ (*r)->news_interface->update_news();
+
+ return return_code;
+}
+
+
+
diff --git a/0.6.3/src/paludis/news.hh b/0.6.3/src/paludis/news.hh
new file mode 100644
index 000000000..1e3e06d11
--- /dev/null
+++ b/0.6.3/src/paludis/news.hh
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_NEWS_HH
+#define PALUDIS_GUARD_SRC_NEWS_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for the do_update_news function.
+ */
+
+/// Handle --update-news.
+int do_update_news();
+
+#endif
+
+
diff --git a/0.6.3/src/paludis/owner.cc b/0.6.3/src/paludis/owner.cc
new file mode 100644
index 000000000..e1a7ee6bb
--- /dev/null
+++ b/0.6.3/src/paludis/owner.cc
@@ -0,0 +1,132 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "owner.hh"
+#include "colour.hh"
+#include "command_line.hh"
+#include <paludis/paludis.hh>
+#include <iostream>
+
+namespace p = paludis;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+namespace
+{
+ struct ContentsFinder :
+ p::ContentsVisitorTypes::ConstVisitor
+ {
+ bool found;
+ const std::string query;
+ const bool full;
+
+ ContentsFinder(const std::string & q, bool f) :
+ found(false),
+ query(q),
+ full(f)
+ {
+ }
+
+ void handle(const std::string & e)
+ {
+ if (full)
+ found |= (e == query);
+ else
+ found |= (std::string::npos != e.find(query));
+ }
+
+ void visit(const p::ContentsFileEntry * const e)
+ {
+ handle(e->name());
+ }
+
+ void visit(const p::ContentsDirEntry * const e)
+ {
+ handle(e->name());
+ }
+
+ void visit(const p::ContentsSymEntry * const e)
+ {
+ handle(e->name());
+ }
+
+ void visit(const p::ContentsMiscEntry * const e)
+ {
+ handle(e->name());
+ }
+ };
+}
+
+void
+do_one_owner(
+ const p::Environment * const env,
+ const std::string & query)
+{
+ cout << "* " << colour(cl_package_name, query) << endl;
+
+ for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
+ r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ {
+ if (! (*r)->installed_interface)
+ continue;
+
+ p::CategoryNamePartCollection::ConstPointer cats((*r)->category_names());
+ for (p::CategoryNamePartCollection::Iterator c(cats->begin()),
+ c_end(cats->end()) ; c != c_end ; ++c)
+ {
+ p::QualifiedPackageNameCollection::ConstPointer pkgs((*r)->package_names(*c));
+ for (p::QualifiedPackageNameCollection::Iterator p(pkgs->begin()),
+ p_end(pkgs->end()) ; p != p_end ; ++p)
+ {
+ p::VersionSpecCollection::ConstPointer vers((*r)->version_specs(*p));
+ for (p::VersionSpecCollection::Iterator v(vers->begin()),
+ v_end(vers->end()) ; v != v_end ; ++v)
+ {
+ p::PackageDatabaseEntry e(*p, *v, (*r)->name());
+ p::Contents::ConstPointer contents((*r)->installed_interface->
+ contents(*p, *v));
+ ContentsFinder d(query, CommandLine::get_instance()->a_full_match.specified());
+ std::for_each(contents->begin(), contents->end(), accept_visitor(&d));
+ if (d.found)
+ cout << " " << e << endl;
+ }
+ }
+ }
+ }
+
+ cout << endl;
+}
+
+
+int
+do_owner()
+{
+ int return_code(0);
+ p::Context context("When performing owner action from command line:");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters());
+ for ( ; q != q_end ; ++q)
+ do_one_owner(env, *q);
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/owner.hh b/0.6.3/src/paludis/owner.hh
new file mode 100644
index 000000000..ce9efba9a
--- /dev/null
+++ b/0.6.3/src/paludis/owner.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_OWNER_HH
+#define PALUDIS_GUARD_SRC_OWNER_HH 1
+
+/** \file
+ * Declaration for the do_owner function.
+ */
+
+/// Handle --owner.
+int do_owner();
+
+#endif
diff --git a/0.6.3/src/paludis/paludis.cc b/0.6.3/src/paludis/paludis.cc
new file mode 100644
index 000000000..91d16540e
--- /dev/null
+++ b/0.6.3/src/paludis/paludis.cc
@@ -0,0 +1,441 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006 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 "applets.hh"
+#include "colour.hh"
+#include "command_line.hh"
+#include "contents.hh"
+#include "install.hh"
+#include "list.hh"
+#include "news.hh"
+#include "owner.hh"
+#include "query.hh"
+#include "sync.hh"
+#include "uninstall.hh"
+#include "config.h"
+
+#include <paludis/paludis.hh>
+#include <paludis/util/util.hh>
+
+#include <libebt/libebt.hh>
+#include <libwrapiter/libwrapiter.hh>
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <cstdlib>
+
+/** \file
+ * Main paludis program.
+ */
+
+namespace p = paludis;
+
+using std::cout;
+using std::cerr;
+using std::endl;
+
+#ifndef DOXYGEN
+struct DoVersion
+{
+};
+#endif
+
+namespace
+{
+ void display_version()
+ {
+ cout << PALUDIS_PACKAGE << " " << 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 << "libebt: " << LIBEBT_VERSION_MAJOR << "." << LIBEBT_VERSION_MINOR
+ << "." << LIBEBT_VERSION_MICRO << endl;
+ cout << "libwrapiter: " << LIBWRAPITER_VERSION_MAJOR << "." << LIBWRAPITER_VERSION_MINOR
+ << "." << LIBWRAPITER_VERSION_MICRO << endl;
+#if HAVE_SANDBOX
+ cout << "sandbox: enabled" << endl;
+#else
+ cout << "sandbox: disabled" << endl;
+#endif
+ }
+
+ void display_info()
+ {
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
+ for (p::IndirectIterator<p::PackageDatabase::RepositoryIterator, const p::Repository>
+ r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ;
+ r != r_end ; ++r)
+ {
+ cout << "Repository " << colour(cl_repository_name, r->name()) << ":" << endl;
+
+ p::RepositoryInfo::ConstPointer ii(r->info(true));
+ for (p::RepositoryInfo::SectionIterator i(ii->begin_sections()),
+ i_end(ii->end_sections()) ; i != i_end ; ++i)
+ {
+ cout << " " << colour(cl_heading, (*i)->heading() + ":") << endl;
+ for (p::RepositoryInfoSection::KeyValueIterator k((*i)->begin_kvs()),
+ k_end((*i)->end_kvs()) ; k != k_end ; ++k)
+ cout << " " << std::setw(22) << std::left << (p::stringify(k->first) + ":")
+ << std::setw(0) << " " << k->second << endl;
+ cout << endl;
+ }
+ }
+
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ p::Context context("In program " + p::join(argv, argv + argc, " ") + ":");
+
+ try
+ {
+ CommandLine::get_instance()->run(argc, argv);
+ set_use_colour(! CommandLine::get_instance()->a_no_color.specified());
+
+ if (CommandLine::get_instance()->a_help.specified())
+ throw DoHelp();
+
+ if (CommandLine::get_instance()->a_version.specified())
+ throw DoVersion();
+
+ if (! CommandLine::get_instance()->a_log_level.specified())
+ p::Log::get_instance()->set_log_level(p::ll_qa);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "debug")
+ p::Log::get_instance()->set_log_level(p::ll_debug);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "qa")
+ p::Log::get_instance()->set_log_level(p::ll_qa);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "warning")
+ p::Log::get_instance()->set_log_level(p::ll_warning);
+ else if (CommandLine::get_instance()->a_log_level.argument() == "silent")
+ p::Log::get_instance()->set_log_level(p::ll_silent);
+ else
+ throw DoHelp("bad value for --log-level");
+
+ p::Log::get_instance()->set_program_name(argv[0]);
+
+ if (1 != (CommandLine::get_instance()->a_query.specified() +
+ CommandLine::get_instance()->a_version.specified() +
+ CommandLine::get_instance()->a_install.specified() +
+ CommandLine::get_instance()->a_uninstall.specified() +
+ CommandLine::get_instance()->a_sync.specified() +
+ CommandLine::get_instance()->a_list_repositories.specified() +
+ CommandLine::get_instance()->a_list_categories.specified() +
+ CommandLine::get_instance()->a_list_packages.specified() +
+ CommandLine::get_instance()->a_list_sync_protocols.specified() +
+ CommandLine::get_instance()->a_list_repository_formats.specified() +
+ CommandLine::get_instance()->a_list_dep_tag_categories.specified() +
+ CommandLine::get_instance()->a_list_vulnerabilities.specified() +
+ CommandLine::get_instance()->a_contents.specified() +
+ CommandLine::get_instance()->a_owner.specified() +
+ CommandLine::get_instance()->a_has_version.specified() +
+ CommandLine::get_instance()->a_update_news.specified() +
+ CommandLine::get_instance()->a_environment_variable.specified() +
+ CommandLine::get_instance()->a_configuration_variable.specified() +
+ CommandLine::get_instance()->a_info.specified() +
+ CommandLine::get_instance()->a_best_version.specified()))
+ {
+ if ((1 == std::distance(CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters())) &&
+ ("moo" == *CommandLine::get_instance()->begin_parameters()))
+ {
+ cout << endl;
+ cout << " ______________________________" << endl;
+ cout << "( Ugh. Another Portage user... )" << endl;
+ cout << " ------------------------------ " << endl;
+ cout << " o" << endl;
+ cout << " o" << endl;
+ cout << " ^__^ /" << endl;
+ cout << " (" << colour(cl_bold_pink, "oo") << ")\\_______/ _________" << endl;
+ cout << " (__)\\ )=( ____|_ \\_____" << endl;
+ cout << " ||----w | \\ \\ \\_____ |" << endl;
+ cout << " || || || ||" << endl;
+ cout << endl;
+ return EXIT_SUCCESS;
+ }
+ else
+ throw DoHelp("you should specify exactly one action");
+ }
+
+ /* these actions don't need DefaultConfig */
+
+ if (CommandLine::get_instance()->a_list_sync_protocols.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-sync-protocols action takes no parameters");
+
+ return do_list_sync_protocols();
+ }
+
+ if (CommandLine::get_instance()->a_list_repository_formats.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-repository-formats action takes no parameters");
+
+ return do_list_repository_formats();
+ }
+
+ if (CommandLine::get_instance()->a_list_dep_tag_categories.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-dep-tag-categories action takes no parameters");
+
+ return do_list_dep_tag_categories();
+ }
+
+ if (CommandLine::get_instance()->a_list_vulnerabilities.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-vulnerabilities action takes no paramters");
+
+ return do_list_vulnerabilities();
+ }
+
+ /* these actions do need DefaultConfig */
+
+ try
+ {
+ std::string paludis_command(argv[0]);
+ if (CommandLine::get_instance()->a_config_suffix.specified())
+ {
+ p::DefaultConfig::set_config_suffix(CommandLine::get_instance()->a_config_suffix.argument());
+ paludis_command.append(" --config-suffix " +
+ CommandLine::get_instance()->a_config_suffix.argument());
+ }
+ paludis_command.append(" --log-level " + CommandLine::get_instance()->a_log_level.argument());
+ p::DefaultConfig::get_instance()->set_paludis_command(paludis_command);
+ }
+ catch (const p::DefaultConfigError & e)
+ {
+ if (CommandLine::get_instance()->a_info.specified())
+ {
+ display_version();
+ cout << endl;
+ cout << "Cannot complete --info output due to configuration exception" << endl;
+ }
+ throw;
+ }
+
+ if (CommandLine::get_instance()->a_info.specified())
+ {
+ display_version();
+ cout << endl;
+ display_info();
+ cout << endl;
+ return EXIT_SUCCESS;
+ }
+
+ if (CommandLine::get_instance()->a_query.specified())
+ {
+ if (CommandLine::get_instance()->empty())
+ throw DoHelp("query action requires at least one parameter");
+
+ return do_query();
+ }
+
+ if (CommandLine::get_instance()->a_install.specified())
+ {
+ if (CommandLine::get_instance()->empty())
+ throw DoHelp("install action requires at least one parameter");
+
+ return do_install();
+ }
+
+ if (CommandLine::get_instance()->a_uninstall.specified())
+ {
+ if (CommandLine::get_instance()->empty())
+ throw DoHelp("uninstall action requires at least one parameter");
+
+ return do_uninstall();
+ }
+
+ if (CommandLine::get_instance()->a_sync.specified())
+ {
+ return do_sync();
+ }
+
+ if (CommandLine::get_instance()->a_list_repositories.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-repositories action takes no parameters");
+
+ return do_list_repositories();
+ }
+
+ if (CommandLine::get_instance()->a_list_categories.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-categories action takes no parameters");
+
+ return do_list_categories();
+ }
+
+ if (CommandLine::get_instance()->a_list_packages.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("list-packages action takes no parameters");
+
+ return do_list_packages();
+ }
+
+ if (CommandLine::get_instance()->a_contents.specified())
+ {
+ if (CommandLine::get_instance()->empty())
+ throw DoHelp("contents action requires at least one parameter");
+
+ return do_contents();
+ }
+
+ if (CommandLine::get_instance()->a_owner.specified())
+ {
+ if (CommandLine::get_instance()->empty())
+ throw DoHelp("owner action requires at least one parameter");
+
+ return do_owner();
+ }
+
+ if (CommandLine::get_instance()->a_has_version.specified())
+ {
+ if (1 != std::distance(CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters()))
+ throw DoHelp("has-version action takes exactly one parameter");
+
+ return do_has_version();
+ }
+
+ if (CommandLine::get_instance()->a_best_version.specified())
+ {
+ if (1 != std::distance(CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters()))
+ throw DoHelp("best-version action takes exactly one parameter");
+
+ return do_best_version();
+ }
+
+ if (CommandLine::get_instance()->a_environment_variable.specified())
+ {
+ if (2 != std::distance(CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters()))
+ throw DoHelp("environment-variable action takes exactly two parameters (depatom var)");
+
+ return do_environment_variable();
+ }
+
+ if (CommandLine::get_instance()->a_configuration_variable.specified())
+ {
+ if (2 != std::distance(CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters()))
+ throw DoHelp("configuration-variable action takes exactly two parameters (depatom var)");
+
+ return do_configuration_variable();
+ }
+
+ if (CommandLine::get_instance()->a_update_news.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw DoHelp("update-news action takes no parameters");
+
+ return do_update_news();
+ }
+
+ throw p::InternalError(__PRETTY_FUNCTION__, "no action?");
+ }
+ catch (const DoVersion &)
+ {
+ display_version();
+ 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;
+ }
+ catch (const paludis::args::ArgsError & e)
+ {
+ cerr << "Usage error: " << e.message() << endl;
+ cerr << "Try " << argv[0] << " --help" << endl;
+ return EXIT_FAILURE;
+ }
+ catch (const 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 p::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/0.6.3/src/paludis/query.cc b/0.6.3/src/paludis/query.cc
new file mode 100644
index 000000000..9d6025b84
--- /dev/null
+++ b/0.6.3/src/paludis/query.cc
@@ -0,0 +1,407 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "colour.hh"
+#include "query.hh"
+#include "licence.hh"
+#include "use.hh"
+#include <functional>
+#include <iomanip>
+#include <iostream>
+#include <paludis/paludis.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <string>
+
+/** \file
+ * Handle the --query action for the main paludis program.
+ */
+
+using namespace paludis;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+void do_one_package_query(
+ const Environment * const env,
+ const std::string & q,
+ MaskReasons & mask_reasons_to_explain,
+ PackageDepAtom::Pointer atom)
+{
+ PackageDatabaseEntryCollection::ConstPointer
+ entries(env->package_database()->query(atom, is_either)),
+ preferred_entries(env->package_database()->query(atom, is_installed_only));
+ if (entries->empty())
+ throw NoSuchPackageError(q);
+ if (preferred_entries->empty())
+ preferred_entries = entries;
+
+ const PackageDatabaseEntry display_entry(*preferred_entries->last());
+
+ /* match! display it. */
+ cout << "* " << colour(cl_package_name, entries->begin()->name);
+ if (atom->version_spec_ptr())
+ cout << " (" << atom->version_operator() << *atom->version_spec_ptr() << ")";
+ if (atom->slot_ptr())
+ cout << " (:" << *atom->slot_ptr() << ")";
+ if (atom->repository_ptr())
+ cout << " (::" << *atom->repository_ptr() << ")";
+ cout << endl;
+
+ /* find all repository names. */
+ RepositoryNameCollection::Concrete repo_names;
+ PackageDatabaseEntryCollection::Iterator e(entries->begin()), e_end(entries->end());
+ for ( ; e != e_end ; ++e)
+ repo_names.append(e->repository);
+
+ /* display versions, by repository. */
+ RepositoryNameCollection::Iterator r(repo_names.begin()), r_end(repo_names.end());
+ for ( ; r != r_end ; ++r)
+ {
+ cout << " " << std::setw(22) << std::left <<
+ (stringify(*r) + ":") << std::setw(0) << " ";
+
+ std::string old_slot;
+ for (e = entries->begin() ; e != e_end ; ++e)
+ if (e->repository == *r)
+ {
+ VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
+ e->repository)->version_metadata(e->name,
+ e->version));
+ if (CommandLine::get_instance()->a_show_slot.specified())
+ {
+ /* show the slot, if we're about to move onto a new slot */
+ std::string slot_name(stringify(metadata->slot));
+ if (old_slot.empty())
+ old_slot = slot_name;
+ else if (old_slot != slot_name)
+ cout << colour(cl_slot, "{:" + old_slot + "} ");
+ old_slot = slot_name;
+ }
+
+ const MaskReasons masks(env->mask_reasons(*e));
+
+ if (masks.none())
+ cout << colour(cl_visible, e->version);
+ else
+ {
+ std::string reasons;
+ for (MaskReason m(MaskReason(0)) ; m < last_mr ;
+ m = MaskReason(static_cast<int>(m) + 1))
+ {
+ if (! masks.test(m))
+ continue;
+
+ switch (m)
+ {
+ case mr_keyword:
+ reasons.append("K");
+ break;
+ case mr_user_mask:
+ reasons.append("U");
+ break;
+ case mr_profile_mask:
+ reasons.append("P");
+ break;
+ case mr_repository_mask:
+ reasons.append("R");
+ break;
+ case mr_eapi:
+ reasons.append("E");
+ break;
+ case mr_license:
+ reasons.append("L");
+ break;
+ case mr_by_association:
+ reasons.append("A");
+ break;
+ case last_mr:
+ break;
+ }
+ }
+ mask_reasons_to_explain |= masks;
+ cout << colour(cl_masked, "(" + stringify(e->version) + ")" + reasons);
+ }
+
+ if (*e == display_entry)
+ cout << "*";
+ cout << " ";
+ }
+
+ /* still need to show the slot for the last item */
+ if (CommandLine::get_instance()->a_show_slot.specified())
+ cout << colour(cl_slot, "{:" + old_slot + "} ");
+
+ cout << endl;
+ }
+
+ /* display metadata */
+ VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
+ display_entry.repository)->version_metadata(
+ display_entry.name, display_entry.version));
+
+ if (CommandLine::get_instance()->a_show_metadata.specified())
+ {
+ cout << " " << std::setw(22) << std::left << "DESCRIPTION:" << std::setw(0) <<
+ " " << metadata->description << endl;
+ cout << " " << std::setw(22) << std::left << "HOMEPAGE:" << std::setw(0) <<
+ " " << metadata->homepage << endl;
+ cout << " " << std::setw(22) << std::left << "LICENSE:" << std::setw(0) <<
+ " " << metadata->license_string << endl;
+
+ cout << " " << std::setw(22) << std::left << "DEPEND:" << std::setw(0) <<
+ " " << metadata->deps.build_depend_string << endl;
+ cout << " " << std::setw(22) << std::left << "RDEPEND:" << std::setw(0) <<
+ " " << metadata->deps.run_depend_string << endl;
+ cout << " " << std::setw(22) << std::left << "PDEPEND:" << std::setw(0) <<
+ " " << metadata->deps.post_depend_string << endl;
+
+ if (metadata->get_cran_interface())
+ {
+ cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
+ " " << metadata->get_cran_interface()->keywords << endl;
+ cout << " " << std::setw(22) << std::left << "PACKAGE:" << std::setw(0) <<
+ " " << metadata->get_cran_interface()->package << endl;
+ cout << " " << std::setw(22) << std::left << "VERSION:" << std::setw(0) <<
+ " " << metadata->get_cran_interface()->version << endl;
+ cout << " " << std::setw(22) << std::left << "IS_BUNDLE:" << std::setw(0) <<
+ " " << std::boolalpha << metadata->get_cran_interface()->is_bundle << endl;
+ }
+
+ if (metadata->get_ebuild_interface())
+ {
+ cout << " " << std::setw(22) << std::left << "IUSE:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->iuse << endl;
+ cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->keywords << endl;
+ cout << " " << std::setw(22) << std::left << "PROVIDE:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->provide_string << endl;
+ cout << " " << std::setw(22) << std::left << "RESTRICT:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->restrict_string << endl;
+ cout << " " << std::setw(22) << std::left << "SRC_URI:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->src_uri << endl;
+ }
+
+ if (metadata->get_ebin_interface())
+ {
+ cout << " " << std::setw(22) << std::left << "BIN_URI:" << std::setw(0) <<
+ " " << metadata->get_ebin_interface()->bin_uri << endl;
+ cout << " " << std::setw(22) << std::left << "SRC_REPOSITORY:" << std::setw(0) <<
+ " " << metadata->get_ebin_interface()->src_repository << endl;
+ }
+ }
+ else
+ {
+ if (! metadata->homepage.empty())
+ cout << " " << std::setw(22) << std::left << "Homepage:" << std::setw(0) <<
+ " " << metadata->homepage << endl;
+
+ if (! metadata->description.empty())
+ cout << " " << std::setw(22) << std::left << "Description:" << std::setw(0) <<
+ " " << metadata->description << endl;
+
+ if (! metadata->license_string.empty())
+ {
+ cout << " " << std::setw(22) << std::left << "License:" << std::setw(0) << " ";
+ LicenceDisplayer d(cout, env, &display_entry);
+ metadata->license()->accept(&d);
+ cout << endl;
+ }
+
+ if (CommandLine::get_instance()->a_show_deps.specified())
+ {
+ if (! metadata->deps.build_depend_string.empty())
+ {
+ DepAtomPrettyPrinter p_depend(12);
+ metadata->deps.build_depend()->accept(&p_depend);
+ cout << " " << std::setw(22) << std::left << "Build dependencies:" << std::setw(0)
+ << endl << p_depend;
+ }
+
+ if (! metadata->deps.run_depend_string.empty())
+ {
+ DepAtomPrettyPrinter p_depend(12);
+ metadata->deps.run_depend()->accept(&p_depend);
+ cout << " " << std::setw(22) << std::left << "Runtime dependencies:" << std::setw(0)
+ << endl << p_depend;
+ }
+
+ if (! metadata->deps.post_depend_string.empty())
+ {
+ DepAtomPrettyPrinter p_depend(12);
+ metadata->deps.post_depend()->accept(&p_depend);
+ cout << " " << std::setw(22) << std::left << "Post dependencies:" << std::setw(0)
+ << endl << p_depend;
+ }
+ }
+
+ if (metadata->get_ebuild_interface())
+ {
+ if (! metadata->get_ebuild_interface()->provide_string.empty())
+ cout << " " << std::setw(22) << std::left << "Provides:" << std::setw(0) <<
+ " " << metadata->get_ebuild_interface()->provide_string << endl;
+
+ if (! metadata->get_ebuild_interface()->iuse.empty())
+ cout << " " << std::setw(22) << std::left << "Use flags:" << std::setw(0) <<
+ " " << make_pretty_use_flags_string(DefaultEnvironment::get_instance(),
+ display_entry, metadata) << endl;
+ }
+
+ if (metadata->get_virtual_interface())
+ cout << " " << std::setw(22) << std::left << "Virtual for:" << std::setw(0) <<
+ " " << metadata->get_virtual_interface()->virtual_for << endl;
+ }
+
+
+ /* blank line */
+ cout << endl;
+}
+
+void do_one_set_query(
+ const Environment * const,
+ const std::string & q,
+ MaskReasons &,
+ DepAtom::Pointer set)
+{
+ cout << "* " << colour(cl_package_name, q) << endl;
+ DepAtomPrettyPrinter packages(12);
+ set->accept(&packages);
+ cout << " " << std::setw(22) << std::left << "Packages:" << std::setw(0)
+ << endl << packages << endl;
+}
+
+void do_one_query(
+ const Environment * const env,
+ const std::string & q,
+ MaskReasons & mask_reasons_to_explain)
+{
+ Context local_context("When handling query '" + q + "':");
+
+ /* we might have a dep atom, but we might just have a simple package name
+ * without a category. or it might be a set... all should work. */
+ PackageDepAtom::Pointer atom(0);
+ DepAtom::Pointer set(0);
+ if (std::string::npos == q.find('/'))
+ {
+ if (0 == ((set = env->package_set(q))))
+ atom.assign(new PackageDepAtom(env->package_database()->fetch_unique_qualified_package_name(
+ PackageNamePart(q))));
+ }
+ else
+ atom.assign(new PackageDepAtom(q));
+
+ if (atom)
+ do_one_package_query(env, q, mask_reasons_to_explain, atom);
+ else
+ do_one_set_query(env, q, mask_reasons_to_explain, set);
+}
+
+int do_query()
+{
+ int return_code(0);
+
+ Context context("When performing query action from command line:");
+ Environment * const env(DefaultEnvironment::get_instance());
+
+ MaskReasons mask_reasons_to_explain;
+
+ CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters());
+ for ( ; q != q_end ; ++q)
+ {
+ try
+ {
+ do_one_query(env, *q, mask_reasons_to_explain);
+ }
+ catch (const AmbiguousPackageNameError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl;
+ for (AmbiguousPackageNameError::OptionsIterator o(e.begin_options()),
+ o_end(e.end_options()) ; o != o_end ; ++o)
+ cerr << " * " << colour(cl_package_name, *o) << endl;
+ cerr << endl;
+ }
+ catch (const NameError & e)
+ {
+ return_code |= 1;
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ }
+ catch (const PackageDatabaseLookupError & e)
+ {
+ return_code |= 1;
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ }
+ }
+
+ if (mask_reasons_to_explain.any())
+ {
+ cout << colour(cl_heading, "Key to mask reasons:") << endl << endl;
+
+ /* use for/case to get compiler warnings when new mr_ are added */
+ for (MaskReason m(MaskReason(0)) ; m < last_mr ;
+ m = MaskReason(static_cast<int>(m) + 1))
+ {
+ if (! mask_reasons_to_explain.test(m))
+ continue;
+
+ switch (m)
+ {
+ case mr_keyword:
+ cout << "* " << colour(cl_masked, "K") << ": keyword";
+ break;
+ case mr_user_mask:
+ cout << "* " << colour(cl_masked, "U") << ": user mask";
+ break;
+ case mr_profile_mask:
+ cout << "* " << colour(cl_masked, "P") << ": profile mask";
+ break;
+ case mr_repository_mask:
+ cout << "* " << colour(cl_masked, "R") << ": repository mask";
+ break;
+ case mr_eapi:
+ cout << "* " << colour(cl_masked, "E") << ": EAPI";
+ break;
+ case mr_license:
+ cout << "* " << colour(cl_masked, "L") << ": licence";
+ break;
+ case mr_by_association:
+ cout << "* " << colour(cl_masked, "A") << ": by association";
+ break;
+
+ case last_mr:
+ break;
+ }
+
+ cout << endl;
+ }
+
+ cout << endl;
+ }
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/query.hh b/0.6.3/src/paludis/query.hh
new file mode 100644
index 000000000..62e7e0283
--- /dev/null
+++ b/0.6.3/src/paludis/query.hh
@@ -0,0 +1,32 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QUERY_HH
+#define PALUDIS_GUARD_SRC_QUERY_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for the do_query function.
+ */
+
+/// Handle --query.
+int do_query();
+
+#endif
diff --git a/0.6.3/src/paludis/sync.cc b/0.6.3/src/paludis/sync.cc
new file mode 100644
index 000000000..0c1b8ce91
--- /dev/null
+++ b/0.6.3/src/paludis/sync.cc
@@ -0,0 +1,129 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "colour.hh"
+#include "sync.hh"
+#include <paludis/tasks/sync_task.hh>
+#include <paludis/default_environment.hh>
+#include <paludis/syncer.hh>
+#include <iomanip>
+#include <iostream>
+#include <string>
+
+/** \file
+ * Handle the --sync action for the main paludis program.
+ */
+
+using namespace paludis;
+using std::cerr;
+using std::cout;
+using std::endl;
+
+namespace
+{
+ class OurSyncTask :
+ public SyncTask
+ {
+ private:
+ int _return_code;
+
+ public:
+ OurSyncTask() :
+ SyncTask(DefaultEnvironment::get_instance()),
+ _return_code(0)
+ {
+ }
+
+ virtual void on_sync_all_pre();
+ virtual void on_sync_pre(const RepositoryName &);
+ virtual void on_sync_post(const RepositoryName &);
+ virtual void on_sync_skip(const RepositoryName &);
+ virtual void on_sync_fail(const RepositoryName &, const SyncFailedError &);
+ virtual void on_sync_succeed(const RepositoryName &);
+ virtual void on_sync_all_post();
+
+ int return_code() const
+ {
+ return _return_code;
+ }
+ };
+
+ void
+ OurSyncTask::on_sync_all_pre()
+ {
+ }
+
+ void
+ OurSyncTask::on_sync_pre(const RepositoryName & r)
+ {
+ cout << colour(cl_heading, "Sync " + stringify(r)) << endl;
+ cerr << xterm_title("Syncing " + stringify(r));
+ }
+
+ void
+ OurSyncTask::on_sync_post(const RepositoryName &)
+ {
+ }
+
+ void
+ OurSyncTask::on_sync_skip(const RepositoryName & r)
+ {
+ cout << "Sync " << r << " skipped" << endl;
+ }
+
+ void
+ OurSyncTask::on_sync_succeed(const RepositoryName & r)
+ {
+ cout << "Sync " << r << " completed" << endl;
+ }
+
+ void
+ OurSyncTask::on_sync_fail(const RepositoryName & r, const SyncFailedError & e)
+ {
+ _return_code |= 1;
+ cout << endl;
+ cerr << "Sync error:" << endl;
+ cerr << " * " << e.backtrace("\n * ") << e.message() << endl;
+ cerr << endl;
+ cout << "Sync " << r << " failed" << endl;
+ }
+
+ void
+ OurSyncTask::on_sync_all_post()
+ {
+ cout << endl;
+ }
+}
+
+int do_sync()
+{
+ Context context("When performing sync action from command line:");
+
+ OurSyncTask task;
+
+ for (CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q)
+ task.add_target(*q);
+
+ task.execute();
+
+ return task.return_code();
+}
+
+
diff --git a/0.6.3/src/paludis/sync.hh b/0.6.3/src/paludis/sync.hh
new file mode 100644
index 000000000..92c518cd9
--- /dev/null
+++ b/0.6.3/src/paludis/sync.hh
@@ -0,0 +1,33 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_SYNC_HH
+#define PALUDIS_GUARD_SRC_SYNC_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for the do_sync function.
+ */
+
+/// Handle --sync.
+int do_sync();
+
+#endif
+
diff --git a/0.6.3/src/paludis/uninstall.cc b/0.6.3/src/paludis/uninstall.cc
new file mode 100644
index 000000000..08666d1fe
--- /dev/null
+++ b/0.6.3/src/paludis/uninstall.cc
@@ -0,0 +1,185 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2005, 2006 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 "colour.hh"
+#include "uninstall.hh"
+
+#include <paludis/default_environment.hh>
+#include <paludis/tasks/uninstall_task.hh>
+
+#include <iostream>
+
+/** \file
+ * Handle the --uninstall action for the main paludis program.
+ */
+
+using namespace paludis;
+
+using std::cerr;
+using std::cout;
+using std::endl;
+
+namespace
+{
+ class OurUninstallTask :
+ public UninstallTask
+ {
+ private:
+ int _count, _current_count;
+
+ public:
+ OurUninstallTask() :
+ UninstallTask(DefaultEnvironment::get_instance()),
+ _count(0),
+ _current_count(0)
+ {
+ };
+
+ virtual void on_build_unmergelist_pre()
+ {
+ cout << "Building unmerge list... " << std::flush;
+ }
+
+ virtual void on_build_unmergelist_post()
+ {
+ cout << "done" << endl;
+ }
+
+ virtual void on_display_unmerge_list_pre()
+ {
+ cout << endl << colour(cl_heading, "These packages will be uninstalled:")
+ << endl << endl;
+ }
+
+ virtual void on_display_unmerge_list_post()
+ {
+ cout << endl << endl <<
+ "Total: " << _count << (_count == 1 ? " package" : " packages") << endl;
+ }
+
+ virtual void on_display_unmerge_list_entry(const PackageDatabaseEntry & d)
+ {
+ cout << "* " << colour(cl_package_name, stringify(d)) << endl;
+ ++_count;
+ }
+
+ virtual void on_uninstall_all_pre()
+ {
+ }
+
+ virtual void on_uninstall_pre(const PackageDatabaseEntry & d)
+ {
+ cout << endl << colour(cl_heading, "Uninstalling " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
+
+ cerr << xterm_title("(" + stringify(++_current_count) + " of " +
+ stringify(_count) + ") Uninstalling " +
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
+ }
+
+ virtual void on_uninstall_post(const PackageDatabaseEntry &)
+ {
+ }
+
+ virtual void on_uninstall_all_post()
+ {
+ }
+
+ virtual void on_update_world_pre()
+ {
+ cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
+ }
+
+ virtual void on_update_world(const PackageDepAtom & a)
+ {
+ cout << "* removing " << colour(cl_package_name, a.package()) << endl;
+ }
+
+ virtual void on_update_world_post()
+ {
+ cout << endl;
+ }
+
+ virtual void on_preserve_world()
+ {
+ cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
+ cout << "* --preserve-world was specified, skipping world changes" << endl;
+ cout << endl;
+ }
+ };
+}
+
+int
+do_uninstall()
+{
+ int return_code(0);
+
+ Context context("When performing uninstall action from command line:");
+
+ OurUninstallTask task;
+
+ task.set_pretend(CommandLine::get_instance()->a_pretend.specified());
+ task.set_no_config_protect(CommandLine::get_instance()->a_no_config_protection.specified());
+ task.set_preserve_world(CommandLine::get_instance()->a_preserve_world.specified());
+
+ try
+ {
+ for (CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q)
+ task.add_target(*q);
+
+ task.execute();
+
+ cout << endl;
+ }
+ catch (const AmbiguousUnmergeTargetError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "Ambiguous unmerge target '" << e.target() << "'. Did you mean:" << endl;
+ for (AmbiguousUnmergeTargetError::Iterator o(e.begin()),
+ o_end(e.end()) ; o != o_end ; ++o)
+ cerr << " * =" << colour(cl_package_name, *o) << endl;
+ cerr << endl;
+ return 1;
+ }
+ catch (const PackageUninstallActionError & e)
+ {
+ cout << endl;
+ cerr << "Uninstall error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << e.message() << endl;
+
+ return_code |= 1;
+ }
+ catch (const NoSuchPackageError & e)
+ {
+ cout << endl;
+ cerr << "Query error:" << endl;
+ cerr << " * " << e.backtrace("\n * ");
+ cerr << "No such package '" << e.name() << "'" << endl;
+ return 1;
+ }
+
+ return return_code;
+}
+
diff --git a/0.6.3/src/paludis/uninstall.hh b/0.6.3/src/paludis/uninstall.hh
new file mode 100644
index 000000000..a2a49ff78
--- /dev/null
+++ b/0.6.3/src/paludis/uninstall.hh
@@ -0,0 +1,33 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_UNINSTALL_HH
+#define PALUDIS_GUARD_SRC_UNINSTALL_HH 1
+
+#include "command_line.hh"
+
+/** \file
+ * Declaration for the do_uninstall function.
+ */
+
+/// Handle --uninstall.
+int do_uninstall();
+
+#endif
+
diff --git a/0.6.3/src/paludis/upgrade_TEST b/0.6.3/src/paludis/upgrade_TEST
new file mode 100755
index 000000000..48b315fe3
--- /dev/null
+++ b/0.6.3/src/paludis/upgrade_TEST
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+PALUDIS_HOME=./upgrade_TEST_dir/config/ \
+ ./paludis --config-suffix upgrade-test --install =test-category/target-1 || exit 1
+
+./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-1 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin1 | grep testbin1 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin2 && exit 1
+
+
+PALUDIS_HOME=./upgrade_TEST_dir/config/ \
+ ./paludis --config-suffix upgrade-test --install target || exit 1
+
+./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-2 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin1 && exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin2 | grep testbin2 >/dev/null || exit 1
+
diff --git a/0.6.3/src/paludis/upgrade_TEST_cleanup.sh b/0.6.3/src/paludis/upgrade_TEST_cleanup.sh
new file mode 100755
index 000000000..bc42e7885
--- /dev/null
+++ b/0.6.3/src/paludis/upgrade_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d upgrade_TEST_dir ] ; then
+ rm -fr upgrade_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/0.6.3/src/paludis/upgrade_TEST_setup.sh b/0.6.3/src/paludis/upgrade_TEST_setup.sh
new file mode 100755
index 000000000..eb69c9535
--- /dev/null
+++ b/0.6.3/src/paludis/upgrade_TEST_setup.sh
@@ -0,0 +1,153 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir upgrade_TEST_dir || exit 1
+cd upgrade_TEST_dir || exit 1
+
+mkdir -p config/.paludis-upgrade-test
+cat <<END > config/.paludis-upgrade-test/specpath
+root = `pwd`/root
+config-suffix =
+END
+
+mkdir -p root/${SYSCONFDIR}/paludis/repositories
+cat <<END > root/${SYSCONFDIR}/paludis/use.conf
+* foo
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf
+* *
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf
+* test
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/bashrc
+export CHOST="my-chost"
+export USER_BASHRC_WAS_USED=yes
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf
+location = `pwd`/repo1
+cache = /var/empty
+format = portage
+profile = \${location}/profiles/testprofile
+buildroot = `pwd`/build
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/installed.conf
+location = \${ROOT}/var/db/pkg
+format = vdb
+buildroot = `pwd`/build
+END
+
+mkdir -p root/tmp
+touch root/${SYSCONFDIR}/ld.so.conf
+mkdir -p root/var/db/pkg
+
+mkdir -p repo1/{eclass,distfiles,profiles/testprofile,test-category/target/files} || exit 1
+
+mkdir -p src/target-1
+cat <<"END" > src/target-1/testbin
+#!/bin/bash
+echo "This is testbin-1"
+END
+chmod +x src/target-1/testbin
+cat <<"END" > src/target-1/testbin1
+#!/bin/bash
+echo "This is testbin1"
+END
+chmod +x src/target-1/testbin1
+cd src
+tar zcf target-1.tar.gz target-1/
+mv target-1.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+mkdir -p src/target-2
+cat <<"END" > src/target-2/testbin
+#!/bin/bash
+echo "This is testbin-2"
+END
+chmod +x src/target-2/testbin
+cat <<"END" > src/target-2/testbin2
+#!/bin/bash
+echo "This is testbin2"
+END
+chmod +x src/target-2/testbin2
+cd src
+tar zcf target-2.tar.gz target-2/
+mv target-2.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+test-category
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+
+cat <<"END" > eclass/myeclass.eclass || exit 1
+the_eclass_works()
+{
+ true
+}
+END
+
+cat <<"END" > test-category/target/target-1.ebuild || exit 1
+inherit myeclass
+
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ export VAR1=yes
+ VAR2=yes
+ local VAR3=yes
+}
+
+src_install() {
+ [[ "${VAR1}" == yes ]] || die
+ [[ "${VAR2}" == yes ]] || die
+ [[ "${VAR3}" == yes ]] && die
+
+ dobin testbin
+ dobin testbin${PV}
+}
+
+pkg_prerm() {
+ [[ "${VAR1}" == yes ]] || die
+ [[ "${VAR2}" == yes ]] || die
+ [[ "${VAR3}" == yes ]] && die
+
+ the_eclass_works || die
+}
+END
+
+cat <<"END" > test-category/target/target-2.ebuild || exit 1
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin testbin
+ dobin testbin${PV}
+}
+END
+cd ..
+
diff --git a/0.6.3/src/paludis/use.cc b/0.6.3/src/paludis/use.cc
new file mode 100644
index 000000000..144b35c01
--- /dev/null
+++ b/0.6.3/src/paludis/use.cc
@@ -0,0 +1,104 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "use.hh"
+#include "colour.hh"
+#include <paludis/util/tokeniser.hh>
+#include <sstream>
+#include <set>
+
+using namespace paludis;
+
+std::string
+make_pretty_use_flags_string(const Environment * const env, const PackageDatabaseEntry & p,
+ VersionMetadata::ConstPointer metadata)
+{
+ std::ostringstream c;
+
+ if (metadata->get_ebuild_interface())
+ {
+ const RepositoryUseInterface * const use_interface(
+ env->package_database()->
+ fetch_repository(p.repository)->use_interface);
+ std::set<UseFlagName> iuse;
+ WhitespaceTokeniser::get_instance()->tokenise(
+ metadata->get_ebuild_interface()->iuse,
+ create_inserter<UseFlagName>(std::inserter(iuse, iuse.end())));
+
+ /* display normal use flags first */
+ for (std::set<UseFlagName>::const_iterator i(iuse.begin()), i_end(iuse.end()) ;
+ i != i_end ; ++i)
+ {
+ if (use_interface->is_expand_flag(*i))
+ continue;
+
+ if (env->query_use(*i, &p))
+ {
+ if (use_interface && use_interface->query_use_force(*i, &p))
+ c << " " << colour(cl_flag_on, "(" + stringify(*i) + ")");
+ else
+ c << " " << colour(cl_flag_on, *i);
+ }
+ else
+ {
+ if (use_interface && use_interface->query_use_mask(*i, &p))
+ c << " " << colour(cl_flag_off, "(-" + stringify(*i) + ")");
+ else
+ c << " " << colour(cl_flag_off, "-" + stringify(*i));
+ }
+ }
+
+ /* now display expand flags */
+ UseFlagName old_expand_name("OFTEN_NOT_BEEN_ON_BOATS");
+ for (std::set<UseFlagName>::const_iterator i(iuse.begin()), i_end(iuse.end()) ;
+ i != i_end ; ++i)
+ {
+ if ((! use_interface->is_expand_flag(*i)) ||
+ (use_interface->is_expand_hidden_flag(*i)))
+ continue;
+
+ UseFlagName expand_name(use_interface->expand_flag_name(*i)),
+ expand_value(use_interface->expand_flag_value(*i));
+
+ if (expand_name != old_expand_name)
+ {
+ c << " " << expand_name << ":";
+ old_expand_name = expand_name;
+ }
+
+ if (env->query_use(*i, &p))
+ {
+ if (use_interface && use_interface->query_use_force(*i, &p))
+ c << " " << colour(cl_flag_on, "(" + stringify(expand_value) + ")");
+ else
+ c << " " << colour(cl_flag_on, expand_value);
+ }
+ else
+ {
+ if (use_interface && use_interface->query_use_mask(*i, &p))
+ c << " " << colour(cl_flag_off, "(-" + stringify(expand_value) + ")");
+ else
+ c << " " << colour(cl_flag_off, "-" + stringify(expand_value));
+ }
+ }
+ }
+
+ return c.str();
+}
+
diff --git a/0.6.3/src/paludis/use.hh b/0.6.3/src/paludis/use.hh
new file mode 100644
index 000000000..fcd19cfe6
--- /dev/null
+++ b/0.6.3/src/paludis/use.hh
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_PALUDIS_USE_HH
+#define PALUDIS_GUARD_SRC_PALUDIS_USE_HH 1
+
+#include <paludis/name.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/version_metadata.hh>
+
+/**
+ * Make a nice string for outputting USE flags.
+ */
+std::string
+make_pretty_use_flags_string(const paludis::Environment * const env, const paludis::PackageDatabaseEntry & p,
+ paludis::VersionMetadata::ConstPointer metadata) PALUDIS_ATTRIBUTE((nonnull(1)));
+
+#endif
diff --git a/0.6.3/src/paludis/version_TEST b/0.6.3/src/paludis/version_TEST
new file mode 100755
index 000000000..02513f03a
--- /dev/null
+++ b/0.6.3/src/paludis/version_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --version