]> git.saurik.com Git - apt.git/commitdiff
Fixed cdrom method problems
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:51 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:51 +0000 (16:51 +0000)
Author: jgg
Date: 1998-12-05 01:45:19 GMT
Fixed cdrom method problems

apt-pkg/acquire-method.cc
apt-pkg/acquire-worker.cc
methods/cdrom.cc

index fc060d83eaa3c8c9db720d060b8dda1e11c0c625..b0176d3cb61c1f624a8ffe58e2a122414f976850 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-method.cc,v 1.12 1998/12/04 22:56:50 jgg Exp $
+// $Id: acquire-method.cc,v 1.13 1998/12/05 01:45:19 jgg Exp $
 /* ######################################################################
 
    Acquire Method
 /* ######################################################################
 
    Acquire Method
@@ -205,11 +205,11 @@ bool pkgAcqMethod::MediaFail(string Required,string Drive)
    while (1)
    {
       if (WaitFd(STDIN_FILENO) == false)
    while (1)
    {
       if (WaitFd(STDIN_FILENO) == false)
-        exit(0);
+        return false;
       
       if (ReadMessages(STDIN_FILENO,MyMessages) == false)
       
       if (ReadMessages(STDIN_FILENO,MyMessages) == false)
-        exit(0);
-      
+        return false;
+
       string Message = MyMessages.front();
       MyMessages.erase(MyMessages.begin());
       
       string Message = MyMessages.front();
       MyMessages.erase(MyMessages.begin());
       
@@ -225,13 +225,13 @@ bool pkgAcqMethod::MediaFail(string Required,string Drive)
       // Change ack
       if (Number == 603)
       {
       // Change ack
       if (Number == 603)
       {
-        while (Message.empty() == false)
+        while (MyMessages.empty() == false)
         {
            Messages.push_back(MyMessages.front());
            MyMessages.erase(MyMessages.begin());
         }
 
         {
            Messages.push_back(MyMessages.front());
            MyMessages.erase(MyMessages.begin());
         }
 
-        return StringToBool(LookupTag(Message,"Fail"),false);
+        return !StringToBool(LookupTag(Message,"Fail"),false);
       }
       
       Messages.push_back(Message);
       }
       
       Messages.push_back(Message);
index 67bb61207c951f7ea2766b4bc706982dd3b54ead..28f8408b6ab8b1c01d879be09bda4b6a9e5f8368 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-worker.cc,v 1.14 1998/12/04 21:16:47 jgg Exp $
+// $Id: acquire-worker.cc,v 1.15 1998/12/05 01:45:20 jgg Exp $
 /* ######################################################################
 
    Acquire Worker 
 /* ######################################################################
 
    Acquire Worker 
@@ -460,7 +460,8 @@ bool pkgAcquire::Worker::InFdReady()
    read returned -1. */
 bool pkgAcquire::Worker::MethodFailure()
 {
    read returned -1. */
 bool pkgAcquire::Worker::MethodFailure()
 {
-   cerr << "Method " << Access << " has died unexpectedly!" << endl;
+   _error->Error("Method %s has died unexpectedly!",Access.c_str());
+   
    if (waitpid(Process,0,0) != Process)
       _error->Warning("I waited but nothing was there!");
    Process = -1;
    if (waitpid(Process,0,0) != Process)
       _error->Warning("I waited but nothing was there!");
    Process = -1;
index 933d88fc4fbac9c62f17099576a66d53685d84fd..de5f8147c06bcf753dfa97a992a85d3adb9116c3 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cdrom.cc,v 1.2 1998/12/04 22:56:55 jgg Exp $
+// $Id: cdrom.cc,v 1.3 1998/12/05 01:45:21 jgg Exp $
 /* ######################################################################
 
    CDROM URI method for APT
 /* ######################################################################
 
    CDROM URI method for APT
@@ -34,7 +34,8 @@ class CDROMMethod : public pkgAcqMethod
 // CDROMMethod::CDROMethod - Constructor                               /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // CDROMMethod::CDROMethod - Constructor                               /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly) 
+CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | 
+                                         SendConfig)
 {
    // Read the database
    string DFile = _config->FindFile("Dir::State::cdroms");
 {
    // Read the database
    string DFile = _config->FindFile("Dir::State::cdroms");
@@ -104,6 +105,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
    }
    
    string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
    }
    
    string CDROM = _config->FindDir("Acquire::cdrom::mount","/cdrom/");
+   if (CDROM[0] == '.')
+      CDROM= SafeGetCWD() + '/' + CDROM;
    string NewID;
    while (1)
    {
    string NewID;
    while (1)
    {
@@ -117,8 +120,9 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
       UnmountCdrom(CDROM);
       if (MediaFail(Get.Host,CDROM) == false)
       {
       UnmountCdrom(CDROM);
       if (MediaFail(Get.Host,CDROM) == false)
       {
-        ID = "FAIL";
-        break;
+        CurrentID = "FAIL";
+        Fail("Wrong CD",true);
+        return true;
       }
       
       MountCdrom(CDROM);
       }
       
       MountCdrom(CDROM);