Procházet zdrojové kódy

* cherry picked the media-change support from apt--mvo--0

Patches applied:

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-50
   * meda-change message is send over status-fd now

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-51
   * include a human readable string for the MediaChange status-fd message as well
Michael Vogt před 21 roky
rodič
revize
e3c00bf5af
4 změnil soubory, kde provedl 35 přidání a 2 odebrání
  1. 8 1
      README.progress-reporting
  2. 19 0
      apt-pkg/acquire-worker.cc
  3. 1 1
      configure.in
  4. 7 0
      debian/changelog

+ 8 - 1
README.progress-reporting

@@ -5,7 +5,7 @@ If the apt options: "APT::Status-Fd" is set, apt will send status
 reports to that fd. The status information is seperated with a ':', 
 there are the following status conditions:
 
-status = {"pmstatus", "dlstatus", "conffile-prompt", "error" } 
+status = {"pmstatus", "dlstatus", "conffile-prompt", "error", "media-change" } 
 
 The reason for using a fd instead of a OpProgress class is that many
 apt frontend fork a (vte) terminal for the actual installation.
@@ -47,6 +47,13 @@ pmconffile
 pmconffile:conffile:percent:'current-conffile' 'new-conffile' useredited distedited
 
 
+media-change
+------------
+media-change:medium:drive:human-readable string
+
+example:
+media-change: Ubuntu 5.10 _Breezy Badger_ - Alpha i386 (20050830):/cdrom/:Please insert the disc labeled: 'Ubuntu 5.10 _Breezy Badger_ - Alpha i386 (20050830)' in the drive '/cdrom/' and press enter.
+
 
 dlstatus
 --------

+ 19 - 0
apt-pkg/acquire-worker.cc

@@ -25,6 +25,7 @@
 #include <apti18n.h>
 
 #include <iostream>
+#include <sstream>
 #include <fstream>
     
 #include <sys/stat.h>
@@ -367,6 +368,24 @@ bool pkgAcquire::Worker::Capabilities(string Message)
 /* */
 bool pkgAcquire::Worker::MediaChange(string Message)
 {
+   int status_fd = _config->FindI("APT::Status-Fd",-1);
+   if(status_fd > 0) 
+   {
+      string Media = LookupTag(Message,"Media");
+      string Drive = LookupTag(Message,"Drive"); 
+      ostringstream msg,status;
+      ioprintf(msg,_("Please insert the disc labeled: "
+		     "'%s' "
+		     "in the drive '%s' and press enter."),
+	       Media.c_str(),Drive.c_str());
+      status << "media-change: "  // message
+	     << Media  << ":"     // media
+	     << Drive  << ":"     // drive
+	     << msg.str()         // l10n message
+	     << endl;
+      write(status_fd, status.str().c_str(), status.str().size());
+   }
+
    if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),
 				    LookupTag(Message,"Drive")) == false)
    {

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.40.1ubuntu4")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.40.1ubuntu5")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

+ 7 - 0
debian/changelog

@@ -1,3 +1,10 @@
+apt (0.6.40.1ubuntu5) breezy; urgency=low
+
+  * Cheery picked michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-{50,51}.
+    This adds media-change reporting to the apt status-fd (ubuntu #15213)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Mon, 12 Sep 2005 15:44:26 +0200
+
 apt (0.6.40.1ubuntu4) breezy; urgency=low
 
   * debian/apt.cron.daily: