aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-31 00:57:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-31 00:57:08 +0000
commitf9f8c7f89f0adbfb1d31292345e6e33a8ea53718 (patch)
tree8d96c203f0cde05e06de4efdbf3f0ace0f90da6b
parent42d73ef9ad00615d05563262beaebb297f4ec5a9 (diff)
downloadpaludis-f9f8c7f89f0adbfb1d31292345e6e33a8ea53718.tar.gz
paludis-f9f8c7f89f0adbfb1d31292345e6e33a8ea53718.tar.xz
Don't try to install things that're already installed, unless there's a newer version available. Remove the ignore patch self dep code now that we have a usable vdb.
-rw-r--r--paludis/dep_list.cc68
-rw-r--r--paludis/dep_list.hh6
-rw-r--r--paludis/package_database.cc24
-rw-r--r--paludis/package_database.hh17
-rw-r--r--paludis/vdb_repository.hh4
-rw-r--r--src/command_line.cc1
-rw-r--r--src/command_line.hh3
-rw-r--r--src/install.cc1
8 files changed, 79 insertions, 45 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 0d6d1ce..3e16a2a 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -106,7 +106,6 @@ namespace paludis
bool recursive_deps;
bool drop_circular;
bool drop_self_circular;
- bool dont_ignore_patch_dep;
bool drop_all;
bool ignore_installed;
///}
@@ -127,7 +126,6 @@ namespace paludis
recursive_deps(true),
drop_circular(false),
drop_self_circular(false),
- dont_ignore_patch_dep(false),
drop_all(false),
ignore_installed(false),
stack_depth(0),
@@ -314,35 +312,39 @@ DepList::visit(const PackageDepAtom * const p)
{
Context context("When resolving package dependency '" + stringify(*p) + "':");
- /* are we already there? */
- std::list<DepListEntry>::iterator i;
- if (_imp->merge_list.end() != ((i = std::find_if(
- _imp->merge_list.begin(),
- _imp->merge_list.end(),
- DepListEntryMatcher(
- _imp->environment->package_database().raw_pointer(), *p)))))
+ PackageDatabaseEntryCollection::ConstPointer installed(
+ _imp->environment->package_database()->query_installed(p));
+
+ /* are we already on the merge list? */
{
- /* what's our status? */
- if (! i->get<dle_has_predeps>())
+ std::list<DepListEntry>::iterator i;
+ if (_imp->merge_list.end() != ((i = std::find_if(
+ _imp->merge_list.begin(),
+ _imp->merge_list.end(),
+ DepListEntryMatcher(
+ _imp->environment->package_database().raw_pointer(), *p)))))
{
- if (_imp->drop_circular)
- return;
- else if (_imp->merge_list_insert_pos == i && (
- _imp->drop_self_circular || (
- ! _imp->dont_ignore_patch_dep && p->package() ==
- QualifiedPackageName("sys-devel/patch"))))
- return;
- else
- throw CircularDependencyError(i, next(i));
- }
+ /* what's our status? */
+ if (! i->get<dle_has_predeps>())
+ {
+ if (! installed->empty())
+ return;
- return;
+ else if (_imp->drop_circular)
+ return;
+
+ else
+ throw CircularDependencyError(i, next(i));
+ }
+
+ return;
+ }
}
/* are we allowed to install things? */
if (_imp->check_existing_only)
{
- _imp->match_found = false;
+ _imp->match_found = ! installed->empty();
return;
}
@@ -355,6 +357,12 @@ DepList::visit(const PackageDepAtom * const p)
for (PackageDatabaseEntryCollection::ReverseIterator e(matches->rbegin()),
e_end(matches->rend()) ; e != e_end ; ++e)
{
+ /* if we're already installed, only include us if we're a better version */
+ /// \todo SLOTs?
+ if (! installed->empty())
+ if (e->get<pde_version>() <= installed->last()->get<pde_version>())
+ continue;
+
/* check masks */
if (_imp->environment->mask_reasons(*e).any())
continue;
@@ -365,7 +373,12 @@ DepList::visit(const PackageDepAtom * const p)
}
if (! match)
- throw AllMaskedError(stringify(*p));
+ {
+ if (! installed->empty())
+ return;
+ else
+ throw AllMaskedError(stringify(*p));
+ }
/* make merge entry */
std::list<DepListEntry>::iterator merge_entry(
@@ -409,7 +422,6 @@ DepList::visit(const PackageDepAtom * const p)
}
}
-
Save<std::list<DepListEntry>::iterator> old_merge_list_insert_pos(
&_imp->merge_list_insert_pos, merge_entry);
@@ -643,12 +655,6 @@ DepList::set_drop_self_circular(const bool value)
}
void
-DepList::set_dont_ignore_patch_dep(const bool value)
-{
- _imp->dont_ignore_patch_dep = value;
-}
-
-void
DepList::set_drop_all(const bool value)
{
_imp->drop_all = value;
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 6cd4a62..a5fff32 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -271,12 +271,6 @@ namespace paludis
void set_drop_self_circular(const bool value);
/**
- * Behaviour: if set, don't ignore the stupid sys-devel/patch dep
- * upon itself
- */
- void set_dont_ignore_patch_dep(const bool value);
-
- /**
* Behaviour: if set, any circular dependencies are treated as if
* they do not exist.
*/
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 3c5d9d3..ac321a4 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -160,7 +160,7 @@ PackageDatabase::fetch_unique_qualified_package_name(
}
PackageDatabaseEntryCollection::Pointer
-PackageDatabase::query(const PackageDepAtom * const a) const
+PackageDatabase::_do_query(const PackageDepAtom * const a, bool installed_only) const
{
PackageDatabaseEntryCollection::Pointer result(new PackageDatabaseEntryCollection);
@@ -169,6 +169,9 @@ PackageDatabase::query(const PackageDepAtom * const a) const
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
{
+ if (installed_only && ! r->installed())
+ continue;
+
if (! r->has_category_named(a->package().get<qpn_category>()))
continue;
@@ -187,10 +190,21 @@ PackageDatabase::query(const PackageDepAtom * const a) const
}
}
-
return result;
}
+PackageDatabaseEntryCollection::Pointer
+PackageDatabase::query(const PackageDepAtom * const a) const
+{
+ return _do_query(a, false);
+}
+
+PackageDatabaseEntryCollection::Pointer
+PackageDatabase::query_installed(const PackageDepAtom * const a) const
+{
+ return _do_query(a, true);
+}
+
const RepositoryName &
PackageDatabase::better_repository(const RepositoryName & r1,
const RepositoryName & r2) const
@@ -224,6 +238,12 @@ PackageDatabase::query(PackageDepAtom::ConstPointer a) const
return query(a.raw_pointer());
}
+PackageDatabaseEntryCollection::Pointer
+PackageDatabase::query_installed(PackageDepAtom::ConstPointer a) const
+{
+ return query_installed(a.raw_pointer());
+}
+
PackageDatabase::RepositoryIterator
PackageDatabase::begin_repositories() const
{
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 91dd8e2..0e442b5 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -191,6 +191,10 @@ namespace paludis
private InstantiationPolicy<PackageDatabase, instantiation_method::NonCopyableTag>,
public InternalCounted<PackageDatabase>
{
+ private:
+ PackageDatabaseEntryCollection::Pointer _do_query(
+ const PackageDepAtom * const a, bool installed_only) const;
+
public:
/**
* Constructor.
@@ -247,6 +251,19 @@ namespace paludis
PackageDepAtom::ConstPointer a) const;
/**
+ * Query the repository, installed packages only.
+ */
+ PackageDatabaseEntryCollection::Pointer query_installed(
+ const PackageDepAtom * const a) const;
+
+ /**
+ * Query the repository (overload for a CountedPtr), installed
+ * packages only.
+ */
+ PackageDatabaseEntryCollection::Pointer query_installed(
+ PackageDepAtom::ConstPointer a) const;
+
+ /**
* Which repository is better?
*/
const RepositoryName & better_repository(const RepositoryName &,
diff --git a/paludis/vdb_repository.hh b/paludis/vdb_repository.hh
index 6309ecb..e79410f 100644
--- a/paludis/vdb_repository.hh
+++ b/paludis/vdb_repository.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_VDB_REPOSITORY_HH 1
#include <paludis/repository.hh>
+#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
namespace paludis
@@ -68,7 +69,8 @@ namespace paludis
virtual bool do_is_mirror(const std::string &) const;
- virtual void do_install(const QualifiedPackageName &, const VersionSpec &) const;
+ virtual void do_install(const QualifiedPackageName &,
+ const VersionSpec &) const PALUDIS_ATTRIBUTE((noreturn));
public:
/**
diff --git a/src/command_line.cc b/src/command_line.cc
index 4325ab3..9231f08 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -58,7 +58,6 @@ CommandLine::CommandLine() :
("as-needed", "To resolve circular dependencies"),
"as-needed"),
a_dl_drop_self_circular(&dl_args, "dl-drop-self-circular", '\0', "Drop self-circular dependencies"),
- a_dl_patch_dep(&dl_args, "dl-dont-ignore-the-frickin-patch-dep", '\0', "Don't ignore the stupid patch depend on itself"),
a_dl_drop_circular(&dl_args, "dl-drop-circular", '\0', "Drop circular dependencies"),
a_dl_drop_all(&dl_args, "dl-drop-all", '0', "Drop all dependencies"),
a_dl_ignore_installed(&dl_args, "dl-ignore-installed", 'e', "Ignore installed packages"),
diff --git a/src/command_line.hh b/src/command_line.hh
index 9a47b6d..70c19d9 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -136,9 +136,6 @@ class CommandLine :
/// --dl-drop-self-circular
paludis::args::SwitchArg a_dl_drop_self_circular;
- /// --dl-dont-ignore-the-frickin-patch-dep
- paludis::args::SwitchArg a_dl_patch_dep;
-
/// --dl-drop-circular
paludis::args::SwitchArg a_dl_drop_circular;
diff --git a/src/install.cc b/src/install.cc
index 6dd5f92..8d905cf 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -61,7 +61,6 @@ do_install()
p::DepList dep_list(env);
dep_list.set_drop_self_circular(CommandLine::get_instance()->a_dl_drop_self_circular.specified());
- dep_list.set_dont_ignore_patch_dep(CommandLine::get_instance()->a_dl_patch_dep.specified());
dep_list.set_drop_circular(CommandLine::get_instance()->a_dl_drop_circular.specified());
dep_list.set_drop_all(CommandLine::get_instance()->a_dl_drop_all.specified());
dep_list.set_ignore_installed(CommandLine::get_instance()->a_dl_ignore_installed.specified());