summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2d18d44)
Author: jgg
Date: 1998-12-22 07:36:49 GMT
Fixes
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- 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
/* ######################################################################
CDROM URI method for APT
class CDROMMethod : public pkgAcqMethod
{
Configuration Database;
class CDROMMethod : public pkgAcqMethod
{
Configuration Database;
string CurrentID;
virtual bool Fetch(FetchItem *Itm);
string CurrentID;
virtual bool Fetch(FetchItem *Itm);
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
// ---------------------------------------------------------------------
/* */
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
+ 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 /*{{{*/
};
/*}}}*/
// CDROMMethod::GetID - Get the ID hash for /*{{{*/
tag associated with it. */
string CDROMMethod::GetID(string Name)
{
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)
for (; Top != 0;)
{
if (Top->Value == Name)
string ID = GetID(Get.Host);
// All non IMS queries for package files fail.
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");
{
Fail("Please use apt-cdrom to make this CD recognized by APT."
" apt-get update cannot be used to add new CDs");