[Aptitude-svn-commit] r4341 - in branches/aptitude-0.3/aptitude: .
src/cmdline
Daniel Burrows
dburrows at costa.debian.org
Thu Sep 29 23:15:59 UTC 2005
Author: dburrows
Date: Thu Sep 29 23:15:57 2005
New Revision: 4341
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.cc
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.h
Log:
Write generic code to execute a download object from the command-line.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Sep 29 23:15:57 2005
@@ -1,5 +1,10 @@
2005-09-29 Daniel Burrows <dburrows at debian.org>
+ * src/cmdline_util.cc, src/cmdline_util.h:
+
+ Write generic code to execute a download object from the
+ command-line.
+
* src/ui_download_manager.cc:
Actually use both ui_start_download and ui_stop_download.
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.cc Thu Sep 29 23:15:57 2005
@@ -5,12 +5,16 @@
#include "cmdline_util.h"
#include "cmdline_common.h"
+#include "cmdline_progress.h"
#include <aptitude.h>
#include <ui.h>
#include <vs_progress.h>
#include <generic/apt/apt.h>
+#include <generic/apt/config_signal.h>
+#include <generic/apt/download_manager.h>
+#include <generic/apt/download_signal_log.h>
#include <vscreen/vscreen.h>
@@ -155,3 +159,23 @@
return true;
}
+
+download_manager::result cmdline_do_download(download_manager *m)
+{
+ OpTextProgress progress(aptcfg->FindI("Quiet", 0));
+ std::auto_ptr<download_signal_log> log(gen_cmdline_download_progress());
+
+ if(!m->prepare(progress, *log.get(), log.get()))
+ return download_manager::failure;
+
+ download_manager::result finish_res;
+
+ do
+ {
+ pkgAcquire::RunResult download_res = m->do_download();
+ finish_res = m->finish(download_res, progress);
+ }
+ while(finish_res == download_manager::do_again);
+
+ return finish_res;
+}
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.h (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_util.h Thu Sep 29 23:15:57 2005
@@ -7,6 +7,9 @@
#include "cmdline_common.h"
+// For download_manager::result
+#include <generic/apt/download_manager.h>
+
void cmdline_show_pkglist(pkgvector &items);
void cmdline_show_stringlist(strvector &items);
@@ -43,4 +46,13 @@
string &package,
string &sourcestr);
+/** Run the given download and post-download commands using the
+ * standard command-line UI. Runs the preparation routine, the
+ * actual download, and the post-download commands.
+ *
+ * \return the success status of the post-download commands, or
+ * failure if the process failed before they could be run.
+ */
+download_manager::result cmdline_do_download(download_manager *m);
+
#endif // CMDLINE_UTIL_H
More information about the Aptitude-svn-commit
mailing list