summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:18 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:18 +0000
commitf631d1baacfd7eb0b0c2c98e971da24d57129fcb (patch)
tree7bd058e1bd7a4c413a3557b3b498114a09cb4c01 /methods
parent2d18d44ecd4bfe976805024279e5118d11be26b9 (diff)
downloadapt-f631d1baacfd7eb0b0c2c98e971da24d57129fcb.tar.gz
Fixes
Author: jgg Date: 1998-12-22 07:36:49 GMT Fixes
Diffstat (limited to 'methods')
-rw-r--r--methods/cdrom.cc36
1 files changed, 21 insertions, 15 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index de5f8147..e114371d 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cdrom.cc,v 1.3 1998/12/05 01:45:21 jgg Exp $
+// $Id: cdrom.cc,v 1.4 1998/12/22 07:36:49 jgg Exp $
/* ######################################################################
CDROM URI method for APT
@@ -21,6 +21,7 @@
class CDROMMethod : public pkgAcqMethod
{
Configuration Database;
+ bool DatabaseLoaded;
string CurrentID;
virtual bool Fetch(FetchItem *Itm);
@@ -35,19 +36,8 @@ class CDROMMethod : public pkgAcqMethod
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
- SendConfig)
+ SendConfig), 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());
- Fail();
- }
- }
};
/*}}}*/
// CDROMMethod::GetID - Get the ID hash for /*{{{*/
@@ -56,7 +46,23 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
tag associated with it. */
string CDROMMethod::GetID(string Name)
{
- const Configuration::Item *Top = Database.Tree(0);
+ 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());
+ Fail();
+ }
+ }
+ DatabaseLoaded = true;
+ }
+
+ const Configuration::Item *Top = Database.Tree("CD");
for (; Top != 0;)
{
if (Top->Value == Name)
@@ -90,7 +96,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
string ID = GetID(Get.Host);
// All non IMS queries for package files fail.
- if (Itm->IndexFile == true || ID.empty() == false)
+ if (Itm->IndexFile == true || ID.empty() == true)
{
Fail("Please use apt-cdrom to make this CD recognized by APT."
" apt-get update cannot be used to add new CDs");