aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-30 17:40:00 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-30 17:40:00 +0000
commitd4d82ee3cb912898b8fae820e3e53bd9a075f5a4 (patch)
treea290b0519f3f3b052dd20a5d69020d5066812410
parent0d3ff4c44d9934db94e00e9cb0bec5f319d35f3d (diff)
downloadpaludis-d4d82ee3cb912898b8fae820e3e53bd9a075f5a4.tar.gz
paludis-d4d82ee3cb912898b8fae820e3e53bd9a075f5a4.tar.xz
Add exclude unmirrorable fetch option
-rw-r--r--doc/api/cplusplus/examples/example_action.cc5
-rw-r--r--doc/api/ruby/example_action.rb3
-rw-r--r--paludis/action.hh6
-rw-r--r--paludis/install_task.cc1
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc33
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.hh3
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc2
-rw-r--r--paludis/repositories/e/ebuild_entries.cc2
-rw-r--r--paludis/repositories/e/source_uri_finder.hh2
-rw-r--r--python/action.cc10
-rwxr-xr-xpython/action_TEST.py9
-rw-r--r--ruby/action.cc19
-rw-r--r--ruby/action_TEST.rb15
-rw-r--r--src/clients/accerso/accerso.cc1
14 files changed, 74 insertions, 37 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index 57d858c..fc3f83d 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -58,9 +58,10 @@ int main(int argc, char * argv[])
/* Carry out a FetchAction. We need to specify various options when
* creating a FetchAction, controlling whether safe resume is used
- * and whether unneeded (e.g. due to disabled USE flags) source
- * files should still be fetched. */
+ * and whether unneeded (e.g. due to disabled USE flags) and
+ * unmirrorable source files should still be fetched. */
FetchAction fetch_action(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(true)
diff --git a/doc/api/ruby/example_action.rb b/doc/api/ruby/example_action.rb
index 8cd500f..60db632 100644
--- a/doc/api/ruby/example_action.rb
+++ b/doc/api/ruby/example_action.rb
@@ -32,8 +32,9 @@ ids.each do | id |
# Carry out a FetchAction. We need to specify various options when creating a FetchAction,
# controlling whether safe resume is used and whether unneeded (e.g. due to disabled USE
- # flags) source files should still be fetched.
+ # flags) and unmirrorable source files should still be fetched.
fetch_action = FetchAction.new(FetchActionOptions.new({
+ :exclude_unmirrorable => false,
:fetch_unneeded => false,
:safe_resume => true
}))
diff --git a/paludis/action.hh b/paludis/action.hh
index a336fad..59f9662 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -49,6 +49,7 @@ namespace paludis
{
struct config_protect;
struct destination;
+ struct exclude_unmirrorable;
struct failed_automatic_fetching;
struct failed_integrity_checks;
struct fetch_unneeded;
@@ -68,6 +69,11 @@ namespace paludis
*/
struct FetchActionOptions
{
+ /**
+ * \since 0.32
+ */
+ NamedValue<n::exclude_unmirrorable, bool> exclude_unmirrorable;
+
NamedValue<n::fetch_unneeded, bool> fetch_unneeded;
/**
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index f5c820e..2da262c 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -95,6 +95,7 @@ namespace paludis
dep_list(e, o),
fetch_options(
make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(false)
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 4aa9e40..3f76ca2 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -61,6 +61,7 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> id;
const FSEntry distdir;
const bool check_unneeded;
+ const bool exclude_unmirrorable;
std::set<std::string> done;
const std::tr1::shared_ptr<Sequence<FetchActionFailure> > failures;
@@ -80,11 +81,13 @@ namespace paludis
const bool n,
const FSEntry & m2,
const UseManifest um,
- const std::tr1::shared_ptr<OutputDeviant> & md) :
+ const std::tr1::shared_ptr<OutputDeviant> & md,
+ const bool x) :
env(e),
id(i),
distdir(d),
check_unneeded(c),
+ exclude_unmirrorable(x),
failures(new Sequence<FetchActionFailure>),
need_nofetch(false),
in_nofetch(n),
@@ -105,8 +108,9 @@ CheckFetchedFilesVisitor::CheckFetchedFilesVisitor(
const bool n,
const FSEntry & m2,
const UseManifest um,
- const std::tr1::shared_ptr<OutputDeviant> & md) :
- PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n, m2, um, md))
+ const std::tr1::shared_ptr<OutputDeviant> & md,
+ const bool x) :
+ PrivateImplementationPattern<CheckFetchedFilesVisitor>(new Implementation<CheckFetchedFilesVisitor>(e, i, d, c, n, m2, um, md, x))
{
}
@@ -369,16 +373,19 @@ CheckFetchedFilesVisitor::visit_leaf(const FetchableURIDepSpec & u)
{
if (_imp->in_nofetch)
{
- Log::get_instance()->message("e.check_fetched_files.requires_manual", ll_debug, lc_context)
- << "Manual fetch required for '" << u.filename() << "'";
- *_imp->out << "requires manual fetch";
- _imp->need_nofetch = true;
- _imp->failures->push_back(make_named_values<FetchActionFailure>(
- value_for<n::failed_automatic_fetching>(false),
- value_for<n::failed_integrity_checks>(""),
- value_for<n::requires_manual_fetching>(true),
- value_for<n::target_file>(u.filename())
- ));
+ if (! _imp->exclude_unmirrorable)
+ {
+ Log::get_instance()->message("e.check_fetched_files.requires_manual", ll_debug, lc_context)
+ << "Manual fetch required for '" << u.filename() << "'";
+ *_imp->out << "requires manual fetch";
+ _imp->need_nofetch = true;
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>(""),
+ value_for<n::requires_manual_fetching>(true),
+ value_for<n::target_file>(u.filename())
+ ));
+ }
}
else
{
diff --git a/paludis/repositories/e/check_fetched_files_visitor.hh b/paludis/repositories/e/check_fetched_files_visitor.hh
index 6d0a87e..a27dc8f 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.hh
+++ b/paludis/repositories/e/check_fetched_files_visitor.hh
@@ -53,7 +53,8 @@ namespace paludis
const bool fetch_restrict,
const FSEntry & m2,
const UseManifest um,
- const std::tr1::shared_ptr<OutputDeviant> & maybe_output_deviant);
+ const std::tr1::shared_ptr<OutputDeviant> & maybe_output_deviant,
+ const bool exclude_unmirrorable);
~CheckFetchedFilesVisitor();
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index acc6150..19e877d 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -916,6 +916,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
FetchAction action(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(true)
@@ -1020,6 +1021,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
FetchAction action(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(true)
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index c65fcfe..7cd2458 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -443,7 +443,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
o.fetch_unneeded(), fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
_imp->e_repository->params().use_manifest,
- o.maybe_output_deviant());
+ o.maybe_output_deviant(), o.exclude_unmirrorable());
id->fetches_key()->value()->accept(c);
if (c.need_nofetch())
diff --git a/paludis/repositories/e/source_uri_finder.hh b/paludis/repositories/e/source_uri_finder.hh
index 35aa581..36e672b 100644
--- a/paludis/repositories/e/source_uri_finder.hh
+++ b/paludis/repositories/e/source_uri_finder.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* 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
diff --git a/python/action.cc b/python/action.cc
index 507fcff..de929f4 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -73,11 +73,13 @@ namespace
}
FetchActionOptions * make_fetch_action_options(
+ const bool exclude_unmirrorable,
const bool fetch_unneeded,
const bool safe_resume
)
{
return new FetchActionOptions(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(exclude_unmirrorable),
value_for<n::fetch_unneeded>(fetch_unneeded),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(safe_resume)
@@ -166,9 +168,15 @@ void expose_action()
.def("__init__",
bp::make_constructor(&make_fetch_action_options),
- "__init__(fetch_uneeded, safe_resume)"
+ "__init__(exclude_unmirrorable, fetch_uneeded, safe_resume)"
)
+ .add_property("exclude_unmirrorable",
+ &named_values_getter<FetchActionOptions, n::exclude_unmirrorable, bool, &FetchActionOptions::exclude_unmirrorable>,
+ &named_values_setter<FetchActionOptions, n::exclude_unmirrorable, bool, &FetchActionOptions::exclude_unmirrorable>,
+ "[rw] bool"
+ )
+
.add_property("fetch_unneeded",
&named_values_getter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
&named_values_setter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
diff --git a/python/action_TEST.py b/python/action_TEST.py
index 51d14d7..a123935 100755
--- a/python/action_TEST.py
+++ b/python/action_TEST.py
@@ -46,17 +46,20 @@ class TestCase_01_InstallActionOptions(unittest.TestCase):
class TestCase_02_FetchActionOptions(unittest.TestCase):
def test_01_create(self):
- FetchActionOptions(True, True)
+ FetchActionOptions(True, True, True)
def test_02_data_members(self):
- fao = FetchActionOptions(True, True)
+ fao = FetchActionOptions(True, True, True)
+ self.assertEquals(fao.exclude_unmirrorable, True)
self.assertEquals(fao.fetch_unneeded, True)
self.assertEquals(fao.safe_resume, True)
+ fao.exclude_unmirrorable = False
fao.fetch_unneeded = False
fao.safe_resume = False
+ self.assertEquals(fao.exclude_unmirrorable, False)
self.assertEquals(fao.fetch_unneeded, False)
self.assertEquals(fao.safe_resume, False)
@@ -69,7 +72,7 @@ class TestCase_04_InstallAction(unittest.TestCase):
class TestCase_05_FetchAction(unittest.TestCase):
def test_01_create(self):
- FetchAction(FetchActionOptions(True, True))
+ FetchAction(FetchActionOptions(False, True, True))
class TestCase_06_UninstallAction(unittest.TestCase):
def test_01_create(self):
diff --git a/ruby/action.cc b/ruby/action.cc
index 58e763c..dd10a9f 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -217,7 +217,7 @@ namespace
/*
* call-seq:
- * FetchActionOptions.new(fetch_unneeded, safe_resume) -> FetchActionOptions
+ * FetchActionOptions.new(exclude_unmirrorable, fetch_unneeded, safe_resume) -> FetchActionOptions
* FetchActionOptions.new(Hash) -> FetchActionOptions
*
* FetchActionOptions.new can either be called with all parameters in order, or with one hash
@@ -229,6 +229,7 @@ namespace
FetchActionOptions * ptr(0);
try
{
+ bool v_exclude_unmirrorable;
bool v_fetch_unneeded;
bool v_safe_resume;
@@ -238,22 +239,23 @@ namespace
rb_raise(rb_eArgError, "Missing Parameter: fetch_unneeded");
if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("safe_resume"))))
rb_raise(rb_eArgError, "Missing Parameter: safe_resume");
- v_fetch_unneeded =
- rb_hash_aref(argv[0], ID2SYM(rb_intern("fetch_unneeded"))) != Qfalse;
- v_safe_resume =
- rb_hash_aref(argv[0], ID2SYM(rb_intern("safe_resume"))) != Qfalse;
+ v_fetch_unneeded = rb_hash_aref(argv[0], ID2SYM(rb_intern("fetch_unneeded"))) != Qfalse;
+ v_safe_resume = rb_hash_aref(argv[0], ID2SYM(rb_intern("safe_resume"))) != Qfalse;
+ v_exclude_unmirrorable = rb_hash_aref(argv[0], ID2SYM(rb_intern("exclude_unmirrorable"))) != Qfalse;
}
- else if (2 == argc)
+ else if (3 == argc)
{
+ v_exclude_unmirrorable = argv[0] != Qfalse;
v_fetch_unneeded = argv[0] != Qfalse;
v_safe_resume = argv[1] != Qfalse;
}
else
{
- rb_raise(rb_eArgError, "FetchActionOptions expects one or two arguments, but got %d",argc);
+ rb_raise(rb_eArgError, "FetchActionOptions expects one or three arguments, but got %d",argc);
}
ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(v_exclude_unmirrorable),
value_for<n::fetch_unneeded>(v_fetch_unneeded),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(v_safe_resume)
@@ -724,6 +726,9 @@ namespace
rb_define_method(c_fetch_action_options, "safe_resume?",
RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::safe_resume, bool,
&FetchActionOptions::safe_resume>::fetch)), 0);
+ rb_define_method(c_fetch_action_options, "exclude_unmirrorable?",
+ RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::exclude_unmirrorable, bool,
+ &FetchActionOptions::exclude_unmirrorable>::fetch)), 0);
/*
* Document-class: Paludis::FetchActionFailure
diff --git a/ruby/action_TEST.rb b/ruby/action_TEST.rb
index c8cc5d1..0b5fd3c 100644
--- a/ruby/action_TEST.rb
+++ b/ruby/action_TEST.rb
@@ -87,9 +87,9 @@ module Paludis
class TestCase_FetchActionOptions < Test::Unit::TestCase
def test_create
- assert_kind_of FetchActionOptions, FetchActionOptions.new(false, false)
+ assert_kind_of FetchActionOptions, FetchActionOptions.new(false, false, false)
assert_kind_of FetchActionOptions, FetchActionOptions.new(
- {:safe_resume => false, :fetch_unneeded => false})
+ {:safe_resume => false, :fetch_unneeded => false, :exclude_unmirrorable => false})
end
end
@@ -147,11 +147,11 @@ module Paludis
class TestCase_FetchAction < Test::Unit::TestCase
def test_create
- assert_kind_of FetchAction, FetchAction.new(FetchActionOptions.new(false, false))
- assert_kind_of Action, FetchAction.new(FetchActionOptions.new(false, false))
+ assert_kind_of FetchAction, FetchAction.new(FetchActionOptions.new(false, false, false))
+ assert_kind_of Action, FetchAction.new(FetchActionOptions.new(false, false, false))
assert_kind_of FetchAction, FetchAction.new(FetchActionOptions.new(
- {:safe_resume => false, :fetch_unneeded => false}))
+ {:safe_resume => false, :fetch_unneeded => false, :exclude_unmirrorable => false}))
end
def test_bad_create
@@ -165,15 +165,16 @@ module Paludis
end
def test_options
- a = FetchAction.new(FetchActionOptions.new(false, true))
+ a = FetchAction.new(FetchActionOptions.new(false, true, false))
assert_kind_of FetchActionOptions, a.options
assert !a.options.fetch_unneeded?
assert a.options.safe_resume?
- a = FetchAction.new(FetchActionOptions.new({:safe_resume => false, :fetch_unneeded => true}))
+ a = FetchAction.new(FetchActionOptions.new({:safe_resume => false, :fetch_unneeded => true, :exclude_unmirrorable => false}))
assert_kind_of FetchActionOptions, a.options
assert a.options.fetch_unneeded?
assert !a.options.safe_resume?
+ assert !a.options.exclude_unmirrorable?
end
end
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index e556229..38755b6 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -136,6 +136,7 @@ main(int argc, char *argv[])
try
{
FetchAction a(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(true),
value_for<n::fetch_unneeded>(true),
value_for<n::maybe_output_deviant>(make_null_shared_ptr()),
value_for<n::safe_resume>(true)