aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-24 13:34:29 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-24 13:34:29 +0000
commit425ac90fbf4cb4a596be248bfe438ef10ec21588 (patch)
tree184ee1022a33146e1c917db5bd6433c789c4631b
parent22ac78d1a4cf8e59f2c174579836357c04972aea (diff)
downloadpaludis-425ac90fbf4cb4a596be248bfe438ef10ec21588.tar.gz
paludis-425ac90fbf4cb4a596be248bfe438ef10ec21588.tar.xz
Make a FetchAction. Kill builtin_fetch. Support SRC_URI labels. Support arrows in SRC_URI. Fixes: ticket:260. Fixes: ticket:257
-rw-r--r--configure.ac1
-rw-r--r--paludis/action-fwd.hh9
-rw-r--r--paludis/action.cc74
-rw-r--r--paludis/action.hh100
-rw-r--r--paludis/action.sr44
-rw-r--r--paludis/dep_label-fwd.hh42
-rw-r--r--paludis/dep_label.cc76
-rw-r--r--paludis/dep_label.hh74
-rw-r--r--paludis/dep_list/condition_tracker.hh8
-rw-r--r--paludis/dep_spec-fwd.hh11
-rw-r--r--paludis/dep_spec.cc59
-rw-r--r--paludis/dep_spec.hh39
-rw-r--r--paludis/dep_tag.cc4
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/repositories/e/Makefile.am54
-rw-r--r--paludis/repositories/e/aa_visitor.cc5
-rw-r--r--paludis/repositories/e/aa_visitor.hh2
-rw-r--r--paludis/repositories/e/aa_visitor_TEST.cc2
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc229
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh69
-rw-r--r--paludis/repositories/e/dep_lexer.cc2
-rw-r--r--paludis/repositories/e/dep_lexer.hh3
-rw-r--r--paludis/repositories/e/dep_parser-fwd.hh1
-rw-r--r--paludis/repositories/e/dep_parser.cc687
-rw-r--r--paludis/repositories/e/dep_parser.hh69
-rw-r--r--paludis/repositories/e/dep_parser_TEST.cc76
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc25
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.hh2
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer_TEST.cc (renamed from paludis/dep_spec_pretty_printer_TEST.cc)34
-rw-r--r--paludis/repositories/e/e_key.cc14
-rw-r--r--paludis/repositories/e/e_repository.cc5
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc101
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh106
-rw-r--r--paludis/repositories/e/e_repository_entries.hh6
-rw-r--r--paludis/repositories/e/eapi-fwd.hh1
-rw-r--r--paludis/repositories/e/eapi.cc83
-rw-r--r--paludis/repositories/e/eapi.hh11
-rw-r--r--paludis/repositories/e/eapi.sr2
-rw-r--r--paludis/repositories/e/eapis/0.conf6
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf12
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf6
-rw-r--r--paludis/repositories/e/ebin.cc11
-rw-r--r--paludis/repositories/e/ebuild.cc26
-rw-r--r--paludis/repositories/e/ebuild.hh8
-rw-r--r--paludis/repositories/e/ebuild.sr8
-rw-r--r--paludis/repositories/e/ebuild/Makefile.am32
-rw-r--r--paludis/repositories/e/ebuild/builtin_fetch.bash137
-rw-r--r--paludis/repositories/e/ebuild/builtin_fetchbin.bash98
-rw-r--r--paludis/repositories/e/ebuild/builtin_merge.bash144
-rw-r--r--paludis/repositories/e/ebuild/builtin_unmerge.bash115
-rw-r--r--paludis/repositories/e/ebuild/digests/Makefile.am31
-rw-r--r--paludis/repositories/e/ebuild/digests/domd5.cc54
-rw-r--r--paludis/repositories/e/ebuild/digests/dormd160.cc53
-rw-r--r--paludis/repositories/e/ebuild/digests/dosha256.cc52
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash4
-rw-r--r--paludis/repositories/e/ebuild/merge.cc451
-rw-r--r--paludis/repositories/e/ebuild/merge_TEST.bash223
-rwxr-xr-xpaludis/repositories/e/ebuild/merge_TEST_cleanup.sh10
-rwxr-xr-xpaludis/repositories/e/ebuild/merge_TEST_setup.sh74
-rw-r--r--paludis/repositories/e/ebuild/merge_common.cc99
-rw-r--r--paludis/repositories/e/ebuild/merge_common.hh50
-rw-r--r--paludis/repositories/e/ebuild/pkg_nofetch.bash19
-rw-r--r--paludis/repositories/e/ebuild/unmerge.cc320
-rw-r--r--paludis/repositories/e/ebuild/unmerge_TEST.bash94
-rwxr-xr-xpaludis/repositories/e/ebuild/unmerge_TEST_cleanup.sh11
-rwxr-xr-xpaludis/repositories/e/ebuild/unmerge_TEST_setup.sh15
-rw-r--r--paludis/repositories/e/ebuild_entries.cc391
-rw-r--r--paludis/repositories/e/ebuild_entries.hh3
-rw-r--r--paludis/repositories/e/ebuild_id.cc13
-rw-r--r--paludis/repositories/e/fetch_visitor.cc246
-rw-r--r--paludis/repositories/e/fetch_visitor.hh69
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc74
-rwxr-xr-xpaludis/repositories/e/fetch_visitor_TEST_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/fetch_visitor_TEST_setup.sh13
-rw-r--r--paludis/repositories/e/source_uri_finder.cc214
-rw-r--r--paludis/repositories/e/source_uri_finder.hh68
-rw-r--r--paludis/repositories/e/source_uri_finder_TEST.cc60
-rw-r--r--paludis/repositories/e/vdb_id.cc10
-rw-r--r--paludis/repositories/e/vdb_repository.cc27
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc4
-rw-r--r--paludis/repositories/fake/fake_package_id.cc19
-rw-r--r--paludis/repositories/fake/fake_repository.cc4
-rw-r--r--paludis/repositories/gems/gem_specification.cc7
-rw-r--r--paludis/repositories/gems/gems_repository.cc4
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc4
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc4
-rw-r--r--paludis/repositories/virtuals/package_id.cc7
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc4
-rw-r--r--paludis/repository.cc30
-rw-r--r--paludis/repository.hh97
-rw-r--r--paludis/set_file_TEST.cc46
-rw-r--r--paludis/syncer.cc4
-rw-r--r--paludis/syncer.hh2
-rw-r--r--paludis/tasks/install_task.cc79
-rw-r--r--paludis/tasks/uninstall_task.cc10
-rw-r--r--python/dep_spec.cc53
-rw-r--r--python/dep_spec.hh17
-rw-r--r--python/repository.cc24
-rw-r--r--src/clients/contrarius/install.cc38
-rw-r--r--src/clients/paludis/install.cc40
-rwxr-xr-xsrc/clients/paludis/install_TEST2
-rw-r--r--src/clients/paludis/uninstall.cc3
-rw-r--r--src/output/console_query_task.cc21
103 files changed, 3049 insertions, 2965 deletions
diff --git a/configure.ac b/configure.ac
index 674b939..0e6e0d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1219,7 +1219,6 @@ AC_OUTPUT(
paludis/repositories/e/eapis/Makefile
paludis/repositories/e/ebuild/0/Makefile
paludis/repositories/e/ebuild/Makefile
- paludis/repositories/e/ebuild/digests/Makefile
paludis/repositories/e/ebuild/echo_functions.bash
paludis/repositories/e/ebuild/exheres-0/Makefile
paludis/repositories/e/ebuild/exheres-0/echo_functions.bash
diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh
index 4683c12..0018ce8 100644
--- a/paludis/action-fwd.hh
+++ b/paludis/action-fwd.hh
@@ -31,6 +31,7 @@ namespace paludis
class UninstallAction;
class PretendAction;
class ConfigAction;
+ class FetchAction;
class SupportsActionTestBase;
template <typename A_> class SupportsActionTest;
@@ -38,10 +39,18 @@ namespace paludis
class ActionVisitorTypes;
class SupportsActionTestVisitorTypes;
+ class ActionError;
class UnsupportedActionError;
+ class InstallActionError;
+ class FetchActionError;
+ class UninstallActionError;
+ class ConfigActionError;
+
+ class FetchActionFailure;
class InstallActionOptions;
class UninstallActionOptions;
+ class FetchActionOptions;
#include <paludis/action-se.hh>
diff --git a/paludis/action.cc b/paludis/action.cc
index d42a3b8..24d6c2b 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -21,6 +21,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/sequence-impl.hh>
using namespace paludis;
@@ -32,12 +33,16 @@ template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, ConfigAction
template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, PretendAction>;
template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, InstalledAction>;
template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, UninstallAction>;
+template class MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, FetchAction>;
template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstallAction> >;
template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<ConfigAction> >;
template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<PretendAction> >;
template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<InstalledAction> >;
template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<UninstallAction> >;
+template class MutableAcceptInterfaceVisitsThis<SupportsActionTestVisitorTypes, SupportsActionTest<FetchAction> >;
+
+template class Sequence<FetchActionFailure>;
Action::~Action()
{
@@ -70,6 +75,30 @@ InstallAction::~InstallAction()
namespace paludis
{
template <>
+ struct Implementation<FetchAction>
+ {
+ const FetchActionOptions options;
+
+ Implementation(const FetchActionOptions & o) :
+ options(o)
+ {
+ }
+ };
+}
+
+FetchAction::FetchAction(const FetchActionOptions & o) :
+ PrivateImplementationPattern<FetchAction>(new Implementation<FetchAction>(o)),
+ options(_imp->options)
+{
+}
+
+FetchAction::~FetchAction()
+{
+}
+
+namespace paludis
+{
+ template <>
struct Implementation<UninstallAction>
{
const UninstallActionOptions options;
@@ -131,7 +160,7 @@ SupportsActionTestBase::~SupportsActionTestBase()
}
UnsupportedActionError::UnsupportedActionError(const PackageID & id, const Action & a) throw () :
- Exception("Unsupported action '" + stringify(a) + "' on '" + stringify(id) + "'")
+ ActionError("Unsupported action '" + stringify(a) + "' on '" + stringify(id) + "'")
{
}
@@ -175,6 +204,11 @@ namespace
{
s << "config";
}
+
+ void visit(const FetchAction &)
+ {
+ s << "fetch";
+ }
};
}
@@ -186,3 +220,41 @@ paludis::operator<< (std::ostream & s, const Action & a)
return s;
}
+ActionError::ActionError(const std::string & msg) throw () :
+ Exception(msg)
+{
+}
+
+InstallActionError::InstallActionError(const std::string & msg) throw () :
+ ActionError("Install error: " + msg)
+{
+}
+
+FetchActionError::FetchActionError(const std::string & msg,
+ const tr1::shared_ptr<const Sequence<FetchActionFailure> > & e) throw () :
+ ActionError("Fetch error: " + msg),
+ _failures(e)
+{
+}
+
+FetchActionError::FetchActionError(const std::string & msg) throw () :
+ ActionError("Fetch error: " + msg)
+{
+}
+
+const tr1::shared_ptr<const Sequence<FetchActionFailure> >
+FetchActionError::failures() const
+{
+ return _failures;
+}
+
+UninstallActionError::UninstallActionError(const std::string & msg) throw () :
+ ActionError("Uninstall error: " + msg)
+{
+}
+
+ConfigActionError::ConfigActionError(const std::string & msg) throw () :
+ ActionError("Configuration error: " + msg)
+{
+}
+
diff --git a/paludis/action.hh b/paludis/action.hh
index db80026..e668b34 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -26,7 +26,9 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/sr.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/sequence-fwd.hh>
namespace paludis
{
@@ -38,6 +40,7 @@ namespace paludis
ActionVisitorTypes,
Action,
InstallAction,
+ FetchAction,
InstalledAction,
UninstallAction,
PretendAction,
@@ -51,6 +54,7 @@ namespace paludis
SupportsActionTestVisitorTypes,
SupportsActionTestBase,
SupportsActionTest<InstallAction>,
+ SupportsActionTest<FetchAction>,
SupportsActionTest<InstalledAction>,
SupportsActionTest<UninstallAction>,
SupportsActionTest<PretendAction>,
@@ -78,6 +82,18 @@ namespace paludis
const InstallActionOptions & options;
};
+ class PALUDIS_VISIBLE FetchAction :
+ public Action,
+ private PrivateImplementationPattern<FetchAction>,
+ public MutableAcceptInterfaceVisitsThis<ActionVisitorTypes, FetchAction>
+ {
+ public:
+ FetchAction(const FetchActionOptions &);
+ ~FetchAction();
+
+ const FetchActionOptions & options;
+ };
+
class PALUDIS_VISIBLE UninstallAction :
public Action,
private PrivateImplementationPattern<UninstallAction>,
@@ -129,14 +145,94 @@ namespace paludis
{
};
- class PALUDIS_VISIBLE UnsupportedActionError :
+ std::ostream & operator<< (std::ostream &, const Action &) PALUDIS_VISIBLE;
+
+ /**
+ * Parent class for action errors.
+ *
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE ActionError :
public Exception
{
public:
+ /**
+ * Constructor.
+ */
+ ActionError(const std::string & msg) throw ();
+ };
+
+ class PALUDIS_VISIBLE UnsupportedActionError :
+ public ActionError
+ {
+ public:
UnsupportedActionError(const PackageID &, const Action &) throw ();
};
- std::ostream & operator<< (std::ostream &, const Action &) PALUDIS_VISIBLE;
+ /**
+ * Thrown if an install fails.
+ *
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE InstallActionError : public ActionError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ InstallActionError(const std::string & msg) throw ();
+ };
+
+ /**
+ * Thrown if a fetch fails.
+ *
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE FetchActionError :
+ public ActionError
+ {
+ private:
+ const tr1::shared_ptr<const Sequence<FetchActionFailure> > _failures;
+
+ public:
+ FetchActionError(const std::string &) throw ();
+ FetchActionError(const std::string &, const tr1::shared_ptr<const Sequence<FetchActionFailure> > &) throw ();
+
+ const tr1::shared_ptr<const Sequence<FetchActionFailure> > failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
+ * Thrown if an uninstall fails.
+ *
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE UninstallActionError : public ActionError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ UninstallActionError(const std::string & msg) throw ();
+ };
+
+ /**
+ * Thrown if a configure fails.
+ *
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+ class PALUDIS_VISIBLE ConfigActionError : public ActionError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ ConfigActionError(const std::string & msg) throw ();
+ };
}
#endif
diff --git a/paludis/action.sr b/paludis/action.sr
index 1341a17..cd7a7a8 100644
--- a/paludis/action.sr
+++ b/paludis/action.sr
@@ -1,14 +1,32 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
+make_class_FetchActionOptions()
+{
+ visible
+ allow_named_args
+
+ key fetch_unneeded bool
+ key safe_resume bool
+
+ doxygen_comment << "END"
+ /**
+ * Options for FetchAction.
+ *
+ * \see FetchAction
+ * \nosubgrouping
+ */
+END
+}
+
+
make_class_InstallActionOptions()
{
visible
+ allow_named_args
key no_config_protect bool
- key fetch_only bool
key debug_build InstallActionDebugOption
- key safe_resume bool
key destination "tr1::shared_ptr<Repository>"
doxygen_comment << "END"
@@ -24,6 +42,7 @@ END
make_class_UninstallActionOptions()
{
visible
+ allow_named_args
key no_config_protect bool
@@ -37,3 +56,24 @@ make_class_UninstallActionOptions()
END
}
+make_class_FetchActionFailure()
+{
+ visible
+ allow_named_args
+
+ key target_file std::string
+ key requires_manual_fetching bool
+ key failed_automatic_fetching bool
+ key failed_integrity_checks std::string
+
+ doxygen_comment << "END"
+ /**
+ * A failed fetch action part.
+ *
+ * \see FetchActionError
+ * \ingroup grpexceptions
+ * \nosubgrouping
+ */
+END
+}
+
diff --git a/paludis/dep_label-fwd.hh b/paludis/dep_label-fwd.hh
new file mode 100644
index 0000000..2c7e58b
--- /dev/null
+++ b/paludis/dep_label-fwd.hh
@@ -0,0 +1,42 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_LABEL_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_LABEL_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+ struct URILabelVisitorTypes;
+ struct URILabel;
+
+ template <typename T_> struct ConcreteURILabel;
+ typedef ConcreteURILabel<enum URIMirrorsThenListedLabelTag { }> URIMirrorsThenListedLabel;
+ typedef ConcreteURILabel<enum URIMirrorsOnlyLabelTag { }> URIMirrorsOnlyLabel;
+ typedef ConcreteURILabel<enum URIListedOnlyLabelTag { }> URIListedOnlyLabel;
+ typedef ConcreteURILabel<enum URIListedThenMirrorsLabelTag { }> URIListedThenMirrorsLabel;
+ typedef ConcreteURILabel<enum URILocalMirrorsOnlyLabelTag { }> URILocalMirrorsOnlyLabel;
+ typedef ConcreteURILabel<enum URIManualOnlyLabelTag { }> URIManualOnlyLabel;
+
+ std::ostream & operator<< (std::ostream &, const URILabel &) PALUDIS_VISIBLE;
+}
+
+#endif
diff --git a/paludis/dep_label.cc b/paludis/dep_label.cc
new file mode 100644
index 0000000..9f23364
--- /dev/null
+++ b/paludis/dep_label.cc
@@ -0,0 +1,76 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/dep_label.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <ostream>
+
+using namespace paludis;
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const URILabel & l)
+{
+ s << l.text();
+ return s;
+}
+
+URILabel::~URILabel()
+{
+}
+
+namespace paludis
+{
+ template <>
+ template <typename T_>
+ struct Implementation<ConcreteURILabel<T_> >
+ {
+ const std::string text;
+
+ Implementation(const std::string & t) :
+ text(t)
+ {
+ }
+ };
+}
+
+template <typename T_>
+ConcreteURILabel<T_>::ConcreteURILabel(const std::string & t) :
+ PrivateImplementationPattern<ConcreteURILabel<T_> >(new Implementation<ConcreteURILabel<T_> >(t))
+{
+}
+
+template <typename T_>
+ConcreteURILabel<T_>::~ConcreteURILabel()
+{
+}
+
+template <typename T_>
+const std::string
+ConcreteURILabel<T_>::text() const
+{
+ return _imp->text;
+}
+
+template class ConcreteURILabel<URIMirrorsThenListedLabel::Tag>;
+template class ConcreteURILabel<URIMirrorsOnlyLabel::Tag>;
+template class ConcreteURILabel<URIListedOnlyLabel::Tag>;
+template class ConcreteURILabel<URIListedThenMirrorsLabel::Tag>;
+template class ConcreteURILabel<URILocalMirrorsOnlyLabel::Tag>;
+template class ConcreteURILabel<URIManualOnlyLabel::Tag>;
+
diff --git a/paludis/dep_label.hh b/paludis/dep_label.hh
new file mode 100644
index 0000000..22ae201
--- /dev/null
+++ b/paludis/dep_label.hh
@@ -0,0 +1,74 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_LABEL_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_LABEL_HH 1
+
+#include <paludis/dep_label-fwd.hh>
+#include <paludis/util/visitor.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ struct URILabelVisitorTypes :
+ VisitorTypes<
+ URILabelVisitorTypes,
+ URILabel,
+ URIMirrorsThenListedLabel,
+ URIMirrorsOnlyLabel,
+ URIListedOnlyLabel,
+ URIListedThenMirrorsLabel,
+ URILocalMirrorsOnlyLabel,
+ URIManualOnlyLabel
+ >
+ {
+ };
+
+ class PALUDIS_VISIBLE URILabel :
+ private InstantiationPolicy<URILabel, instantiation_method::NonCopyableTag>,
+ public virtual ConstAcceptInterface<URILabelVisitorTypes>
+ {
+ public:
+ virtual ~URILabel() = 0;
+
+ virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ template <typename T_>
+ class PALUDIS_VISIBLE ConcreteURILabel :
+ public URILabel,
+ public ConstAcceptInterfaceVisitsThis<URILabelVisitorTypes, ConcreteURILabel<T_> >,
+ private PrivateImplementationPattern<ConcreteURILabel<T_> >
+ {
+ private:
+ using PrivateImplementationPattern<ConcreteURILabel<T_> >::_imp;
+
+ public:
+ ConcreteURILabel(const std::string &);
+ ~ConcreteURILabel();
+
+ virtual const std::string text() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ typedef T_ Tag;
+ };
+}
+
+#endif
diff --git a/paludis/dep_list/condition_tracker.hh b/paludis/dep_list/condition_tracker.hh
index b6ab244..cb02587 100644
--- a/paludis/dep_list/condition_tracker.hh
+++ b/paludis/dep_list/condition_tracker.hh
@@ -57,11 +57,11 @@ namespace paludis
using ConstVisitor<DependencySpecTree>::VisitConstSequence<ConditionTracker, AllDepSpec>::visit_sequence;
- virtual void visit_sequence(const AnyDepSpec &, DependencySpecTree::ConstSequenceIterator, DependencySpecTree::ConstSequenceIterator);
- virtual void visit_sequence(const UseDepSpec &, DependencySpecTree::ConstSequenceIterator, DependencySpecTree::ConstSequenceIterator);
+ void visit_sequence(const AnyDepSpec &, DependencySpecTree::ConstSequenceIterator, DependencySpecTree::ConstSequenceIterator);
+ void visit_sequence(const UseDepSpec &, DependencySpecTree::ConstSequenceIterator, DependencySpecTree::ConstSequenceIterator);
- virtual void visit_leaf(const PackageDepSpec &) PALUDIS_ATTRIBUTE((noreturn));
- virtual void visit_leaf(const BlockDepSpec &) PALUDIS_ATTRIBUTE((noreturn));
+ void visit_leaf(const PackageDepSpec &) PALUDIS_ATTRIBUTE((noreturn));
+ void visit_leaf(const BlockDepSpec &) PALUDIS_ATTRIBUTE((noreturn));
};
}
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index 7346158..7d19611 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -22,6 +22,7 @@
#include <iosfwd>
#include <string>
+#include <paludis/dep_label.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/visitor.hh>
@@ -36,6 +37,7 @@ namespace paludis
class UseDepSpec;
class BlockDepSpec;
class StringDepSpec;
+ template <typename T_> class LabelsDepSpec;
#include <paludis/dep_spec-se.hh>
@@ -56,6 +58,13 @@ namespace paludis
std::ostream & operator<< (std::ostream &, const PackageDepSpec &) PALUDIS_VISIBLE;
/**
+ * A LabelsDepSpec<URILabelVisitorTypes> can be written to an ostream.
+ *
+ * \ingroup grpdepspecs
+ */
+ std::ostream & operator<< (std::ostream &, const LabelsDepSpec<URILabelVisitorTypes> &) PALUDIS_VISIBLE;
+
+ /**
* A generic DepSpec heirarchy.
*
* \ingroup grpdepspecs
@@ -68,6 +77,7 @@ namespace paludis
TreeLeaf<GenericSpecTree, URIDepSpec>,
TreeLeaf<GenericSpecTree, PackageDepSpec>,
TreeLeaf<GenericSpecTree, BlockDepSpec>,
+ TreeLeaf<GenericSpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
ConstTreeSequence<GenericSpecTree, AllDepSpec>,
ConstTreeSequence<GenericSpecTree, AnyDepSpec>,
ConstTreeSequence<GenericSpecTree, UseDepSpec>
@@ -102,6 +112,7 @@ namespace paludis
URISpecTree,
DepSpec,
TreeLeaf<URISpecTree, URIDepSpec>,
+ TreeLeaf<URISpecTree, LabelsDepSpec<URILabelVisitorTypes> >,
ConstTreeSequence<URISpecTree, AllDepSpec>,
ConstTreeSequence<URISpecTree, UseDepSpec>
>
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 6c9b79b..d427b4c 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -23,6 +23,7 @@
#include <paludis/version_requirements.hh>
#include <paludis/util/clone-impl.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/join.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -760,6 +761,13 @@ paludis::operator<< (std::ostream & s, const PackageDepSpec & a)
return s;
}
+std::ostream &
+paludis::operator<< (std::ostream & s, const LabelsDepSpec<URILabelVisitorTypes> & l)
+{
+ s << join(l.begin(), l.end(), "+") << ":";
+ return s;
+}
+
PackageDepSpecError::PackageDepSpecError(const std::string & msg) throw () :
Exception(msg)
{
@@ -1033,3 +1041,54 @@ URIDepSpec::clone() const
return tr1::shared_ptr<URIDepSpec>(new URIDepSpec(text()));
}
+namespace paludis
+{
+ template <>
+ template <typename T_>
+ struct Implementation<LabelsDepSpec<T_ > >
+ {
+ std::list<tr1::shared_ptr<const typename T_::BasicNode> > items;
+ };
+}
+
+template <typename T_>
+LabelsDepSpec<T_>::LabelsDepSpec() :
+ PrivateImplementationPattern<LabelsDepSpec<T_> >(new Implementation<LabelsDepSpec<T_> >)
+{
+}
+
+template <typename T_>
+LabelsDepSpec<T_>::~LabelsDepSpec()
+{
+}
+
+template <typename T_>
+tr1::shared_ptr<DepSpec>
+LabelsDepSpec<T_>::clone() const
+{
+ return tr1::shared_ptr<LabelsDepSpec<T_> >(new LabelsDepSpec<T_>);
+}
+
+template <typename T_>
+typename LabelsDepSpec<T_>::Iterator
+LabelsDepSpec<T_>::begin() const
+{
+ return Iterator(indirect_iterator(_imp->items.begin()));
+}
+
+template <typename T_>
+typename LabelsDepSpec<T_>::Iterator
+LabelsDepSpec<T_>::end() const
+{
+ return Iterator(indirect_iterator(_imp->items.end()));
+}
+
+template <typename T_>
+void
+LabelsDepSpec<T_>::add_label(const tr1::shared_ptr<const typename T_::BasicNode> & item)
+{
+ _imp->items.push_back(item);
+}
+
+template class LabelsDepSpec<URILabelVisitorTypes>;
+
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index cb91f7f..c368c12 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -22,6 +22,7 @@
#include <paludis/dep_spec-fwd.hh>
#include <paludis/dep_tag-fwd.hh>
+#include <paludis/dep_label-fwd.hh>
#include <paludis/name.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/clone.hh>
@@ -457,6 +458,44 @@ namespace paludis
virtual tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ /**
+ * A LabelsDepSpec represents a labels entry using a particular visitor
+ * types class.
+ *
+ * \ingroup grpdepspecs
+ * \nosubgrouping
+ */
+ template <typename SpecTree_>
+ class PALUDIS_VISIBLE LabelsDepSpec :
+ public DepSpec,
+ private PrivateImplementationPattern<LabelsDepSpec<SpecTree_> >
+ {
+ private:
+ using PrivateImplementationPattern<LabelsDepSpec<SpecTree_> >::_imp;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ LabelsDepSpec();
+ ~LabelsDepSpec();
+
+ ///\}
+
+ ///\name Contained labels
+ ///\{
+
+ void add_label(const tr1::shared_ptr<const typename SpecTree_::BasicNode> &);
+ typedef libwrapiter::ForwardIterator<LabelsDepSpec<SpecTree_>, const typename SpecTree_::BasicNode> Iterator;
+ Iterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ Iterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ virtual tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
}
#endif
diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc
index f00e638..23494ca 100644
--- a/paludis/dep_tag.cc
+++ b/paludis/dep_tag.cc
@@ -230,6 +230,10 @@ namespace
s << "!" << *b.blocked_spec() << " ";
}
+ void
+ visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
+ {
+ }
};
struct DepTagComparator :
diff --git a/paludis/files.m4 b/paludis/files.m4
index bf88fbd..28a34fc 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -12,6 +12,7 @@ add(`about', `hh', `test')
add(`action', `hh', `cc', `fwd', `se', `sr')
add(`config_file', `hh', `cc', `se', `test', `testscript')
add(`contents', `hh', `cc', `fwd')
+add(`dep_label', `hh', `cc', `fwd')
add(`dep_spec', `hh', `cc', `se', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_tag', `hh', `cc', `fwd', `sr')
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 8d4c44e..2d058f9 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -34,6 +34,7 @@ libpaludiserepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_
paludis_repositories_e_include_HEADERS = \
aa_visitor.hh \
+ check_fetched_files_visitor.hh \
dep_lexer.hh \
dep_parser.hh \
dep_parser-se.hh \
@@ -64,11 +65,13 @@ paludis_repositories_e_include_HEADERS = \
ebuild_id.hh \
eclass_mtimes.hh \
exheres_layout.hh \
+ fetch_visitor.hh \
glsa-sr.hh \
glsa.hh \
layout.hh \
make_ebin_repository.hh \
make_ebuild_repository.hh \
+ source_uri_finder.hh \
traditional_layout.hh \
use_desc.hh \
vdb_id.hh \
@@ -82,6 +85,7 @@ paludis_repositories_e_include_HEADERS = \
libpaludiserepository_la_SOURCES = \
aa_visitor.cc \
dep_lexer.cc \
+ check_fetched_files_visitor.cc \
dep_parser.cc \
dep_spec_pretty_printer.cc \
e_key.cc \
@@ -105,11 +109,13 @@ libpaludiserepository_la_SOURCES = \
ebuild_id.cc \
eclass_mtimes.cc \
exheres_layout.cc \
+ fetch_visitor.cc \
glsa.cc \
layout.cc \
make_ebin_repository.cc \
make_ebuild_repository.cc \
registration.cc \
+ source_uri_finder.cc \
traditional_layout.cc \
use_desc.cc \
vdb_id.cc \
@@ -173,6 +179,17 @@ e_repository_sets_TEST_LDADD = \
e_repository_sets_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)
+dep_spec_pretty_printer_TEST_SOURCES = dep_spec_pretty_printer_TEST.cc
+
+dep_spec_pretty_printer_TEST_LDADD = \
+ libpaludiserepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
dep_lexer_TEST_SOURCES = dep_lexer_TEST.cc
dep_lexer_TEST_LDADD = \
@@ -206,6 +223,30 @@ aa_visitor_TEST_LDADD = \
$(top_builddir)/test/libtest.a \
$(DYNAMIC_LD_LIBS)
+fetch_visitor_TEST_SOURCES = fetch_visitor_TEST.cc
+
+fetch_visitor_TEST_LDADD = \
+ libpaludiserepository.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+source_uri_finder_TEST_SOURCES = source_uri_finder_TEST.cc
+
+source_uri_finder_TEST_LDADD = \
+ libpaludiserepository.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
EXTRA_DIST = \
aa_visitor_TEST.cc \
dep_lexer_TEST.cc \
@@ -213,6 +254,7 @@ EXTRA_DIST = \
dep_parser-se.hh \
dep_parser-se.cc \
dep_parser_TEST.cc \
+ dep_spec_pretty_printer_TEST.cc \
eapi.sr \
eapi-sr.hh \
eapi-sr.cc \
@@ -237,6 +279,10 @@ EXTRA_DIST = \
e_repository_sets_TEST.cc \
e_repository_sets_TEST_setup.sh \
e_repository_sets_TEST_cleanup.sh \
+ fetch_visitor_TEST.cc \
+ fetch_visitor_TEST_setup.sh \
+ fetch_visitor_TEST_cleanup.sh \
+ source_uri_finder_TEST.cc \
xml_things_TEST.cc \
xml_things_TEST_setup.sh \
xml_things_TEST_cleanup.sh \
@@ -282,7 +328,8 @@ check_SCRIPTS = \
e_repository_TEST_setup.sh e_repository_TEST_cleanup.sh \
xml_things_TEST_setup.sh xml_things_TEST_cleanup.sh \
vdb_repository_TEST_setup.sh vdb_repository_TEST_cleanup.sh \
- e_repository_sets_TEST_setup.sh e_repository_sets_TEST_cleanup.sh
+ e_repository_sets_TEST_setup.sh e_repository_sets_TEST_cleanup.sh \
+ fetch_visitor_TEST_setup.sh fetch_visitor_TEST_cleanup.sh
TESTS_ENVIRONMENT = env \
TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
@@ -388,11 +435,14 @@ endif
TESTS = \
dep_lexer_TEST \
dep_parser_TEST \
+ dep_spec_pretty_printer_TEST \
e_repository_TEST \
vdb_unmerger_TEST \
$(GLSA_TESTS) \
e_repository_sets_TEST \
- aa_visitor_TEST
+ aa_visitor_TEST \
+ fetch_visitor_TEST \
+ source_uri_finder_TEST
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/e/aa_visitor.cc b/paludis/repositories/e/aa_visitor.cc
index 48e9304..8949d53 100644
--- a/paludis/repositories/e/aa_visitor.cc
+++ b/paludis/repositories/e/aa_visitor.cc
@@ -72,6 +72,11 @@ AAVisitor::visit_leaf(const URIDepSpec & p)
_imp->aa.push_back(p.filename());
}
+void
+AAVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
+{
+}
+
AAVisitor::Iterator
AAVisitor::begin() const
{
diff --git a/paludis/repositories/e/aa_visitor.hh b/paludis/repositories/e/aa_visitor.hh
index 59e1065..22dbe67 100644
--- a/paludis/repositories/e/aa_visitor.hh
+++ b/paludis/repositories/e/aa_visitor.hh
@@ -65,6 +65,8 @@ namespace paludis
void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
+
///}
/// \name Iterator functions
diff --git a/paludis/repositories/e/aa_visitor_TEST.cc b/paludis/repositories/e/aa_visitor_TEST.cc
index 03e99d3..76ec845 100644
--- a/paludis/repositories/e/aa_visitor_TEST.cc
+++ b/paludis/repositories/e/aa_visitor_TEST.cc
@@ -39,7 +39,7 @@ namespace test_cases
void run()
{
AAVisitor p1;
- DepParser::parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_EQUAL(join(p1.begin(), p1.end(), " "), "b c d e");
}
} test_aa_visitor;
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
new file mode 100644
index 0000000..76a58a5
--- /dev/null
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -0,0 +1,229 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/check_fetched_files_visitor.hh>
+#include <paludis/repositories/e/source_uri_finder.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/repository.hh>
+#include <paludis/about.hh>
+#include <paludis/action.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/save.hh>
+#include <paludis/util/stringify.hh>
+#include <iostream>
+#include <list>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<CheckFetchedFilesVisitor>
+ {
+ const Environment * const env;
+ const tr1::shared_ptr<const PackageID> id;
+ const FSEntry distdir;
+ const bool check_unneeded;
+
+ std::set<std::string> done;
+ const tr1::shared_ptr<Sequence<FetchActionFailure> > failures;
+ bool need_nofetch;
+ bool in_nofetch;
+
+ Implementation(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const FSEntry & d,
+ const bool c,
+ const bool n) :
+ env(e),
+ id(i),
+ distdir(d),
+ check_unneeded(c),
+ failures(new Sequence<FetchActionFailure>),
+ need_nofetch(false),
+ in_nofetch(n)
+ {
+ }
+ };
+}
+
+CheckFetchedFilesVisitor::CheckFetchedFilesVisitor(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const FSEntry & d,
+ const bool c,
+ const bool n) :
+ PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n))
+{
+}
+
+CheckFetchedFilesVisitor::~CheckFetchedFilesVisitor()
+{
+}
+
+void
+CheckFetchedFilesVisitor::visit_sequence(const UseDepSpec & u,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator end)
+{
+ Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
+ if ((_imp->check_unneeded) || (_imp->env->query_use(u.flag(), *_imp->id) ^ u.inverse()))
+ std::for_each(cur, end, accept_visitor(*this));
+}
+
+void
+CheckFetchedFilesVisitor::visit_sequence(const AllDepSpec &,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator end)
+{
+ Save<bool> save_in_nofetch(&_imp->in_nofetch, _imp->in_nofetch);
+ std::for_each(cur, end, accept_visitor(*this));
+}
+
+namespace
+{
+ struct InNoFetchVisitor :
+ ConstVisitor<URILabelVisitorTypes>
+ {
+ bool result;
+
+ InNoFetchVisitor() :
+ result(false)
+ {
+ }
+
+ void visit(const URIMirrorsOnlyLabel &)
+ {
+ }
+
+ void visit(const URIManualOnlyLabel &)
+ {
+ result = true;
+ }
+
+ void visit(const URIMirrorsThenListedLabel &)
+ {
+ }
+
+ void visit(const URILocalMirrorsOnlyLabel &)
+ {
+ result = true;
+ }
+
+ void visit(const URIListedOnlyLabel &)
+ {
+ }
+
+ void visit(const URIListedThenMirrorsLabel &)
+ {
+ }
+ };
+}
+
+void
+CheckFetchedFilesVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
+{
+ InNoFetchVisitor v;
+ std::for_each(l.begin(), l.end(), accept_visitor(v));
+ _imp->in_nofetch = v.result;
+}
+
+void
+CheckFetchedFilesVisitor::visit_leaf(const URIDepSpec & u)
+{
+ Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
+
+ if (_imp->done.end() != _imp->done.find(u.filename()))
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Already checked '" << u.filename() << "'";
+ return;
+ }
+ _imp->done.insert(u.filename());
+
+ std::cout << "Checking '" << u.filename() << "'... ";
+
+ if (! (_imp->distdir / u.filename()).is_regular_file())
+ {
+ if (_imp->in_nofetch)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Manual fetch required for '" << u.filename() << "'";
+ std::cout << "requires manual fetch";
+ _imp->need_nofetch = true;
+ _imp->failures->push_back(FetchActionFailure::create()
+ .target_file(u.filename())
+ .requires_manual_fetching(true)
+ .failed_automatic_fetching(false)
+ .failed_integrity_checks("")
+ );
+ }
+ else
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Automatic fetch failed for '" << u.filename() << "'";
+ std::cout << "does not exist";
+ _imp->failures->push_back(FetchActionFailure::create()
+ .target_file(u.filename())
+ .requires_manual_fetching(false)
+ .failed_automatic_fetching(true)
+ .failed_integrity_checks("")
+ );
+ }
+ }
+ else if (0 == (_imp->distdir / u.filename()).file_size())
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Empty file for '" << u.filename() << "'";
+ std::cout << "empty file";
+ _imp->failures->push_back(FetchActionFailure::create()
+ .target_file(u.filename())
+ .requires_manual_fetching(false)
+ .failed_integrity_checks("SIZE (empty file)")
+ .failed_automatic_fetching(false)
+ );
+ }
+ else
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Success for '" << u.filename() << "'";
+ std::cout << "ok";
+ }
+
+ std::cout << std::endl;
+}
+
+const tr1::shared_ptr<const Sequence<FetchActionFailure> >
+CheckFetchedFilesVisitor::failures() const
+{
+ return _imp->failures;
+}
+
+bool
+CheckFetchedFilesVisitor::need_nofetch() const
+{
+ return _imp->need_nofetch;
+}
+
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
new file mode 100644
index 0000000..1503eb1
--- /dev/null
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -0,0 +1,69 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_CHECK_FETCHED_FILES_VISITOR_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_CHECK_FETCHED_FILES_VISITOR_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/visitor-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tr1_memory.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/action-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE CheckFetchedFilesVisitor :
+ private PrivateImplementationPattern<CheckFetchedFilesVisitor>,
+ public ConstVisitor<URISpecTree>
+ {
+ public:
+ CheckFetchedFilesVisitor(
+ const Environment * const,
+ const tr1::shared_ptr<const PackageID> &,
+ const FSEntry & distdir,
+ const bool check_unneeded,
+ const bool fetch_restrict);
+
+ ~CheckFetchedFilesVisitor();
+
+ void visit_sequence(const UseDepSpec &,
+ URISpecTree::ConstSequenceIterator,
+ URISpecTree::ConstSequenceIterator);
+
+ void visit_sequence(const AllDepSpec &,
+ URISpecTree::ConstSequenceIterator,
+ URISpecTree::ConstSequenceIterator);
+
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
+
+ void visit_leaf(const URIDepSpec &);
+
+ const tr1::shared_ptr<const Sequence<FetchActionFailure> > failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool need_nofetch() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/dep_lexer.cc b/paludis/repositories/e/dep_lexer.cc
index 6542fde..c1cd980 100644
--- a/paludis/repositories/e/dep_lexer.cc
+++ b/paludis/repositories/e/dep_lexer.cc
@@ -91,6 +91,8 @@ DepLexer::DepLexer(const std::string & s) :
throw DepStringLexError(s, "')' should be followed by whitespace");
else if (std::string::npos == t->find_first_not_of(" \t\n"))
_imp->tokens.push_back(std::make_pair(dpl_whitespace, *t));
+ else if (':' == (*t)[t->length() - 1])
+ _imp->tokens.push_back(std::make_pair(dpl_label, *t));
else if ('?' == (*t)[t->length() - 1])
_imp->tokens.push_back(std::make_pair(dpl_use_flag, *t));
else
diff --git a/paludis/repositories/e/dep_lexer.hh b/paludis/repositories/e/dep_lexer.hh
index f39abca..91d2f0f 100644
--- a/paludis/repositories/e/dep_lexer.hh
+++ b/paludis/repositories/e/dep_lexer.hh
@@ -86,7 +86,8 @@ namespace paludis
dpl_double_bar, ///< a double bar ('any' marker)
dpl_open_paren, ///< open paren
dpl_close_paren, ///< close paren
- dpl_arrow ///< arrow
+ dpl_arrow, ///< arrow
+ dpl_label ///< a label
};
/**
diff --git a/paludis/repositories/e/dep_parser-fwd.hh b/paludis/repositories/e/dep_parser-fwd.hh
index d6bdbbb..edf3301 100644
--- a/paludis/repositories/e/dep_parser-fwd.hh
+++ b/paludis/repositories/e/dep_parser-fwd.hh
@@ -27,7 +27,6 @@ namespace paludis
{
namespace erepository
{
- class DepParser;
class DepStringNestingError;
class DepStringParseError;
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index feba76b..afed12c 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -25,6 +25,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <stack>
@@ -53,6 +54,8 @@ DepStringNestingError::DepStringNestingError(const std::string & dep_string) thr
namespace
{
+ struct LabelsAreURI;
+
enum DepParserState
{
dps_initial,
@@ -63,7 +66,8 @@ namespace
dps_had_use_flag_space,
dps_had_text_arrow,
dps_had_text_arrow_space,
- dps_had_text_arrow_text
+ dps_had_text_arrow_text,
+ dps_had_label
};
using namespace tr1::placeholders;
@@ -231,6 +235,30 @@ namespace
}
};
+ template <typename H_, typename K_>
+ struct HandleLabel
+ {
+ static void add(const std::string & s, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> &,
+ const EAPI &)
+ {
+ throw DepStringParseError(s, "label is not allowed here");
+ }
+ };
+
+ template <typename H_>
+ struct HandleLabel<H_, LabelsAreURI>
+ {
+ static void add(const std::string & s, tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)> & p,
+ const EAPI & e)
+ {
+ if (e.supported && e.supported->uri_labels)
+ p(tr1::shared_ptr<TreeLeaf<H_, LabelsDepSpec<URILabelVisitorTypes> > >(
+ new TreeLeaf<H_, LabelsDepSpec<URILabelVisitorTypes> >(parse_uri_label(s, e))));
+ else
+ throw DepStringParseError(s, "URI labels not allowed in this EAPI");
+ }
+ };
+
bool disallow_any_use(const DependencySpecTreeParseMode tree_mode)
{
switch (tree_mode)
@@ -250,369 +278,440 @@ namespace
}
}
-template <typename H_, typename I_, bool any_, bool use_>
-tr1::shared_ptr<typename H_::ConstItem>
-DepParser::_parse(const std::string & s, bool disallow_any_use, const I_ & p)
+namespace
{
- Context context("When parsing dependency string '" + s + "':");
+ template <typename H_, typename I_, bool any_, bool use_, typename Label_>
+ tr1::shared_ptr<typename H_::ConstItem>
+ parse(const std::string & s, bool disallow_any_use, const I_ & p, const EAPI & e)
+ {
+ Context context("When parsing dependency string '" + s + "':");
- tr1::shared_ptr<ConstTreeSequence<H_, AllDepSpec> > result(
- new ConstTreeSequence<H_, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
- std::stack<std::pair<tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>, bool> > stack;
- stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, result, _1)), false));
+ tr1::shared_ptr<ConstTreeSequence<H_, AllDepSpec> > result(
+ new ConstTreeSequence<H_, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
+ std::stack<std::pair<tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>, bool> > stack;
+ stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
+ tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, result, _1)), false));
- std::string arrow_lhs;
- DepParserState state(dps_initial);
- DepLexer lexer(s);
- DepLexer::Iterator i(lexer.begin()), i_end(lexer.end());
+ std::string arrow_lhs;
+ DepParserState state(dps_initial);
+ DepLexer lexer(s);
+ DepLexer::Iterator i(lexer.begin()), i_end(lexer.end());
- for ( ; i != i_end ; ++i)
- {
- Context local_context("When handling lexer token '" + i->second +
- "' (" + stringify(i->first) + "):");
- do
+ for ( ; i != i_end ; ++i)
{
- switch (state)
+ Context local_context("When handling lexer token '" + i->second +
+ "' (" + stringify(i->first) + "):");
+ do
{
- case dps_initial:
- do
- {
- switch (i->first)
+ switch (state)
+ {
+ case dps_initial:
+ do
{
- case dpl_whitespace:
- continue;
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ continue;
- case dpl_arrow:
- throw DepStringParseError(s, "Arrow not allowed here");
+ case dpl_arrow:
+ throw DepStringParseError(s, "Arrow not allowed here");
- case dpl_text:
- {
- if (i->second.empty())
- throw DepStringParseError(i->second, "Empty text entry");
+ case dpl_text:
+ {
+ if (i->second.empty())
+ throw DepStringParseError(i->second, "Empty text entry");
+
+ DepLexer::Iterator i_fwd(next(i));
+ if (i_fwd != i_end && i_fwd->first == dpl_whitespace && ++i_fwd != i_end
+ && i_fwd->first == dpl_arrow)
+ {
+ arrow_lhs = i->second;
+ i = i_fwd;
+ state = dps_had_text_arrow;
+ }
+ else
+ p.template add<H_>(i->second, stack.top().first);
+ }
+ continue;
- DepLexer::Iterator i_fwd(next(i));
- if (i_fwd != i_end && i_fwd->first == dpl_whitespace && ++i_fwd != i_end
- && i_fwd->first == dpl_arrow)
+ case dpl_open_paren:
{
- arrow_lhs = i->second;
- i = i_fwd;
- state = dps_had_text_arrow;
+ tr1::shared_ptr<ConstTreeSequence<H_, AllDepSpec> > a(new ConstTreeSequence<H_, AllDepSpec>(
+ tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
+ stack.top().first(a);
+ stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
+ tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, a, _1)), false));
+ state = dps_had_paren;
}
- else
- p.template add<H_>(i->second, stack.top().first);
- }
- continue;
-
- case dpl_open_paren:
- {
- tr1::shared_ptr<ConstTreeSequence<H_, AllDepSpec> > a(new ConstTreeSequence<H_, AllDepSpec>(
- tr1::shared_ptr<AllDepSpec>(new AllDepSpec)));
- stack.top().first(a);
- stack.push(std::make_pair(tr1::function<void (tr1::shared_ptr<ConstAcceptInterface<H_> >)>(
- tr1::bind(&ConstTreeSequence<H_, AllDepSpec>::add, a, _1)), false));
+ continue;
+
+ case dpl_close_paren:
+ if (stack.empty())
+ throw DepStringNestingError(s);
+ stack.pop();
+ if (stack.empty())
+ throw DepStringNestingError(s);
state = dps_had_paren;
- }
- continue;
-
- case dpl_close_paren:
- if (stack.empty())
- throw DepStringNestingError(s);
- stack.pop();
- if (stack.empty())
- throw DepStringNestingError(s);
- state = dps_had_paren;
- continue;
-
- case dpl_double_bar:
- HandleAny<H_, any_>::handle(s, stack);
- state = dps_had_double_bar;
- continue;
-
- case dpl_use_flag:
- if (use_ && disallow_any_use && stack.top().second)
- throw DepStringParseError(s, "use? group is not allowed immediately under a || ( )");
- HandleUse<H_, use_>::handle(s, i->second, stack);
- state = dps_had_use_flag;
- continue;
-
- }
- throw InternalError(PALUDIS_HERE,
- "dps_initial: i->first is " + stringify(i->first));
-
- } while (0);
- continue;
-
- case dps_had_double_bar:
- do
- {
- switch (i->first)
+ continue;
+
+ case dpl_double_bar:
+ HandleAny<H_, any_>::handle(s, stack);
+ state = dps_had_double_bar;
+ continue;
+
+ case dpl_use_flag:
+ if (use_ && disallow_any_use && stack.top().second)
+ throw DepStringParseError(s, "use? group is not allowed immediately under a || ( )");
+ HandleUse<H_, use_>::handle(s, i->second, stack);
+ state = dps_had_use_flag;
+ continue;
+
+ case dpl_label:
+ HandleLabel<H_, Label_>::add(i->second, stack.top().first, e);
+ state = dps_had_label;
+ continue;
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_initial: i->first is " + stringify(i->first));
+
+ } while (0);
+ continue;
+
+ case dps_had_double_bar:
+ do
{
- case dpl_whitespace:
- state = dps_had_double_bar_space;
- continue;
-
- case dpl_text:
- case dpl_arrow:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_open_paren:
- case dpl_close_paren:
- throw DepStringParseError(s, "Expected space after '||'");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_double_bar: i->first is " + stringify(i->first));
-
- } while (0);
- continue;
-
- case dps_had_double_bar_space:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_had_double_bar_space;
+ continue;
+
+ case dpl_text:
+ case dpl_arrow:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_open_paren:
+ case dpl_close_paren:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected space after '||'");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_double_bar: i->first is " + stringify(i->first));
+
+ } while (0);
+ continue;
+
+ case dps_had_double_bar_space:
+ do
{
- case dpl_open_paren:
- state = dps_initial;
- continue;
-
- case dpl_whitespace:
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected '(' after '|| '");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_double_bar_space: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_paren:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_open_paren:
+ state = dps_initial;
+ continue;
+
+ case dpl_whitespace:
+ case dpl_text:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected '(' after '|| '");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_double_bar_space: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_paren:
+ do
{
- case dpl_whitespace:
- state = dps_initial;
- continue;
-
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_open_paren:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected space after '(' or ')'");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_paren: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_use_flag:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_initial;
+ continue;
+
+ case dpl_text:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_open_paren:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected space after '(' or ')'");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_paren: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_use_flag:
+ do
{
- case dpl_whitespace:
- state = dps_had_use_flag_space;
- continue;
-
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_open_paren:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected space after use flag");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_use_flag: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_use_flag_space:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_had_use_flag_space;
+ continue;
+
+ case dpl_text:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_open_paren:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected space after use flag");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_use_flag: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_use_flag_space:
+ do
{
- case dpl_open_paren:
- state = dps_had_paren;
- continue;
-
- case dpl_whitespace:
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected '(' after use flag");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_use_flag_space: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_text_arrow:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_open_paren:
+ state = dps_had_paren;
+ continue;
+
+ case dpl_whitespace:
+ case dpl_text:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected '(' after use flag");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_use_flag_space: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_label:
+ do
{
- case dpl_whitespace:
- state = dps_had_text_arrow_space;
- continue;
-
- case dpl_text:
- case dpl_open_paren:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected whitespace after arrow");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_text_arrow: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_text_arrow_space:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_initial;
+ continue;
+
+ case dpl_text:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_open_paren:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected space after label");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_label: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_text_arrow:
+ do
{
- case dpl_whitespace:
- continue;
-
- case dpl_text:
- state = dps_had_text_arrow_text;
- p.template add_arrow<H_>(arrow_lhs, i->second, stack.top().first);
- continue;
-
- case dpl_open_paren:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_close_paren:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected text after whitespace after arrow");
- }
- throw InternalError(PALUDIS_HERE,
- "dps_had_text_arrow_space: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case dps_had_text_arrow_text:
- do
- {
- switch (i->first)
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_had_text_arrow_space;
+ continue;
+
+ case dpl_text:
+ case dpl_open_paren:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected whitespace after arrow");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_text_arrow: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_text_arrow_space:
+ do
{
- case dpl_whitespace:
- state = dps_initial;
- continue;
-
- case dpl_text:
- case dpl_open_paren:
- case dpl_use_flag:
- case dpl_close_paren:
- case dpl_double_bar:
- case dpl_arrow:
- throw DepStringParseError(s, "Expected whitespace after text after whitespace after arrow");
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ continue;
+
+ case dpl_text:
+ state = dps_had_text_arrow_text;
+ p.template add_arrow<H_>(arrow_lhs, i->second, stack.top().first);
+ continue;
+
+ case dpl_open_paren:
+ case dpl_use_flag:
+ case dpl_double_bar:
+ case dpl_close_paren:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected text after whitespace after arrow");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_text_arrow_space: i->first is " + stringify(i->first));
+ } while (0);
+ continue;
+
+ case dps_had_text_arrow_text:
+ do
+ {
+ switch (i->first)
+ {
+ case dpl_whitespace:
+ state = dps_initial;
+ continue;
+
+ case dpl_text:
+ case dpl_open_paren:
+ case dpl_use_flag:
+ case dpl_close_paren:
+ case dpl_double_bar:
+ case dpl_arrow:
+ case dpl_label:
+ throw DepStringParseError(s, "Expected whitespace after text after whitespace after arrow");
+ }
+ throw InternalError(PALUDIS_HERE,
+ "dps_had_text_arrow_text: i->first is " + stringify(i->first));
}
- throw InternalError(PALUDIS_HERE,
- "dps_had_text_arrow_text: i->first is " + stringify(i->first));
- }
- while (0);
- continue;
- }
- throw InternalError(PALUDIS_HERE,
- "state is " + stringify(state));
-
- } while (0);
- }
+ while (0);
+ continue;
+ }
+ throw InternalError(PALUDIS_HERE,
+ "state is " + stringify(state));
- if (stack.empty())
- throw DepStringNestingError(s);
+ } while (0);
+ }
- switch (state)
- {
- case dps_initial:
- case dps_had_paren:
- case dps_had_text_arrow_text:
- case dps_had_text_arrow_space:
- break;
-
- case dps_had_double_bar_space:
- case dps_had_double_bar:
- case dps_had_use_flag:
- case dps_had_use_flag_space:
- case dps_had_text_arrow:
- throw DepStringParseError(s, "Unexpected end of string");
- }
+ if (stack.empty())
+ throw DepStringNestingError(s);
+
+ switch (state)
+ {
+ case dps_initial:
+ case dps_had_paren:
+ case dps_had_text_arrow_text:
+ case dps_had_text_arrow_space:
+ break;
+
+ case dps_had_double_bar_space:
+ case dps_had_double_bar:
+ case dps_had_use_flag:
+ case dps_had_use_flag_space:
+ case dps_had_text_arrow:
+ case dps_had_label:
+ throw DepStringParseError(s, "Unexpected end of string");
+ }
- stack.pop();
- if (! stack.empty())
- throw DepStringNestingError(s);
- return result;
+ stack.pop();
+ if (! stack.empty())
+ throw DepStringNestingError(s);
+ return result;
+ }
}
tr1::shared_ptr<DependencySpecTree::ConstItem>
-DepParser::parse_depend(const std::string & s, const EAPI & e)
+paludis::erepository::parse_depend(const std::string & s, const EAPI & e)
{
Context c("When parsing dependency string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' dependencies");
- return _parse<DependencySpecTree, ParsePackageOrBlockDepSpec, true, true>(s,
+ return parse<DependencySpecTree, ParsePackageOrBlockDepSpec, true, true, void>(s,
disallow_any_use(e.supported->dependency_spec_tree_parse_mode),
- ParsePackageOrBlockDepSpec(e.supported->package_dep_spec_parse_mode));
+ ParsePackageOrBlockDepSpec(e.supported->package_dep_spec_parse_mode), e);
}
tr1::shared_ptr<ProvideSpecTree::ConstItem>
-DepParser::parse_provide(const std::string & s, const EAPI & e)
+paludis::erepository::parse_provide(const std::string & s, const EAPI & e)
{
Context c("When parsing provide string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' provides");
- return _parse<ProvideSpecTree, ParsePackageDepSpec, false, true>(s, false,
- ParsePackageDepSpec(pds_pm_eapi_0));
+ return parse<ProvideSpecTree, ParsePackageDepSpec, false, true, void>(s, false,
+ ParsePackageDepSpec(pds_pm_eapi_0), e);
}
tr1::shared_ptr<RestrictSpecTree::ConstItem>
-DepParser::parse_restrict(const std::string & s, const EAPI & e)
+paludis::erepository::parse_restrict(const std::string & s, const EAPI & e)
{
Context c("When parsing restrict string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' restrictions");
- return _parse<RestrictSpecTree, ParseTextDepSpec, false, true>(s, false,
- ParseTextDepSpec());
+ return parse<RestrictSpecTree, ParseTextDepSpec, false, true, void>(s, false,
+ ParseTextDepSpec(), e);
}
tr1::shared_ptr<URISpecTree::ConstItem>
-DepParser::parse_uri(const std::string & s, const EAPI & e)
+paludis::erepository::parse_uri(const std::string & s, const EAPI & e)
{
Context c("When parsing URI string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' URIs");
- return _parse<URISpecTree, ParseURIDepSpec, false, true>(s, false,
- ParseURIDepSpec(e.supported->uri_supports_arrow));
+ return parse<URISpecTree, ParseURIDepSpec, false, true, LabelsAreURI>(s, false,
+ ParseURIDepSpec(e.supported->uri_supports_arrow), e);
}
tr1::shared_ptr<LicenseSpecTree::ConstItem>
-DepParser::parse_license(const std::string & s, const EAPI & e)
+paludis::erepository::parse_license(const std::string & s, const EAPI & e)
{
Context c("When parsing license string '" + s + "' using EAPI '" + e.name + "':");
if (! e.supported)
throw DepStringParseError(s, "Don't know how to parse EAPI '" + e.name + "' licenses");
- return _parse<LicenseSpecTree, ParseTextDepSpec, true, true>(s,
- true, ParseTextDepSpec());
+ return parse<LicenseSpecTree, ParseTextDepSpec, true, true, void>(s,
+ true, ParseTextDepSpec(), e);
+}
+
+tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> >
+paludis::erepository::parse_uri_label(const std::string & s, const EAPI & e)
+{
+ Context context("When parsing label string '" + s + "' using EAPI '" + e.name + "':");
+
+ if (s.empty())
+ throw DepStringParseError(s, "Empty label");
+
+ std::string c(e.supported->uri_labels->class_for_label(s.substr(0, s.length() - 1)));
+ if (c.empty())
+ throw DepStringParseError(s, "Unknown label");
+
+ tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> > l(new LabelsDepSpec<URILabelVisitorTypes>);
+
+ if (c == "URIMirrorsThenListedLabel")
+ l->add_label(make_shared_ptr(new URIMirrorsThenListedLabel(s.substr(0, s.length() - 1))));
+ else if (c == "URIMirrorsOnlyLabel")
+ l->add_label(make_shared_ptr(new URIMirrorsOnlyLabel(s.substr(0, s.length() - 1))));
+ else if (c == "URIListedOnlyLabel")
+ l->add_label(make_shared_ptr(new URIListedOnlyLabel(s.substr(0, s.length() - 1))));
+ else if (c == "URIListedThenMirrorsLabel")
+ l->add_label(make_shared_ptr(new URIListedThenMirrorsLabel(s.substr(0, s.length() - 1))));
+ else if (c == "URILocalMirrorsOnlyLabel")
+ l->add_label(make_shared_ptr(new URILocalMirrorsOnlyLabel(s.substr(0, s.length() - 1))));
+ else if (c == "URIManualOnlyLabel")
+ l->add_label(make_shared_ptr(new URIManualOnlyLabel(s.substr(0, s.length() - 1))));
+ else
+ throw DepStringParseError(s, "Label '" + s + "' maps to unknown class '" + c + "'");
+
+ return l;
}
diff --git a/paludis/repositories/e/dep_parser.hh b/paludis/repositories/e/dep_parser.hh
index 2602ab0..ab1237f 100644
--- a/paludis/repositories/e/dep_parser.hh
+++ b/paludis/repositories/e/dep_parser.hh
@@ -29,7 +29,7 @@
#include <string>
/** \file
- * Declarations for the DepParser class.
+ * Declarations for the DepParser routines.
*
* \ingroup grpdepparser
*/
@@ -72,51 +72,40 @@ namespace paludis
};
/**
- * The DepParser converts string representations of a dependency
- * specification into a DepSpec instance. The DepLexer class is
- * used as the first stage.
- *
- * \ingroup grpdepparser
+ * Parse a dependency heirarchy.
*/
- class PALUDIS_VISIBLE DepParser :
- private InstantiationPolicy<DepParser, instantiation_method::NonInstantiableTag>
- {
- private:
- template <typename H_, typename I_, bool any_, bool use_>
- static tr1::shared_ptr<typename H_::ConstItem> _parse(const std::string &,
- bool disallow_any_use, const I_ &);
+ tr1::shared_ptr<DependencySpecTree::ConstItem> parse_depend(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
- public:
- /**
- * Parse a dependency heirarchy.
- */
- static tr1::shared_ptr<DependencySpecTree::ConstItem> parse_depend(const std::string & s,
- const EAPI &);
+ /**
+ * Parse a provide heirarchy.
+ */
+ tr1::shared_ptr<ProvideSpecTree::ConstItem> parse_provide(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
- /**
- * Parse a provide heirarchy.
- */
- static tr1::shared_ptr<ProvideSpecTree::ConstItem> parse_provide(const std::string & s,
- const EAPI &);
+ /**
+ * Parse a restrict.
+ */
+ tr1::shared_ptr<RestrictSpecTree::ConstItem> parse_restrict(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
- /**
- * Parse a restrict.
- */
- static tr1::shared_ptr<RestrictSpecTree::ConstItem> parse_restrict(const std::string & s,
- const EAPI &);
+ /**
+ * Parse a uri heirarchy.
+ */
+ tr1::shared_ptr<URISpecTree::ConstItem> parse_uri(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
- /**
- * Parse a uri heirarchy.
- */
- static tr1::shared_ptr<URISpecTree::ConstItem> parse_uri(const std::string & s,
- const EAPI &);
+ /**
+ * Parse a license heirarchy.
+ */
+ tr1::shared_ptr<LicenseSpecTree::ConstItem> parse_license(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
- /**
- * Parse a license heirarchy.
- */
- static tr1::shared_ptr<LicenseSpecTree::ConstItem> parse_license(const std::string & s,
- const EAPI &);
- };
+ /**
+ * Parse a URI label.
+ */
+ tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> > parse_uri_label(const std::string & s,
+ const EAPI &) PALUDIS_VISIBLE;
}
}
diff --git a/paludis/repositories/e/dep_parser_TEST.cc b/paludis/repositories/e/dep_parser_TEST.cc
index d1276fa..c489bef 100644
--- a/paludis/repositories/e/dep_parser_TEST.cc
+++ b/paludis/repositories/e/dep_parser_TEST.cc
@@ -48,7 +48,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("",
+ parse_depend("",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
}
@@ -65,7 +65,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend(" \n \t",
+ parse_depend(" \n \t",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
}
@@ -82,7 +82,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("app-editors/vim",
+ parse_depend("app-editors/vim",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim");
}
@@ -99,17 +99,17 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d1(0, false);
- DepParser::parse_depend(">=app-editors/vim-6.4_alpha",
+ parse_depend(">=app-editors/vim-6.4_alpha",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d1);
TEST_CHECK_EQUAL(stringify(d1), ">=app-editors/vim-6.4_alpha");
DepSpecPrettyPrinter d2(0, false);
- DepParser::parse_depend("=app-editors/vim-6.4_alpha-r1",
+ parse_depend("=app-editors/vim-6.4_alpha-r1",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d2);
TEST_CHECK_EQUAL(stringify(d2), "=app-editors/vim-6.4_alpha-r1");
DepSpecPrettyPrinter d3(0, false);
- DepParser::parse_depend(">=app-editors/vim-6.4_alpha:one",
+ parse_depend(">=app-editors/vim-6.4_alpha:one",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d3);
TEST_CHECK_EQUAL(stringify(d3), ">=app-editors/vim-6.4_alpha:one");
}
@@ -126,7 +126,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("app-editors/vim app-misc/hilite \nsys-apps/findutils",
+ parse_depend("app-editors/vim app-misc/hilite \nsys-apps/findutils",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim app-misc/hilite sys-apps/findutils");
}
@@ -139,7 +139,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("|| ( one/one two/two )",
+ parse_depend("|| ( one/one two/two )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one two/two )");
}
@@ -152,15 +152,15 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("|| ( one/one foo? ( two/two ) )",
+ parse_depend("|| ( one/one foo? ( two/two ) )",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one foo? ( two/two ) )");
- TEST_CHECK_THROWS(DepParser::parse_depend("|| ( one/one foo? ( two/two ) )",
+ TEST_CHECK_THROWS(parse_depend("|| ( one/one foo? ( two/two ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
DepSpecPrettyPrinter e(0, false);
- DepParser::parse_depend("|| ( one/one ( foo? ( two/two ) ) )",
+ parse_depend("|| ( one/one ( foo? ( two/two ) ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
TEST_CHECK_EQUAL(stringify(e), "|| ( one/one ( foo? ( two/two ) ) )");
}
@@ -177,7 +177,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend(" ( one/one two/two ) ",
+ parse_depend(" ( one/one two/two ) ",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "one/one two/two");
}
@@ -194,7 +194,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_depend("foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "foo? ( one/one )");
}
} test_dep_spec_parser_use;
@@ -210,7 +210,7 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- DepParser::parse_depend("!foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_depend("!foo? ( one/one )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "!foo? ( one/one )");
}
} test_dep_spec_parser_inv_use;
@@ -222,14 +222,14 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, true);
- DepParser::parse_uri("a\n->\tb", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
+ parse_uri("a\n->\tb", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d);
TEST_CHECK_EQUAL(stringify(d), "a -> b\n");
DepSpecPrettyPrinter e(0, true);
- DepParser::parse_uri("a-> b", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
+ parse_uri("a-> b", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(e);
TEST_CHECK_EQUAL(stringify(e), "a->\nb\n");
- TEST_CHECK_THROWS(DepParser::parse_uri("a -> b",
+ TEST_CHECK_THROWS(parse_uri("a -> b",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d), DepStringError);
}
} test_dep_spec_parser_uri;
@@ -245,15 +245,15 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- TEST_CHECK_THROWS(DepParser::parse_depend("!foo? ( one/one",
+ TEST_CHECK_THROWS(parse_depend("!foo? ( one/one",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("!foo? ( one/one ) )",
+ TEST_CHECK_THROWS(parse_depend("!foo? ( one/one ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("( ( ( ) )",
+ TEST_CHECK_THROWS(parse_depend("( ( ( ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("( ( ( ) ) ) )",
+ TEST_CHECK_THROWS(parse_depend("( ( ( ) ) ) )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend(")",
+ TEST_CHECK_THROWS(parse_depend(")",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
}
} test_dep_spec_parser_bad_nesting;
@@ -269,38 +269,38 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter d(0, false);
- TEST_CHECK_THROWS(DepParser::parse_depend("||",
+ TEST_CHECK_THROWS(parse_depend("||",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("|| ",
+ TEST_CHECK_THROWS(parse_depend("|| ",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("foo?",
+ TEST_CHECK_THROWS(parse_depend("foo?",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("!foo? ||",
+ TEST_CHECK_THROWS(parse_depend("!foo? ||",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("(((",
+ TEST_CHECK_THROWS(parse_depend("(((",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend(")",
+ TEST_CHECK_THROWS(parse_depend(")",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_depend("(foo/bar)",
+ TEST_CHECK_THROWS(parse_depend("(foo/bar)",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_license("a -> b",
+ TEST_CHECK_THROWS(parse_license("a -> b",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("( -> )",
+ TEST_CHECK_THROWS(parse_uri("( -> )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("( -> )",
+ TEST_CHECK_THROWS(parse_uri("( -> )",
*EAPIData::get_instance()->eapi_from_string("0"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("foo? -> bar",
+ TEST_CHECK_THROWS(parse_uri("foo? -> bar",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("a ->",
+ TEST_CHECK_THROWS(parse_uri("a ->",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("a -> ( )",
+ TEST_CHECK_THROWS(parse_uri("a -> ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("a -> )",
+ TEST_CHECK_THROWS(parse_uri("a -> )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("a -> || ( )",
+ TEST_CHECK_THROWS(parse_uri("a -> || ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
- TEST_CHECK_THROWS(DepParser::parse_uri("a -> foo? ( )",
+ TEST_CHECK_THROWS(parse_uri("a -> foo? ( )",
*EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(d), DepStringError);
}
} test_dep_spec_parser_bad_values;
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index 3150c38..2d86367 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -24,6 +24,7 @@
#include <paludis/util/save.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/stringify.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
/** \file
@@ -42,12 +43,14 @@ namespace paludis
{
std::stringstream s;
unsigned indent;
+ bool extra_label_indent;
bool use_newlines;
bool outer_block;
bool need_space;
Implementation(unsigned i, bool b) :
indent(i),
+ extra_label_indent(false),
use_newlines(b),
outer_block(true),
need_space(false)
@@ -85,6 +88,7 @@ DepSpecPrettyPrinter::visit_sequence(const AllDepSpec &,
{
Save<unsigned> old_indent(&_imp->indent, _imp->outer_block ? _imp->indent : _imp->indent + 4);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, _imp->outer_block ? _imp->extra_label_indent : false);
std::for_each(cur, end, accept_visitor(*this));
}
@@ -106,6 +110,7 @@ DepSpecPrettyPrinter::visit_sequence(const AnyDepSpec &,
_imp->s << newline();
{
Save<unsigned> old_indent(&_imp->indent, _imp->indent + 4);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
std::for_each(cur, end, accept_visitor(*this));
}
_imp->s << indent() << ")";
@@ -123,6 +128,7 @@ DepSpecPrettyPrinter::visit_sequence(const UseDepSpec & a,
_imp->s << newline();
{
Save<unsigned> old_indent(&_imp->indent, _imp->indent + 4);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
std::for_each(cur, end, accept_visitor(*this));
}
_imp->s << indent() << ")";
@@ -162,6 +168,25 @@ DepSpecPrettyPrinter::visit_leaf(const BlockDepSpec & b)
_imp->s << newline();
}
+void
+DepSpecPrettyPrinter::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
+{
+ if (_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = false;
+ _imp->indent -= 4;
+ }
+
+ _imp->s << indent() << stringify(l);
+ _imp->s << newline();
+
+ if (! _imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = true;
+ _imp->indent += 4;
+ }
+}
+
std::string
DepSpecPrettyPrinter::newline()
{
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.hh b/paludis/repositories/e/dep_spec_pretty_printer.hh
index 155b1da..87f364b 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.hh
+++ b/paludis/repositories/e/dep_spec_pretty_printer.hh
@@ -81,6 +81,8 @@ namespace paludis
void visit_leaf(const URIDepSpec &);
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
+
///}
};
diff --git a/paludis/dep_spec_pretty_printer_TEST.cc b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
index ca0d980..0065593 100644
--- a/paludis/dep_spec_pretty_printer_TEST.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer_TEST.cc
@@ -18,15 +18,16 @@
*/
#include "dep_spec_pretty_printer.hh"
-#include "portage_dep_parser.hh"
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/eapi.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
using namespace test;
using namespace paludis;
+using namespace paludis::erepository;
namespace test_cases
{
@@ -37,24 +38,29 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter p1(0, false);
- PortageDepParser::parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, "foo/bar bar/baz");
DepSpecPrettyPrinter p2(0, false);
- PortageDepParser::parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
+ parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, "foo/bar moo? ( bar/baz )");
DepSpecPrettyPrinter p3(0, false);
- PortageDepParser::parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
+ parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, "|| ( a/b ( c/d e/f ) )");
DepSpecPrettyPrinter p4(0, false);
- PortageDepParser::parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
+ parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, "a b");
DepSpecPrettyPrinter p5(0, false);
- PortageDepParser::parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p5);
+ parse_uri("( a -> b c x? ( d e ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p5);
TEST_CHECK_STRINGIFY_EQUAL(p5, "a -> b c x? ( d e )");
+
+ DepSpecPrettyPrinter p6(0, false);
+ parse_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
+ *EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p6);
+ TEST_CHECK_STRINGIFY_EQUAL(p6, "a manual: b x? ( c mirrors-first: d manual: e ) f");
}
} test_pretty_printer_no_indent;
@@ -65,21 +71,27 @@ namespace test_cases
void run()
{
DepSpecPrettyPrinter p1(4);
- PortageDepParser::parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
+ parse_depend("foo/bar bar/baz", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p1);
TEST_CHECK_STRINGIFY_EQUAL(p1, " foo/bar\n bar/baz\n");
DepSpecPrettyPrinter p2(4);
- PortageDepParser::parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
+ parse_depend("foo/bar moo? ( bar/baz )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p2);
TEST_CHECK_STRINGIFY_EQUAL(p2, " foo/bar\n moo? (\n bar/baz\n )\n");
DepSpecPrettyPrinter p3(4);
- PortageDepParser::parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
+ parse_depend("|| ( a/b ( c/d e/f ) )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p3);
TEST_CHECK_STRINGIFY_EQUAL(p3, " || (\n a/b\n (\n c/d\n"
" e/f\n )\n )\n");
DepSpecPrettyPrinter p4(4);
- PortageDepParser::parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
+ parse_license("( ( ( ) a ) b )", *EAPIData::get_instance()->eapi_from_string("paludis-1"))->accept(p4);
TEST_CHECK_STRINGIFY_EQUAL(p4, " a\n b\n");
+
+ DepSpecPrettyPrinter p5(4);
+ parse_uri("a manual: b x? ( c mirrors-first: d manual: e ) f",
+ *EAPIData::get_instance()->eapi_from_string("exheres-0"))->accept(p5);
+ TEST_CHECK_STRINGIFY_EQUAL(p5, " a\n manual:\n b\n x? (\n c\n"
+ " mirrors-first:\n d\n manual:\n e\n )\n f\n");
}
} test_pretty_printer_indent;
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index d1dfee6..0e7d4bf 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -111,7 +111,7 @@ EDependenciesKey::value() const
IdleActionPool::get_instance()->increase_unprepared_stat();
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = DepParser::parse_depend(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_depend(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
@@ -140,7 +140,7 @@ EDependenciesKey::idle_load() const
try
{
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "' as idle action:");
- _imp->value = DepParser::parse_depend(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_depend(_imp->string_value, *_imp->id->eapi());
_imp->value_used = tr1::bind(tr1::mem_fn(&IdleActionPool::increase_used_stat), IdleActionPool::get_instance());
return iar_success;
}
@@ -202,7 +202,7 @@ ELicenseKey::value() const
IdleActionPool::get_instance()->increase_unprepared_stat();
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = DepParser::parse_license(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_license(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
@@ -231,7 +231,7 @@ ELicenseKey::idle_load() const
try
{
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "' as idle action:");
- _imp->value = DepParser::parse_license(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_license(_imp->string_value, *_imp->id->eapi());
_imp->value_used = tr1::bind(tr1::mem_fn(&IdleActionPool::increase_used_stat), IdleActionPool::get_instance());
return iar_success;
}
@@ -284,7 +284,7 @@ EURIKey::value() const
return _imp->value;
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = DepParser::parse_uri(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_uri(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
@@ -343,7 +343,7 @@ ERestrictKey::value() const
return _imp->value;
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = DepParser::parse_restrict(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_restrict(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
@@ -402,7 +402,7 @@ EProvideKey::value() const
return _imp->value;
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = DepParser::parse_provide(_imp->string_value, *_imp->id->eapi());
+ _imp->value = parse_provide(_imp->string_value, *_imp->id->eapi());
return _imp->value;
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index a310b56..4337cf9 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1046,6 +1046,11 @@ namespace
result = true;
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ result = true;
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
}
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 207eefd..d37e7da 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -31,6 +31,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/query.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <test/test_framework.hh>
@@ -732,5 +733,105 @@ namespace test_cases
}
} test_e_repository_manifest;
+ struct ERepositoryFetchTest : TestCase
+ {
+ ERepositoryFetchTest() : TestCase("fetch") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "exheres");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "e_repository_TEST_dir/repo12");
+ keys->insert("profiles", "e_repository_TEST_dir/repo12/profiles/profile");
+ keys->insert("layout", "exheres");
+ keys->insert("eapi_when_unknown", "exheres-0");
+ keys->insert("eapi_when_unspecified", "exheres-0");
+ keys->insert("profile_eapi", "exheres-0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
+ tr1::shared_ptr<ERepository> repo(make_ebuild_repository(&env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ FetchAction action(FetchActionOptions::create()
+ .fetch_unneeded(false)
+ .safe_resume(true)
+ );
+
+ {
+ TestMessageSuffix suffix("no files", true);
+ const tr1::shared_ptr<const PackageID> no_files_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/no-files", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(no_files_id);
+ TEST_CHECK(no_files_id->short_description_key());
+ TEST_CHECK_EQUAL(no_files_id->short_description_key()->value(), "The Description");
+ no_files_id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("fetched files", true);
+ const tr1::shared_ptr<const PackageID> fetched_files_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/fetched-files", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(fetched_files_id);
+ TEST_CHECK((FSEntry("e_repository_TEST_dir") / "distdir" / "already-fetched.txt").is_regular_file());
+ fetched_files_id->perform_action(action);
+ TEST_CHECK((FSEntry("e_repository_TEST_dir") / "distdir" / "already-fetched.txt").is_regular_file());
+ }
+
+ {
+ TestMessageSuffix suffix("fetchable files", true);
+ TEST_CHECK(! (FSEntry("e_repository_TEST_dir") / "distdir" / "fetchable-1.txt").is_regular_file());
+ const tr1::shared_ptr<const PackageID> fetchable_files_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/fetchable-files", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(fetchable_files_id);
+ fetchable_files_id->perform_action(action);
+ TEST_CHECK((FSEntry("e_repository_TEST_dir") / "distdir" / "fetchable-1.txt").is_regular_file());
+ }
+
+ {
+ TestMessageSuffix suffix("arrow files", true);
+ TEST_CHECK(! (FSEntry("e_repository_TEST_dir") / "distdir" / "arrowed.txt").is_regular_file());
+ const tr1::shared_ptr<const PackageID> arrow_files_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/arrow-files", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(arrow_files_id);
+ arrow_files_id->perform_action(action);
+ TEST_CHECK((FSEntry("e_repository_TEST_dir") / "distdir" / "arrowed.txt").is_regular_file());
+ }
+
+ {
+ TestMessageSuffix suffix("unfetchable files", true);
+ const tr1::shared_ptr<const PackageID> unfetchable_files_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/unfetchable-files", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(unfetchable_files_id);
+ TEST_CHECK_THROWS(unfetchable_files_id->perform_action(action), FetchActionError);
+ }
+
+ {
+ const tr1::shared_ptr<const PackageID> no_files_restricted_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/no-files-restricted", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(no_files_restricted_id);
+ no_files_restricted_id->perform_action(action);
+ }
+
+ {
+ const tr1::shared_ptr<const PackageID> fetched_files_restricted_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/fetched-files-restricted", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(fetched_files_restricted_id);
+ fetched_files_restricted_id->perform_action(action);
+ }
+
+ {
+ const tr1::shared_ptr<const PackageID> fetchable_files_restricted_id(*env.package_database()->query(query::Matches(
+ PackageDepSpec("cat/fetchable-files-restricted", pds_pm_unspecific)), qo_require_exactly_one)->last());
+ TEST_CHECK(fetchable_files_restricted_id);
+ TEST_CHECK_THROWS(fetchable_files_restricted_id->perform_action(action), FetchActionError);
+ }
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+ } test_e_repository_fetch;
}
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 8e7d991..4e45de9 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -4,6 +4,13 @@
mkdir e_repository_TEST_dir || exit 1
cd e_repository_TEST_dir || exit 1
+mkdir -p distdir
+echo "already fetched" > distdir/already-fetched.txt || exit 1
+
+mkdir -p fetchable
+echo "one" > fetchable/fetchable-1.txt || exit 1
+echo "two" > fetchable/fetchable-2.txt || exit 1
+
mkdir -p repo1/{eclass,distfiles,profiles/profile} || exit 1
cd repo1 || exit 1
echo "test-repo-1" > profiles/repo_name || exit 1
@@ -302,3 +309,102 @@ MISC ChangeLog 34 RMD160 64ae4731e1de8dc8d81f0504c22e586358a5b6f0 SHA256 a8dfbbc
MISC metadata.xml 37 RMD160 52a6de8e54eeea3b5e3e8357a400fbc6d3f4062b SHA256 ba3b181b832c002612fba7768c95e526e188658d8fc85b92c153940ad43169de
END
cd ..
+
+mkdir -p repo12/{profiles/profile,metadata} || exit 1
+cd repo12 || exit 1
+echo "test-repo-12" >> profiles/repo_name || exit 1
+echo "cat" >> metadata/categories.conf || exit 1
+cat <<END > profiles/profile/make.defaults
+END
+mkdir -p packages/cat/no-files
+cat <<END > packages/cat/no-files/no-files-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/fetched-files
+cat <<END > packages/cat/fetched-files/fetched-files-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="file:///var/empty/already-fetched.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/fetchable-files
+cat <<END > packages/cat/fetchable-files/fetchable-files-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="file:///$(dirname $(pwd ) )/fetchable/fetchable-1.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/arrow-files
+cat <<END > packages/cat/arrow-files/arrow-files-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="file:///$(dirname $(pwd ) )/fetchable/fetchable-1.txt -> arrowed.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/unfetchable-files
+cat <<END > packages/cat/unfetchable-files/unfetchable-files-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="file:///var/empty/unfetchable-file.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/no-files-restricted
+cat <<END > packages/cat/no-files-restricted/no-files-restricted-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/fetched-files-restricted
+cat <<END > packages/cat/fetched-files-restricted/fetched-files-restricted-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="manual: file:///var/empty/already-fetched.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+mkdir -p packages/cat/fetchable-files-restricted
+cat <<END > packages/cat/fetchable-files-restricted/fetchable-files-restricted-1.exheres-0 || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI="manual: file:///$(dirname $(pwd ) )/fetchable/fetchable-2.txt"
+SLOT="0"
+MYOPTIONS=""
+LICENSE="GPL-2"
+PLATFORMS="test"
+DEPENDENCIES=""
+END
+cd ..
+
+cd ..
+
diff --git a/paludis/repositories/e/e_repository_entries.hh b/paludis/repositories/e/e_repository_entries.hh
index 8eb719f..1fed153 100644
--- a/paludis/repositories/e/e_repository_entries.hh
+++ b/paludis/repositories/e/e_repository_entries.hh
@@ -88,6 +88,12 @@ namespace paludis
tr1::shared_ptr<const ERepositoryProfile>) const = 0;
/**
+ * Handle a fetch.
+ */
+ virtual void fetch(const tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
+ tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+
+ /**
* Handle a pretend.
*/
virtual bool pretend(const tr1::shared_ptr<const ERepositoryID> &,
diff --git a/paludis/repositories/e/eapi-fwd.hh b/paludis/repositories/e/eapi-fwd.hh
index fe54207..d7e680e 100644
--- a/paludis/repositories/e/eapi-fwd.hh
+++ b/paludis/repositories/e/eapi-fwd.hh
@@ -32,6 +32,7 @@ namespace paludis
class EAPIEbuildMetadataVariables;
class EAPIEbuildEnvironmentVariables;
class EAPIEbuildOptions;
+ class EAPILabels;
}
}
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index dd211c3..b3dda3a 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -33,6 +33,9 @@
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/config_file.hh>
+#include <map>
+#include <vector>
+
using namespace paludis;
using namespace paludis::erepository;
@@ -109,7 +112,6 @@ namespace paludis
.ebuild_uninstall(k.get("ebuild_uninstall"))
.ebuild_pretend(k.get("ebuild_pretend"))
.ebuild_metadata(k.get("ebuild_metadata"))
- .ebuild_fetch(k.get("ebuild_fetch"))
.ebuild_nofetch(k.get("ebuild_nofetch"))
.ebuild_variable(k.get("ebuild_variable"))
.ebuild_config(k.get("ebuild_config")))))
@@ -161,6 +163,9 @@ namespace paludis
.env_accept_keywords(k.get("env_accept_keywords"))
.description_use(k.get("description_use"))
)))
+
+ .uri_labels(make_shared_ptr(new EAPILabels(k.get("uri_labels"))))
+
))))));
}
@@ -169,38 +174,6 @@ namespace paludis
throw EAPIConfigurationError("No EAPI configuration found for EAPI 0");
else
values.insert(std::make_pair("", i->second));
-
- values.insert(std::make_pair("CRAN-1",
- make_shared_ptr(new EAPI("CRAN-1", make_shared_ptr(new SupportedEAPI(
- SupportedEAPI::create()
- .package_dep_spec_parse_mode(pds_pm_permissive)
- .strict_package_dep_spec_parse_mode(pds_pm_permissive)
- .dependency_spec_tree_parse_mode(dst_pm_eapi_0)
- .iuse_flag_parse_mode(iuse_pm_permissive)
- .strict_iuse_flag_parse_mode(iuse_pm_permissive)
- .breaks_portage(true)
- .uri_supports_arrow(false)
- .ebuild_options(tr1::shared_ptr<EAPIEbuildOptions>())
- .ebuild_metadata_variables(tr1::shared_ptr<EAPIEbuildMetadataVariables>())
- .ebuild_environment_variables(tr1::shared_ptr<EAPIEbuildEnvironmentVariables>())
- .ebuild_phases(tr1::shared_ptr<EAPIEbuildPhases>())
- ))))));
-
- values.insert(std::make_pair("gems-1",
- make_shared_ptr(new EAPI("gems-1", make_shared_ptr(new SupportedEAPI(
- SupportedEAPI::create()
- .package_dep_spec_parse_mode(pds_pm_permissive)
- .strict_package_dep_spec_parse_mode(pds_pm_permissive)
- .dependency_spec_tree_parse_mode(dst_pm_eapi_0)
- .iuse_flag_parse_mode(iuse_pm_permissive)
- .strict_iuse_flag_parse_mode(iuse_pm_permissive)
- .breaks_portage(true)
- .uri_supports_arrow(false)
- .ebuild_options(tr1::shared_ptr<EAPIEbuildOptions>())
- .ebuild_metadata_variables(tr1::shared_ptr<EAPIEbuildMetadataVariables>())
- .ebuild_environment_variables(tr1::shared_ptr<EAPIEbuildEnvironmentVariables>())
- .ebuild_phases(tr1::shared_ptr<EAPIEbuildPhases>())
- ))))));
}
};
}
@@ -235,3 +208,47 @@ EAPIData::unknown_eapi() const
return make_shared_ptr(new EAPI("UNKNOWN", tr1::shared_ptr<SupportedEAPI>()));
}
+namespace paludis
+{
+ template <>
+ struct Implementation<EAPILabels>
+ {
+ std::map<std::string, std::string> v;
+ };
+}
+
+EAPILabels::EAPILabels(const std::string & s) :
+ PrivateImplementationPattern<EAPILabels>(new Implementation<EAPILabels>)
+{
+ std::vector<std::string> tokens;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tok(";");
+ tok.tokenise(s, std::back_inserter(tokens));
+
+ for (std::vector<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ {
+ std::vector<std::string> values;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> vtok("=");
+ vtok.tokenise(*t, std::back_inserter(values));
+
+ if (values.size() != 2)
+ throw EAPIConfigurationError("EAPI labels value '" + s + "' has bad values size '" + stringify(values.size()) + "'");
+
+ _imp->v.insert(std::make_pair(strip_leading(strip_trailing(values[0], " \t\r\n"), " \t\r\n"),
+ strip_leading(strip_trailing(values[1], " \t\r\n"), " \t\r\n")));
+ }
+}
+
+EAPILabels::~EAPILabels()
+{
+}
+
+const std::string
+EAPILabels::class_for_label(const std::string & s) const
+{
+ std::map<std::string, std::string>::const_iterator i(_imp->v.find(s));
+ if (_imp->v.end() == i)
+ return "";
+ return i->second;
+}
+
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 3661029..77f9e8f 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -35,6 +35,17 @@ namespace paludis
{
#include <paludis/repositories/e/eapi-sr.hh>
+ class PALUDIS_VISIBLE EAPILabels :
+ private InstantiationPolicy<EAPILabels, instantiation_method::NonCopyableTag>,
+ private PrivateImplementationPattern<EAPILabels>
+ {
+ public:
+ EAPILabels(const std::string &);
+ ~EAPILabels();
+
+ const std::string class_for_label(const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
/**
* Thrown if an EAPI configuration is broken.
*
diff --git a/paludis/repositories/e/eapi.sr b/paludis/repositories/e/eapi.sr
index 6b3a545..170c400 100644
--- a/paludis/repositories/e/eapi.sr
+++ b/paludis/repositories/e/eapi.sr
@@ -10,7 +10,6 @@ make_class_EAPIEbuildPhases()
key ebuild_uninstall std::string
key ebuild_pretend std::string
key ebuild_metadata std::string
- key ebuild_fetch std::string
key ebuild_nofetch std::string
key ebuild_variable std::string
key ebuild_config std::string
@@ -161,6 +160,7 @@ make_class_SupportedEAPI()
key ebuild_phases "tr1::shared_ptr<const EAPIEbuildPhases>"
key ebuild_metadata_variables "tr1::shared_ptr<const EAPIEbuildMetadataVariables>"
key ebuild_environment_variables "tr1::shared_ptr<const EAPIEbuildEnvironmentVariables>"
+ key uri_labels "tr1::shared_ptr<const EAPILabels>"
doxygen_comment << "END"
/**
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index b41c2d4..0ecb5fd 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -74,9 +74,6 @@ ebuild_pretend =
ebuild_metadata = \
sandbox userpriv noexec : metadata
-ebuild_fetch = \
- sandbox userpriv : fetch
-
ebuild_nofetch = \
sandbox userpriv : nofetch
@@ -129,3 +126,6 @@ env_accept_keywords = ACCEPT_KEYWORDS
env_portdir = PORTDIR
env_distdir = DISTDIR
+uri_labels = \
+ default = URIMirrorsThenListedLabel
+
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index f6b59d5..ffcba08 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -78,9 +78,6 @@ ebuild_pretend = \
ebuild_metadata = \
sandbox userpriv noexec : metadata
-ebuild_fetch = \
- sandbox userpriv : fetch
-
ebuild_nofetch = \
sandbox userpriv : nofetch
@@ -134,3 +131,12 @@ env_accept_keywords = ACCEPT_PLATFORMS
env_portdir = REPODIR
env_distdir = FETCHEDDIR
+uri_labels = \
+ default = URIListedThenMirrorsLabel ; \
+ mirrors-first = URIMirrorsThenListedLabel ; \
+ mirrors-only = URIMirrorsOnlyLabel ; \
+ listed-only = URIListedOnlyLabel ; \
+ listed-first = URIListedThenMirrorsLabel ; \
+ local-only = URILocalMirrorsOnlyLabel ; \
+ manual = URIManualOnlyLabel
+
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 3e23ce6..2b72be9 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -77,9 +77,6 @@ ebuild_pretend = \
ebuild_metadata = \
sandbox userpriv noexec : metadata
-ebuild_fetch = \
- sandbox userpriv : fetch
-
ebuild_nofetch = \
sandbox userpriv : nofetch
@@ -132,3 +129,6 @@ env_accept_keywords = ACCEPT_KEYWORDS
env_portdir = PORTDIR
env_distdir = DISTDIR
+uri_labels = \
+ default = URIListedThenMirrorsLabel
+
diff --git a/paludis/repositories/e/ebin.cc b/paludis/repositories/e/ebin.cc
index 4928dd0..c64eaee 100644
--- a/paludis/repositories/e/ebin.cc
+++ b/paludis/repositories/e/ebin.cc
@@ -27,6 +27,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/about.hh>
#include <paludis/package_id.hh>
+#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
#include <sys/resource.h>
#include <sys/time.h>
@@ -146,7 +147,7 @@ EbinFetchCommand::commands() const
bool
EbinFetchCommand::failure()
{
- throw PackageFetchActionError("Fetch failed for '" + stringify(*params.package_id) + "'");
+ throw FetchActionError("Fetch failed for '" + stringify(*params.package_id) + "'");
}
Command
@@ -208,7 +209,7 @@ EbinInstallCommand::commands() const
bool
EbinInstallCommand::failure()
{
- throw PackageInstallActionError("Install failed for '" + stringify(*params.package_id) + "'");
+ throw InstallActionError("Install failed for '" + stringify(*params.package_id) + "'");
}
Command
@@ -275,7 +276,7 @@ EbinMergeCommand::operator() ()
.with_echo_to_stderr());
if (0 != run_command(build_tarball))
- throw PackageInstallActionError("Error creating '" + stringify(tar) + "'");
+ throw InstallActionError("Error creating '" + stringify(tar) + "'");
Command create_env(Command("cp -f '" + stringify(merge_params.environment_file) + "' '.paludis-binpkg-environment'")
.with_chdir(merge_params.image)
@@ -287,7 +288,7 @@ EbinMergeCommand::operator() ()
.with_echo_to_stderr());
if (0 != run_command(create_env) || 0 != run_command(add_env_to_tarball))
- throw PackageInstallActionError("Error adding environment to '" + tar + "'");
+ throw InstallActionError("Error adding environment to '" + tar + "'");
Command clean_env(Command("rm -f '.paludis-binpkg-environment'")
.with_chdir(merge_params.image)
@@ -300,6 +301,6 @@ EbinMergeCommand::operator() ()
.with_echo_to_stderr());
if (0 != run_command(compress_tarball))
- throw PackageInstallActionError("Error compressing '" + tar + "'");
+ throw InstallActionError("Error compressing '" + tar + "'");
}
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index af71660..37cd16d 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -36,6 +36,7 @@
#include <paludis/config_file.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
#include <sys/resource.h>
#include <sys/time.h>
@@ -421,25 +422,23 @@ EbuildVariableCommand::do_run_command(const Command & cmd)
}
std::string
-EbuildFetchCommand::commands() const
+EbuildNoFetchCommand::commands() const
{
return params.commands;
}
bool
-EbuildFetchCommand::failure()
+EbuildNoFetchCommand::failure()
{
- throw PackageFetchActionError("Fetch failed for '" + stringify(*params.package_id) + "'");
+ throw FetchActionError("Fetch failed for '" + stringify(*params.package_id) + "'");
}
Command
-EbuildFetchCommand::extend_command(const Command & cmd)
+EbuildNoFetchCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
.with_setenv("A", fetch_params.a)
- .with_setenv("FLAT_SRC_URI", fetch_params.flat_src_uri)
.with_setenv("ROOT", fetch_params.root)
- .with_setenv("PALUDIS_USE_SAFE_RESUME", fetch_params.safe_resume ? "oohyesplease" : "")
.with_setenv("PALUDIS_PROFILE_DIR", stringify(*fetch_params.profiles->begin()))
.with_setenv("PALUDIS_PROFILE_DIRS", join(fetch_params.profiles->begin(),
fetch_params.profiles->end(), " ")));
@@ -459,8 +458,8 @@ EbuildFetchCommand::extend_command(const Command & cmd)
return result;
}
-EbuildFetchCommand::EbuildFetchCommand(const EbuildCommandParams & p,
- const EbuildFetchCommandParams & f) :
+EbuildNoFetchCommand::EbuildNoFetchCommand(const EbuildCommandParams & p,
+ const EbuildNoFetchCommandParams & f) :
EbuildCommand(p),
fetch_params(f)
{
@@ -475,7 +474,7 @@ EbuildInstallCommand::commands() const
bool
EbuildInstallCommand::failure()
{
- throw PackageInstallActionError("Install failed for '" + stringify(*params.package_id) + "'");
+ throw InstallActionError("Install failed for '" + stringify(*params.package_id) + "'");
}
Command
@@ -557,7 +556,7 @@ EbuildUninstallCommand::ebuild_file() const
bool
EbuildUninstallCommand::failure()
{
- throw PackageUninstallActionError("Uninstall failed for '" + stringify(*params.package_id) + "'");
+ throw UninstallActionError("Uninstall failed for '" + stringify(*params.package_id) + "'");
}
Command
@@ -593,8 +592,7 @@ EbuildConfigCommand::commands() const
bool
EbuildConfigCommand::failure()
{
- throw PackageConfigActionError("Configure failed for '" + stringify(
- *params.package_id) + "'");
+ throw ConfigActionError("Configure failed for '" + stringify(*params.package_id) + "'");
}
Command
@@ -657,7 +655,7 @@ WriteVDBEntryCommand::operator() ()
);
if (0 != (run_command(cmd)))
- throw PackageInstallActionError("Write VDB Entry command failed");
+ throw InstallActionError("Write VDB Entry command failed");
}
VDBPostMergeCommand::VDBPostMergeCommand(const VDBPostMergeCommandParams & p) :
@@ -679,7 +677,7 @@ VDBPostMergeCommand::operator() ()
#endif
if (0 != (run_command(ebuild_cmd)))
- throw PackageInstallActionError("VDB Entry post merge commands failed");
+ throw InstallActionError("VDB Entry post merge commands failed");
}
std::string
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 82f768b..b72edee 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -162,17 +162,17 @@ namespace paludis
};
/**
- * An EbuildFetchCommand is used to download and verify the digests for a
+ * An EbuildNoFetchCommand is used to download and verify the digests for a
* particular ebuild in a ERepository. On failure it throws.
*
* \ingroup grpebuildinterface
*/
- class EbuildFetchCommand :
+ class EbuildNoFetchCommand :
public EbuildCommand
{
protected:
/// Parameters for fetch.
- const EbuildFetchCommandParams fetch_params;
+ const EbuildNoFetchCommandParams fetch_params;
virtual std::string commands() const;
@@ -184,7 +184,7 @@ namespace paludis
/**
* Constructor.
*/
- EbuildFetchCommand(const EbuildCommandParams &, const EbuildFetchCommandParams &);
+ EbuildNoFetchCommand(const EbuildCommandParams &, const EbuildNoFetchCommandParams &);
};
/**
diff --git a/paludis/repositories/e/ebuild.sr b/paludis/repositories/e/ebuild.sr
index 20fd4c3..db31a6b 100644
--- a/paludis/repositories/e/ebuild.sr
+++ b/paludis/repositories/e/ebuild.sr
@@ -30,23 +30,21 @@ END
allow_named_args
}
-make_class_EbuildFetchCommandParams()
+make_class_EbuildNoFetchCommandParams()
{
key a std::string
key aa std::string
key use std::string
key use_expand std::string
- key flat_src_uri std::string
key root std::string
key profiles "tr1::shared_ptr<const FSEntrySequence>"
key expand_vars "tr1::shared_ptr<const Map<std::string, std::string> >"
- key safe_resume bool
doxygen_comment << "END"
/**
- * Parameters for an EbuildFetchCommand.
+ * Parameters for an EbuildNoFetchCommand.
*
- * \see EbuildFetchCommand
+ * \see EbuildNoFetchCommand
* \ingroup grpebuildinterface
* \nosubgrouping
*/
diff --git a/paludis/repositories/e/ebuild/Makefile.am b/paludis/repositories/e/ebuild/Makefile.am
index 3e21082..c48d839 100644
--- a/paludis/repositories/e/ebuild/Makefile.am
+++ b/paludis/repositories/e/ebuild/Makefile.am
@@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~
-SUBDIRS = . 0 exheres-0 digests utils
+SUBDIRS = . 0 exheres-0 utils
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -8,18 +8,14 @@ libexecprogdir = $(libexecdir)/paludis/
libexecprog_SCRIPTS = \
build_functions.bash \
- builtin_fetch.bash \
- builtin_fetchbin.bash \
builtin_init.bash \
builtin_initbin.bash \
builtin_loadenv.bash \
- builtin_merge.bash \
builtin_metadata.bash \
builtin_prepare.bash \
builtin_saveenv.bash \
builtin_strip.bash \
builtin_tidyup.bash \
- builtin_unmerge.bash \
builtin_unpackbin.bash \
builtin_variable.bash \
die_functions.bash \
@@ -58,31 +54,7 @@ TESTS_ENVIRONMENT = env \
TEST_SCRIPT_DIR="$(srcdir)/" \
bash $(top_srcdir)/test/run_test.sh $(top_srcdir)/paludis/repositories/e/ebuild/run_test.bash
-TESTS = echo_functions_TEST.bash list_functions_TEST.bash kernel_functions_TEST.bash \
- merge_TEST.bash unmerge_TEST.bash
-
-libexecprog_PROGRAMS = merge unmerge
-merge_SOURCES = merge.cc merge_common.cc merge_common.hh
-merge_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/digests/libpaludisdigests.la \
- $(top_builddir)/paludis/selinux/libpaludisselinux.la \
- $(DYNAMIC_LD_LIBS) \
- $(PTHREAD_LIBS)
-merge_LDFLAGS = $(PTHREAD_LIBS)
-
-unmerge_SOURCES = unmerge.cc merge_common.cc merge_common.hh
-unmerge_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/digests/libpaludisdigests.la \
- $(DYNAMIC_LD_LIBS) \
- $(PTHREAD_LIBS)
-unmerge_LDFLAGS = $(PTHREAD_LIBS)
-
-check_SCRIPTS = $(TESTS) \
- merge_TEST_setup.sh merge_TEST_cleanup.sh \
- unmerge_TEST_setup.sh unmerge_TEST_cleanup.sh \
- run_test.bash $(TESTS)
+TESTS = echo_functions_TEST.bash list_functions_TEST.bash kernel_functions_TEST.bash
EXTRA_DIST = $(libexecprog_SCRIPTS) run_test.bash $(TESTS) $(check_SCRIPTS)
diff --git a/paludis/repositories/e/ebuild/builtin_fetch.bash b/paludis/repositories/e/ebuild/builtin_fetch.bash
deleted file mode 100644
index c3f6402..0000000
--- a/paludis/repositories/e/ebuild/builtin_fetch.bash
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# 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
-
-builtin_fetch()
-{
- [[ -d "${DISTDIR}" ]] || die "DISTDIR \"${DISTDIR}\" is not a directory"
-
- local a nofetch unique_aa old_aa
- for a in ${FLAT_SRC_URI} ; do
- local aa=${a##*/}
- hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
-
- if [[ -f "${DISTDIR}/${aa}" ]] && [[ "0" != $(getfsize "${DISTDIR}/${aa}") ]] ; then
- if [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Already have ${aa}"
- old_aa="${aa}"
- fi
- else
- if [[ -f "${DISTDIR}/${aa}" ]] ; then
- ebuild_section "Trying to remove existing ${aa}..."
- rm -f "${DISTDIR}/${aa}"
- fi
-
- if ! hasq fetch ${RESTRICT} ; then
- if [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Need to fetch ${aa}"
- old_aa="${aa}"
- fi
- local d
- for d in ${PALUDIS_FETCHERS_DIRS:-${PALUDIS_EBUILD_DIR}/fetchers/} ; do
- prg=${d}/do$(echo ${a%%://*} | tr '[:upper:]' '[:lower:]' )
- ebuild_notice "debug" "fetcher program candidate for '${a}' is '${prg}'"
- [[ -x "${prg}" ]] && break
- done
- if [[ -x "${prg}" ]] ; then
- ${prg} "${a}" "${DISTDIR}/${aa}"
- else
- eerror "Don't know how to fetch '${a}'"
- fi
- else
- if ! [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Can't fetch ${aa}"
- old_aa="${aa}"
- fi
- fi
- fi
- done
-
- for a in ${unique_aa} ; do
- [[ -f ${DISTDIR}/${a} ]] || nofetch="${nofetch} ${a}"
- done
-
- if [[ -n "${nofetch}" ]] ; then
- local c
- echo
- eerror "Couldn't fetch the following components:"
- for c in ${nofetch} ; do
- eerror " * ${c}"
- done
- echo
- die "builtin_fetch failed"
- fi
-
- local badfetch=
- if [[ -f "${FILESDIR}/digest-${PN}-${PVR%-r0}" ]] ; then
- local line items prg
- while read line ; do
- line=( ${line} )
- if ! hasq "${line[2]}" ${A} ; then
- ebuild_section "Skipping check for ${line[2]}"
- continue
- fi
-
- prg="${PALUDIS_EBUILD_DIR}/digests/do$(echo ${line[0]} | tr \
- '[[:upper:]]' '[[:lower:]]')"
- if [[ -x "${prg}" ]] ; then
- ebegin_unhooked "Checking ${line[0]} for ${line[2]}"
- if [[ $("${prg}" "${DISTDIR}/${line[2]}" ) == "${line[1]}" ]] ; then
- eend 0
- else
- eend 1
- hasq "${line[2]}" ${badfetch} || badfetch="${badfetch} ${line[2]}"
- fi
- else
- einfo_unhooked "Can't check ${line[0]} for ${line[2]}"
- fi
-
- done < "${FILESDIR}"/digest-${PN}-${PVR%-r0}
- else
- ebuild_section "No digest file, skipping integrity checks"
- fi
-
- if [[ -n "${badfetch}" ]] ; then
- local c
- echo
- eerror "Bad digests encountered for the following components:"
- for c in ${badfetch} ; do
- eerror " * ${c}"
- done
- echo
- die "builtin_fetch failed"
- fi
-}
-
-ebuild_f_fetch()
-{
- local old_sandbox_write="${SANDBOX_WRITE}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${DISTDIR}"
- if hasq "fetch" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_fetch (RESTRICT)"
- elif hasq "fetch" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_fetch (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_fetch"
- builtin_fetch
- ebuild_section "Done builtin_fetch"
- fi
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${old_sandbox_write}"
- true
-}
-
-
diff --git a/paludis/repositories/e/ebuild/builtin_fetchbin.bash b/paludis/repositories/e/ebuild/builtin_fetchbin.bash
deleted file mode 100644
index 17af258..0000000
--- a/paludis/repositories/e/ebuild/builtin_fetchbin.bash
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
-#
-# This file is part of the Paludis package manager. Paludis is free software;
-# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License, version 2, as published by the Free Software Foundation.
-#
-# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-
-builtin_fetchbin()
-{
- [[ -d "${DISTDIR}" ]] || die "DISTDIR \"${DISTDIR}\" is not a directory"
-
- local a nofetch unique_aa old_aa
- for a in ${FLAT_BIN_URI} ; do
- local aa=${a##*/}
- hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
-
- if [[ -f "${DISTDIR}/${aa}" ]] && [[ "0" != $(getfsize "${DISTDIR}/${aa}") ]] ; then
- if [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Already have ${aa}"
- old_aa="${aa}"
- fi
- else
- if [[ -f "${DISTDIR}/${aa}" ]] ; then
- ebuild_section "Trying to remove existing ${aa}..."
- rm -f "${DISTDIR}/${aa}"
- fi
-
- if ! hasq fetchbin ${RESTRICT} ; then
- if [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Need to fetch ${aa}"
- old_aa="${aa}"
- fi
- local d
- for d in ${PALUDIS_FETCHERS_DIRS:-${PALUDIS_EBUILD_DIR}/fetchers/} ; do
- prg=${d}/do$(echo ${a%%://*} | tr '[:upper:]' '[:lower:]' )
- ebuild_notice "debug" "fetcher program candidate for '${a}' is '${prg}'"
- [[ -x "${prg}" ]] && break
- done
- if [[ -x "${prg}" ]] ; then
- ${prg} "${a}" "${DISTDIR}/${aa}"
- else
- eerror "Don't know how to fetch '${a}'"
- fi
- else
- if ! [[ "${old_aa}" != "${aa}" ]] ; then
- ebuild_section "Can't fetch ${aa}"
- old_aa="${aa}"
- fi
- fi
- fi
- done
-
- for a in ${unique_aa} ; do
- [[ -f ${DISTDIR}/${a} ]] || nofetch="${nofetch} ${a}"
- done
-
- if [[ -n "${nofetch}" ]] ; then
- local c
- echo
- eerror "Couldn't fetch the following components:"
- for c in ${nofetch} ; do
- eerror " * ${c}"
- done
- echo
- die "builtin_fetchbin failed"
- fi
-}
-
-ebuild_f_fetchbin()
-{
- local old_sandbox_write="${SANDBOX_WRITE}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${DISTDIR}"
- if hasq "fetchbin" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_fetchbin (RESTRICT)"
- elif hasq "fetchbin" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_fetchbin (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_fetchbin"
- builtin_fetchbin
- ebuild_section "Done builtin_fetchbin"
- fi
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${old_sandbox_write}"
- true
-}
-
-
-
diff --git a/paludis/repositories/e/ebuild/builtin_merge.bash b/paludis/repositories/e/ebuild/builtin_merge.bash
deleted file mode 100644
index d922e92..0000000
--- a/paludis/repositories/e/ebuild/builtin_merge.bash
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
-#
-# This file is part of the Paludis package manager. Paludis is free software;
-# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License, version 2, as published by the Free Software Foundation.
-#
-# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-
-# !!! This is used for compatibility with older Paludis versions only. When
-# !!! upgrading from versions below 0.20.0, this code will be used until the
-# !!! 'restart paludis' exec kicks in.
-
-builtin_merge()
-{
- ebuild_section "Merging to '${ROOT:-/}'..."
-
- shopt -q dotglob
- local olddotglob=$?
- shopt -s dotglob
-
- local v=$(vdb_path)
- if [[ -z "${v}" ]] ; then
- v=${ROOT}/var/db/pkg
- fi
- local dbdir="${v}/${CATEGORY}/${PF}"
- ebuild_section "Writing VDB entry to '${dbdir}'..."
- install -d "${dbdir}" || die "couldn't make pkg db directory (\"${dbdir}\")"
- install -d "${v}/".cache || die "couldn't make pkg db cache"
-
- local v VDB_FORMAT="paludis-2" COUNTER="$(date +%s )"
- for v in CATEGORY CBUILD CHOST COUNTER DEPEND DESCRIPTION EAPI \
- FEATURES HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
- PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER ; do
- echo "${!v}" > "${dbdir}"/${v} || die "pkg db write ${v} failed"
- ebuild_notice "debug" "Writing VDB key ${v}=${!v}"
- done
- for v in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
- EXTRA_ECONF EXTRA_EINSTALL EXTRA_EMAKE LDFLAGS LIBCXXFLAGS \
- REPOSITORY ; do
- [[ -z "${!v}" ]] && continue
- echo "${!v}" > "${dbdir}"/${v} || die "pkg db write ${v} failed"
- ebuild_notice "debug" "Writing VDB key ${v}=${!v}"
- done
-
- if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} ]]; then
- CONFIG_PROTECT=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT}
- fi
- if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} ]]; then
- CONFIG_PROTECT_MASK=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK}
- fi
-
- export CONFIG_PROTECT="${CONFIG_PROTECT}"
- export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK}"
-
- [[ -f "${EBUILD}" ]] && cp "${EBUILD}" ${dbdir}/
-
- local reinstall=
- if [[ -f "${dbdir}/CONTENTS" ]] ; then
- mv "${dbdir}/CONTENTS" "${dbdir}/OLDCONTENTS" || die "save contents failed"
- reinstall="yes"
- fi
-
- ebuild_notice "debug" "Writing VDB environment.bz2"
- for v in ${USE_EXPAND} ; do
- ebuild_notice "debug" "USE_EXPAND ${v}=${!v}"
- done
- ( set ; export -p | sed 's:^declare -rx:declare -x:' ) | bzip2 > ${dbdir}/environment.bz2
- > ${dbdir}/CONTENTS
-
- local merge=${PALUDIS_EBUILD_DIR}/merge
- [[ -x "${merge}" ]] || merge="${PALUDIS_EBUILD_DIR_FALLBACK}"/merge
- [[ -x "${merge}" ]] || die "Couldn't find merge"
-
- local unmerge=${PALUDIS_EBUILD_DIR}/unmerge
- [[ -x "${unmerge}" ]] || unmerge="${PALUDIS_EBUILD_DIR_FALLBACK}"/unmerge
- [[ -x "${unmerge}" ]] || die "Couldn't find unmerge"
-
- if [[ -n "${D}" ]] && [[ -d "${D}" ]] ; then
- install -d "${ROOT%/}/" || die "couldn't make \${ROOT} (\"${ROOT}\")"
- if [[ -d "${D}" ]] ; then
- ${merge} "${D%/}/" "${ROOT%/}/" "${dbdir}/CONTENTS" || die "merge failed"
- fi
- fi
-
- echo hash -r
- hash -r
-
- if ! /bin/sh -c 'echo Good, our shell is still usable' ; then
- echo "Looks like our shell broke. Trying an ldconfig to fix it..."
- ldconfig -r ${ROOT}
- fi
-
- if [[ -n "${reinstall}" ]] ; then
- ${unmerge} "${ROOT%/}/" "${dbdir}/OLDCONTENTS" || die "unmerge failed"
-
- echo hash -r
- hash -r
-
- if ! /bin/sh -c 'echo Good, our shell is still usable' ; then
- echo "Looks like our shell broke. Trying an ldconfig to fix it..."
- ldconfig -r ${ROOT}
- fi
-
- rm -f "${dbdir}/OLDCONTENTS"
- fi
-
- [[ $olddotglob != 0 ]] && shopt -u dotglob
- shopt -q dotglob
- [[ $olddotglob == $? ]] || ebuild_notice "warning" "shopt dotglob restore failed"
-}
-
-ebuild_f_merge()
-{
- local old_sandbox_write="${SANDBOX_WRITE}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/"
- local old_sandbox_on="${SANDBOX_ON}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && [[ "$(canonicalise ${ROOT} )" != "/" ]] || SANDBOX_ON=0
-
- if hasq "merge" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_merge (RESTRICT)"
- elif hasq "merge" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_merge (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_merge"
- builtin_merge
- ebuild_section "Done builtin_merge"
- fi
-
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${old_sandbox_write}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_ON="${old_sandbox_on}"
- true
-}
-
diff --git a/paludis/repositories/e/ebuild/builtin_unmerge.bash b/paludis/repositories/e/ebuild/builtin_unmerge.bash
deleted file mode 100644
index e358d8a..0000000
--- a/paludis/repositories/e/ebuild/builtin_unmerge.bash
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# 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
-
-builtin_unmerge()
-{
- local v=$(${PALUDIS_COMMAND} --configuration-variable installed location 2>/dev/null )
- if [[ -z "${v}" ]] ; then
- v=${ROOT}/var/db/pkg
- fi
-
- local dbdir="${v}/${CATEGORY}/${PF}" entry
- [[ -d "${dbdir}" ]] || die "couldn't find pkg db directory (\"${dbdir}\")"
-
- for v in CATEGORY CBUILD CHOST DEPEND DESCRIPTION EAPI \
- FEATURES HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
- PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
- EXTRA_ECONF EXTRA_EINSTALL EXTRA_EMAKE LDFLAGS LIBCXXFLAGS \
- REPOSITORY ; do
- if [[ -f "${dbdir}/${v}" ]] ; then
- eval "${v}=\$(< ${dbdir}/${v} ) || die \"Load key ${v} failed\""
- else
- eval "${v}="
- fi
- done
-
- if [[ -f ${dbdir}/CONFIG_PROTECT ]]; then
- CONFIG_PROTECT="$(< ${dbdir}/CONFIG_PROTECT) ${CONFIG_PROTECT}"
- if [[ -f ${dbdir}/CONFIG_PROTECT_MASK ]]; then
- CONFIG_PROTECT_MASK="$(< ${dbdir}/CONFIG_PROTECT_MASK)"
- fi
- else
- local old_CONFIG_PROTECT="${CONFIG_PROTECT:+${CONFIG_PROTECT} }/etc"
- eval $(bzcat "${dbdir}/environment.bz2" | while read line; do
- line=${line//\'}
- if [[ ${line%%=*} == CONFIG_PROTECT ]]; then
- echo "CONFIG_PROTECT='${line#*=} ${CONFIG_PROTECT}'"
- elif [[ ${line%%=*} == CONFIG_PROTECT_MASK ]]; then
- echo "CONFIG_PROTECT_MASK='${line#*=}'"
- fi
- done)
-
- # catalyst creates things with an empty CONFIG_PROTECT...
- if [[ -z "${CONFIG_PROTECT// }" ]] ; then
- ewarn "CONFIG_PROTECT from environment.bz2 is empty"
- ewarn "Using a fallback of '${old_CONFIG_PROTECT}'"
- CONFIG_PROTECT="${old_CONFIG_PROTECT}"
- fi
- fi
-
- if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT} ]]; then
- CONFIG_PROTECT=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT}
- fi
- if [[ -n ${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK} ]]; then
- CONFIG_PROTECT_MASK=${PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK}
- fi
-
- export CONFIG_PROTECT="${CONFIG_PROTECT}"
- export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK}"
-
- local unmerge=${PALUDIS_EBUILD_DIR}/unmerge
- [[ -x "${unmerge}" ]] || unmerge="${PALUDIS_EBUILD_DIR_FALLBACK}"/unmerge
- [[ -x "${unmerge}" ]] || die "Couldn't find unmerge"
-
- ${unmerge} "${ROOT}/" "${dbdir}/CONTENTS" || die "unmerge failed"
-
- echo hash -r
- hash -r
-
- if ! /bin/sh -c 'echo Good, our shell is still usable' ; then
- echo "Looks like our shell broke. Trying an ldconfig to fix it..."
- ldconfig -r ${ROOT}
- fi
-
- rm -fr "${dbdir}"
-}
-
-ebuild_f_unmerge()
-{
- local old_sandbox_write="${SANDBOX_WRITE}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${ROOT%/}/"
- local old_sandbox_on="${SANDBOX_ON}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && [[ "$(canonicalise ${ROOT} )" != "/" ]] || SANDBOX_ON=0
-
- if hasq "unmerge" ${RESTRICT} ; then
- ebuild_section "Skipping builtin_unmerge (RESTRICT)"
- elif hasq "unmerge" ${SKIP_FUNCTIONS} ; then
- ebuild_section "Skipping builtin_unmerge (SKIP_FUNCTIONS)"
- else
- ebuild_section "Starting builtin_unmerge"
- builtin_unmerge
- ebuild_section "Done builtin_unmerge"
- fi
-
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${old_sandbox_write}"
- [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_ON="${old_sandbox_on}"
- true
-}
-
-
diff --git a/paludis/repositories/e/ebuild/digests/Makefile.am b/paludis/repositories/e/ebuild/digests/Makefile.am
deleted file mode 100644
index d4ad645..0000000
--- a/paludis/repositories/e/ebuild/digests/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-CLEANFILES = *~
-SUBDIRS = .
-
-libexecprogdir = $(libexecdir)/paludis/digests/
-
-libexecprog_PROGRAMS = \
- dosha256 \
- dormd160 \
- domd5
-
-dosha256_SOURCES = dosha256.cc
-dosha256_LDADD = $(top_builddir)/paludis/digests/libpaludisdigests.la
-
-dormd160_SOURCES = dormd160.cc
-dormd160_LDADD = $(top_builddir)/paludis/digests/libpaludisdigests.la
-
-domd5_SOURCES = domd5.cc
-domd5_LDADD = $(top_builddir)/paludis/digests/libpaludisdigests.la
-
-TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \
- TEST_SCRIPT_DIR="$(srcdir)/" \
- bash $(top_srcdir)/test/run_test.sh
-
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
-
-built-sources : $(BUILT_SOURCES)
- for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
-
-
diff --git a/paludis/repositories/e/ebuild/digests/domd5.cc b/paludis/repositories/e/ebuild/digests/domd5.cc
deleted file mode 100644
index d139f47..0000000
--- a/paludis/repositories/e/ebuild/digests/domd5.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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 <paludis/digests/md5.hh>
-#include <iostream>
-#include <cstdlib>
-#include <fstream>
-
-int
-main(int argc, char * argv[])
-{
- if (argc >= 3)
- {
- std::cerr << "usage: " << argv[0] << " [filename]" << std::endl;
- return EXIT_FAILURE;
- }
-
- if (argc == 2)
- {
- std::ifstream f(argv[1]);
- if (! f)
- {
- std::cerr << argv[0] << ": could not open '" << argv[1] << "'" << std::endl;
- return EXIT_FAILURE;
- }
- paludis::MD5 sum(f);
- std::cout << sum.hexsum() << std::endl;
- }
- else
- {
- paludis::MD5 sum(std::cin);
- std::cout << sum.hexsum() << std::endl;
- }
-
-}
-
-
-
diff --git a/paludis/repositories/e/ebuild/digests/dormd160.cc b/paludis/repositories/e/ebuild/digests/dormd160.cc
deleted file mode 100644
index 47fcd7f..0000000
--- a/paludis/repositories/e/ebuild/digests/dormd160.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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 <paludis/digests/rmd160.hh>
-#include <iostream>
-#include <fstream>
-#include <cstdlib>
-
-int
-main(int argc, char * argv[])
-{
- if (argc >= 3)
- {
- std::cerr << "usage: " << argv[0] << " [filename]" << std::endl;
- return EXIT_FAILURE;
- }
-
- if (argc == 2)
- {
- std::ifstream f(argv[1]);
- if (! f)
- {
- std::cerr << argv[0] << ": could not open '" << argv[1] << "'" << std::endl;
- return EXIT_FAILURE;
- }
- paludis::RMD160 sum(f);
- std::cout << sum.hexsum() << std::endl;
- }
- else
- {
- paludis::RMD160 sum(std::cin);
- std::cout << sum.hexsum() << std::endl;
- }
-
-}
-
-
diff --git a/paludis/repositories/e/ebuild/digests/dosha256.cc b/paludis/repositories/e/ebuild/digests/dosha256.cc
deleted file mode 100644
index 056ce5a..0000000
--- a/paludis/repositories/e/ebuild/digests/dosha256.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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 <paludis/digests/sha256.hh>
-#include <iostream>
-#include <cstdlib>
-#include <fstream>
-
-int
-main(int argc, char * argv[])
-{
- if (argc >= 3)
- {
- std::cerr << "usage: " << argv[0] << " [filename]" << std::endl;
- return EXIT_FAILURE;
- }
-
- if (argc == 2)
- {
- std::ifstream f(argv[1]);
- if (! f)
- {
- std::cerr << argv[0] << ": could not open '" << argv[1] << "'" << std::endl;
- return EXIT_FAILURE;
- }
- paludis::SHA256 sum(f);
- std::cout << sum.hexsum() << std::endl;
- }
- else
- {
- paludis::SHA256 sum(std::cin);
- std::cout << sum.hexsum() << std::endl;
- }
-
-}
-
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 8bbd370..5d9e1a8 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -360,8 +360,8 @@ ebuild_main()
for action in $@ ; do
case ${action} in
- metadata|variable|init|prepare|fetch|merge|unmerge|tidyup|\
- strip|loadenv|saveenv|fetchbin|initbin|unpackbin)
+ metadata|variable|init|prepare|merge|unmerge|tidyup|\
+ strip|loadenv|saveenv|initbin|unpackbin)
ebuild_load_module builtin_${action}
;;
diff --git a/paludis/repositories/e/ebuild/merge.cc b/paludis/repositories/e/ebuild/merge.cc
deleted file mode 100644
index 77e78bf..0000000
--- a/paludis/repositories/e/ebuild/merge.cc
+++ /dev/null
@@ -1,451 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "merge_common.hh"
-
-#include <paludis/digests/md5.hh>
-#include <paludis/util/dir_iterator.hh>
-#include <paludis/util/fd_output_stream.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/pstream.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/strip.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/fd_holder.hh>
-#include <paludis/selinux/security_context.hh>
-
-#include <algorithm>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <iterator>
-#include <string>
-#include <vector>
-
-#include <cstdlib>
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "config.h"
-
-using namespace paludis;
-using namespace merge;
-
-using std::cout;
-using std::cerr;
-using std::endl;
-using std::ifstream;
-using std::ofstream;
-using std::istreambuf_iterator;
-using std::ostreambuf_iterator;
-
-namespace
-{
- int exit_status;
-
- FSEntry
- make_config_protect_name(const FSEntry & name, const FSEntry & file_to_install)
- {
- int n(0);
- std::string file_to_install_name(stringify(file_to_install));
-
- ifstream our_md5_file(file_to_install_name.c_str());
- if (! our_md5_file)
- throw Failure("Could not get md5 for '" + file_to_install_name + "'");
- MD5 our_md5(our_md5_file);
-
- FSEntry result(name);
- std::string result_name(stringify(name));
- while (true)
- {
- if (! result.exists())
- return result;
- else if (result.is_regular_file())
- {
- ifstream other_md5_file(result_name.c_str());
- if (! other_md5_file)
- throw Failure("Could not get md5 for '" + result_name + "'");
- MD5 other_md5(other_md5_file);
-
- if (our_md5.hexsum() == other_md5.hexsum())
- return result;
- }
-
- std::stringstream s;
- s << std::setw(4) << std::setfill('0') << std::right << n++;
- result = FSEntry(stringify(name.dirname() / ("._cfg" + s.str() + "_"
- + name.basename())));
- result_name = stringify(result);
- }
- }
-
- void
- do_dir(const FSEntry & root, const FSEntry & src_dir,
- const FSEntry & dst_dir, ofstream * const contents)
- {
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst_dir.dirname()));
-
- Context context("Installing directory in root '" + root_str + "' from '"
- + stringify(src_dir) + "' to '" + stringify(dst_dir) + "':");
-
- if (root_str == "/")
- root_str.clear();
- if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
- throw Failure("do_dir confused: '" + root_str + "' '" + dst_dir_str + "'");
- if (dst_dir_str == "/")
- dst_dir_str.clear();
-
- cout << ">>> " << std::setw(5) << std::left << "[dir]" << " " <<
- dst_dir_str.substr(root_str.length()) << "/" << dst_dir.basename();
-
- if (dst_dir.is_directory())
- {
- cout << " <dir>" << endl;
- }
- else if (dst_dir.is_symbolic_link() && dst_dir.realpath().is_directory())
- {
- Log::get_instance()->message(ll_qa, lc_no_context, "Expected '" + stringify(dst_dir) +
- "' to be a directory or non-existent, but found a symlink to a directory");
- cout << " <sym -> dir>" << endl;
- }
- else if (dst_dir.exists())
- {
- cout << " <obj>" << endl;
- throw Failure("Expected '" + stringify(dst_dir) +
- "' to be a directory or non-existent, but found a file");
- }
- else
- {
- cout << " <new>" << endl;
-
- mode_t mode(src_dir.permissions());
-
-//#ifdef HAVE_SELINUX
- tr1::shared_ptr<FSCreateCon> createcon;
- if (MatchPathCon::get_instance()->good())
- {
- FSCreateCon *p = new FSCreateCon(MatchPathCon::get_instance()->match(dst_dir_str.substr(root_str.length()),
- mode));
- createcon.reset(p);
- }
-//#endif
-
- FSEntry dst_dir_copy(dst_dir);
- dst_dir_copy.mkdir(mode);
- dst_dir_copy.chown(src_dir.owner(), src_dir.group());
- /* the chmod is needed to pick up fancy set*id bits */
- dst_dir_copy.chmod(src_dir.permissions());
- }
-
- *contents << "dir " << dst_dir_str.substr(root_str.length()) << "/" <<
- dst_dir.basename() << endl;
- }
-
- void
- copy_file_contents(int input_fd, int fd)
- {
- char buf[4096];
- ssize_t count;
- while ((count = read(input_fd, buf, 4096)) > 0)
- write(fd, buf, count);
- }
-
- void
- do_obj(const FSEntry & root, const FSEntry & src,
- const FSEntry & dst, ofstream * const contents)
- {
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname())),
- src_str(stringify(src));
-
- Context context("Installing object in root '" + root_str + "' from '"
- + stringify(src) + "' to '" + stringify(dst) + "':");
-
- if (root_str == "/")
- root_str.clear();
- if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
- throw Failure("do_obj confused: '" + root_str + "' '" + dst_dir_str + "'");
- if (dst_dir_str == "/")
- dst_dir_str.clear();
-
- cout << ">>> " << std::setw(5) << std::left << "[obj]" << " " <<
- dst_dir_str.substr(root_str.length()) << "/" << dst.basename();
-
- if (dst.is_directory())
- {
- cout << " <dir>" << endl;
- throw Failure("Cannot overwrite directory '" + stringify(dst) + "' with a file");
- }
- else
- {
- FSEntry real_dst(dst);
-
- FDHolder input_fd(::open(src_str.c_str(), O_RDONLY), false);
- if (-1 == input_fd)
- throw Failure("Cannot read '" + src_str + "'");
-
- if (dst.exists())
- {
- if (is_config_protected(root, dst))
- {
- real_dst = make_config_protect_name(dst, src);
- if (dst != real_dst)
- cout << " -> " << real_dst << endl;
- else
- cout << endl;
- }
- else
- {
- if (dst.is_regular_file())
- {
- cout << " <obj>" << endl;
-
- mode_t mode(dst.permissions());
- if ((mode & S_ISUID) || (mode & S_ISGID))
- {
- mode &= 0400;
- FSEntry(dst).chmod(mode);
- }
- FSEntry(dst).unlink();
- }
- else if (dst.is_symbolic_link())
- {
- cout << " <sym>" << endl;
- FSEntry(dst).unlink();
- }
- else
- {
- cout << " <?""?""?>" << endl;
- FSEntry(dst).unlink();
- }
- }
- }
- else
- cout << " <new>" << endl;
-
- /* FDHolder must be destroyed before we do the md5 thing, or the
- * disk write may not have synced. */
- {
-//#ifdef HAVE_SELINUX
- tr1::shared_ptr<FSCreateCon> createcon;
- if (MatchPathCon::get_instance()->good())
- createcon.reset(new
- FSCreateCon(MatchPathCon::get_instance()->match(dst_dir_str.substr(root_str.length()) + "/"
- + dst.basename(), src.permissions())));
-//#endif
- FDHolder fd(::open(stringify(real_dst).c_str(), O_WRONLY | O_CREAT, src.permissions()));
- if (-1 == fd)
- throw Failure("Cannot open '" + stringify(real_dst) + "' for write");
-
- if (0 != ::fchown(fd, src.owner(), src.group()))
- throw Failure("Cannot fchown '" + stringify(real_dst) + "': " +
- stringify(::strerror(errno)));
-
- /* the chmod is needed for set*id bits, which are dropped by
- * umask in the ::open */
- if (0 != ::fchmod(fd, src.permissions()))
- throw Failure("Cannot fchmod '" + stringify(real_dst) + "': " +
- stringify(::strerror(errno)));
-
- copy_file_contents(input_fd, fd);
- }
-
- ifstream dst_file(stringify(dst).c_str());
- if (! dst_file)
- throw Failure("Could not get md5 for '" + stringify(dst_file) + "'");
- MD5 md5(dst_file);
-
- *contents << "obj " << dst_dir_str.substr(root_str.length()) << "/" <<
- dst.basename() << " " << md5.hexsum() << " " <<
- FSEntry(stringify(dst)).mtime() << endl;
- }
- }
-
- void
- do_sym(const FSEntry & root, const FSEntry & src,
- const FSEntry & dst, ofstream * const contents)
- {
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname()));
-
- Context context("Installing symlink in root '" + root_str + "' from '"
- + stringify(src) + "' to '" + stringify(dst) + "':");
-
- if (root_str == "/")
- root_str.clear();
- if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
- throw Failure("do_sym confused: '" + root_str + "' '" + dst_dir_str + "'");
- if (dst_dir_str == "/")
- dst_dir_str.clear();
-
- cout << ">>> " << std::setw(5) << std::left << "[sym]" << " " <<
- dst_dir_str.substr(root_str.length()) << "/" << dst.basename();
-
- if (dst.exists())
- {
- if (dst.is_directory())
- throw Failure("Can't overwrite directory '" + stringify(dst) +
- "' with symlink to '" + src.readlink() + "'");
- else if (dst.is_symbolic_link())
- {
- cout << " <sym>" << endl;
- FSEntry(dst).unlink();
- }
- else
- {
- cout << " <obj>" << endl;
- mode_t mode(dst.permissions());
- if ((mode & S_ISUID) || (mode & S_ISGID))
- {
- mode &= 0400;
- FSEntry(dst).chmod(mode);
- }
- FSEntry(dst).unlink();
- }
- }
- else
- cout << " <new>" << endl;
-
-//#ifdef HAVE_SELINUX
- // permissions() on a symlink does weird things, but matchpathcon only cares about the file type,
- // so just pass S_IFLNK.
- tr1::shared_ptr<FSCreateCon> createcon;
- if (MatchPathCon::get_instance()->good())
- createcon.reset(new
- FSCreateCon(MatchPathCon::get_instance()->match(dst_dir_str.substr(root_str.length()) + "/"
- + dst.basename(), S_IFLNK)));
-//#endif
-
- if (0 != ::symlink(src.readlink().c_str(), stringify(dst).c_str()))
- {
- Log::get_instance()->message(ll_warning, lc_no_context, "Couldn't create symlink '"
- + src.readlink() + "' at '" + stringify(dst) + "'");
- exit_status |= 2;
- }
-
- *contents << "sym " << dst_dir_str.substr(root_str.length()) << "/" <<
- dst.basename() << " -> " << dst.readlink() << " " <<
- FSEntry(stringify(dst)).mtime() << endl;
- }
-
- void
- merge_this(const FSEntry & root, const FSEntry & src_dir, const FSEntry & dst_dir,
- ofstream * const contents)
- {
- Context context("Merging under root '" + stringify(root) + "' from '"
- + stringify(src_dir) + "' to '" + stringify(dst_dir) + "':");
-
- if (! root.is_directory())
- throw Failure("merge_this called with bad root '" + stringify(root) + "'");
- if (! src_dir.is_directory())
- throw Failure("merge_this called with bad src_dir '" + stringify(src_dir) + "'");
- if (! dst_dir.is_directory())
- throw Failure("merge_this called with bad dst_dir '" + stringify(dst_dir) + "'");
-
- for (DirIterator d(src_dir, false), d_end ; d != d_end ; ++d)
- {
- if (d->is_regular_file())
- do_obj(root, src_dir / d->basename(), dst_dir / d->basename(), contents);
- else if (d->is_symbolic_link())
- do_sym(root, src_dir / d->basename(), dst_dir / d->basename(), contents);
- else if (d->is_directory())
- {
- do_dir(root, src_dir / d->basename(), dst_dir / d->basename(), contents);
- merge_this(root, (src_dir / d->basename()).realpath(), (dst_dir / d->basename()).realpath(), contents);
- }
- else
- throw Failure("Don't know how to merge '" + stringify(*d) + "'");
- }
- }
-}
-
-int
-main(int argc, char * argv[])
-{
- Context context("In main program:");
-
-//#ifdef HAVE_SELINUX
- // If the MatchPathCon initialisation fails, don't attempt to match contexts when merging.
- if (! MatchPathCon::get_instance()->good())
- Log::get_instance()->message(ll_warning, lc_no_context,
- "matchpathcon_init failed; not setting security contexts");
-//#endif
-
- exit_status = 0;
- try
- {
- if (argc != 4)
- throw Failure("Usage: " + stringify(argv[0]) + " src dst contents");
-
- Log::get_instance()->set_program_name(argv[0]);
- std::string log_level(getenv_with_default("PALUDIS_EBUILD_LOG_LEVEL", "qa"));
-
- if (log_level == "debug")
- Log::get_instance()->set_log_level(ll_debug);
- else if (log_level == "qa")
- Log::get_instance()->set_log_level(ll_qa);
- else if (log_level == "warning")
- Log::get_instance()->set_log_level(ll_warning);
- else if (log_level == "silent")
- Log::get_instance()->set_log_level(ll_silent);
- else
- throw Failure("bad value for log level");
-
- Log::get_instance()->message(ll_debug, lc_no_context,
- "CONFIG_PROTECT is " + getenv_with_default("CONFIG_PROTECT", "(unset)"));
- Log::get_instance()->message(ll_debug, lc_no_context,
- "CONFIG_PROTECT_MASK is " + getenv_with_default("CONFIG_PROTECT_MASK", "(unset)"));
-
- FSEntry src(argv[1]), dst(argv[2]), contents(argv[3]);
-
- if (! ((src = src.realpath())).is_directory())
- throw Failure(stringify(argv[1]) + ": not a directory");
- if (! ((dst = dst.realpath())).is_directory())
- throw Failure(stringify(argv[2]) + ": not a directory");
-
- ofstream contents_file(stringify(contents).c_str());
- if (! contents_file)
- throw Failure(stringify(contents) + ": not writeable");
-
- ::umask(0000);
- merge_this(dst, src, dst, &contents_file);
- return exit_status;
- }
- catch (const Failure & f)
- {
- cerr << argv[0] << ": fatal error: " << f.message << endl;
- return EXIT_FAILURE;
- }
- catch (const Exception & e)
- {
- cerr << argv[0] << ": fatal error:" << endl
- << " * " << e.backtrace("\n * ") << e.message()
- << " (" << e.what() << ")" << endl;
- return EXIT_FAILURE;
- }
- catch (const std::exception & e)
- {
- cerr << argv[0] << ": fatal error: " << e.what() << endl;
- return EXIT_FAILURE;
- }
-}
-
diff --git a/paludis/repositories/e/ebuild/merge_TEST.bash b/paludis/repositories/e/ebuild/merge_TEST.bash
deleted file mode 100644
index 2315625..0000000
--- a/paludis/repositories/e/ebuild/merge_TEST.bash
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
-#
-# This file is part of the Paludis package manager. Paludis is free software;
-# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License version 2, as published by the Free Software Foundation.
-#
-# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-
-merge_empty_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/empty_src" \
- "merge_TEST_dir/empty_dst" \
- "merge_TEST_dir/empty_contents" 1>/dev/null
- test_return_code
-}
-
-merge_files_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/files_src" \
- "merge_TEST_dir/files_dst" \
- "merge_TEST_dir/files_contents" 1>/dev/null
- test_return_code
-
- [[ -f "merge_TEST_dir/files_dst/one" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/files_dst/one)" "contents of one"
-
- [[ -f "merge_TEST_dir/files_dst/two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/files_dst/two)" "contents of two"
-}
-
-merge_dirs_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/dirs_src" \
- "merge_TEST_dir/dirs_dst" \
- "merge_TEST_dir/dirs_contents" 1>/dev/null
- test_return_code
-
- [[ -d "merge_TEST_dir/dirs_dst/dir_one" ]] ; test_return_code
- [[ -d "merge_TEST_dir/dirs_dst/dir_two" ]] ; test_return_code
- [[ -d "merge_TEST_dir/dirs_dst/dir_two/dir_three" ]] ; test_return_code
-
- [[ -f "merge_TEST_dir/dirs_dst/dir_one/one" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_dst/dir_one/one)" "contents of one"
-
- [[ -f "merge_TEST_dir/dirs_dst/dir_two/two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_dst/dir_two/two)" "contents of two"
-
- [[ -f "merge_TEST_dir/dirs_dst/dir_two/dir_three/three" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_dst/dir_two/dir_three/three)" "contents of three"
-}
-
-merge_dirs_over_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/dirs_over_src" \
- "merge_TEST_dir/dirs_over_dst" \
- "merge_TEST_dir/dirs_over_contents" 1>/dev/null
- test_return_code
-
- [[ -d "merge_TEST_dir/dirs_over_dst/dir_one/" ]] ; test_return_code
- [[ -d "merge_TEST_dir/dirs_over_dst/dir_two/" ]] ; test_return_code
- [[ -d "merge_TEST_dir/dirs_over_dst/dir_two/dir_three/" ]] ; test_return_code
-
- [[ -f "merge_TEST_dir/dirs_over_dst/dir_one/one" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_one/one)" "contents of one"
-
- [[ -f "merge_TEST_dir/dirs_over_dst/dir_two/two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_two/two)" "contents of two"
-
- [[ -f "merge_TEST_dir/dirs_over_dst/dir_two/dir_three/three" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/dirs_over_dst/dir_two/dir_three/three)" "contents of three"
-}
-
-merge_links_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/links_src" \
- "merge_TEST_dir/links_dst" \
- "merge_TEST_dir/links_contents" 1>/dev/null
- test_return_code
-
- [[ -f "merge_TEST_dir/links_dst/one" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_dst/one)" "contents of one"
-
- [[ -f "merge_TEST_dir/links_dst/two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_dst/two)" "contents of two"
-
- [[ -f "merge_TEST_dir/links_dst/link_to_two" ]] ; test_return_code
- [[ -L "merge_TEST_dir/links_dst/link_to_two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_dst/link_to_two)" "contents of two"
-}
-
-merge_links_over_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/links_over_src" \
- "merge_TEST_dir/links_over_dst" \
- "merge_TEST_dir/links_over_contents" 1>/dev/null
- test_return_code
-
- [[ -f "merge_TEST_dir/links_over_dst/one" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_over_dst/one)" "contents of one"
-
- [[ -f "merge_TEST_dir/links_over_dst/two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_over_dst/two)" "contents of two"
-
- [[ -f "merge_TEST_dir/links_over_dst/link_to_two" ]] ; test_return_code
- [[ -L "merge_TEST_dir/links_over_dst/link_to_two" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_over_dst/link_to_two)" "contents of two"
-
- [[ -f "merge_TEST_dir/links_over_dst/link_to_three" ]] ; test_return_code
- [[ -L "merge_TEST_dir/links_over_dst/link_to_three" ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/links_over_dst/link_to_three)" "contents of three"
-}
-
-merge_links_over_dir_TEST()
-{
- ! ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/links_over_dir_src" \
- "merge_TEST_dir/links_over_dir_dst" \
- "merge_TEST_dir/links_over_dir_contents" &>/dev/null
- test_return_code
-}
-
-merge_config_protect_TEST()
-{
- export CONFIG_PROTECT=/dir
-
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/config_pro_src" \
- "merge_TEST_dir/config_pro_dst" \
- "merge_TEST_dir/config_pro_contents" 1>/dev/null
- test_return_code
-
- echo -n "[one]"
-
- [[ -f merge_TEST_dir/config_pro_dst/dir/one ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0000_one ]] ; test_return_code
- ! [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0001_one ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/one)" "i am a fish"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0000_one)" "contents of one"
-
- echo -n "[two]"
-
- [[ -f merge_TEST_dir/config_pro_dst/dir/two ]] ; test_return_code
- ! [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0000_two ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/two)" "contents of two"
-
- echo -n "[three]"
-
- [[ -f merge_TEST_dir/config_pro_dst/dir/three ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0000_three ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0001_three ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0002_three ]] ; test_return_code
- ! [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0003_three ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/three)" "i am a fish"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0000_three)" "i am a dish"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0001_three)" "i am a fist"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0002_three)" "contents of three"
-
- echo -n "[four]"
-
- [[ -f merge_TEST_dir/config_pro_dst/dir/four ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0000_four ]] ; test_return_code
- [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0001_four ]] ; test_return_code
- ! [[ -f merge_TEST_dir/config_pro_dst/dir/._cfg0002_four ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/four)" "i am a fish"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0000_four)" "contents of four"
- test_equality "$(< merge_TEST_dir/config_pro_dst/dir/._cfg0001_four)" "i am a fist"
-}
-
-merge_config_protect_noroot_TEST()
-{
- export CONFIG_PROTECT=$(${PALUDIS_EBUILD_DIR}/utils/canonicalise `pwd` )/merge_TEST_dir/noroot_dst/dir
-
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "merge_TEST_dir/config_pro_noroot_src" \
- "/" \
- "merge_TEST_dir/config_pro_slash_root_contents" 1>/dev/null
- test_return_code
-
- echo -n "[one]"
-
- [[ -f merge_TEST_dir/noroot_dst/dir/one ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0000_one ]] ; test_return_code
- ! [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0001_one ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/one)" "i am a fish"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0000_one)" "contents of one"
-
- echo -n "[two]"
-
- [[ -f merge_TEST_dir/noroot_dst/dir/two ]] ; test_return_code
- ! [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0000_two ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/two)" "contents of two"
-
- echo -n "[three]"
-
- [[ -f merge_TEST_dir/noroot_dst/dir/three ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0000_three ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0001_three ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0002_three ]] ; test_return_code
- ! [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0003_three ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/three)" "i am a fish"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0000_three)" "i am a dish"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0001_three)" "i am a fist"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0002_three)" "contents of three"
-
- echo -n "[four]"
-
- [[ -f merge_TEST_dir/noroot_dst/dir/four ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0000_four ]] ; test_return_code
- [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0001_four ]] ; test_return_code
- ! [[ -f merge_TEST_dir/noroot_dst/dir/._cfg0002_four ]] ; test_return_code
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/four)" "i am a fish"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0000_four)" "contents of four"
- test_equality "$(< merge_TEST_dir/noroot_dst/dir/._cfg0001_four)" "i am a fist"
-
-}
-
diff --git a/paludis/repositories/e/ebuild/merge_TEST_cleanup.sh b/paludis/repositories/e/ebuild/merge_TEST_cleanup.sh
deleted file mode 100755
index 4b40b8f..0000000
--- a/paludis/repositories/e/ebuild/merge_TEST_cleanup.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d merge_TEST_dir ] ; then
- rm -fr merge_TEST_dir
-else
- true
-fi
-
-
diff --git a/paludis/repositories/e/ebuild/merge_TEST_setup.sh b/paludis/repositories/e/ebuild/merge_TEST_setup.sh
deleted file mode 100755
index 4af857d..0000000
--- a/paludis/repositories/e/ebuild/merge_TEST_setup.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir -p merge_TEST_dir/{empty_src,empty_dst} || exit 2
-
-mkdir -p merge_TEST_dir/{files_src,files_dst} || exit 2
-echo "contents of one" > merge_TEST_dir/files_src/one
-echo "contents of two" > merge_TEST_dir/files_src/two
-
-mkdir -p merge_TEST_dir/{dirs_src/{dir_one,dir_two/dir_three},dirs_dst} || exit 3
-echo "contents of one" > merge_TEST_dir/dirs_src/dir_one/one
-echo "contents of two" > merge_TEST_dir/dirs_src/dir_two/two
-echo "contents of three" > merge_TEST_dir/dirs_src/dir_two/dir_three/three
-
-mkdir -p merge_TEST_dir/{dirs_over_src/{dir_one,dir_two/dir_three},dirs_over_dst} || exit 4
-mkdir -p merge_TEST_dir/dirs_over_dst/{one,real}
-ln -s real merge_TEST_dir/dirs_over_dst/two
-echo "contents of one" > merge_TEST_dir/dirs_over_src/dir_one/one
-echo "contents of two" > merge_TEST_dir/dirs_over_src/dir_two/two
-echo "contents of three" > merge_TEST_dir/dirs_over_src/dir_two/dir_three/three
-
-mkdir -p merge_TEST_dir/{links_src,links_dst} || exit 5
-echo "contents of one" > merge_TEST_dir/links_src/one
-echo "contents of two" > merge_TEST_dir/links_src/two
-ln -s two merge_TEST_dir/links_src/link_to_two
-
-mkdir -p merge_TEST_dir/{links_over_src,links_over_dst} || exit 5
-echo "contents of one" > merge_TEST_dir/links_over_src/one
-echo "contents of two" > merge_TEST_dir/links_over_src/two
-echo "contents of three" > merge_TEST_dir/links_over_src/three
-ln -s two merge_TEST_dir/links_over_src/link_to_two
-ln -s three merge_TEST_dir/links_over_src/link_to_three
-echo "existing file" > merge_TEST_dir/link_to_two
-ln -s ../ merge_TEST_dir/links_over_dst/link_to_three
-
-mkdir -p merge_TEST_dir/{links_over_dir_src,links_over_dir_dst} || exit 5
-echo "contents of one" > merge_TEST_dir/links_over_dir_src/one
-echo "contents of two" > merge_TEST_dir/links_over_dir_src/two
-echo "contents of three" > merge_TEST_dir/links_over_dir_src/three
-ln -s two merge_TEST_dir/links_over_dir_src/link_to_two
-ln -s three merge_TEST_dir/links_over_dir_src/link_to_three
-mkdir merge_TEST_dir/links_over_dir_dst/link_to_two
-echo "existing file" > merge_TEST_dir/links_over_dir_dst/link_to_three
-
-mkdir -p merge_TEST_dir/{config_pro_src/dir,config_pro_dst/dir} || exit 6
-echo "contents of one" > merge_TEST_dir/config_pro_src/dir/one
-echo "contents of two" > merge_TEST_dir/config_pro_src/dir/two
-echo "contents of three" > merge_TEST_dir/config_pro_src/dir/three
-echo "contents of four" > merge_TEST_dir/config_pro_src/dir/four
-echo "i am a fish" > merge_TEST_dir/config_pro_dst/dir/one
-echo "contents of two" > merge_TEST_dir/config_pro_dst/dir/two
-echo "i am a fish" > merge_TEST_dir/config_pro_dst/dir/three
-echo "i am a dish" > merge_TEST_dir/config_pro_dst/dir/._cfg0000_three
-echo "i am a fist" > merge_TEST_dir/config_pro_dst/dir/._cfg0001_three
-echo "i am a fish" > merge_TEST_dir/config_pro_dst/dir/four
-echo "contents of four" > merge_TEST_dir/config_pro_dst/dir/._cfg0000_four
-echo "i am a fist" > merge_TEST_dir/config_pro_dst/dir/._cfg0001_four
-
-d=merge_TEST_dir/config_pro_noroot_src/$(${PALUDIS_EBUILD_DIR}/utils/canonicalise `pwd` )/merge_TEST_dir/noroot_dst/dir
-mkdir -p "${d}" || exit 7
-mkdir -p merge_TEST_dir/noroot_dst/dir || exit 7
-echo "contents of one" > ${d}/one
-echo "contents of two" > ${d}/two
-echo "contents of three" > ${d}/three
-echo "contents of four" > ${d}/four
-echo "i am a fish" > merge_TEST_dir/noroot_dst/dir/one
-echo "contents of two" > merge_TEST_dir/noroot_dst/dir/two
-echo "i am a fish" > merge_TEST_dir/noroot_dst/dir/three
-echo "i am a dish" > merge_TEST_dir/noroot_dst/dir/._cfg0000_three
-echo "i am a fist" > merge_TEST_dir/noroot_dst/dir/._cfg0001_three
-echo "i am a fish" > merge_TEST_dir/noroot_dst/dir/four
-echo "contents of four" > merge_TEST_dir/noroot_dst/dir/._cfg0000_four
-echo "i am a fist" > merge_TEST_dir/noroot_dst/dir/._cfg0001_four
-
diff --git a/paludis/repositories/e/ebuild/merge_common.cc b/paludis/repositories/e/ebuild/merge_common.cc
deleted file mode 100644
index 27b9e11..0000000
--- a/paludis/repositories/e/ebuild/merge_common.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-/* 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 "merge_common.hh"
-
-#include <paludis/util/dir_iterator.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/pstream.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/strip.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/tokeniser.hh>
-
-#include <algorithm>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <iterator>
-#include <string>
-#include <vector>
-
-#include <cstdlib>
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-using namespace paludis;
-
-std::vector<std::string>
-merge::get_config_var(const std::string & var)
-{
- std::vector<std::string> result, preresult;
- WhitespaceTokeniser::get_instance()->tokenise(getenv_with_default(var, ""),
- std::back_inserter(preresult));
- result.reserve(preresult.size());
-
- for (std::vector<std::string>::const_iterator i(preresult.begin()), i_end(preresult.end()) ;
- i != i_end ; ++i)
- {
- if (i->empty())
- continue;
- if ("-*" == *i)
- result.clear();
- else if ('-' == i->at(0))
- result.erase(std::remove(result.begin(), result.end(), i->substr(1)), result.end());
- else
- result.push_back(*i);
- }
- return result;
-}
-
-bool
-merge::is_config_protected(const FSEntry & root, const FSEntry & file)
-{
- static std::vector<std::string> cfg_pro(get_config_var("CONFIG_PROTECT")),
- cfg_pro_mask(get_config_var("CONFIG_PROTECT_MASK"));
-
- std::string file_str(stringify(file)), root_str(stringify(root));
- if (0 != file_str.compare(0, root_str.length(), root_str))
- throw Failure("is_config_protected confused: '" + root_str + "' '" + file_str + "'");
- file_str.erase(0, root_str.length());
- if (file_str.empty())
- file_str = "/";
- if ('/' != file_str.at(0))
- file_str = "/" + file_str;
-
- bool result(false);
- for (std::vector<std::string>::const_iterator c(cfg_pro.begin()),
- c_end(cfg_pro.end()) ; c != c_end && ! result ; ++c)
- if (0 == fnmatch((*c + "/*").c_str(), file_str.c_str(), 0))
- result = true;
-
- for (std::vector<std::string>::const_iterator c(cfg_pro_mask.begin()),
- c_end(cfg_pro_mask.end()) ; c != c_end && result ; ++c)
- if (0 == fnmatch((*c + "/*").c_str(), file_str.c_str(), 0))
- result = false;
-
- return result;
-}
-
diff --git a/paludis/repositories/e/ebuild/merge_common.hh b/paludis/repositories/e/ebuild/merge_common.hh
deleted file mode 100644
index 3ab1399..0000000
--- a/paludis/repositories/e/ebuild/merge_common.hh
+++ /dev/null
@@ -1,50 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_EBUILD_UTILS_MERGE_COMMON_HH
-#define PALUDIS_GUARD_EBUILD_UTILS_MERGE_COMMON_HH 1
-
-#include <string>
-#include <vector>
-
-namespace paludis
-{
- class FSEntry;
-}
-
-namespace merge
-{
- struct Failure
- {
- std::string message;
-
- Failure(const std::string & m) :
- message(m)
- {
- }
- };
-
- std::vector<std::string>
- get_config_var(const std::string & var);
-
- bool
- is_config_protected(const paludis::FSEntry & root, const paludis::FSEntry & file);
-}
-
-#endif
diff --git a/paludis/repositories/e/ebuild/pkg_nofetch.bash b/paludis/repositories/e/ebuild/pkg_nofetch.bash
index 09c1791..13aa371 100644
--- a/paludis/repositories/e/ebuild/pkg_nofetch.bash
+++ b/paludis/repositories/e/ebuild/pkg_nofetch.bash
@@ -1,7 +1,7 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
#
# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
# Gentoo Foundation and distributed under the terms of the GNU General
@@ -42,20 +42,9 @@ ebuild_f_nofetch()
if hasq "nofetch" ${SKIP_FUNCTIONS} ; then
ebuild_section "Skipping pkg_nofetch (SKIP_FUNCTIONS)"
else
- local a f=
- for a in ${A} ; do
- [[ -f "${DISTDIR}/${a}" ]] && continue
- f=yes
- done
-
- if [[ -z "${f}" ]] ; then
- ebuild_section "Skipping pkg_nofetch (fully fetched already)"
- else
- ebuild_section "Starting pkg_nofetch"
- pkg_nofetch
- ebuild_section "Done pkg_nofetch"
- die "Manual fetching is required"
- fi
+ ebuild_section "Starting pkg_nofetch"
+ pkg_nofetch
+ ebuild_section "Done pkg_nofetch"
fi
[[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_WRITE="${old_sandbox_write}"
true
diff --git a/paludis/repositories/e/ebuild/unmerge.cc b/paludis/repositories/e/ebuild/unmerge.cc
deleted file mode 100644
index 367b42c..0000000
--- a/paludis/repositories/e/ebuild/unmerge.cc
+++ /dev/null
@@ -1,320 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "merge_common.hh"
-
-#include <paludis/digests/md5.hh>
-
-#include <paludis/util/dir_iterator.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/pstream.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/strip.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/tokeniser.hh>
-
-#include <algorithm>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <iterator>
-#include <string>
-#include <vector>
-#include <list>
-
-#include <cstdlib>
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-using namespace paludis;
-using namespace merge;
-
-using std::cout;
-using std::cerr;
-using std::endl;
-using std::ifstream;
-
-namespace
-{
- int exit_status;
-
- template <typename Iter_>
- void unmerge_contents(const FSEntry & root, const Iter_ begin, const Iter_ end)
- {
- using std::istreambuf_iterator;
-
- for (Iter_ cur(begin) ; cur != end ; ++cur)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*cur, std::back_inserter(tokens));
- if (tokens.empty())
- continue;
-
- if ("obj" == tokens.at(0))
- {
- while (tokens.size() > 4)
- {
- if (std::string::npos != tokens.at(4).find('='))
- break;
-
- tokens.at(1).append(" " + tokens.at(2));
- for (unsigned i = 2 ; i < tokens.size() - 1 ; ++i)
- tokens.at(i) = tokens.at(i + 1);
- tokens.pop_back();
- }
-
- if (tokens.size() != 4)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Malformed VDB entry '" + *cur + "'");
- exit_status |= 4;
- }
- else if (! (root / tokens.at(1)).is_regular_file())
- cout << "--- [!type] " << tokens.at(1) << endl;
- else if (stringify((root / tokens.at(1)).mtime()) != tokens.at(3))
- cout << "--- [!time] " << tokens.at(1) << endl;
- else
- {
- ifstream md5_file(stringify(root / tokens.at(1)).c_str());
- if (! md5_file)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Couldn't get md5 for '" + stringify(root / tokens.at(1)) + "'");
- cout << "--- [!md5?] " << tokens.at(1) << endl;
- }
- else if (MD5(md5_file).hexsum() != tokens.at(2))
- cout << "--- [!md5 ] " << tokens.at(1) << endl;
- else if (is_config_protected(root, root / tokens.at(1)))
- cout << "--- [cfgpr] " << tokens.at(1) << endl;
- else
- {
- cout << "<<< " << tokens.at(1) << endl;
-
- mode_t mode((root / tokens.at(1)).permissions());
- if ((mode & S_ISUID) || (mode & S_ISGID))
- {
- mode &= 0400;
- (root / tokens.at(1)).chmod(mode);
- }
- (root / tokens.at(1)).unlink();
- }
- }
- }
- else if ("sym" == tokens.at(0))
- {
- while (tokens.size() > 5)
- {
- if (std::string::npos != tokens.at(2).find('='))
- break;
-
- if (tokens.at(2) == "->")
- break;
-
- tokens.at(1).append(" " + tokens.at(2));
- for (unsigned i = 2 ; i < tokens.size() - 1; ++i)
- tokens.at(i) = tokens.at(i + 1);
- tokens.pop_back();
- }
-
- while (tokens.size() > 5)
- {
- if (std::string::npos != tokens.at(2).find('='))
- break;
-
- if (tokens.at(4) == "->")
- break;
-
- tokens.at(3).append(" " + tokens.at(4));
- for (unsigned i = 4 ; i < tokens.size() - 1; ++i)
- tokens.at(i) = tokens.at(i + 1);
- tokens.pop_back();
- }
-
- if (tokens.size() != 5)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Malformed VDB entry '" + *cur + "'");
- exit_status |= 4;
- }
- else if (! (root / tokens.at(1)).is_symbolic_link())
- cout << "--- [!type] " << tokens.at(1) << endl;
- else if (stringify((root / tokens.at(1)).mtime()) != tokens.at(4))
- cout << "--- [!time] " << tokens.at(1) << endl;
- else if ((root / tokens.at(1)).readlink() != tokens.at(3))
- cout << "--- [!dest] " << tokens.at(1) << endl;
- else
- {
- cout << "<<< " << tokens.at(1) << endl;
- (root / tokens.at(1)).unlink();
- }
- }
- else if ("misc" == tokens.at(0))
- {
- }
- else if ("fif" == tokens.at(0) || "dev" == tokens.at(0))
- {
- while (tokens.size() > 2)
- {
- if (std::string::npos != tokens.at(2).find('='))
- break;
-
- tokens.at(1).append(" " + tokens.at(2));
- for (unsigned i = 2 ; i < tokens.size() - 1; ++i)
- tokens.at(i) = tokens.at(i + 1);
- tokens.pop_back();
- }
-
- if (tokens.size() != 2)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Malformed VDB entry '" + *cur + "'");
- exit_status |= 8;
- }
- else if ("fif" == tokens.at(0) && ! (root / tokens.at(1)).is_fifo())
- cout << "--- [!type] " << tokens.at(1) << endl;
- else if ("dev" == tokens.at(0) && ! (root / tokens.at(1)).is_device())
- cout << "--- [!type] " << tokens.at(1) << endl;
- else
- {
- cout << "<<< " << tokens.at(1) << endl;
- (root / tokens.at(1)).unlink();
- }
- }
- else if ("dir" == tokens.at(0))
- /* nothing */ ;
- else
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Skipping unknown VDB entry '" + *cur + "'");
- exit_status |= 2;
- }
- }
- }
-
- template <typename Iter_>
- void unmerge_directories(const FSEntry & root, const Iter_ begin, const Iter_ end)
- {
- using std::istreambuf_iterator;
-
- for (Iter_ cur(begin) ; cur != end ; ++cur)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*cur, std::back_inserter(tokens));
- if (tokens.empty())
- continue;
-
- if ("dir" == tokens.at(0))
- {
- while (tokens.size() > 2)
- {
- if (std::string::npos != tokens.at(2).find('='))
- break;
-
- tokens.at(1).append(" " + tokens.at(2));
- for (unsigned i = 2 ; i < tokens.size() - 1; ++i)
- tokens.at(i) = tokens.at(i + 1);
- tokens.pop_back();
- }
-
- if (tokens.size() != 2)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Malformed VDB entry '" + *cur + "'");
- exit_status |= 8;
- }
- else if (! (root / tokens.at(1)).is_directory())
- cout << "--- [!type] " << tokens.at(1) << endl;
- else if (DirIterator((root / tokens.at(1)), false) != DirIterator())
- cout << "--- [!empt] " << tokens.at(1) << endl;
- else
- {
- cout << "<<< " << tokens.at(1) << endl;
- (root / tokens.at(1)).rmdir();
- }
- }
- }
- }
-}
-
-int
-main(int argc, char * argv[])
-{
- Context context("In main program:");
- exit_status = 0;
- try
- {
- if (argc != 3)
- throw Failure("Usage: " + stringify(argv[0]) + " root contents");
-
- Log::get_instance()->set_program_name(argv[0]);
- std::string log_level(getenv_with_default("PALUDIS_EBUILD_LOG_LEVEL", "qa"));
-
- if (log_level == "debug")
- Log::get_instance()->set_log_level(ll_debug);
- else if (log_level == "qa")
- Log::get_instance()->set_log_level(ll_qa);
- else if (log_level == "warning")
- Log::get_instance()->set_log_level(ll_warning);
- else if (log_level == "silent")
- Log::get_instance()->set_log_level(ll_silent);
- else
- throw Failure("bad value for log level");
-
- FSEntry root(argv[1]), contents(argv[2]);
-
- if (! ((root = root.realpath())).is_directory())
- throw Failure(stringify(argv[1]) + ": not a directory");
-
- ifstream contents_file(stringify(contents).c_str());
- if (! contents_file)
- throw Failure(stringify(contents) + ": not readable");
-
- std::list<std::string> lines;
- std::string line;
- while (std::getline(contents_file, line))
- lines.push_back(line);
-
- unmerge_contents(root, lines.begin(), lines.end());
- unmerge_directories(root, lines.rbegin(), lines.rend());
- return exit_status;
- }
- catch (const Failure & f)
- {
- cerr << argv[0] << ": fatal error: " << f.message << endl;
- return EXIT_FAILURE;
- }
- catch (const Exception & e)
- {
- cerr << argv[0] << ": fatal error:" << endl
- << " * " << e.backtrace("\n * ") << e.message()
- << " (" << e.what() << ")" << endl;
- return EXIT_FAILURE;
- }
- catch (const std::exception & e)
- {
- cerr << argv[0] << ": fatal error: " << e.what() << endl;
- return EXIT_FAILURE;
- }
-}
-
-
diff --git a/paludis/repositories/e/ebuild/unmerge_TEST.bash b/paludis/repositories/e/ebuild/unmerge_TEST.bash
deleted file mode 100644
index fa00682..0000000
--- a/paludis/repositories/e/ebuild/unmerge_TEST.bash
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
-#
-# This file is part of the Paludis package manager. Paludis is free software;
-# you can redistribute it and/or modify it under the terms of the GNU General
-# Public License version 2, as published by the Free Software Foundation.
-#
-# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA 02111-1307 USA
-
-unmerge_empty_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "unmerge_TEST_dir/empty_src" \
- "unmerge_TEST_dir/empty_dst" \
- "unmerge_TEST_dir/empty_contents" 1>/dev/null
- test_return_code
-
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/unmerge "unmerge_TEST_dir/empty_dst" \
- "unmerge_TEST_dir/empty_contents" 1>/dev/null
- test_return_code
-
- ok=
- for a in unmerge_TEST_dir/empty_dst/* ; do
- [[ -e "$a" ]] || continue
- test_equality "$a" ""
- ok=no
- done
- test_equality "$ok" ""
-}
-
-unmerge_files_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "unmerge_TEST_dir/files_src" \
- "unmerge_TEST_dir/files_dst" \
- "unmerge_TEST_dir/files_contents" 1>/dev/null
- test_return_code
-
- ok=
- for a in unmerge_TEST_dir/files_dst/* ; do
- [[ -e "$a" ]] || continue
- ok=yes
- break
- done
- test_equality "$ok" "yes"
-
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/unmerge "unmerge_TEST_dir/files_dst" \
- "unmerge_TEST_dir/files_contents" 1>/dev/null
- test_return_code
-
- ok=
- for a in unmerge_TEST_dir/files_dst/* ; do
- [[ -e "$a" ]] || continue
- test_equality "$a" ""
- ok=no
- done
- test_equality "$ok" ""
-}
-
-unmerge_spaces_TEST()
-{
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/merge "unmerge_TEST_dir/spaces_src" \
- "unmerge_TEST_dir/spaces_dst" \
- "unmerge_TEST_dir/spaces_contents"
- test_return_code
-
- ok=
- for a in unmerge_TEST_dir/spaces_dst/* ; do
- [[ -e "$a" ]] || continue
- ok=yes
- break
- done
- test_equality "$ok" "yes"
-
- ${TOP_BUILD_DIR}/paludis/repositories/e/ebuild/unmerge "unmerge_TEST_dir/spaces_dst" \
- "unmerge_TEST_dir/spaces_contents"
- test_return_code
-
- ok=
- for a in unmerge_TEST_dir/spaces_dst/* ; do
- [[ -e "$a" ]] || continue
- test_equality "$a" ""
- ok=no
- done
- test_equality "$ok" ""
-}
-
diff --git a/paludis/repositories/e/ebuild/unmerge_TEST_cleanup.sh b/paludis/repositories/e/ebuild/unmerge_TEST_cleanup.sh
deleted file mode 100755
index e0f01b6..0000000
--- a/paludis/repositories/e/ebuild/unmerge_TEST_cleanup.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d unmerge_TEST_dir ] ; then
- rm -fr unmerge_TEST_dir
-else
- true
-fi
-
-
-
diff --git a/paludis/repositories/e/ebuild/unmerge_TEST_setup.sh b/paludis/repositories/e/ebuild/unmerge_TEST_setup.sh
deleted file mode 100755
index 33643aa..0000000
--- a/paludis/repositories/e/ebuild/unmerge_TEST_setup.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir -p unmerge_TEST_dir/{empty_src,empty_dst} || exit 2
-
-mkdir -p unmerge_TEST_dir/{files_src,files_dst} || exit 3
-echo "file one" > unmerge_TEST_dir/files_src/one
-echo "file two" > unmerge_TEST_dir/files_src/two
-
-mkdir -p unmerge_TEST_dir/{spaces_src,spaces_dst} || exit 4
-echo "file one" > unmerge_TEST_dir/spaces_src/"file one"
-mkdir -p unmerge_TEST_dir/spaces_src/"dir two"
-echo "file two" > unmerge_TEST_dir/spaces_src/"dir two"/"file two"
-ln -s "link three" unmerge_TEST_dir/spaces_src/"link three"
-
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 302e366..cff0fe1 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -25,6 +25,8 @@
#include <paludis/repositories/e/ebuild_id.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/fetch_visitor.hh>
+#include <paludis/repositories/e/check_fetched_files_visitor.hh>
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -128,6 +130,10 @@ namespace
_specs.push_back(&a);
}
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
+ {
+ }
+
typedef std::list<const URIDepSpec *>::const_iterator Iterator;
Iterator begin()
@@ -141,6 +147,68 @@ namespace
}
};
+ class AFinder :
+ private InstantiationPolicy<AFinder, instantiation_method::NonCopyableTag>,
+ public ConstVisitor<URISpecTree>
+ {
+ private:
+ std::list<std::pair<const URIDepSpec *, const LabelsDepSpec<URILabelVisitorTypes> *> > _specs;
+ std::list<const LabelsDepSpec<URILabelVisitorTypes> *> _labels;
+
+ const Environment * const env;
+ const tr1::shared_ptr<const PackageID> id;
+
+ public:
+ AFinder(const Environment * const e, const tr1::shared_ptr<const PackageID> & i) :
+ env(e),
+ id(i)
+ {
+ _labels.push_back(0);
+ }
+
+ void visit_leaf(const URIDepSpec & a)
+ {
+ _specs.push_back(std::make_pair(&a, *_labels.begin()));
+ }
+
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
+ {
+ *_labels.begin() = &l;
+ }
+
+ void visit_sequence(const AllDepSpec &,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator e)
+ {
+ _labels.push_front(*_labels.begin());
+ std::for_each(cur, e, accept_visitor(*this));
+ _labels.pop_front();
+ }
+
+ void visit_sequence(const UseDepSpec & u,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator e)
+ {
+ if (env->query_use(u.flag(), *id) ^ u.inverse())
+ {
+ _labels.push_front(*_labels.begin());
+ std::for_each(cur, e, accept_visitor(*this));
+ _labels.pop_front();
+ }
+ }
+
+ typedef std::list<std::pair<const URIDepSpec *, const LabelsDepSpec<URILabelVisitorTypes> *> >::const_iterator Iterator;
+
+ Iterator begin()
+ {
+ return _specs.begin();
+ }
+
+ Iterator end() const
+ {
+ return _specs.end();
+ }
+ };
}
namespace
@@ -234,14 +302,14 @@ namespace
}
void
-EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
- const InstallActionOptions & o, tr1::shared_ptr<const ERepositoryProfile> p) const
+EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
+ const FetchActionOptions & o, tr1::shared_ptr<const ERepositoryProfile> p) const
{
using namespace tr1::placeholders;
- Context context("When installing '" + stringify(*id) + "':");
+ Context context("When fetching '" + stringify(*id) + "':");
- bool fetch_restrict(false), no_mirror(false), userpriv_restrict;
+ bool fetch_restrict(false), no_mirror(false);
{
DepSpecFlattener restricts(_imp->params.environment, id);
if (id->restrict_key())
@@ -253,12 +321,6 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
restricts.end() != std::find_if(restricts.begin(), restricts.end(),
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nofetch"));
- userpriv_restrict =
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
- tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
- restricts.end() != std::find_if(restricts.begin(), restricts.end(),
- tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
-
no_mirror =
restricts.end() != std::find_if(restricts.begin(), restricts.end(),
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "mirror")) ||
@@ -266,88 +328,183 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nomirror"));
}
- std::string archives, all_archives, flat_src_uri;
+ bool fetch_userpriv_ok(_imp->environment->reduced_gid() != getgid());
+ if (fetch_userpriv_ok)
+ {
+ FSEntry f(_imp->params.distdir);
+ Context c("When checking permissions on '" + stringify(f) + "' for userpriv:");
+
+ if (f.exists())
+ {
+ if (f.group() != _imp->environment->reduced_gid())
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
+ stringify(f) + "' owned by group '" +
+ stringify(get_group_name(f.group())) + "', not '" +
+ stringify(get_group_name(_imp->environment->reduced_gid())) +
+ "', so cannot enable userpriv");
+ fetch_userpriv_ok = false;
+ }
+ else if (! f.has_permission(fs_ug_group, fs_perm_write))
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
+ stringify(f) + "' does not group write permission," +
+ "cannot enable userpriv");
+ fetch_userpriv_ok = false;
+ }
+ }
+ }
+
+ std::string archives, all_archives;
{
std::set<std::string> already_in_archives;
- /* make A and FLAT_SRC_URI */
- DepSpecFlattener f(_imp->params.environment, id);
+ /* make A */
+ AFinder f(_imp->params.environment, id);
if (id->src_uri_key())
id->src_uri_key()->value()->accept(f);
- for (DepSpecFlattener::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
+ for (AFinder::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
{
- const tr1::shared_ptr<const URIDepSpec> spec(tr1::static_pointer_cast<const URIDepSpec>(*i));
- if (! spec->renamed_url_suffix().empty())
- throw PackageInstallActionError("Can't install '" + stringify(*id) + "' since it uses SRC_URI arrow components");
+ const URIDepSpec * const spec(static_cast<const URIDepSpec *>(i->first));
- std::string::size_type pos(spec->original_url().rfind('/'));
- if (std::string::npos == pos)
+ if (already_in_archives.end() == already_in_archives.find(spec->filename()))
{
- if (already_in_archives.end() == already_in_archives.find(spec->original_url()))
- {
- archives.append(spec->original_url());
- already_in_archives.insert(spec->original_url());
- }
+ archives.append(spec->filename());
+ already_in_archives.insert(spec->filename());
}
- else
+ archives.append(" ");
+ }
+
+ /* make AA */
+ if (! id->eapi()->supported->ebuild_environment_variables->env_aa.empty())
+ {
+ AAFinder g;
+ if (id->src_uri_key())
+ id->src_uri_key()->value()->accept(g);
+ std::set<std::string> already_in_all_archives;
+
+ for (AAFinder::Iterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
{
- if (already_in_archives.end() == already_in_archives.find(spec->original_url().substr(pos + 1)))
+ if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->filename()))
{
- archives.append(spec->original_url().substr(pos + 1));
- already_in_archives.insert(spec->original_url().substr(pos + 1));
+ all_archives.append((*gg)->filename());
+ already_in_all_archives.insert((*gg)->filename());
}
+ all_archives.append(" ");
}
- archives.append(" ");
+ }
+ else
+ all_archives = "AA-not-set-for-this-EAPI";
+ }
- /* add * mirror entries */
- tr1::shared_ptr<const MirrorsSequence> star_mirrors(_imp->params.environment->mirrors("*"));
- for (MirrorsSequence::Iterator m(star_mirrors->begin()), m_end(star_mirrors->end()) ; m != m_end ; ++m)
- flat_src_uri.append(*m + "/" + spec->original_url().substr(pos + 1) + " ");
+ /* Strip trailing space. Some ebuilds rely upon this. From kde-meta.eclass:
+ * [[ -n ${A/${TARBALL}/} ]] && unpack ${A/${TARBALL}/}
+ * Rather annoying.
+ */
+ archives = strip_trailing(archives, " ");
+ all_archives = strip_trailing(all_archives, " ");
- if (0 == spec->original_url().compare(0, 9, "mirror://"))
+ if (id->src_uri_key())
+ {
+ std::string mirrors_name(_imp->e_repository->params().master_repository ?
+ stringify(_imp->e_repository->params().master_repository->name()) :
+ stringify(_imp->e_repository->name()));
+ FetchVisitor f(_imp->params.environment, id, *id->eapi(),
+ _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_userpriv_ok, mirrors_name, fetch_restrict);
+ id->src_uri_key()->value()->accept(f);
+ CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_restrict);
+ id->src_uri_key()->value()->accept(c);
+
+ if (c.need_nofetch())
+ {
+ std::string use(make_use(_imp->params.environment, *id, p));
+ std::string expand_sep(stringify(id->eapi()->supported->ebuild_options->use_expand_separator));
+ tr1::shared_ptr<Map<std::string, std::string> > expand_vars(make_expand(
+ _imp->params.environment, *id, p, use, expand_sep));
+
+ tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
+
+ EAPIPhases phases(id->eapi()->supported->ebuild_phases->ebuild_nofetch);
+ for (EAPIPhases::Iterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
+ phase != phase_end ; ++phase)
{
- std::string mirror(spec->original_url().substr(9));
- std::string::size_type spos(mirror.find('/'));
-
- if (std::string::npos == spos)
- throw PackageInstallActionError("Can't install '" + stringify(*id) + "' since SRC_URI is broken");
-
- tr1::shared_ptr<const MirrorsSequence> mirrors(_imp->params.environment->mirrors(mirror.substr(0, spos)));
- if (! _imp->e_repository->is_mirror(mirror.substr(0, spos)) &&
- mirrors->empty())
- throw PackageInstallActionError("Can't install '" + stringify(*id) +
- "' since SRC_URI references unknown mirror:// '" +
- mirror.substr(0, spos) + "'");
-
- for (MirrorsSequence::Iterator m(mirrors->begin()), m_end(mirrors->end()) ; m != m_end ; ++m)
- flat_src_uri.append(*m + "/" + mirror.substr(spos + 1) + " ");
-
- for (RepositoryMirrorsInterface::MirrorsIterator
- m(_imp->e_repository->begin_mirrors(mirror.substr(0, spos))),
- m_end(_imp->e_repository->end_mirrors(mirror.substr(0, spos))) ;
- m != m_end ; ++m)
- flat_src_uri.append(m->second + "/" + mirror.substr(spos + 1) + " ");
+ EbuildCommandParams command_params(EbuildCommandParams::create()
+ .environment(_imp->params.environment)
+ .package_id(id)
+ .ebuild_dir(_imp->e_repository->layout()->package_directory(id->name()))
+ .ebuild_file(_imp->e_repository->layout()->package_file(*id))
+ .files_dir(_imp->e_repository->layout()->package_directory(id->name()) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .exlibsdirs(exlibsdirs)
+ .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
+ _imp->params.location)
+ .distdir(_imp->params.distdir)
+ .userpriv(phase->option("userpriv"))
+ .sandbox(phase->option("sandbox"))
+ .commands(join(phase->begin_commands(), phase->end_commands(), " "))
+ .buildroot(_imp->params.buildroot));
+
+ EbuildNoFetchCommand nofetch_cmd(command_params,
+ EbuildNoFetchCommandParams::create()
+ .a(archives)
+ .aa(all_archives)
+ .use(use)
+ .use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ .expand_vars(expand_vars)
+ .root("/")
+ .profiles(_imp->params.profiles));
+
+ if (! nofetch_cmd())
+ throw FetchActionError("Fetch of '" + stringify(*id) + "' failed", c.failures());
}
- else
- flat_src_uri.append(spec->original_url());
- flat_src_uri.append(" ");
+ }
- /* add mirror://gentoo/ entries */
- std::string master_mirror(strip_trailing_string(stringify(_imp->e_repository->name()), "x-"));
- if (! no_mirror && _imp->e_repository->is_mirror(master_mirror))
- {
- tr1::shared_ptr<const MirrorsSequence> repo_mirrors(_imp->params.environment->mirrors(master_mirror));
+ if (! c.failures()->empty())
+ throw FetchActionError("Fetch of '" + stringify(*id) + "' failed", c.failures());
+ }
+}
+
+void
+EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
+ const InstallActionOptions & o, tr1::shared_ptr<const ERepositoryProfile> p) const
+{
+ using namespace tr1::placeholders;
+
+ Context context("When installing '" + stringify(*id) + "':");
+
+ bool userpriv_restrict;
+ {
+ DepSpecFlattener restricts(_imp->params.environment, id);
+ if (id->restrict_key())
+ id->restrict_key()->value()->accept(restricts);
+
+ userpriv_restrict =
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "userpriv")) ||
+ restricts.end() != std::find_if(restricts.begin(), restricts.end(),
+ tr1::bind(std::equal_to<std::string>(), tr1::bind(tr1::mem_fn(&StringDepSpec::text), _1), "nouserpriv"));
+ }
+
+ std::string archives, all_archives;
+ {
+ std::set<std::string> already_in_archives;
+
+ /* make A */
+ AFinder f(_imp->params.environment, id);
+ if (id->src_uri_key())
+ id->src_uri_key()->value()->accept(f);
- for (MirrorsSequence::Iterator m(repo_mirrors->begin()), m_end(repo_mirrors->end()) ; m != m_end ; ++m)
- flat_src_uri.append(*m + "/" + spec->original_url().substr(pos + 1) + " ");
+ for (AFinder::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i)
+ {
+ const URIDepSpec * const spec(static_cast<const URIDepSpec *>(i->first));
- for (RepositoryMirrorsInterface::MirrorsIterator
- m(_imp->e_repository->begin_mirrors(master_mirror)),
- m_end(_imp->e_repository->end_mirrors(master_mirror)) ;
- m != m_end ; ++m)
- flat_src_uri.append(m->second + "/" + spec->original_url().substr(pos + 1) + " ");
+ if (already_in_archives.end() == already_in_archives.find(spec->filename()))
+ {
+ archives.append(spec->filename());
+ already_in_archives.insert(spec->filename());
}
+ archives.append(" ");
}
/* make AA */
@@ -360,22 +517,10 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
for (AAFinder::Iterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
{
- std::string::size_type pos((*gg)->text().rfind('/'));
- if (std::string::npos == pos)
- {
- if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->text()))
- {
- all_archives.append((*gg)->text());
- already_in_all_archives.insert((*gg)->text());
- }
- }
- else
+ if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->filename()))
{
- if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->text().substr(pos + 1)))
- {
- all_archives.append((*gg)->text().substr(pos + 1));
- already_in_all_archives.insert((*gg)->text().substr(pos + 1));
- }
+ all_archives.append((*gg)->filename());
+ already_in_all_archives.insert((*gg)->filename());
}
all_archives.append(" ");
}
@@ -402,77 +547,6 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
- /* fetch */
- {
- bool fetch_userpriv_ok(_imp->environment->reduced_gid() != getgid());
- if (fetch_userpriv_ok)
- {
- FSEntry f(_imp->params.distdir);
- Context c("When checking permissions on '" + stringify(f) + "' for userpriv:");
-
- if (f.exists())
- {
- if (f.group() != _imp->environment->reduced_gid())
- {
- Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(f) + "' owned by group '" +
- stringify(get_group_name(f.group())) + "', not '" +
- stringify(get_group_name(_imp->environment->reduced_gid())) +
- "', so cannot enable userpriv");
- fetch_userpriv_ok = false;
- }
- else if (! f.has_permission(fs_ug_group, fs_perm_write))
- {
- Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(f) + "' does not group write permission," +
- "cannot enable userpriv");
- fetch_userpriv_ok = false;
- }
- }
- }
-
- EAPIPhases phases(fetch_restrict ?
- id->eapi()->supported->ebuild_phases->ebuild_nofetch :
- id->eapi()->supported->ebuild_phases->ebuild_fetch);
-
- for (EAPIPhases::Iterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
- phase != phase_end ; ++phase)
- {
- EbuildCommandParams command_params(EbuildCommandParams::create()
- .environment(_imp->params.environment)
- .package_id(id)
- .ebuild_dir(_imp->e_repository->layout()->package_directory(id->name()))
- .ebuild_file(_imp->e_repository->layout()->package_file(*id))
- .files_dir(_imp->e_repository->layout()->package_directory(id->name()) / "files")
- .eclassdirs(_imp->params.eclassdirs)
- .exlibsdirs(exlibsdirs)
- .portdir(_imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- .distdir(_imp->params.distdir)
- .commands(join(phase->begin_commands(), phase->end_commands(), " "))
- .sandbox(phase->option("sandbox"))
- .userpriv(phase->option("userpriv") && fetch_userpriv_ok)
- .buildroot(_imp->params.buildroot));
-
- EbuildFetchCommand fetch_cmd(command_params,
- EbuildFetchCommandParams::create()
- .a(archives)
- .aa(all_archives)
- .use(use)
- .use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
- .expand_vars(expand_vars)
- .flat_src_uri(flat_src_uri)
- .root(o.destination->installed_interface ? stringify(o.destination->installed_interface->root()) : "/")
- .profiles(_imp->params.profiles)
- .safe_resume(o.safe_resume));
-
- fetch_cmd();
- }
-
- if (o.fetch_only)
- return;
- }
-
bool userpriv_ok((! userpriv_restrict) && (_imp->environment->reduced_gid() != getgid()));
if (userpriv_ok)
{
@@ -506,7 +580,7 @@ EbuildEntries::install(const tr1::shared_ptr<const ERepositoryID> & id,
if (phase->option("merge"))
{
if (! o.destination->destination_interface)
- throw PackageInstallActionError("Can't install '" + stringify(*id)
+ throw InstallActionError("Can't install '" + stringify(*id)
+ "' to destination '" + stringify(o.destination->name())
+ "' because destination does not provide destination_interface");
@@ -593,8 +667,7 @@ EbuildEntries::get_environment_variable(const tr1::shared_ptr<const ERepositoryI
var);
if (! cmd())
- throw EnvironmentVariableActionError("Couldn't get environment variable '" +
- stringify(var) + "' for package '" + stringify(*id) + "'");
+ throw ActionError("Couldn't get environment variable '" + stringify(var) + "' for package '" + stringify(*id) + "'");
return cmd.result();
}
diff --git a/paludis/repositories/e/ebuild_entries.hh b/paludis/repositories/e/ebuild_entries.hh
index 840726d..d5848da 100644
--- a/paludis/repositories/e/ebuild_entries.hh
+++ b/paludis/repositories/e/ebuild_entries.hh
@@ -79,6 +79,9 @@ namespace paludis
virtual std::string get_environment_variable(const tr1::shared_ptr<const ERepositoryID> &, const std::string & var,
tr1::shared_ptr<const ERepositoryProfile>) const;
+ virtual void fetch(const tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
+ tr1::shared_ptr<const ERepositoryProfile>) const;
+
virtual void install(const tr1::shared_ptr<const ERepositoryID> &, const InstallActionOptions &,
tr1::shared_ptr<const ERepositoryProfile>) const;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 46911b5..59934a0 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -741,6 +741,11 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ result = true;
+ }
+
void visit(const SupportsActionTest<InstallAction> &)
{
result = true;
@@ -789,6 +794,14 @@ namespace
tr1::static_pointer_cast<const ERepository>(id->repository())->profile());
}
+ void visit(const FetchAction & a)
+ {
+ tr1::static_pointer_cast<const ERepository>(id->repository())->entries()->fetch(
+ tr1::static_pointer_cast<const ERepositoryID>(id),
+ a.options,
+ tr1::static_pointer_cast<const ERepository>(id->repository())->profile());
+ }
+
void visit(const PretendAction &)
{
tr1::static_pointer_cast<const ERepository>(id->repository())->entries()->pretend(
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
new file mode 100644
index 0000000..d7e4cd5
--- /dev/null
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -0,0 +1,246 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/fetch_visitor.hh>
+#include <paludis/repositories/e/source_uri_finder.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/action.hh>
+#include <paludis/repository.hh>
+#include <paludis/about.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <iostream>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<FetchVisitor>
+ {
+ const Environment * const env;
+ const tr1::shared_ptr<const PackageID> id;
+ const EAPI & eapi;
+ const FSEntry distdir;
+ const bool fetch_unneeded;
+ const bool userpriv;
+ const std::string mirrors_name;
+ const bool fetch_restrict;
+
+ tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> > default_label;
+ std::list<const LabelsDepSpec<URILabelVisitorTypes> *> labels;
+
+ Implementation(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const EAPI & p,
+ const FSEntry & d,
+ const bool f,
+ const bool u,
+ const std::string & m,
+ const bool n) :
+ env(e),
+ id(i),
+ eapi(p),
+ distdir(d),
+ fetch_unneeded(f),
+ userpriv(u),
+ mirrors_name(m),
+ fetch_restrict(n)
+ {
+ if (fetch_restrict)
+ {
+ default_label.reset(new LabelsDepSpec<URILabelVisitorTypes>);
+ default_label->add_label(make_shared_ptr(new URIManualOnlyLabel("fetch-restrict")));
+ }
+ else
+ default_label = parse_uri_label("default:", eapi);
+
+ labels.push_front(default_label.get());
+ }
+ };
+}
+
+FetchVisitor::FetchVisitor(
+ const Environment * const e,
+ const tr1::shared_ptr<const PackageID> & i,
+ const EAPI & p,
+ const FSEntry & d,
+ const bool f,
+ const bool u,
+ const std::string & m,
+ const bool n) :
+ PrivateImplementationPattern<FetchVisitor>(new Implementation<FetchVisitor>(e, i, p, d, f, u, m, n))
+{
+}
+
+FetchVisitor::~FetchVisitor()
+{
+}
+
+void
+FetchVisitor::visit_sequence(const UseDepSpec & u,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator end)
+{
+ if ((_imp->fetch_unneeded) || (_imp->env->query_use(u.flag(), *_imp->id) ^ u.inverse()))
+ {
+ _imp->labels.push_front(* _imp->labels.begin());
+ std::for_each(cur, end, accept_visitor(*this));
+ _imp->labels.pop_front();
+ }
+}
+
+void
+FetchVisitor::visit_sequence(const AllDepSpec &,
+ URISpecTree::ConstSequenceIterator cur,
+ URISpecTree::ConstSequenceIterator end)
+{
+ _imp->labels.push_front(* _imp->labels.begin());
+ std::for_each(cur, end, accept_visitor(*this));
+ _imp->labels.pop_front();
+}
+
+void
+FetchVisitor::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & l)
+{
+ *_imp->labels.begin() = &l;
+}
+
+namespace
+{
+ FSEntry make_fetcher(const FSEntry & d, const std::string & x)
+ {
+ std::string lower_x;
+ std::transform(x.begin(), x.end(), std::back_inserter(lower_x), &::tolower);
+ return d / ("do" + lower_x);
+ }
+}
+
+void
+FetchVisitor::visit_leaf(const URIDepSpec & u)
+{
+ Context context("When visiting URI dep spec '" + stringify(u.text()) + "':");
+
+ if (! *_imp->labels.begin())
+ throw FetchActionError("No fetch action label available");
+ if (1 != std::distance((*_imp->labels.begin())->begin(), (*_imp->labels.begin())->end()))
+ throw FetchActionError("Fetch action label does not define exactly one behaviour");
+
+ SourceURIFinder source_uri_finder(_imp->env, _imp->id->repository().get(),
+ u.original_url(), u.filename(), _imp->mirrors_name);
+ (*_imp->labels.begin())->begin()->accept(source_uri_finder);
+ for (SourceURIFinder::Iterator i(source_uri_finder.begin()), i_end(source_uri_finder.end()) ;
+ i != i_end ; ++i)
+ {
+ Context local_context("When fetching URI '" + stringify(i->first) + "' to '" + stringify(i->second) + ":");
+
+ FSEntry destination(_imp->distdir / u.filename());
+
+ if (destination.exists())
+ {
+ if (0 == destination.file_size())
+ destination.unlink();
+ else
+ return;
+ }
+
+ std::string::size_type protocol_pos(i->first.find("://"));
+ if (std::string::npos == protocol_pos)
+ continue;
+
+ std::string protocol(i->first.substr(0, protocol_pos));
+ if (protocol.empty())
+ {
+ Log::get_instance()->message(ll_warning, lc_context) << "URI part '" << i->first << "' has empty protocol";
+ continue;
+ }
+
+ const tr1::shared_ptr<const FSEntrySequence> fetch_dirs(_imp->env->fetchers_dirs());
+ bool found(false);
+ for (FSEntrySequence::Iterator d(fetch_dirs->begin()), d_end(fetch_dirs->end()) ;
+ d != d_end ; ++d)
+ if (make_fetcher(*d, protocol).exists())
+ {
+ found = true;
+
+ Command cmd(stringify(make_fetcher(*d, protocol)) + " '" + i->first + "' '" +
+ stringify(_imp->distdir / i->second) + "'");
+ if (_imp->userpriv)
+ cmd.with_uid_gid(_imp->env->reduced_uid(), _imp->env->reduced_gid());
+
+ tr1::shared_ptr<const FSEntrySequence> syncers_dirs(_imp->env->syncers_dirs());
+ tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->env->bashrc_files());
+ tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(_imp->env->fetchers_dirs());
+ tr1::shared_ptr<const FSEntrySequence> hook_dirs(_imp->env->hook_dirs());
+
+ cmd
+ .with_setenv("P", stringify(_imp->id->name().package) + "-" +
+ stringify(_imp->id->version().remove_revision()))
+ .with_setenv("PV", stringify(_imp->id->version().remove_revision()))
+ .with_setenv("PR", stringify(_imp->id->version().revision_only()))
+ .with_setenv("PN", stringify(_imp->id->name().package))
+ .with_setenv("PVR", stringify(_imp->id->version()))
+ .with_setenv("PF", stringify(_imp->id->name().package) + "-" +
+ stringify(_imp->id->version()))
+ .with_setenv("CATEGORY", stringify(_imp->id->name().category))
+ .with_setenv("REPOSITORY", stringify(_imp->id->repository()->name()))
+ .with_setenv("EAPI", stringify(_imp->eapi.name))
+ .with_setenv("SLOT", "")
+ .with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
+ stringify(PALUDIS_VERSION_MINOR) + "." +
+ stringify(PALUDIS_VERSION_MICRO) +
+ (std::string(PALUDIS_SUBVERSION_REVISION).empty() ?
+ std::string("") : "-r" + std::string(PALUDIS_SUBVERSION_REVISION)))
+ .with_setenv("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
+ .with_setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "))
+ .with_setenv("PALUDIS_HOOK_DIRS", join(hook_dirs->begin(), hook_dirs->end(), " "))
+ .with_setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " "))
+ .with_setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " "))
+ .with_setenv("PALUDIS_COMMAND", _imp->env->paludis_command())
+ .with_setenv("PALUDIS_REDUCED_GID", stringify(_imp->env->reduced_gid()))
+ .with_setenv("PALUDIS_REDUCED_UID", stringify(_imp->env->reduced_uid()))
+ .with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
+ .with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"));
+
+ std::cout << "Trying to fetch '" << i->first << "' to '" << i->second << "'..." << std::endl;
+ if (0 != run_command(cmd))
+ destination.unlink();
+ break;
+ }
+
+ if (! found)
+ Log::get_instance()->message(ll_warning, lc_context) << "URI part '" << i->first << "' uses unknown protocol '"
+ << protocol << "'";
+ }
+}
+
diff --git a/paludis/repositories/e/fetch_visitor.hh b/paludis/repositories/e/fetch_visitor.hh
new file mode 100644
index 0000000..edca26f
--- /dev/null
+++ b/paludis/repositories/e/fetch_visitor.hh
@@ -0,0 +1,69 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_FETCH_VISITOR_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_FETCH_VISITOR_HH 1
+
+#include <paludis/repositories/e/eapi-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/visitor-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tr1_memory.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE FetchVisitor :
+ private PrivateImplementationPattern<FetchVisitor>,
+ public ConstVisitor<URISpecTree>
+ {
+ public:
+ FetchVisitor(
+ const Environment * const,
+ const tr1::shared_ptr<const PackageID> &,
+ const EAPI & eapi,
+ const FSEntry & distdir,
+ const bool fetch_unneeded,
+ const bool userpriv,
+ const std::string & mirrors_name,
+ const bool fetch_restrict);
+
+ ~FetchVisitor();
+
+ void visit_sequence(const AllDepSpec &,
+ URISpecTree::ConstSequenceIterator,
+ URISpecTree::ConstSequenceIterator);
+
+ void visit_sequence(const UseDepSpec &,
+ URISpecTree::ConstSequenceIterator,
+ URISpecTree::ConstSequenceIterator);
+
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
+
+ void visit_leaf(const URIDepSpec &);
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
new file mode 100644
index 0000000..066b903
--- /dev/null
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -0,0 +1,74 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/fetch_visitor.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/package_database.hh>
+#include <paludis/query.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+#include <fstream>
+#include <iterator>
+
+using namespace test;
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace test_cases
+{
+ struct FetchVisitorTest : TestCase
+ {
+ FetchVisitorTest() : TestCase("fetch visitor") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ const tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
+ env.package_database()->add_repository(1, repo);
+ repo->add_version("cat", "pkg", "1");
+
+ TEST_CHECK(FSEntry("fetch_visitor_TEST_dir/in/input1").exists());
+ TEST_CHECK(! FSEntry("fetch_visitor_TEST_dir/out/input1").exists());
+
+ const tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string("exheres-0"));
+ FetchVisitor v(&env, *env.package_database()->query(query::Matches(PackageDepSpec("=cat/pkg-1", pds_pm_permissive)),
+ qo_require_exactly_one)->begin(),
+ *eapi, FSEntry("fetch_visitor_TEST_dir/out"),
+ false, false, "test", false);
+ parse_uri("file:///" + stringify(FSEntry("fetch_visitor_TEST_dir/in/input1").realpath()), *eapi)->accept(v);
+
+ TEST_CHECK(FSEntry("fetch_visitor_TEST_dir/out/input1").is_regular_file());
+ std::ifstream f(stringify(FSEntry("fetch_visitor_TEST_dir/out/input1")).c_str());
+ TEST_CHECK(f);
+ std::string s((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
+ TEST_CHECK_EQUAL(s, "contents of one\n");
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+ } test_fetch_visitor;
+}
+
diff --git a/paludis/repositories/e/fetch_visitor_TEST_cleanup.sh b/paludis/repositories/e/fetch_visitor_TEST_cleanup.sh
new file mode 100755
index 0000000..d9f826c
--- /dev/null
+++ b/paludis/repositories/e/fetch_visitor_TEST_cleanup.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d fetch_visitor_TEST_dir ] ; then
+ rm -fr fetch_visitor_TEST_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/fetch_visitor_TEST_setup.sh b/paludis/repositories/e/fetch_visitor_TEST_setup.sh
new file mode 100755
index 0000000..14e2b70
--- /dev/null
+++ b/paludis/repositories/e/fetch_visitor_TEST_setup.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir fetch_visitor_TEST_dir || exit 1
+cd fetch_visitor_TEST_dir || exit 1
+
+mkdir -p "in"
+mkdir -p "out"
+
+cat <<END > in/input1
+contents of one
+END
+
diff --git a/paludis/repositories/e/source_uri_finder.cc b/paludis/repositories/e/source_uri_finder.cc
new file mode 100644
index 0000000..9eb4d51
--- /dev/null
+++ b/paludis/repositories/e/source_uri_finder.cc
@@ -0,0 +1,214 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/source_uri_finder.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/repository.hh>
+#include <paludis/environment.hh>
+#include <paludis/action.hh>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<SourceURIFinder>
+ {
+ const Environment * const env;
+ const Repository * const repo;
+ const std::string url;
+ const std::string filename;
+ const std::string mirrors_name;
+
+ std::list<std::pair<std::string, std::string> > items;
+
+ Implementation(const Environment * const e, const Repository * const r, const std::string & u, const std::string & f,
+ const std::string & m) :
+ env(e),
+ repo(r),
+ url(u),
+ filename(f),
+ mirrors_name(m)
+ {
+ }
+ };
+}
+
+SourceURIFinder::SourceURIFinder(const Environment * const e, const Repository * const repo,
+ const std::string & u, const std::string & f, const std::string & m) :
+ PrivateImplementationPattern<SourceURIFinder>(new Implementation<SourceURIFinder>(e, repo, u, f, m))
+{
+}
+
+SourceURIFinder::~SourceURIFinder()
+{
+}
+
+SourceURIFinder::Iterator
+SourceURIFinder::begin() const
+{
+ return Iterator(_imp->items.begin());
+}
+
+SourceURIFinder::Iterator
+SourceURIFinder::end() const
+{
+ return Iterator(_imp->items.end());
+}
+
+void
+SourceURIFinder::visit(const URIMirrorsThenListedLabel &)
+{
+ Context context("When using URIMirrorsThenListedLabel:");
+ add_local_mirrors();
+ add_mirrors();
+ add_listed();
+}
+
+void
+SourceURIFinder::visit(const URIListedThenMirrorsLabel &)
+{
+ Context context("When using URIListedThenMirrorsLabel:");
+ add_local_mirrors();
+ add_listed();
+ add_mirrors();
+}
+
+void
+SourceURIFinder::visit(const URIMirrorsOnlyLabel &)
+{
+ Context context("When using URIMirrorsOnlyLabel:");
+ add_local_mirrors();
+ add_mirrors();
+}
+
+void
+SourceURIFinder::visit(const URIListedOnlyLabel &)
+{
+ Context context("When using URIListedOnlyLabel:");
+ add_local_mirrors();
+ add_listed();
+}
+
+void
+SourceURIFinder::visit(const URIManualOnlyLabel &)
+{
+}
+
+void
+SourceURIFinder::visit(const URILocalMirrorsOnlyLabel &)
+{
+ Context context("When using URILocalMirrorsOnlyLabel:");
+ add_local_mirrors();
+}
+
+void
+SourceURIFinder::add_local_mirrors()
+{
+ Context context("When adding local mirrors:");
+
+ tr1::shared_ptr<const MirrorsSequence> mirrors(_imp->env->mirrors("*"));
+ if (mirrors->empty())
+ Log::get_instance()->message(ll_debug, lc_context) << "Mirrors set is empty";
+
+ for (MirrorsSequence::Iterator m(mirrors->begin()), m_end(mirrors->end()) ; m != m_end ; ++m)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << *m << "/" << _imp->filename;
+ _imp->items.push_back(std::make_pair(*m + "/" + _imp->filename, _imp->filename));
+ }
+}
+
+void
+SourceURIFinder::add_mirrors()
+{
+ Context context("When adding repository mirrors from '" + _imp->mirrors_name + "':");
+
+ tr1::shared_ptr<const MirrorsSequence> mirrors(_imp->env->mirrors(_imp->mirrors_name));
+ if (mirrors->empty())
+ Log::get_instance()->message(ll_debug, lc_context) << "Environment mirrors set is empty";
+
+ for (MirrorsSequence::Iterator m(mirrors->begin()), m_end(mirrors->end()) ; m != m_end ; ++m)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << *m << "/" << _imp->filename;
+ _imp->items.push_back(std::make_pair(*m + "/" + _imp->filename, _imp->filename));
+ }
+
+ {
+ Context local_context("When adding repository mirrors '" + _imp->mirrors_name + "':");
+ if (_imp->repo->mirrors_interface)
+ for (RepositoryMirrorsInterface::MirrorsIterator m(_imp->repo->mirrors_interface->begin_mirrors(_imp->mirrors_name)),
+ m_end(_imp->repo->mirrors_interface->end_mirrors(_imp->mirrors_name)) ;
+ m != m_end ; ++m)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << m->second << "/" << _imp->filename;
+ _imp->items.push_back(std::make_pair(m->second + "/" + _imp->filename, _imp->filename));
+ }
+ }
+}
+
+void
+SourceURIFinder::add_listed()
+{
+ Context context("When adding listed locations:");
+
+ if (0 == _imp->url.compare(0, 9, "mirror://"))
+ {
+ std::string mirror(_imp->url.substr(9));
+ std::string::size_type p(mirror.find("/"));
+ if (std::string::npos == p)
+ throw FetchActionError("Broken URI component '" + _imp->url + "'");
+ mirror.erase(p);
+
+ std::string original_name(_imp->url.substr(_imp->url.rfind("/")));
+
+ {
+ Context local_context("When adding from environment for listed mirror '" + mirror + "':");
+ tr1::shared_ptr<const MirrorsSequence> mirrors(_imp->env->mirrors(mirror));
+ if (mirrors->empty())
+ Log::get_instance()->message(ll_debug, lc_context) << "Mirrors set is empty";
+ for (MirrorsSequence::Iterator m(mirrors->begin()), m_end(mirrors->end()) ; m != m_end ; ++m)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << *m << "/" << original_name;
+ _imp->items.push_back(std::make_pair(*m + "/" + original_name, _imp->filename));
+ }
+ }
+
+ {
+ Context local_context("When adding from repository for listed mirror '" + mirror + "':");
+ if (_imp->repo->mirrors_interface)
+ for (RepositoryMirrorsInterface::MirrorsIterator m(_imp->repo->mirrors_interface->begin_mirrors(mirror)),
+ m_end(_imp->repo->mirrors_interface->end_mirrors(mirror)) ;
+ m != m_end ; ++m)
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << m->second << "/" << original_name;
+ _imp->items.push_back(std::make_pair(m->second + "/" + original_name, _imp->filename));
+ }
+ }
+ }
+ else
+ {
+ Log::get_instance()->message(ll_debug, lc_context) << "Adding " << _imp->url;
+ _imp->items.push_back(std::make_pair(_imp->url, _imp->filename));
+ }
+}
+
diff --git a/paludis/repositories/e/source_uri_finder.hh b/paludis/repositories/e/source_uri_finder.hh
new file mode 100644
index 0000000..250ae62
--- /dev/null
+++ b/paludis/repositories/e/source_uri_finder.hh
@@ -0,0 +1,68 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SOURCE_URI_FINDER_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SOURCE_URI_FINDER_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/visitor.hh>
+#include <paludis/dep_label.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/repository-fwd.hh>
+
+#include <libwrapiter/libwrapiter_forward_iterator-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE SourceURIFinder :
+ private PrivateImplementationPattern<SourceURIFinder>,
+ public ConstVisitor<URILabelVisitorTypes>
+ {
+ private:
+ void add_local_mirrors();
+ void add_mirrors();
+ void add_listed();
+
+ public:
+ SourceURIFinder(const Environment * const env,
+ const Repository * const repo,
+ const std::string & url,
+ const std::string & filename,
+ const std::string & mirrors_name);
+
+ ~SourceURIFinder();
+
+ typedef libwrapiter::ForwardIterator<SourceURIFinder, const std::pair<std::string, std::string> > Iterator;
+ Iterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ Iterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void visit(const URIMirrorsOnlyLabel &);
+ void visit(const URIMirrorsThenListedLabel &);
+ void visit(const URIListedOnlyLabel &);
+ void visit(const URIListedThenMirrorsLabel &);
+ void visit(const URILocalMirrorsOnlyLabel &);
+ void visit(const URIManualOnlyLabel &);
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/source_uri_finder_TEST.cc b/paludis/repositories/e/source_uri_finder_TEST.cc
new file mode 100644
index 0000000..e832978
--- /dev/null
+++ b/paludis/repositories/e/source_uri_finder_TEST.cc
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/source_uri_finder.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/package_database.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+
+using namespace test;
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace test_cases
+{
+ struct SourceURIFinderTest : TestCase
+ {
+ SourceURIFinderTest() : TestCase("source uri finder") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ const tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
+ env.package_database()->add_repository(1, repo);
+
+ SourceURIFinder f(&env, repo.get(), "http://example.com/input", "output", "monkey");
+ URIMirrorsThenListedLabel label("mirrors-then-listed");
+ label.accept(f);
+
+ SourceURIFinder::Iterator i(f.begin());
+
+ TEST_CHECK(i != f.end());
+ TEST_CHECK_EQUAL(i->first, "http://example.com/input");
+ TEST_CHECK_EQUAL(i->second, "output");
+
+ ++i;
+
+ TEST_CHECK(i == f.end());
+ }
+ } test_source_uri_finder;
+}
+
diff --git a/paludis/repositories/e/vdb_id.cc b/paludis/repositories/e/vdb_id.cc
index d71de9d..397dd81 100644
--- a/paludis/repositories/e/vdb_id.cc
+++ b/paludis/repositories/e/vdb_id.cc
@@ -604,6 +604,10 @@ namespace
result = true;
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<PretendAction> &)
{
}
@@ -652,6 +656,7 @@ namespace
void visit(const InstallAction & a) PALUDIS_ATTRIBUTE((noreturn));
void visit(const PretendAction & a) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const FetchAction & a) PALUDIS_ATTRIBUTE((noreturn));
};
void PerformAction::visit(const InstallAction & a)
@@ -663,6 +668,11 @@ namespace
{
throw UnsupportedActionError(*id, a);
}
+
+ void PerformAction::visit(const FetchAction & a)
+ {
+ throw UnsupportedActionError(*id, a);
+ }
}
void
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index e86ea7b..be49847 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -350,7 +350,7 @@ VDBRepository::perform_uninstall(const tr1::shared_ptr<const ERepositoryID> & id
Context context("When uninstalling '" + stringify(*id) + (reinstalling ? "' for a reinstall:" : "':"));
if (! _imp->params.root.is_directory())
- throw PackageInstallActionError("Couldn't uninstall '" + stringify(*id) +
+ throw InstallActionError("Couldn't uninstall '" + stringify(*id) +
"' because root ('" + stringify(_imp->params.root) + "') is not a directory");
std::string reinstalling_str(reinstalling ? "-reinstalling-" : "");
@@ -435,7 +435,7 @@ VDBRepository::perform_config(const tr1::shared_ptr<const ERepositoryID> & id) c
Context context("When configuring '" + stringify(*id) + "':");
if (! _imp->params.root.is_directory())
- throw PackageInstallActionError("Couldn't configure '" + stringify(*id) +
+ throw InstallActionError("Couldn't configure '" + stringify(*id) +
"' because root ('" + stringify(_imp->params.root) + "') is not a directory");
tr1::shared_ptr<FSEntrySequence> eclassdirs(new FSEntrySequence);
@@ -643,15 +643,13 @@ VDBRepository::get_environment_variable(
stringify(id->version())));
if (! vdb_dir.is_directory_or_symlink_to_directory())
- throw EnvironmentVariableActionError("Could not find VDB entry for '"
- + stringify(*id) + "'");
+ throw ActionError("Could not find VDB entry for '" + stringify(*id) + "'");
if ((vdb_dir / var).is_regular_file_or_symlink_to_regular_file())
{
std::ifstream f(stringify(vdb_dir / var).c_str());
if (! f)
- throw EnvironmentVariableActionError("Could not read '" +
- stringify(vdb_dir / var) + "'");
+ throw ActionError("Could not read '" + stringify(vdb_dir / var) + "'");
return strip_trailing_string(
std::string((std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>()), "\n");
@@ -664,12 +662,11 @@ VDBRepository::get_environment_variable(
(std::istreambuf_iterator<char>(p)),
std::istreambuf_iterator<char>()), "\n"));
if (0 != p.exit_status())
- throw EnvironmentVariableActionError("Could not load environment.bz2");
+ throw ActionError("Could not load environment.bz2");
return result;
}
else
- throw EnvironmentVariableActionError("Could not get variable '" + var + "' for '"
- + stringify(*id) + "'");
+ throw ActionError("Could not get variable '" + var + "' for '" + stringify(*id) + "'");
}
tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence>
@@ -771,7 +768,7 @@ VDBRepository::load_provided_using_cache() const
}
DepSpecFlattener f(_imp->params.environment, id);
- tr1::shared_ptr<ProvideSpecTree::ConstItem> pp(DepParser::parse_provide(
+ tr1::shared_ptr<ProvideSpecTree::ConstItem> pp(parse_provide(
join(next(next(tokens.begin())), tokens.end(), " "), *EAPIData::get_instance()->eapi_from_string("paludis-1")));
pp->accept(f);
@@ -968,7 +965,7 @@ VDBRepository::merge(const MergeOptions & m)
+ "' to VDB repository '" + stringify(name()) + "':");
if (! is_suitable_destination_for(*m.package_id))
- throw PackageInstallActionError("Not a suitable destination for '" + stringify(*m.package_id) + "'");
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id) + "'");
bool is_replace(package_id_if_exists(m.package_id->name(), m.package_id->version()));
@@ -1019,13 +1016,13 @@ VDBRepository::merge(const MergeOptions & m)
for (DirIterator d(tmp_vdb_dir, false), d_end ; d != d_end ; ++d)
FSEntry(*d).unlink();
tmp_vdb_dir.rmdir();
- throw PackageInstallActionError("Not proceeding with install due to merge sanity check failing");
+ throw InstallActionError("Not proceeding with install due to merge sanity check failing");
}
if (is_replace)
{
if ((vdb_dir.dirname() / ("-reinstalling-" + vdb_dir.basename())).exists())
- throw PackageInstallActionError("Directory '" + stringify(vdb_dir.dirname() /
+ throw InstallActionError("Directory '" + stringify(vdb_dir.dirname() /
("-reinstalling-" + vdb_dir.basename())) + "' already exists, probably due to "
"a previous failed upgrade. If it is safe to do so, remove this directory and try "
"again.");
@@ -1183,6 +1180,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
result = true;
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 495b4c0..1147d90 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -153,6 +153,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 6e07fe8..88ea773 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -284,22 +284,22 @@ namespace paludis
keywords(new FakeMetadataKeywordSetKey("KEYWORDS", "Keywords", "test", mkt_normal)),
iuse(new FakeMetadataIUseSetKey("IUSE", "Used USE flags", "", iuse_pm_permissive, mkt_normal)),
license(new FakeMetadataSpecTreeKey<LicenseSpecTree>("LICENSE", "Licenses",
- "", tr1::bind(&erepository::DepParser::parse_license, _1,
+ "", tr1::bind(&erepository::parse_license, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_normal)),
provide(new FakeMetadataSpecTreeKey<ProvideSpecTree>("PROVIDE", "Provided packages",
- "", tr1::bind(&erepository::DepParser::parse_provide, _1,
+ "", tr1::bind(&erepository::parse_provide, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_normal)),
build_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("DEPEND", "Build dependencies",
- "", tr1::bind(&erepository::DepParser::parse_depend, _1,
+ "", tr1::bind(&erepository::parse_depend, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
run_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("RDEPEND", "Run dependencies",
- "", tr1::bind(&erepository::DepParser::parse_depend, _1,
+ "", tr1::bind(&erepository::parse_depend, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
post_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("PDEPEND", "Post dependencies",
- "", tr1::bind(&erepository::DepParser::parse_depend, _1,
+ "", tr1::bind(&erepository::parse_depend, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
suggested_dependencies(new FakeMetadataSpecTreeKey<DependencySpecTree>("SDEPEND", "Suggested dependencies",
- "", tr1::bind(&erepository::DepParser::parse_depend, _1,
+ "", tr1::bind(&erepository::parse_depend, _1,
*erepository::EAPIData::get_instance()->eapi_from_string("0")), mkt_dependencies)),
has_masks(false)
{
@@ -709,6 +709,13 @@ namespace
throw UnsupportedActionError(*id, a);
}
+ void visit(const FetchAction & a)
+ {
+ SupportsActionTest<FetchAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
void visit(const ConfigAction & a)
{
SupportsActionTest<ConfigAction> t;
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index a660794..abc7c83 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -132,6 +132,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
}
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index ac61a19..8fe7138 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -585,6 +585,13 @@ namespace
throw UnsupportedActionError(*id, a);
}
+ void visit(const FetchAction & a)
+ {
+ SupportsActionTest<FetchAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 64b0716..3e5968b 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -277,6 +277,10 @@ namespace
result = true;
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<ConfigAction> &)
{
}
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 557c85c..60d4f10 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -317,6 +317,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
result = true;
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 8f7e650..1fe1c99 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -304,6 +304,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 9c2fb6f..5d654ca 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -404,6 +404,13 @@ namespace
throw UnsupportedActionError(*id, a);
}
+ void visit(const FetchAction & a)
+ {
+ SupportsActionTest<FetchAction> t;
+ if (! id->repository()->some_ids_might_support_action(t))
+ throw UnsupportedActionError(*id, a);
+ }
+
void visit(const PretendAction & a)
{
SupportsActionTest<PretendAction> t;
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index b7ffa6f..2d873a7 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -365,6 +365,10 @@ namespace
{
}
+ void visit(const SupportsActionTest<FetchAction> &)
+ {
+ }
+
void visit(const SupportsActionTest<UninstallAction> &)
{
}
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 755fa01..c459131 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -102,36 +102,6 @@ Repository::name() const
return _name;
}
-PackageActionError::PackageActionError(const std::string & msg) throw () :
- Exception(msg)
-{
-}
-
-PackageInstallActionError::PackageInstallActionError(const std::string & msg) throw () :
- PackageActionError("Install error: " + msg)
-{
-}
-
-EnvironmentVariableActionError::EnvironmentVariableActionError(const std::string & msg) throw () :
- PackageActionError("Environment variable query error: " + msg)
-{
-}
-
-PackageFetchActionError::PackageFetchActionError(const std::string & msg) throw () :
- PackageActionError("Fetch error: " + msg)
-{
-}
-
-PackageUninstallActionError::PackageUninstallActionError(const std::string & msg) throw () :
- PackageActionError("Uninstall error: " + msg)
-{
-}
-
-PackageConfigActionError::PackageConfigActionError(const std::string & msg) throw () :
- PackageActionError("Configuration error: " + msg)
-{
-}
-
tr1::shared_ptr<const RepositoryInfo>
Repository::info(bool) const
{
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 370367b..62ec2f2 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -817,103 +817,6 @@ namespace paludis
virtual ~RepositoryHookInterface();
};
-
- /**
- * Parent class for install, uninstall errors.
- *
- * \ingroup grpexceptions
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PackageActionError : public Exception
- {
- protected:
- /**
- * Constructor.
- */
- PackageActionError(const std::string & msg) throw ();
- };
-
- /**
- * Thrown if an install fails.
- *
- * \ingroup grprepository
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PackageInstallActionError : public PackageActionError
- {
- public:
- /**
- * Constructor.
- */
- PackageInstallActionError(const std::string & msg) throw ();
- };
-
- /**
- * Thrown if a fetch fails.
- *
- * \ingroup grpexceptions
- * \ingroup grprepository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PackageFetchActionError : public PackageActionError
- {
- public:
- /**
- * Constructor.
- */
- PackageFetchActionError(const std::string & msg) throw ();
- };
-
- /**
- * Thrown if an uninstall fails.
- *
- * \ingroup grprepository
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PackageUninstallActionError : public PackageActionError
- {
- public:
- /**
- * Constructor.
- */
- PackageUninstallActionError(const std::string & msg) throw ();
- };
-
- /**
- * Thrown if a configure fails.
- *
- * \ingroup grprepository
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE PackageConfigActionError : public PackageActionError
- {
- public:
- /**
- * Constructor.
- */
- PackageConfigActionError(const std::string & msg) throw ();
- };
-
- /**
- * Thrown if an environment variable query fails.
- *
- * \ingroup grprepository
- * \ingroup grpexceptions
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE EnvironmentVariableActionError :
- public PackageActionError
- {
- public:
- /**
- * Constructor.
- */
- EnvironmentVariableActionError(const std::string & msg) throw ();
- };
}
#endif
diff --git a/paludis/set_file_TEST.cc b/paludis/set_file_TEST.cc
index 90eae91..5f97be2 100644
--- a/paludis/set_file_TEST.cc
+++ b/paludis/set_file_TEST.cc
@@ -30,15 +30,15 @@ using namespace paludis;
namespace
{
- struct DepSpecStringifier :
- ConstVisitor<DependencySpecTree>
+ struct SetSpecStringifier :
+ ConstVisitor<SetSpecTree>
{
std::ostringstream s;
void
visit_sequence(const AllDepSpec &,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
+ SetSpecTree::ConstSequenceIterator cur,
+ SetSpecTree::ConstSequenceIterator end)
{
s << "( ";
std::for_each(cur, end, accept_visitor(*this));
@@ -46,37 +46,11 @@ namespace
}
void
- visit_sequence(const AnyDepSpec &,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
- {
- s << "|| ( ";
- std::for_each(cur, end, accept_visitor(*this));
- s << ") ";
- }
-
- void
- visit_sequence(const UseDepSpec & a,
- DependencySpecTree::ConstSequenceIterator cur,
- DependencySpecTree::ConstSequenceIterator end)
- {
- s << (a.inverse() ? "!" : "") << a.flag() << "? ( ";
- std::for_each(cur, end, accept_visitor(*this));
- s << ") ";
- }
-
- void
visit_leaf(const PackageDepSpec & p)
{
s << p << " ";
}
- void
- visit_leaf(const BlockDepSpec & b)
- {
- s << "!" << *b.blocked_spec() << " ";
- }
-
};
}
@@ -96,7 +70,7 @@ namespace test_cases
.environment(0));
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( foo/bar >=bar/baz-1.23 ) ");
}
@@ -104,7 +78,7 @@ namespace test_cases
f.add("foo/bar");
f.add("moo/oink");
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( foo/bar >=bar/baz-1.23 moo/oink ) ");
}
@@ -122,7 +96,7 @@ namespace test_cases
f.remove("bar/cow");
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( foo/bar moo/oink ) ");
}
@@ -157,7 +131,7 @@ namespace test_cases
.environment(0));
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( >=bar/baz-1.23 ) ");
}
@@ -165,7 +139,7 @@ namespace test_cases
f.add("foo/bar");
f.add("moo/oink");
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( >=bar/baz-1.23 moo/oink ) ");
}
@@ -183,7 +157,7 @@ namespace test_cases
f.remove("bar/cow");
{
- DepSpecStringifier p;
+ SetSpecStringifier p;
f.contents()->accept(p);
TEST_CHECK_STRINGIFY_EQUAL(p.s.str(), "( moo/oink ) ");
}
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index a88fc3f..66ca515 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -47,12 +47,12 @@ NoSuchSyncerError::NoSuchSyncerError(const std::string & format) throw () :
}
SyncFailedError::SyncFailedError(const std::string & local, const std::string & remote) throw () :
- PackageActionError("sync of '" + local + "' from '" + remote + "' failed")
+ Exception("sync of '" + local + "' from '" + remote + "' failed")
{
}
SyncFailedError::SyncFailedError(const std::string & msg) throw () :
- PackageActionError(msg)
+ Exception(msg)
{
}
diff --git a/paludis/syncer.hh b/paludis/syncer.hh
index 1f80885..a3bbfdc 100644
--- a/paludis/syncer.hh
+++ b/paludis/syncer.hh
@@ -105,7 +105,7 @@ namespace paludis
* \ingroup grpexceptions
*/
class PALUDIS_VISIBLE SyncFailedError :
- public PackageActionError
+ public Exception
{
public:
/**
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index fca4336..6fe696f 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -46,6 +46,7 @@ namespace paludis
Environment * const env;
DepList dep_list;
DepList::Iterator current_dep_list_entry;
+ FetchActionOptions fetch_options;
InstallActionOptions install_options;
UninstallActionOptions uninstall_options;
@@ -55,6 +56,7 @@ namespace paludis
tr1::shared_ptr<const DestinationsSet> destinations;
bool pretend;
+ bool fetch_only;
bool preserve_world;
bool had_set_targets;
@@ -66,11 +68,22 @@ namespace paludis
env(e),
dep_list(e, o),
current_dep_list_entry(dep_list.begin()),
- install_options(false, false, iado_none, false, tr1::shared_ptr<Repository>()),
+ fetch_options(
+ FetchActionOptions::create()
+ .safe_resume(false)
+ .fetch_unneeded(false)
+ ),
+ install_options(
+ InstallActionOptions::create()
+ .no_config_protect(false)
+ .debug_build(iado_none)
+ .destination(tr1::shared_ptr<Repository>())
+ ),
uninstall_options(false),
targets(new ConstTreeSequence<SetSpecTree, AllDepSpec>(tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
destinations(d),
pretend(false),
+ fetch_only(false),
preserve_world(false),
had_set_targets(false),
had_package_targets(false),
@@ -178,7 +191,7 @@ InstallTask::execute()
if (_imp->pretend &&
0 != perform_hook(Hook("install_pretend_pre")("TARGETS", join(_imp->raw_targets.begin(),
_imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageInstallActionError("Pretend install aborted by hook");
+ throw InstallActionError("Pretend install aborted by hook");
on_display_merge_list_pre();
@@ -190,7 +203,7 @@ InstallTask::execute()
0 != perform_hook(Hook("install_pretend_display_item_pre")
("TARGET", stringify(*dep->package_id))
("KIND", stringify(dep->kind))).max_exit_status)
- throw PackageInstallActionError("Pretend install aborted by hook");
+ throw InstallActionError("Pretend install aborted by hook");
_imp->current_dep_list_entry = dep;
on_display_merge_list_entry(*dep);
@@ -199,7 +212,7 @@ InstallTask::execute()
0 != perform_hook(Hook("install_pretend_display_item_post")
("TARGET", stringify(*dep->package_id))
("KIND", stringify(dep->kind))).max_exit_status)
- throw PackageInstallActionError("Pretend install aborted by hook");
+ throw InstallActionError("Pretend install aborted by hook");
}
/* we're done displaying our task list */
@@ -222,7 +235,7 @@ InstallTask::execute()
{
if (0 != perform_hook(Hook("install_pretend_post")("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageInstallActionError("Pretend install aborted by hook");
+ throw InstallActionError("Pretend install aborted by hook");
return;
}
@@ -233,11 +246,11 @@ InstallTask::execute()
}
/* we're about to fetch / install the entire list */
- if (_imp->install_options.fetch_only)
+ if (_imp->fetch_only)
{
if (0 != perform_hook(Hook("fetch_all_pre")("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageInstallActionError("Fetch aborted by hook");
+ throw InstallActionError("Fetch aborted by hook");
on_fetch_all_pre();
}
else
@@ -252,7 +265,7 @@ InstallTask::execute()
if (0 != perform_hook(Hook("install_all_pre")
("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
("PALUDIS_NO_LIVE_DESTINATION", any_live_destination ? "" : "yes")).max_exit_status)
- throw PackageInstallActionError("Install aborted by hook");
+ throw InstallActionError("Install aborted by hook");
on_install_all_pre();
}
@@ -280,12 +293,12 @@ InstallTask::execute()
std::string cpvr(stringify(*dep->package_id));
/* we're about to fetch / install one item */
- if (_imp->install_options.fetch_only)
+ if (_imp->fetch_only)
{
if (0 != perform_hook(Hook("fetch_pre")
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageInstallActionError("Fetch of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Fetch of '" + cpvr + "' aborted by hook");
on_fetch_pre(*dep);
}
else
@@ -294,18 +307,24 @@ InstallTask::execute()
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))
("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status)
- throw PackageInstallActionError("Install of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Install of '" + cpvr + "' aborted by hook");
on_install_pre(*dep);
}
/* fetch / install one item */
try
{
- _imp->install_options.destination = dep->destination;
- InstallAction install_action(_imp->install_options);
- dep->package_id->perform_action(install_action);
+ FetchAction fetch_action(_imp->fetch_options);
+ dep->package_id->perform_action(fetch_action);
+
+ if (! _imp->fetch_only)
+ {
+ _imp->install_options.destination = dep->destination;
+ InstallAction install_action(_imp->install_options);
+ dep->package_id->perform_action(install_action);
+ }
}
- catch (const PackageInstallActionError & e)
+ catch (const InstallActionError & e)
{
on_install_fail(*dep);
HookResult PALUDIS_ATTRIBUTE((unused)) dummy(perform_hook(Hook("install_fail")("TARGET", cpvr)("MESSAGE", e.message())));
@@ -313,13 +332,13 @@ InstallTask::execute()
}
/* we've fetched / installed one item */
- if (_imp->install_options.fetch_only)
+ if (_imp->fetch_only)
{
on_fetch_post(*dep);
if (0 != perform_hook(Hook("fetch_post")
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageInstallActionError("Fetch of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Fetch of '" + cpvr + "' aborted by hook");
}
else
{
@@ -328,10 +347,10 @@ InstallTask::execute()
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))
("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status)
- throw PackageInstallActionError("Install of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Install of '" + cpvr + "' aborted by hook");
}
- if (_imp->install_options.fetch_only || ! live_destination)
+ if (_imp->fetch_only || ! live_destination)
continue;
/* figure out whether we need to unmerge (clean) anything */
@@ -379,7 +398,7 @@ InstallTask::execute()
{
if (0 != perform_hook(Hook("clean_all_pre")("TARGETS", join(
indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status)
- throw PackageInstallActionError("Clean aborted by hook");
+ throw InstallActionError("Clean aborted by hook");
on_clean_all_pre(*dep, clean_list);
for (PackageIDSequence::Iterator c(clean_list.begin()),
@@ -388,7 +407,7 @@ InstallTask::execute()
/* clean one item */
if (0 != perform_hook(Hook("clean_pre")("TARGET", stringify(**c))
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageInstallActionError("Clean of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Clean of '" + cpvr + "' aborted by hook");
on_clean_pre(*dep, **c);
try
@@ -396,7 +415,7 @@ InstallTask::execute()
UninstallAction uninstall_action(_imp->uninstall_options);
(*c)->perform_action(uninstall_action);
}
- catch (const PackageUninstallActionError & e)
+ catch (const UninstallActionError & e)
{
on_clean_fail(*dep, **c);
HookResult PALUDIS_ATTRIBUTE((unused)) dummy(perform_hook(Hook("clean_fail")
@@ -407,13 +426,13 @@ InstallTask::execute()
on_clean_post(*dep, **c);
if (0 != perform_hook(Hook("clean_post")("TARGET", stringify(**c))
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageInstallActionError("Clean of '" + cpvr + "' aborted by hook");
+ throw InstallActionError("Clean of '" + cpvr + "' aborted by hook");
}
/* we're done cleaning */
if (0 != perform_hook(Hook("clean_all_post")("TARGETS", join(
indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status)
- throw PackageInstallActionError("Clean aborted by hook");
+ throw InstallActionError("Clean aborted by hook");
on_clean_all_post(*dep, clean_list);
}
@@ -435,7 +454,7 @@ InstallTask::execute()
}
/* update world */
- if (! _imp->install_options.fetch_only)
+ if (! _imp->fetch_only)
{
if (! _imp->preserve_world)
{
@@ -480,19 +499,19 @@ InstallTask::execute()
}
/* we've fetched / installed the entire list */
- if (_imp->install_options.fetch_only)
+ if (_imp->fetch_only)
{
on_fetch_all_post();
if (0 != perform_hook(Hook("fetch_all_post")("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageInstallActionError("Fetch aborted by hook");
+ throw InstallActionError("Fetch aborted by hook");
}
else
{
on_install_all_post();
if (0 != perform_hook(Hook("install_all_post")("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageInstallActionError("Install aborted by hook");
+ throw InstallActionError("Install aborted by hook");
}
}
@@ -518,7 +537,7 @@ InstallTask::set_no_config_protect(const bool value)
void
InstallTask::set_fetch_only(const bool value)
{
- _imp->install_options.fetch_only = value;
+ _imp->fetch_only = value;
}
void
@@ -589,7 +608,7 @@ InstallTask::had_package_targets() const
void
InstallTask::set_safe_resume(const bool value)
{
- _imp->install_options.safe_resume = value;
+ _imp->fetch_options.safe_resume = value;
}
HookResult
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index d678028..7d7bca4 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -342,7 +342,7 @@ UninstallTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("uninstall_all_pre")("TARGETS", join(_imp->raw_targets.begin(),
_imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageUninstallActionError("Uninstall aborted by hook");
+ throw UninstallActionError("Uninstall aborted by hook");
on_uninstall_all_pre();
int x(0), y(0);
@@ -361,7 +361,7 @@ UninstallTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageUninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
+ throw UninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
on_uninstall_pre(*i);
try
@@ -369,7 +369,7 @@ UninstallTask::execute()
UninstallAction uninstall_action(_imp->uninstall_options);
i->package_id->perform_action(uninstall_action);
}
- catch (const PackageUninstallActionError & e)
+ catch (const UninstallActionError & e)
{
HookResult PALUDIS_ATTRIBUTE((unused)) dummy(_imp->env->perform_hook(Hook("uninstall_fail")("TARGET", cpvr)("MESSAGE", e.message())));
throw;
@@ -379,14 +379,14 @@ UninstallTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
- throw PackageUninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
+ throw UninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
}
on_uninstall_all_post();
if (0 !=
_imp->env->perform_hook(Hook("uninstall_all_post")("TARGETS", join(_imp->raw_targets.begin(),
_imp->raw_targets.end(), " "))).max_exit_status)
- throw PackageUninstallActionError("Uninstall aborted by hook");
+ throw UninstallActionError("Uninstall aborted by hook");
}
void
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 43a666b..fb14f25 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -46,6 +46,7 @@ template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonP
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonBlockDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonPlainTextDepSpec>;
template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURIDepSpec>;
+template class ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURILabelsDepSpec>;
template class Visits<const PythonAllDepSpec>;
template class Visits<const PythonAnyDepSpec>;
@@ -54,7 +55,7 @@ template class Visits<const PythonPackageDepSpec>;
template class Visits<const PythonBlockDepSpec>;
template class Visits<const PythonPlainTextDepSpec>;
template class Visits<const PythonURIDepSpec>;
-
+template class Visits<const PythonURILabelsDepSpec>;
PythonDepSpec::PythonDepSpec()
{
@@ -442,6 +443,14 @@ PythonURIDepSpec::renamed_url_suffix() const
return text().substr(p + 4);
}
+PythonURILabelsDepSpec::PythonURILabelsDepSpec(const std::string &)
+{
+}
+
+PythonURILabelsDepSpec::PythonURILabelsDepSpec(const LabelsDepSpec<URILabelVisitorTypes> &)
+{
+}
+
SpecTreeToPython::SpecTreeToPython() :
_current_parent(new PythonAllDepSpec())
{
@@ -508,6 +517,12 @@ SpecTreeToPython::visit_leaf(const BlockDepSpec & d)
_current_parent->add_child(tr1::shared_ptr<PythonBlockDepSpec>(new PythonBlockDepSpec(d)));
}
+void
+SpecTreeToPython::visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> & d)
+{
+ _current_parent->add_child(tr1::shared_ptr<PythonURILabelsDepSpec>(new PythonURILabelsDepSpec(d)));
+}
+
const tr1::shared_ptr<const PythonDepSpec>
SpecTreeToPython::result() const
{
@@ -554,6 +569,7 @@ struct AllowedTypes<URISpecTree>
AllowedTypes(const AllDepSpec &) {};
AllowedTypes(const UseDepSpec &) {};
AllowedTypes(const URIDepSpec &) {};
+ AllowedTypes(const LabelsDepSpec<URILabelVisitorTypes> &) {};
};
template<>
@@ -650,6 +666,13 @@ struct NiceClassNames<URIDepSpec>
const char * NiceClassNames<URIDepSpec>::name = "URIDepSpec";
template<>
+struct NiceClassNames<LabelsDepSpec<URILabelVisitorTypes> >
+{
+ static const char * name;
+};
+const char * NiceClassNames<LabelsDepSpec<URILabelVisitorTypes> >::name = "URILabelsDepSpec";
+
+template<>
struct NiceClassNames<BlockDepSpec>
{
static const char * name;
@@ -812,6 +835,13 @@ SpecTreeFromPython<H_>::visit(const PythonURIDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::visit(const PythonURILabelsDepSpec & d)
+{
+ dispatch<H_, LabelsDepSpec<URILabelVisitorTypes> >(this, d);
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::visit(const PythonBlockDepSpec & d)
{
dispatch<H_, BlockDepSpec>(this, d);
@@ -895,6 +925,15 @@ SpecTreeFromPython<H_>::real_visit(const PythonURIDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::real_visit(const PythonURILabelsDepSpec &)
+{
+ _add(tr1::shared_ptr<TreeLeaf<H_, LabelsDepSpec<URILabelVisitorTypes> > >(
+ new TreeLeaf<H_, LabelsDepSpec<URILabelVisitorTypes> >(tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> >(
+ new LabelsDepSpec<URILabelVisitorTypes>))));
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::real_visit(const PythonBlockDepSpec & d)
{
_add(tr1::shared_ptr<TreeLeaf<H_, BlockDepSpec> >(
@@ -1310,6 +1349,17 @@ void PALUDIS_VISIBLE expose_dep_spec()
;
/**
+ * URILabelsDepSpec
+ */
+ bp::class_<PythonURILabelsDepSpec, bp::bases<PythonDepSpec>, boost::noncopyable>
+ (
+ "URILabelsDepSpec",
+ "A URILabelsDepSpec represents a URI label.",
+ bp::init<const std::string &>("__init__(str)")
+ )
+ ;
+
+ /**
* BlockDepSpec
*/
bp::class_<PythonBlockDepSpec, bp::bases<PythonStringDepSpec>, boost::noncopyable >
@@ -1331,3 +1381,4 @@ void PALUDIS_VISIBLE expose_dep_spec()
)
;
}
+
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 71644ff..ca2aa69 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -37,6 +37,7 @@ namespace paludis
class PythonPackageDepSpec;
class PythonURIDepSpec;
class PythonBlockDepSpec;
+ class PythonURILabelsDepSpec;
struct PythonDepSpecVisitorTypes :
VisitorTypes<
@@ -48,7 +49,8 @@ namespace paludis
PythonBlockDepSpec,
PythonPlainTextDepSpec,
PythonPackageDepSpec,
- PythonURIDepSpec
+ PythonURIDepSpec,
+ PythonURILabelsDepSpec
>
{
};
@@ -209,6 +211,15 @@ namespace paludis
tr1::shared_ptr<const PythonPackageDepSpec> blocked_spec() const;
};
+ class PALUDIS_VISIBLE PythonURILabelsDepSpec :
+ public PythonDepSpec,
+ public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonURILabelsDepSpec>
+ {
+ public:
+ PythonURILabelsDepSpec(const std::string &);
+ PythonURILabelsDepSpec(const LabelsDepSpec<URILabelVisitorTypes> &);
+ };
+
/**
* Used to convert one of the SpecTrees to PythonDepSpec.
*/
@@ -245,6 +256,8 @@ namespace paludis
void visit_leaf(const BlockDepSpec &);
void visit_leaf(const URIDepSpec &);
+
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &);
};
/**
@@ -273,6 +286,7 @@ namespace paludis
void visit(const PythonPlainTextDepSpec &);
void visit(const PythonBlockDepSpec &);
void visit(const PythonURIDepSpec &);
+ void visit(const PythonURILabelsDepSpec &);
void real_visit(const PythonAllDepSpec &);
void real_visit(const PythonAnyDepSpec &);
@@ -281,6 +295,7 @@ namespace paludis
void real_visit(const PythonPlainTextDepSpec &);
void real_visit(const PythonBlockDepSpec &);
void real_visit(const PythonURIDepSpec &);
+ void real_visit(const PythonURILabelsDepSpec &);
};
}
}
diff --git a/python/repository.cc b/python/repository.cc
index ad26e3c..8cc8198 100644
--- a/python/repository.cc
+++ b/python/repository.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/environment.hh>
#include <paludis/util/set.hh>
@@ -188,24 +189,21 @@ void PALUDIS_VISIBLE expose_repository()
/**
* Exceptions
*/
- ExceptionRegister::get_instance()->add_exception<PackageActionError>
- ("PackageActionError", "BaseException",
+ ExceptionRegister::get_instance()->add_exception<ActionError>
+ ("ActionError", "BaseException",
"Parent class for install, uninstall errors.");
- ExceptionRegister::get_instance()->add_exception<PackageInstallActionError>
- ("PackageInstallActionError", "PackageActionError",
+ ExceptionRegister::get_instance()->add_exception<InstallActionError>
+ ("InstallActionError", "ActionError",
"Thrown if an install fails.");
- ExceptionRegister::get_instance()->add_exception<PackageFetchActionError>
- ("PackageFetchActionError", "PackageActionError",
+ ExceptionRegister::get_instance()->add_exception<FetchActionError>
+ ("FetchActionError", "ActionError",
"Thrown if a fetch fails.");
- ExceptionRegister::get_instance()->add_exception<PackageUninstallActionError>
- ("PackageUninstallActionError", "PackageActionError",
+ ExceptionRegister::get_instance()->add_exception<UninstallActionError>
+ ("UninstallActionError", "ActionError",
"Thrown if an uninstall fails.");
- ExceptionRegister::get_instance()->add_exception<PackageConfigActionError>
- ("PackageConfigActionError", "PackageActionError",
+ ExceptionRegister::get_instance()->add_exception<ConfigActionError>
+ ("ConfigActionError", "ActionError",
"Thrown if a configure fails.");
- ExceptionRegister::get_instance()->add_exception<EnvironmentVariableActionError>
- ("EnvironmentVariableActionError", "PackageActionError",
- "Thrown if an environment variable query fails.");
/**
* DestinationIterable
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 868c7da..66d414c 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -40,6 +40,7 @@
#include <paludis/query.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
+#include <paludis/action.hh>
/** \file
* Handle the --install action for the contrarius program.
@@ -261,7 +262,7 @@ do_install(tr1::shared_ptr<Environment> env, std::string spec_str)
cerr << endl;
return 1;
}
- catch (const PackageInstallActionError & e)
+ catch (const InstallActionError & e)
{
cout << endl;
cerr << "Install error:" << endl;
@@ -271,13 +272,46 @@ do_install(tr1::shared_ptr<Environment> env, std::string spec_str)
return_code |= 1;
}
- catch (const PackageFetchActionError & e)
+ catch (const FetchActionError & e)
{
cout << endl;
cerr << "Fetch error:" << endl;
cerr << " * " << e.backtrace("\n * ");
cerr << e.message() << endl;
cerr << endl;
+ if (e.failures())
+ {
+ for (Sequence<FetchActionFailure>::Iterator f(e.failures()->begin()), f_end(e.failures()->end()) ;
+ f != f_end ; ++f)
+ {
+ cerr << " * File '" << f->target_file << "': ";
+
+ bool need_comma(false);
+ if (f->requires_manual_fetching)
+ {
+ cerr << "requires manual fetching";
+ need_comma = true;
+ }
+
+ if (f->failed_automatic_fetching)
+ {
+ if (need_comma)
+ cerr << ", ";
+ cerr << "failed automatic fetching";
+ need_comma = true;
+ }
+
+ if (! f->failed_integrity_checks.empty())
+ {
+ if (need_comma)
+ cerr << "failed automatic fetching";
+ cerr << "failed integrity checks: " << f->failed_integrity_checks;
+ need_comma = true;
+ }
+
+ cerr << endl;
+ }
+ }
return_code |= 1;
}
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 41d700e..afad9a6 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -54,6 +54,7 @@
#include <paludis/query.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
+#include <paludis/action.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -587,7 +588,7 @@ do_install(tr1::shared_ptr<Environment> env)
cerr << endl;
return 1;
}
- catch (const PackageInstallActionError & e)
+ catch (const InstallActionError & e)
{
cout << endl;
cerr << "Install error:" << endl;
@@ -599,13 +600,48 @@ do_install(tr1::shared_ptr<Environment> env)
return_code |= 1;
}
- catch (const PackageFetchActionError & e)
+ catch (const FetchActionError & e)
{
cout << endl;
cerr << "Fetch error:" << endl;
cerr << " * " << e.backtrace("\n * ");
cerr << e.message() << endl;
cerr << endl;
+
+ if (e.failures())
+ {
+ for (Sequence<FetchActionFailure>::Iterator f(e.failures()->begin()), f_end(e.failures()->end()) ;
+ f != f_end ; ++f)
+ {
+ cerr << " * File '" << f->target_file << "': ";
+
+ bool need_comma(false);
+ if (f->requires_manual_fetching)
+ {
+ cerr << "requires manual fetching";
+ need_comma = true;
+ }
+
+ if (f->failed_automatic_fetching)
+ {
+ if (need_comma)
+ cerr << ", ";
+ cerr << "failed automatic fetching";
+ need_comma = true;
+ }
+
+ if (! f->failed_integrity_checks.empty())
+ {
+ if (need_comma)
+ cerr << "failed automatic fetching";
+ cerr << "failed integrity checks: " << f->failed_integrity_checks;
+ need_comma = true;
+ }
+
+ cerr << endl;
+ }
+ }
+
show_resume_command(env, task);
cerr << endl;
diff --git a/src/clients/paludis/install_TEST b/src/clients/paludis/install_TEST
index d7356c5..1e83e04 100755
--- a/src/clients/paludis/install_TEST
+++ b/src/clients/paludis/install_TEST
@@ -26,7 +26,7 @@ PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
grep target install_TEST_dir/root/var/db/pkg/world >/dev/null && exit 10
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
- --query test-category/target || exit 11
+ -qMD test-category/target || exit 11
true
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index 5c16226..4d75570 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -25,6 +25,7 @@
#include <paludis/util/set.hh>
#include <paludis/dep_list/uninstall_list.hh>
#include <paludis/package_database.hh>
+#include <paludis/action.hh>
#include <iostream>
#include <limits>
@@ -256,7 +257,7 @@ namespace
cerr << endl;
return 1;
}
- catch (const PackageUninstallActionError & e)
+ catch (const UninstallActionError & e)
{
cout << endl;
cerr << "Uninstall error:" << endl;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 84848dc..fb26bfc 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -215,10 +215,9 @@ namespace
{
if (k.type() == type)
{
- task->output_left_column(task->want_raw() ? k.human_name() + ":" : k.raw_name());
if (task->want_raw())
{
- task->output_left_column(k.raw_name());
+ task->output_left_column(k.raw_name() + ":");
task->output_right_column(k.pretty_print_flat());
}
else
@@ -235,16 +234,15 @@ namespace
{
if (k.type() == type)
{
- task->output_left_column(task->want_raw() ? k.human_name() + ":" : k.raw_name());
if (task->want_raw())
{
- task->output_left_column(k.raw_name());
+ task->output_left_column(k.raw_name() + ":");
task->output_right_column(k.pretty_print_flat());
}
else
{
task->output_left_column(k.human_name() + ":");
- task->output_stream() << k.pretty_print();
+ task->output_stream() << k.pretty_print_flat();
task->output_right_column("");
}
}
@@ -254,10 +252,9 @@ namespace
{
if (k.type() == type)
{
- task->output_left_column(task->want_raw() ? k.human_name() + ":" : k.raw_name());
if (task->want_raw())
{
- task->output_left_column(k.raw_name());
+ task->output_left_column(k.raw_name() + ":");
task->output_right_column(k.pretty_print_flat());
}
else
@@ -274,10 +271,9 @@ namespace
{
if (k.type() == type)
{
- task->output_left_column(task->want_raw() ? k.human_name() + ":" : k.raw_name());
if (task->want_raw())
{
- task->output_left_column(k.raw_name());
+ task->output_left_column(k.raw_name() + ":");
task->output_right_column(k.pretty_print_flat());
}
else
@@ -294,10 +290,9 @@ namespace
{
if (k.type() == type)
{
- task->output_left_column(task->want_raw() ? k.human_name() + ":" : k.raw_name());
if (task->want_raw())
{
- task->output_left_column(k.raw_name());
+ task->output_left_column(k.raw_name() + ":");
task->output_right_column(k.pretty_print_flat());
}
else
@@ -414,6 +409,10 @@ namespace
{
empty = false;
}
+
+ void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
+ {
+ }
};
template <typename T_>