]> git.saurik.com Git - apt.git/commitdiff
Fixed cd stuff and some minor bugs
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:53:46 +0000 (16:53 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:53:46 +0000 (16:53 +0000)
Author: jgg
Date: 1999-05-23 05:45:12 GMT
Fixed cd stuff and some minor bugs

cmdline/apt-config.cc
cmdline/apt-get.cc
debian/changelog
doc/apt-config.8.yo
dselect/install
methods/cdrom.cc

index 3a2a4d9ca38647788cff7c82f5697e77667fac40..c626a1ee0ae50c6e808ab1445ac91bc079649474 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-config.cc,v 1.4 1999/03/29 19:28:52 jgg Exp $
+// $Id: apt-config.cc,v 1.5 1999/05/23 05:45:12 jgg Exp $
 /* ######################################################################
    
    APT Config - Program to manipulate APT configuration files
@@ -31,8 +31,19 @@ bool DoShell(CommandLine &CmdL)
 {
    for (const char **I = CmdL.FileList + 1; *I != 0; I += 2)
    {
-      if (I[1] == 0)
+      if (I[1] == 0 || strlen(I[1]) == 0)
         return _error->Error("Arguments not in pairs");
+
+      // Check if the caller has requested a directory path
+      if (I[1][strlen(I[1])-1] == '/')
+      {
+        char S[300];
+        strcpy(S,I[1]);
+        S[strlen(S)-1] = 0;
+        if (_config->Exists(S) == true)
+           cout << *I << "=\"" << _config->FindDir(S) << '"' << endl;
+      }
+      
       if (_config->Exists(I[1]) == true)
         cout << *I << "=\"" << _config->Find(I[1]) << '"' << endl;
    }
index ea56e4c22595c383db23357e648d4850042e6e48..043cc35bc6161c3cdd86372feeaae7e4112a53c7 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.59 1999/05/20 05:53:38 jgg Exp $
+// $Id: apt-get.cc,v 1.60 1999/05/23 05:45:12 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -614,7 +614,11 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,bool Saftey =
    }
 
    if (_config->FindB("APT::Get::Download-Only",false) == true)
+   {
+      if (Failed == false && _config->FindB("APT::Get::Fix-Missing",false) == false)
+        return _error->Error("Some files failed to download");
       return true;
+   }
    
    if (Failed == true && _config->FindB("APT::Get::Fix-Missing",false) == false)
    {
index ffdb1a2a7668379a4e149649b86c9761f8c9b9e2..4bfe44249ab7e0a171b3edcfb4e49ad0aeb4a6e6 100644 (file)
@@ -7,7 +7,10 @@ apt (0.3.6.1) unstable; urgency=low
     Closes: #37499
   * Man page typo Closes: #37762
   * Fixed parsing of the Source: line. Closes: #37679
-  * Dpkg/dpkg-hurd source bug. Closes: #38004
+  * Dpkg/dpkg-hurd source bug. Closes: #38004, #38032
+  * Added a check for an empty cache directory. Closes: #37963
+  * Return a failure code if -d is given and packages fail to download.
+    Closes: #38127
   
  -- Jason Gunthorpe <jgg@debian.org>  Wed, 12 May 1999 09:18:49 -0700
  
index f15d669ee8f5942f4ac7961107c555bc5e841c9c..93da32905dfa435edb792e6df7abdf54ae28e739 100644 (file)
@@ -38,6 +38,9 @@ eval $RES
 This will set the shell environment variable $OPTS to the value of
 MyApp::Options with a default of -f.
 
+If the configuration item to retrieve is prefixed with a / then it will
+be retrieved using filename mode which prepends base paths.
+
 enddit()
 
 manpageoptions()
index 572e8d1c3738c20a27ba07f02ef7217f1053dbbe..6cf5dcf1addc61f0ae3aa5650b74187656d6260c 100755 (executable)
@@ -7,7 +7,8 @@ APTGET="/usr/bin/apt-get"
 DPKG="/usr/bin/dpkg"
 set -e
 RES=`apt-config shell CLEAN DSelect::Clean OPTS DSelect::Options \
-                      DPKG Dir::Bin::dpkg APTGET Dir::Bin::apt-get`
+                      DPKG Dir::Bin::dpkg/ APTGET Dir::Bin::apt-get/ \
+                     ARCHIVES Dir::Cache::Archives/`
 eval $RES
 set +e
 
@@ -47,6 +48,12 @@ fi
 
 # Finished OK
 if [ $RES -eq 0 ]; then
+
+   if [ `ls $ARCHIVES $ARCHIVES/partial | egrep -v "^lock$|^partial$" | wc -l` \
+        -eq 0 ]; then
+      exit 0
+   fi
+   
    # Check the cleaning mode
    case `echo $CLEAN | tr '[:upper:]' '[:lower:]'` in
      auto)
index 778cc63b10839674be7961fa0ced5917bbe67732..a4446576668b7d2de0280f45ce2b2b8c3af67c12 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cdrom.cc,v 1.8 1999/03/28 01:37:26 jgg Exp $
+// $Id: cdrom.cc,v 1.9 1999/05/23 05:45:13 jgg Exp $
 /* ######################################################################
 
    CDROM URI method for APT
@@ -40,40 +40,23 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
 {
 };
                                                                        /*}}}*/
-// CDROMMethod::GetID - Get the ID hash for                                                                    /*{{{*/
+// CDROMMethod::GetID - Search the database for a matching string      /*{{{*/
 // ---------------------------------------------------------------------
-/* We search the configuration space for the name and then return the ID
-   tag associated with it. */
+/* */
 string CDROMMethod::GetID(string Name)
 {
-   if (DatabaseLoaded == false)
-   {
-      // Read the database
-      string DFile = _config->FindFile("Dir::State::cdroms");
-      if (FileExists(DFile) == true)
-      {
-        if (ReadConfigFile(Database,DFile) == false)
-        {
-           _error->Error("Unable to read the cdrom database %s",
-                         DFile.c_str());
-           return string();
-        }   
-      }
-      DatabaseLoaded = true;
-   }
-   
+   // Search for an ID
    const Configuration::Item *Top = Database.Tree("CD");
    if (Top != 0)
       Top = Top->Child;
-
+   
    for (; Top != 0;)
-   {
+   {      
       if (Top->Value == Name)
         return Top->Tag;
-
+      
       Top = Top->Next;
-   }   
-   
+   }
    return string();
 }
                                                                        /*}}}*/
@@ -95,13 +78,23 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
       URIDone(Res);
       return true;
    }
