aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-02 04:28:12 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-02 04:28:12 +0100
commitd7f42a8566937f53326989cce30bece16bbee814 (patch)
treecfc2732021437e53e3e64052abacb79b0bf3fd5e
parent7ee12e2d21290c3c05768cf156d1bc0a98312ec1 (diff)
downloadpaludis-d7f42a8566937f53326989cce30bece16bbee814.tar.gz
paludis-d7f42a8566937f53326989cce30bece16bbee814.tar.xz
Don't require virtuals repository.
Various test cases would fail if we didn't enable virtuals repository support. For distributions that don't use old style virtuals, building virtuals repository just for test cases is silly. Fixes: ticket:603
-rw-r--r--configure.ac13
-rw-r--r--paludis/Makefile.am.m42
-rw-r--r--paludis/dep_list_TEST.cc6
-rw-r--r--paludis/dep_list_TEST.hh28
-rw-r--r--paludis/dep_list_TEST_blockers.cc6
-rw-r--r--paludis/environments/no_config/no_config_environment.cc6
-rw-r--r--paludis/environments/paludis/paludis_config.cc4
-rw-r--r--paludis/environments/portage/portage_environment.cc5
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc24
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh46
-rw-r--r--paludis/uninstall_list_TEST.cc24
-rw-r--r--python/Makefile.am7
-rwxr-xr-xpython/mask_TEST.py25
-rwxr-xr-xpython/package_database_TEST.py11
-rwxr-xr-xpython/package_id_TEST.py10
-rw-r--r--ruby/Makefile.am7
-rw-r--r--ruby/package_database_TEST.rb21
17 files changed, 181 insertions, 64 deletions
diff --git a/configure.ac b/configure.ac
index dcabdf7..e5f655c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1078,6 +1078,19 @@ BUILD_REPOSITORIES="$repositories"
AC_SUBST([ALL_REPOSITORIES])
AC_SUBST([BUILD_REPOSITORIES])
+for r in e fake ; do
+ if ! echo $repositories | tr ' ' '\n' | grep "^$r\$" >/dev/null ; then
+ AC_MSG_ERROR([Building without $r repository is unsupported])
+ fi
+done
+
+enable_virtuals_repository=
+if echo $repositories | tr ' ' '\n' | grep '^virtuals$' >/dev/null ; then
+ AC_DEFINE_UNQUOTED([ENABLE_VIRTUALS_REPOSITORY], [1], [Enable virtuals repository])
+ enable_virtuals_repository=yes
+fi
+AM_CONDITIONAL([ENABLE_VIRTUALS_REPOSITORY], test "x$enable_virtuals_repository" = "xyes")
+
if echo $repositories | tr ' ' '\n' | grep '^gems$' >/dev/null ; then
need_syck_check=yes
need_gem_check=yes
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 4dff060..2c0168b 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -22,7 +22,6 @@ $1_TEST_LDADD = \
$(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
$(top_builddir)/paludis/repositories/e/libpaludiserepository.la \
$(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
- $(top_builddir)/paludis/repositories/virtuals/libpaludisvirtualsrepository.la \
libpaludis.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(DYNAMIC_LD_LIBS)
@@ -125,7 +124,6 @@ dep_list_TEST_blockers_LDADD = \
$(top_builddir)/test/libtest.a \
$(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
$(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
- $(top_builddir)/paludis/repositories/virtuals/libpaludisvirtualsrepository.la \
libpaludis.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(DYNAMIC_LD_LIBS)
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index fb92e6c..5e6057f 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -1167,6 +1167,7 @@ namespace test_cases
}
} test_dep_list_55;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
/**
* \test Test DepList resolution behaviour.
*
@@ -1188,6 +1189,7 @@ namespace test_cases
expected.push_back("cat/one-1:0::repo");
}
} test_dep_list_56;
+#endif
/**
* \test Test DepList resolution behaviour.
@@ -1211,6 +1213,7 @@ namespace test_cases
}
} test_dep_list_57;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
/**
* \test Test DepList resolution behaviour.
*
@@ -1229,6 +1232,7 @@ namespace test_cases
expected.push_back("virtual/two-1::virtuals (virtual for cat/one-1:0::repo)");
}
} test_dep_list_58;
+#endif
/**
* \test Test DepList resolution behaviour.
@@ -1274,6 +1278,7 @@ namespace test_cases
}
} test_dep_list_60;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
struct DepListTestCase61 : DepListTestCase<61>
{
void populate_repo()
@@ -1293,6 +1298,7 @@ namespace test_cases
expected.push_back("virtual/foo-2::virtuals (virtual for cat/two-2:0::repo)");
}
} test_dep_list_61;
+#endif
/**
* \test Test DepList resolution behaviour.
diff --git a/paludis/dep_list_TEST.hh b/paludis/dep_list_TEST.hh
index a8a04a2..e27a236 100644
--- a/paludis/dep_list_TEST.hh
+++ b/paludis/dep_list_TEST.hh
@@ -24,18 +24,19 @@
#include <paludis/dep_list_exceptions.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/repositories/virtuals/virtuals_repository.hh>
-#include <paludis/repositories/virtuals/installed_virtuals_repository.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/environments/test/test_environment.hh>
+#include <paludis/repository_maker.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <string>
#include <list>
#include <ostream>
+#include "config.h"
+
using namespace paludis;
using namespace test;
@@ -73,6 +74,15 @@ namespace paludis
return s;
}
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::string virtuals_repo_keys(const std::string & k)
+ {
+ if (k == "root")
+ return "/";
+ return "";
+ }
+#endif
}
namespace test_cases
@@ -88,8 +98,10 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<FakeRepository> repo;
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo;
- std::tr1::shared_ptr<VirtualsRepository> virtuals_repo;
- std::tr1::shared_ptr<InstalledVirtualsRepository> installed_virtuals_repo;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::tr1::shared_ptr<Repository> virtuals_repo;
+ std::tr1::shared_ptr<Repository> installed_virtuals_repo;
+#endif
std::list<std::string> expected;
std::string merge_target;
bool done_populate;
@@ -102,14 +114,18 @@ namespace test_cases
env(),
repo(new FakeRepository(&env, RepositoryName("repo"))),
installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed"))),
- virtuals_repo(new VirtualsRepository(&env)),
- installed_virtuals_repo(new InstalledVirtualsRepository(&env, FSEntry("/"))),
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ virtuals_repo((*(*RepositoryMaker::get_instance())["virtuals"])(&env, virtuals_repo_keys)),
+ installed_virtuals_repo((*(*RepositoryMaker::get_instance())["installed_virtuals"])(&env, virtuals_repo_keys)),
+#endif
done_populate(false)
{
env.package_database()->add_repository(4, repo);
env.package_database()->add_repository(3, installed_repo);
+#ifdef ENABLE_VIRTUALS_REPOSITORY
env.package_database()->add_repository(2, virtuals_repo);
env.package_database()->add_repository(1, installed_virtuals_repo);
+#endif
}
/**
diff --git a/paludis/dep_list_TEST_blockers.cc b/paludis/dep_list_TEST_blockers.cc
index 68b6fb0..ae94f88 100644
--- a/paludis/dep_list_TEST_blockers.cc
+++ b/paludis/dep_list_TEST_blockers.cc
@@ -79,6 +79,7 @@ namespace test_cases
}
} test_dep_list_list_block;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
struct DepListTestCaseSelfBlock : DepListTestCaseBase
{
DepListTestCaseSelfBlock() : DepListTestCaseBase("self block via provide on list") { }
@@ -140,6 +141,7 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL(*next(next(next(d.begin())))->package_id, "cat/one-1:0::repo");
}
} test_dep_list_provided_block;
+#endif
struct DepListTestCaseBlockOnList : DepListTestCaseBase
{
@@ -208,6 +210,7 @@ namespace test_cases
}
} test_dep_list_no_block_on_no_upgrade;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
struct DepListTestCaseNoBlockOnNoUpgradeViaProvided : DepListTestCaseBase
{
DepListTestCaseNoBlockOnNoUpgradeViaProvided() : DepListTestCaseBase("no block on no upgrade via provided") { }
@@ -280,6 +283,7 @@ namespace test_cases
expected.push_back("cat/one-1:0::repo");
}
} test_dep_list_no_block_on_replaced_provide;
+#endif
struct DepListTestCaseRestrictedOlderSelf : DepListTestCaseBase
{
@@ -308,6 +312,7 @@ namespace test_cases
}
} test_dep_list_restricted_older_self;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
struct DepListTestCaseRestrictedOlderSelfProvide : DepListTestCaseBase
{
DepListTestCaseRestrictedOlderSelfProvide() : DepListTestCaseBase("restricted older self provide") { }
@@ -365,6 +370,7 @@ namespace test_cases
TEST_CHECK(d.begin() == d.end());
}
} test_dep_list_restricted_older_other_provide;
+#endif
}
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 84bb2ce..fa06394 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -41,6 +41,8 @@
#include <set>
#include <list>
+#include "config.h"
+
using namespace paludis;
using namespace paludis::no_config_environment;
@@ -220,9 +222,11 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
RepositoryMaker::get_instance()->find_maker("ebuild")(env,
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))));
+#ifdef ENABLE_VIRTUALS_REPOSITORY
if ((*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::support_old_style_virtuals()])
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(env,
std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
+#endif
}
else
{
@@ -244,9 +248,11 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
new Map<std::string, std::string>);
iv_keys->insert("root", "/");
+#ifdef ENABLE_VIRTUALS_REPOSITORY
if ((*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::support_old_style_virtuals()])
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
+#endif
}
}
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 2439c25..7bdc045 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -373,8 +373,9 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
/* repositories */
{
- /* add virtuals repositories */
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ /* add virtuals repositories */
if ((*DistributionData::get_instance()->distribution_from_string(distribution()))[k::support_old_style_virtuals()])
{
std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(
@@ -392,6 +393,7 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
(k::keys(), std::tr1::bind(&from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1))
);
}
+#endif
/* add normal repositories */
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 708404f..9957183 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -56,6 +56,7 @@
#include <vector>
#include <list>
#include <fstream>
+#include "config.h"
using namespace paludis;
using namespace paludis::portage_environment;
@@ -462,22 +463,26 @@ PortageEnvironment::_load_profile(const FSEntry & d)
void
PortageEnvironment::_add_virtuals_repository()
{
+#ifdef ENABLE_VIRTUALS_REPOSITORY
std::tr1::shared_ptr<Map<std::string, std::string> > keys(
new Map<std::string, std::string>);
package_database()->add_repository(-2,
RepositoryMaker::get_instance()->find_maker("virtuals")(this,
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+#endif
}
void
PortageEnvironment::_add_installed_virtuals_repository()
{
+#ifdef ENABLE_VIRTUALS_REPOSITORY
std::tr1::shared_ptr<Map<std::string, std::string> > keys(
new Map<std::string, std::string>);
keys->insert("root", stringify(root()));
package_database()->add_repository(-1,
RepositoryMaker::get_instance()->find_maker("installed_virtuals")(this,
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+#endif
}
void
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 39dfdb5..b4c0e87 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -51,6 +51,8 @@
#include <fstream>
#include <string>
+#include "config.h"
+
using namespace test;
using namespace paludis;
@@ -1071,6 +1073,12 @@ namespace test_cases
void run()
{
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
+#else
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
+#endif
+
TestEnvironment env;
env.set_paludis_command("/bin/false");
@@ -1094,12 +1102,14 @@ namespace test_cases
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
env.package_database()->add_repository(2, installed_repo);
+#ifdef ENABLE_VIRTUALS_REPOSITORY
std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
iv_keys->insert("root", "/");
env.package_database()->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(&env,
std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(&env,
std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
+#endif
InstallAction action(InstallActionOptions::named_create()
(k::debug_build(), iado_none)
@@ -1108,12 +1118,14 @@ namespace test_cases
(k::destination(), installed_repo)
);
+#ifdef ENABLE_VIRTUALS_REPOSITORY
{
const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=virtual/virtual-pretend-installed-0",
&env, UserPackageDepSpecOptions()))))]->last());
TEST_CHECK(id);
}
+#endif
{
TestMessageSuffix suffix("in-ebuild die", true);
@@ -1524,6 +1536,11 @@ namespace test_cases
void run()
{
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
+#else
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
+#endif
TestEnvironment env;
env.set_paludis_command("/bin/false");
std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
@@ -1546,13 +1563,6 @@ namespace test_cases
installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
env.package_database()->add_repository(2, installed_repo);
- std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
- iv_keys->insert("root", "/");
- env.package_database()->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(&env,
- std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(&env,
- std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
-
InstallAction action(InstallActionOptions::named_create()
(k::debug_build(), iado_none)
(k::checks(), iaco_default)
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 4438138..6b173e4 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -786,19 +786,21 @@ pkg_setup() {
BV2=$(best_version cat/doesnotexist )
[[ "$BV2" == "" ]] || die "BV2 is $BV2"
- if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
- die "failed virtual/virtual-pretend-installed"
- fi
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
- BV3=$(best_version virtual/virtual-pretend-installed )
- [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
- if best_version virtual/virtual-doesnotexist >/dev/null ; then
- die "not failed virtual/virtual-doesnotexist"
- fi
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
- BV2=$(best_version virtual/virtual-doesnotexist )
- [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
}
END
mkdir -p "cat/has-version"
@@ -1533,20 +1535,22 @@ pkg_setup() {
BV2=$(best_version cat/doesnotexist )
[[ "$BV2" == "" ]] || die "BV2 is $BV2"
- if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
- die "failed virtual/virtual-pretend-installed"
- fi
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
- BV3=$(best_version virtual/virtual-pretend-installed )
- [[ "$BV3" == "virtual/virtual-pretend-installed-1::installed-virtuals (virtual for cat/pretend-installed-1:0::installed)" ]] \
- || die "BV3 is $BV3"
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "virtual/virtual-pretend-installed-1::installed-virtuals (virtual for cat/pretend-installed-1:0::installed)" ]] \
+ || die "BV3 is $BV3"
- if best_version virtual/virtual-doesnotexist >/dev/null ; then
- die "not failed virtual/virtual-doesnotexist"
- fi
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
- BV2=$(best_version virtual/virtual-doesnotexist )
- [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
}
END
mkdir -p "packages/cat/has-version"
diff --git a/paludis/uninstall_list_TEST.cc b/paludis/uninstall_list_TEST.cc
index c8cf335..460a5f9 100644
--- a/paludis/uninstall_list_TEST.cc
+++ b/paludis/uninstall_list_TEST.cc
@@ -21,11 +21,11 @@
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/repositories/virtuals/virtuals_repository.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/package_database.hh>
+#include <paludis/repository_maker.hh>
#include <paludis/user_dep_spec.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -33,6 +33,8 @@
#include <list>
#include <ostream>
+#include "config.h"
+
using namespace paludis;
using namespace test;
@@ -46,6 +48,16 @@ namespace paludis
}
}
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+namespace
+{
+ std::string virtuals_repo_keys(const std::string &)
+ {
+ return "";
+ }
+}
+#endif
+
namespace test_cases
{
/**
@@ -58,7 +70,9 @@ namespace test_cases
protected:
TestEnvironment env;
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo;
- std::tr1::shared_ptr<VirtualsRepository> virtuals_repo;
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::tr1::shared_ptr<Repository> virtuals_repo;
+#endif
std::tr1::shared_ptr<PackageIDSequence> targets;
std::list<std::string> expected;
bool done_populate;
@@ -71,13 +85,17 @@ namespace test_cases
TestCase("uninstall list " + s),
env(),
installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed"))),
- virtuals_repo(new VirtualsRepository(&env)),
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ virtuals_repo((*(*RepositoryMaker::get_instance())["virtuals"])(&env, virtuals_repo_keys)),
+#endif
targets(new PackageIDSequence),
done_populate(false),
unused_target(false)
{
env.package_database()->add_repository(2, installed_repo);
+#ifdef ENABLE_VIRTUALS_REPOSITORY
env.package_database()->add_repository(1, virtuals_repo);
+#endif
}
/**
diff --git a/python/Makefile.am b/python/Makefile.am
index 1e91b52..dd3201a 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -102,6 +102,12 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
repository_TEST_setup.sh repository_TEST_cleanup.sh \
paludis_output_wrapper.py
+if ENABLE_VIRTUALS_REPOSITORY
+PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE=yes
+else
+PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE=no
+endif
+
TESTS_ENVIRONMENT = env \
TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
@@ -117,6 +123,7 @@ TESTS_ENVIRONMENT = env \
PALUDIS_QA_DATA_DIR="$(top_srcdir)/paludis/repositories/e/qa/" \
PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \
PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \
+ PALUDIS_ENABLE_VIRTUALS_REPOSITORY="$(PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE)" \
SYSCONFDIR="$(sysconfdir)" \
LD_LIBRARY_PATH=`echo "\`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/.libs\`: \
\`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/.libs\`: \
diff --git a/python/mask_TEST.py b/python/mask_TEST.py
index 93be950..ae228f7 100755
--- a/python/mask_TEST.py
+++ b/python/mask_TEST.py
@@ -89,17 +89,20 @@ class TestCase_01_Masks(unittest.TestCase):
self.assertEquals(m.explanation(), "Unsupported EAPI 'unsupported'")
def test_05_association_mask(self):
- q = Selection.RequireExactlyOne(Generator.Matches(
- parse_user_package_dep_spec("=virtual/association-1.0", self.e, [])))
- pid = iter(self.e[q]).next()
- m = iter(pid.masks).next()
-
- self.assert_(isinstance(m, Mask))
- self.assert_(isinstance(m, AssociationMask))
-
- self.assertEquals(m.key(), "A")
- self.assertEquals(m.description(), "by association")
- self.assertEquals(m.associated_package().name, "masked/repo")
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ q = Selection.RequireExactlyOne(Generator.Matches(
+ parse_user_package_dep_spec("=virtual/association-1.0", self.e, [])))
+ pid = iter(self.e[q]).next()
+ m = iter(pid.masks).next()
+
+ self.assert_(isinstance(m, Mask))
+ self.assert_(isinstance(m, AssociationMask))
+
+ self.assertEquals(m.key(), "A")
+ self.assertEquals(m.description(), "by association")
+ self.assertEquals(m.associated_package().name, "masked/repo")
+ elif os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") != "no":
+ raise "oops"
class TestCase_02_Masks_subclassing(unittest.TestCase):
def test_01_user_mask(self):
diff --git a/python/package_database_TEST.py b/python/package_database_TEST.py
index 933805e..b3dfa12 100755
--- a/python/package_database_TEST.py
+++ b/python/package_database_TEST.py
@@ -53,12 +53,13 @@ class TestCase_PackageDatabase(unittest.TestCase):
Filter.SupportsUninstallAction())
def test_6_repositories(self):
- self.get_db()
- self.assert_(self.db.more_important_than("testrepo", "virtuals"))
- self.assert_(not self.db.more_important_than("virtuals", "testrepo"))
- self.assertRaises(NoSuchRepositoryError, self.db.fetch_repository, "blah")
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ self.get_db()
+ self.assert_(self.db.more_important_than("testrepo", "virtuals"))
+ self.assert_(not self.db.more_important_than("virtuals", "testrepo"))
+ self.assertRaises(NoSuchRepositoryError, self.db.fetch_repository, "blah")
- self.assertEqual(len(list(self.db.repositories)), 3)
+ self.assertEqual(len(list(self.db.repositories)), 3)
if __name__ == "__main__":
unittest.main()
diff --git a/python/package_id_TEST.py b/python/package_id_TEST.py
index aee738b..1dade02 100755
--- a/python/package_id_TEST.py
+++ b/python/package_id_TEST.py
@@ -33,7 +33,8 @@ class TestCase_01_PackageID(unittest.TestCase):
self.e = NoConfigEnvironment(repo_path, "/var/empty")
self.ie = NoConfigEnvironment(irepo_path)
self.pid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("foo/bar")).next()
- self.vpid = iter(self.e.package_database.fetch_repository("virtuals").package_ids("virtual/bar")).next()
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ self.vpid = iter(self.e.package_database.fetch_repository("virtuals").package_ids("virtual/bar")).next()
self.ipid = iter(self.ie.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one")).next()
self.mpid = iter(self.e.package_database.fetch_repository("testrepo").package_ids("cat/masked")).next()
@@ -113,9 +114,10 @@ class TestCase_01_PackageID(unittest.TestCase):
self.assert_(isinstance(mask, UnacceptedMask))
def test_14_virtual_for_key(self):
- self.assertEquals(self.vpid.virtual_for_key().value(), self.pid)
- self.assertEquals(self.pid.virtual_for_key(), None)
- self.assertEquals(self.ipid.virtual_for_key(), None)
+ if os.environ.get("PALUDIS_ENABLE_VIRTUALS_REPOSITORY") == "yes":
+ self.assertEquals(self.vpid.virtual_for_key().value(), self.pid)
+ self.assertEquals(self.pid.virtual_for_key(), None)
+ self.assertEquals(self.ipid.virtual_for_key(), None)
def test_15_provide_key(self):
self.assert_(isinstance(self.pid.provide_key(), MetadataProvideSpecTreeKey))
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 5a08bc2..89639c0 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -86,6 +86,12 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
repository_TEST_setup.sh repository_TEST_cleanup.sh \
action_TEST_setup.sh action_TEST_cleanup.sh
+if ENABLE_VIRTUALS_REPOSITORY
+PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE=yes
+else
+PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE=no
+endif
+
TESTS_ENVIRONMENT = env \
TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
@@ -101,6 +107,7 @@ TESTS_ENVIRONMENT = env \
PALUDIS_DISTRIBUTION="gentoo" \
PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \
PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \
+ PALUDIS_ENABLE_VIRTUALS_REPOSITORY="$(PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE)" \
SYSCONFDIR="$(sysconfdir)" \
LD_LIBRARY_PATH=`echo "\`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/.libs\`: \
\`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/.libs\`: \
diff --git a/ruby/package_database_TEST.rb b/ruby/package_database_TEST.rb
index e79f1f2..4935b3e 100644
--- a/ruby/package_database_TEST.rb
+++ b/ruby/package_database_TEST.rb
@@ -97,7 +97,11 @@ module Paludis
end
def test_repositories
- assert_equal 3, db.repositories.length
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert_equal 3, db.repositories.length
+ else
+ assert_equal 1, db.repositories.length
+ end
a = db.repositories.find_all do | repo |
repo.name == "testrepo"
@@ -121,13 +125,22 @@ module Paludis
end
def test_more_important_than
- assert db.more_important_than('testrepo', 'virtuals')
- assert ! db.more_important_than('virtuals', 'testrepo')
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert db.more_important_than('testrepo', 'virtuals')
+ assert ! db.more_important_than('virtuals', 'testrepo')
+ elsif ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "no" then
+ else
+ throw "oops"
+ end
end
def test_has_repository_named?
assert db.has_repository_named?('testrepo')
- assert db.has_repository_named?('virtuals')
+ if ENV["PALUDIS_ENABLE_VIRTUALS_REPOSITORY"] == "yes" then
+ assert db.has_repository_named?('virtuals')
+ else
+ assert ! db.has_repository_named?('virtuals')
+ end
assert ! db.has_repository_named?('foobarbaz')
end
end