aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-15 14:47:38 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-15 14:47:38 +0000
commit4c31df7e3cc20f753e4b15b9a1689fbacfe1e63a (patch)
treed9bcc5e730ba1751ab5a2df579b9516e3f1de68c
parent95459be4d333b35c61189c501b7728c8bfb589ad (diff)
downloadpaludis-4c31df7e3cc20f753e4b15b9a1689fbacfe1e63a.tar.gz
paludis-4c31df7e3cc20f753e4b15b9a1689fbacfe1e63a.tar.xz
--fetch support.
-rw-r--r--paludis/portage_repository.cc9
-rw-r--r--src/command_line.cc1
-rw-r--r--src/command_line.hh3
-rw-r--r--src/install.cc112
4 files changed, 74 insertions, 51 deletions
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 3fa056e..6de148e 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -1184,7 +1184,14 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
}
std::string actions;
- if (metadata->get(vmk_virtual).empty())
+ if (o.get<io_fetchonly>())
+ {
+ if (metadata->get(vmk_virtual).empty())
+ actions = "init fetch";
+ else
+ actions = "";
+ }
+ else if (metadata->get(vmk_virtual).empty())
actions = "init fetch setup unpack compile test install strip preinst merge postinst tidyup";
else
actions = "merge";
diff --git a/src/command_line.cc b/src/command_line.cc
index 94107d1..528f410 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -57,6 +57,7 @@ CommandLine::CommandLine() :
a_pretend(&install_args, "pretend", 'p', "Pretend only"),
a_preserve_world(&install_args, "preserve-world", '1', "Don't modify the world file"),
a_no_config_protection(&install_args, "no-config-protection", '\0', "Disable config file protection (dangerous)"),
+ a_fetch(&install_args, "fetch", 'f', "Only fetch sources; don't install anything"),
dl_args(this, "DepList behaviour (use with caution)"),
a_dl_rdepend_post(&dl_args, "dl-rdepend-post", '\0', "Treat RDEPEND like PDEPEND",
diff --git a/src/command_line.hh b/src/command_line.hh
index ce636c5..6291a56 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -143,6 +143,9 @@ class CommandLine :
/// --no-config-protection
paludis::args::SwitchArg a_no_config_protection;
+ /// --fetch
+ paludis::args::SwitchArg a_fetch;
+
/// }
/// \name DepList behaviour arguments
diff --git a/src/install.cc b/src/install.cc
index ca8a41c..bff90eb 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -257,6 +257,8 @@ do_install()
p::InstallOptions opts(false, false);
if (CommandLine::get_instance()->a_no_config_protection.specified())
opts.set<io_noconfigprotect>(true);
+ if (CommandLine::get_instance()->a_fetch.specified())
+ opts.set<io_fetchonly>(true);
for (p::DepList::Iterator dep(dep_list.begin()), dep_end(dep_list.end()) ;
dep != dep_end ; ++dep)
@@ -264,63 +266,73 @@ do_install()
std::string cpv = p::stringify(dep->get<p::dle_name>()) + "-" +
p::stringify(dep->get<p::dle_version>());
- cout << endl << colour(cl_heading,
- "Installing " + cpv) << endl << endl;
-
- // TODO: some way to reset this properly would be nice.
- cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
- p::stringify(max_count) + ") Installing " + cpv);
-
- env->package_database()->fetch_repository(dep->get<p::dle_repository>())->
- install(dep->get<p::dle_name>(), dep->get<p::dle_version>(), opts);
-
- // figure out if we need to unmerge anything
- cout << endl << colour(cl_heading,
- "Cleaning stale versions after installing " + cpv) << endl << endl;
-
- // manually invalidate any installed repos, they're probably
- // wrong now
- for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((*r)->installed())
- (*r)->invalidate();
-
- // look for packages with the same name in the same slot
- p::PackageDatabaseEntryCollection::Pointer collision_list(env->package_database()->query(
- p::PackageDepAtom::Pointer(new p::PackageDepAtom(
- p::stringify(dep->get<p::dle_name>()) + ":" +
- p::stringify(dep->get<p::dle_metadata>()->get(vmk_slot)))),
- is_installed_only));
-
- // don't clean the thing we just installed
- p::PackageDatabaseEntryCollection clean_list;
- for (p::PackageDatabaseEntryCollection::Iterator c(collision_list->begin()),
- c_end(collision_list->end()) ; c != c_end ; ++c)
- if (dep->get<dle_version>() != c->get<pde_version>())
- clean_list.insert(*c);
-
- if (clean_list.empty())
+ if (opts.get<io_fetchonly>())
{
- cout << "* No cleaning required" << endl;
+ cout << endl << colour(cl_heading, "Fetching " + cpv) << endl << endl;
}
else
{
- for (p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
- c_end(clean_list.end()) ; c != c_end ; ++c)
- cout << "* " << colour(cl_package_name, *c) << endl;
- cout << endl;
+ cout << endl << colour(cl_heading,
+ "Installing " + cpv) << endl << endl;
- for (p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
- c_end(clean_list.end()) ; c != c_end ; ++c)
- {
- cout << endl << colour(cl_heading, "Cleaning " + p::stringify(*c)) << endl << endl;
+ // TODO: some way to reset this properly would be nice.
+ cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
+ p::stringify(max_count) + ") Installing " + cpv);
+ }
- // TODO: some way to reset this properly would be nice.
- cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
- p::stringify(max_count) + ") Cleaning " + cpv + ": " + stringify(*c));
+ env->package_database()->fetch_repository(dep->get<p::dle_repository>())->
+ install(dep->get<p::dle_name>(), dep->get<p::dle_version>(), opts);
- env->package_database()->fetch_repository(c->get<p::pde_repository>())->
- uninstall(c->get<p::pde_name>(), c->get<p::pde_version>(), opts);
+ if (! opts.get<io_fetchonly>())
+ {
+ // figure out if we need to unmerge anything
+ cout << endl << colour(cl_heading,
+ "Cleaning stale versions after installing " + cpv) << endl << endl;
+
+ // manually invalidate any installed repos, they're probably
+ // wrong now
+ for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
+ r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ if ((*r)->installed())
+ (*r)->invalidate();
+
+ // look for packages with the same name in the same slot
+ p::PackageDatabaseEntryCollection::Pointer collision_list(env->package_database()->query(
+ p::PackageDepAtom::Pointer(new p::PackageDepAtom(
+ p::stringify(dep->get<p::dle_name>()) + ":" +
+ p::stringify(dep->get<p::dle_metadata>()->get(vmk_slot)))),
+ is_installed_only));
+
+ // don't clean the thing we just installed
+ p::PackageDatabaseEntryCollection clean_list;
+ for (p::PackageDatabaseEntryCollection::Iterator c(collision_list->begin()),
+ c_end(collision_list->end()) ; c != c_end ; ++c)
+ if (dep->get<dle_version>() != c->get<pde_version>())
+ clean_list.insert(*c);
+
+ if (clean_list.empty())
+ {
+ cout << "* No cleaning required" << endl;
+ }
+ else
+ {
+ for (p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
+ c_end(clean_list.end()) ; c != c_end ; ++c)
+ cout << "* " << colour(cl_package_name, *c) << endl;
+ cout << endl;
+
+ for (p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
+ c_end(clean_list.end()) ; c != c_end ; ++c)
+ {
+ cout << endl << colour(cl_heading, "Cleaning " + p::stringify(*c)) << endl << endl;
+
+ // TODO: some way to reset this properly would be nice.
+ cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
+ p::stringify(max_count) + ") Cleaning " + cpv + ": " + stringify(*c));
+
+ env->package_database()->fetch_repository(c->get<p::pde_repository>())->
+ uninstall(c->get<p::pde_name>(), c->get<p::pde_version>(), opts);
+ }
}
}
}