-   
-   string ID = GetID(Get.Host);
-   if (_error->PendingError() == true)
-      return false;
-   
+
+   // Load the database
+   if (DatabaseLoaded == false)
+   {
+      // Read the database
+      string DFile = _config->FindFile("Dir::State::cdroms");
+      if (FileExists(DFile) == true)
+      {
+        if (ReadConfigFile(Database,DFile) == false)
+           return _error->Error("Unable to read the cdrom database %s",
+                         DFile.c_str());
+      }
+      DatabaseLoaded = true;
+   }
+       
    // All non IMS queries for package files fail.
-   if (Itm->IndexFile == true || ID.empty() == true)
+   if (Itm->IndexFile == true || GetID(Get.Host).empty() == true)
    {
       Fail("Please use apt-cdrom to make this CD recognized by APT."
           " apt-get update cannot be used to add new CDs");
@@ -109,7 +102,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
    }
 
    // We already have a CD inserted, but it is the wrong one
-   if (CurrentID.empty() == false && ID != CurrentID)
+   if (CurrentID.empty() == false && Database.Find("CD::" + CurrentID) != Get.Host)
    {
       Fail("Wrong CD",true);
       return true;
@@ -125,7 +118,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
         return false;
    
       // A hit
-      if (NewID == ID)
+      if (Database.Find("CD::" + NewID) == Get.Host)
         break;
 
       // I suppose this should prompt somehow?
@@ -142,23 +135,18 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
       MountCdrom(CDROM);
    }
    
-   // ID matches
-   if (NewID == ID)
-   {
-      Res.Filename = CDROM + File;
-      struct stat Buf;
-      if (stat(Res.Filename.c_str(),&Buf) != 0)
-        return _error->Error("File not found");
-    
-      CurrentID = ID;
-      Res.LastModified = Buf.st_mtime;
-      Res.IMSHit = true;
-      Res.Size = Buf.st_size;
-      URIDone(Res);
-      return true;
-   }
+   // Found a CD
+   Res.Filename = CDROM + File;
+   struct stat Buf;
+   if (stat(Res.Filename.c_str(),&Buf) != 0)
+      return _error->Error("File not found");
    
-   return _error->Error("CDROM not found");
+   CurrentID = NewID;
+   Res.LastModified = Buf.st_mtime;
+   Res.IMSHit = true;
+   Res.Size = Buf.st_size;
+   URIDone(Res);
+   return true;
 }
                                                                        /*}}}*/