diff options
author | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-25 09:27:59 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-25 09:27:59 -0700 |
commit | c390627ceec5e83b7548ecd17bcbaef2951ed224 (patch) | |
tree | 9f10bc7e813b60fc4311501c1b52bdd9fc8ed5c8 | |
parent | d0a3123239ea004964d3882148a87ca2a6c7db92 (diff) | |
download | aptitude-c390627ceec5e83b7548ecd17bcbaef2951ed224.tar.gz |
Replace direct uses of OpTextProgress with calls to make_text_progress().
-rw-r--r-- | src/cmdline/cmdline_clean.cc | 12 | ||||
-rw-r--r-- | src/cmdline/cmdline_do_action.cc | 12 | ||||
-rw-r--r-- | src/cmdline/cmdline_download.cc | 8 | ||||
-rw-r--r-- | src/cmdline/cmdline_extract_cache_subset.cc | 9 | ||||
-rw-r--r-- | src/cmdline/cmdline_forget_new.cc | 10 | ||||
-rw-r--r-- | src/cmdline/cmdline_user_tag.cc | 8 | ||||
-rw-r--r-- | src/cmdline/cmdline_util.cc | 10 |
7 files changed, 48 insertions, 21 deletions
diff --git a/src/cmdline/cmdline_clean.cc b/src/cmdline/cmdline_clean.cc index 69cc13b3..d10ddc5e 100644 --- a/src/cmdline/cmdline_clean.cc +++ b/src/cmdline/cmdline_clean.cc @@ -8,6 +8,7 @@ #include <generic/apt/apt.h> #include <generic/apt/config_signal.h> +#include <generic/apt/text_progress.h> #include <apt-pkg/acquire.h> #include <apt-pkg/clean.h> @@ -21,6 +22,9 @@ using namespace std; +using aptitude::apt::make_text_progress; +using boost::shared_ptr; + int cmdline_clean(int argc, char *argv[], bool simulate) { _error->DumpErrors(); @@ -31,9 +35,9 @@ int cmdline_clean(int argc, char *argv[], bool simulate) return -1; } - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); + shared_ptr<OpProgress> progress = make_text_progress(false); - apt_init(&progress, false); + apt_init(progress.get(), false); if(_error->PendingError()) { @@ -113,9 +117,9 @@ int cmdline_autoclean(int argc, char *argv[], bool simulate) return -1; } - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); + shared_ptr<OpProgress> progress = make_text_progress(false); - apt_init(&progress, false); + apt_init(progress.get(), false); if(_error->PendingError()) { diff --git a/src/cmdline/cmdline_do_action.cc b/src/cmdline/cmdline_do_action.cc index adbe4395..94d7de0f 100644 --- a/src/cmdline/cmdline_do_action.cc +++ b/src/cmdline/cmdline_do_action.cc @@ -15,6 +15,7 @@ #include <generic/apt/apt.h> #include <generic/apt/config_signal.h> #include <generic/apt/download_install_manager.h> +#include <generic/apt/text_progress.h> #include <aptitude.h> @@ -27,6 +28,8 @@ using namespace std; +using boost::shared_ptr; + namespace { void run_dpkg_directly(sigc::slot1<pkgPackageManager::OrderResult, int> f, @@ -136,7 +139,7 @@ int cmdline_do_action(int argc, char *argv[], if(resolver_mode == resolver_mode_default) resolver_mode = resolver_mode_full; - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); + shared_ptr<OpProgress> progress = aptitude::apt::make_text_progress(false); aptcfg->SetNoUser(PACKAGE "::Auto-Upgrade", "false"); @@ -145,8 +148,9 @@ int cmdline_do_action(int argc, char *argv[], // // This way, "aptitude install" will just perform any pending // installations. - apt_init(&progress, (argc==1 && default_action==cmdline_install && - upgrade_mode == no_upgrade), status_fname); + apt_init(progress.get(), + (argc==1 && default_action==cmdline_install && + upgrade_mode == no_upgrade), status_fname); if(_error->PendingError()) { @@ -329,7 +333,7 @@ int cmdline_do_action(int argc, char *argv[], { aptitude::cmdline::apply_user_tags(user_tags); - if(!(*apt_cache_file)->save_selection_list(progress)) + if(!(*apt_cache_file)->save_selection_list(*progress)) { _error->DumpErrors(); return -1; diff --git a/src/cmdline/cmdline_download.cc b/src/cmdline/cmdline_download.cc index c85bb8e6..f3aa0abd 100644 --- a/src/cmdline/cmdline_download.cc +++ b/src/cmdline/cmdline_download.cc @@ -17,6 +17,7 @@ #include <generic/apt/matching/parse.h> #include <generic/apt/matching/pattern.h> #include <generic/apt/pkg_acqfile.h> +#include <generic/apt/text_progress.h> #include <apt-pkg/acquire.h> #include <apt-pkg/error.h> @@ -25,6 +26,9 @@ #include <stdio.h> +using aptitude::apt::make_text_progress; +using boost::shared_ptr; + // Download stuff to the current directory int cmdline_download(int argc, char *argv[]) { @@ -36,8 +40,8 @@ int cmdline_download(int argc, char *argv[]) _error->DumpErrors(); - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); - apt_init(&progress, false); + shared_ptr<OpProgress> progress = make_text_progress(false); + apt_init(progress.get(), false); pkgSourceList list; if(!list.ReadMainList()) diff --git a/src/cmdline/cmdline_extract_cache_subset.cc b/src/cmdline/cmdline_extract_cache_subset.cc index c4de362c..4fefef4d 100644 --- a/src/cmdline/cmdline_extract_cache_subset.cc +++ b/src/cmdline/cmdline_extract_cache_subset.cc @@ -1,6 +1,6 @@ // cmdline_extract_cache_subset.cc // -// Copyright (C) 2008-2009 Daniel Burrows +// Copyright (C) 2008-2010 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -28,12 +28,15 @@ #include <generic/apt/matching/match.h> #include <generic/apt/matching/parse.h> #include <generic/apt/matching/pattern.h> +#include <generic/apt/text_progress.h> #include <stdio.h> #include <apt-pkg/error.h> #include <apt-pkg/progress.h> +using aptitude::apt::make_text_progress; + namespace aptitude { namespace cmdline @@ -48,9 +51,9 @@ namespace aptitude std::string out_dir = argv[1]; - OpTextProgress progress; + boost::shared_ptr<OpProgress> progress = make_text_progress(false); - apt_init(&progress, true); + apt_init(progress.get(), true); if(_error->PendingError()) { _error->DumpErrors(); diff --git a/src/cmdline/cmdline_forget_new.cc b/src/cmdline/cmdline_forget_new.cc index 48624600..9a01438b 100644 --- a/src/cmdline/cmdline_forget_new.cc +++ b/src/cmdline/cmdline_forget_new.cc @@ -8,6 +8,7 @@ #include <generic/apt/apt.h> #include <generic/apt/config_signal.h> +#include <generic/apt/text_progress.h> #include <apt-pkg/error.h> @@ -15,6 +16,9 @@ using namespace std; +using aptitude::apt::make_text_progress; +using boost::shared_ptr; + int cmdline_forget_new(int argc, char *argv[], const char *status_fname, bool simulate) { @@ -28,9 +32,9 @@ int cmdline_forget_new(int argc, char *argv[], return -1; } - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); + shared_ptr<OpProgress> progress = make_text_progress(false); - apt_init(&progress, false, status_fname); + apt_init(progress.get(), false, status_fname); if(_error->PendingError()) { @@ -56,7 +60,7 @@ int cmdline_forget_new(int argc, char *argv[], { (*apt_cache_file)->forget_new(NULL); - (*apt_cache_file)->save_selection_list(progress); + (*apt_cache_file)->save_selection_list(*progress); if(_error->PendingError()) { diff --git a/src/cmdline/cmdline_user_tag.cc b/src/cmdline/cmdline_user_tag.cc index 5ae92628..a3e735fc 100644 --- a/src/cmdline/cmdline_user_tag.cc +++ b/src/cmdline/cmdline_user_tag.cc @@ -30,10 +30,14 @@ #include <generic/apt/matching/match.h> #include <generic/apt/matching/parse.h> #include <generic/apt/matching/pattern.h> +#include <generic/apt/text_progress.h> #include <stdio.h> #include <string.h> +using aptitude::apt::make_text_progress; +using boost::shared_ptr; + namespace aptitude { namespace cmdline @@ -150,8 +154,8 @@ namespace aptitude } } - OpTextProgress text_progress; - if(!(*apt_cache_file)->save_selection_list(text_progress)) + shared_ptr<OpProgress> text_progress = make_text_progress(false); + if(!(*apt_cache_file)->save_selection_list(*text_progress)) return 1; if(!all_ok) diff --git a/src/cmdline/cmdline_util.cc b/src/cmdline/cmdline_util.cc index ac793da6..55299417 100644 --- a/src/cmdline/cmdline_util.cc +++ b/src/cmdline/cmdline_util.cc @@ -19,6 +19,7 @@ #include <generic/apt/matching/match.h> #include <generic/apt/matching/parse.h> #include <generic/apt/matching/pattern.h> +#include <generic/apt/text_progress.h> #include <cwidget/fragment.h> #include <cwidget/toplevel.h> @@ -38,6 +39,9 @@ namespace cw = cwidget; +using aptitude::apt::make_text_progress; +using boost::shared_ptr; + namespace { const int no_install_run_from_ui_preview_return = -1; @@ -393,7 +397,7 @@ download_manager::result cmdline_do_download(download_manager *m, int verbose) { stats initial_stats(0, 0, 0, std::set<std::string>()); - OpTextProgress progress(aptcfg->FindI("Quiet", 0)); + shared_ptr<OpProgress> progress = make_text_progress(false); if(aptcfg->FindI("Quiet", 0) == 0) { @@ -413,7 +417,7 @@ download_manager::result cmdline_do_download(download_manager *m, // and think something failed. _error->DumpErrors(); - if(!m->prepare(progress, *log.get(), log.get())) + if(!m->prepare(*progress, *log.get(), log.get())) return download_manager::failure; download_manager::result finish_res; @@ -421,7 +425,7 @@ download_manager::result cmdline_do_download(download_manager *m, do { pkgAcquire::RunResult download_res = m->do_download(); - m->finish(download_res, &progress, + m->finish(download_res, progress.get(), sigc::bind(sigc::ptr_fun(&assign<download_manager::result>), &finish_res)); } |