aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-25 14:58:29 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-25 14:58:29 +0000
commit726b7f4fb107623b1ba395d5ee769efbcea2cdb4 (patch)
tree47d70ac7df788916bff5714cfb75a7375fef7a7e
parent8aca0f10d1934e4d0170df3eea4c6ab1428a7027 (diff)
downloadpaludis-726b7f4fb107623b1ba395d5ee769efbcea2cdb4.tar.gz
paludis-726b7f4fb107623b1ba395d5ee769efbcea2cdb4.tar.xz
Fix safe resume. Fixes: ticket:372
-rw-r--r--paludis/repositories/e/ebuild_entries.cc2
-rw-r--r--paludis/repositories/e/fetch_visitor.cc16
-rw-r--r--paludis/repositories/e/fetch_visitor.hh3
-rw-r--r--paludis/repositories/e/fetch_visitor_TEST.cc2
4 files changed, 16 insertions, 7 deletions
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 2ca8a60..961a494 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -412,7 +412,7 @@ EbuildEntries::fetch(const tr1::shared_ptr<const ERepositoryID> & id,
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, no_mirror);
+ mirrors_name, fetch_restrict, no_mirror, o.safe_resume);
id->src_uri_key()->value()->accept(f);
CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded, fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
diff --git a/paludis/repositories/e/fetch_visitor.cc b/paludis/repositories/e/fetch_visitor.cc
index 95ec239..8eeec03 100644
--- a/paludis/repositories/e/fetch_visitor.cc
+++ b/paludis/repositories/e/fetch_visitor.cc
@@ -56,6 +56,7 @@ namespace paludis
const std::string mirrors_name;
const bool fetch_restrict;
const bool no_mirror;
+ const bool safe_resume;
tr1::shared_ptr<LabelsDepSpec<URILabelVisitorTypes> > default_label;
std::list<const LabelsDepSpec<URILabelVisitorTypes> *> labels;
@@ -69,7 +70,8 @@ namespace paludis
const bool u,
const std::string & m,
const bool n,
- const bool nm) :
+ const bool nm,
+ const bool sr) :
env(e),
id(i),
eapi(p),
@@ -78,7 +80,8 @@ namespace paludis
userpriv(u),
mirrors_name(m),
fetch_restrict(n),
- no_mirror(nm)
+ no_mirror(nm),
+ safe_resume(sr)
{
if (fetch_restrict)
{
@@ -107,8 +110,9 @@ FetchVisitor::FetchVisitor(
const bool u,
const std::string & m,
const bool n,
- const bool nm) :
- PrivateImplementationPattern<FetchVisitor>(new Implementation<FetchVisitor>(e, i, p, d, f, u, m, n, nm))
+ const bool nm,
+ const bool sr) :
+ PrivateImplementationPattern<FetchVisitor>(new Implementation<FetchVisitor>(e, i, p, d, f, u, m, n, nm, sr))
{
}
@@ -241,6 +245,10 @@ FetchVisitor::visit_leaf(const URIDepSpec & u)
.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"));
+ if (_imp->safe_resume)
+ cmd
+ .with_setenv("PALUDIS_USE_SAFE_RESUME", "yesplease");
+
std::cout << "Trying to fetch '" << i->first << "' to '" << i->second << "'..." << std::endl;
if (0 != run_command(cmd))
destination.unlink();
diff --git a/paludis/repositories/e/fetch_visitor.hh b/paludis/repositories/e/fetch_visitor.hh
index 8f968c9..381ba16 100644
--- a/paludis/repositories/e/fetch_visitor.hh
+++ b/paludis/repositories/e/fetch_visitor.hh
@@ -48,7 +48,8 @@ namespace paludis
const bool userpriv,
const std::string & mirrors_name,
const bool fetch_restrict,
- const bool no_mirror);
+ const bool no_mirror,
+ const bool safe_resume);
~FetchVisitor();
diff --git a/paludis/repositories/e/fetch_visitor_TEST.cc b/paludis/repositories/e/fetch_visitor_TEST.cc
index 87d3cde..12258f0 100644
--- a/paludis/repositories/e/fetch_visitor_TEST.cc
+++ b/paludis/repositories/e/fetch_visitor_TEST.cc
@@ -55,7 +55,7 @@ namespace test_cases
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, false);
+ false, false, "test", false, false, 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());