summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc18
-rw-r--r--apt-pkg/acquire-item.h3
-rw-r--r--apt-pkg/acquire-method.cc7
-rw-r--r--apt-pkg/acquire-worker.cc10
-rw-r--r--apt-pkg/acquire.cc22
-rw-r--r--apt-pkg/acquire.h4
-rw-r--r--apt-pkg/contrib/configuration.cc15
-rw-r--r--apt-pkg/contrib/strutl.cc23
-rw-r--r--apt-pkg/init.cc8
9 files changed, 72 insertions, 38 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index f8cc7a0de..9f9d082fe 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.cc,v 1.6 1998/10/30 07:53:34 jgg Exp $
+// $Id: acquire-item.cc,v 1.7 1998/11/05 07:21:35 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
@@ -94,6 +94,7 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location)
Item(Owner), Location(Location)
{
Decompression = false;
+ Erase = false;
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(Location->PackagesURI());
@@ -136,9 +137,19 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5)
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(Location->PackagesURI());
Rename(DestFile,FinalFile);
+
+ // Remove the compressed version.
+ if (Erase == true)
+ {
+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(Location->PackagesURI());
+ unlink(DestFile.c_str());
+ }
return;
}
-
+
+ Erase = false;
+
// Handle the unzipd case
string FileName = LookupTag(Message,"Alt-Filename");
if (FileName.empty() == false)
@@ -163,6 +174,9 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5)
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
return;
+
+ if (FileName == DestFile)
+ Erase = true;
Decompression = true;
DestFile += ".decomp";
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index bdd4d3581..9ead29c9a 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.h,v 1.4 1998/10/26 07:11:44 jgg Exp $
+// $Id: acquire-item.h,v 1.5 1998/11/05 07:21:36 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
@@ -63,6 +63,7 @@ class pkgAcqIndex : public pkgAcquire::Item
const pkgSourceList::Item *Location;
bool Decompression;
+ bool Erase;
public:
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc
index 8d26537fa..681015910 100644
--- a/apt-pkg/acquire-method.cc
+++ b/apt-pkg/acquire-method.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-method.cc,v 1.3 1998/11/01 08:07:11 jgg Exp $
+// $Id: acquire-method.cc,v 1.4 1998/11/05 07:21:38 jgg Exp $
/* ######################################################################
Acquire Method
@@ -263,10 +263,11 @@ int pkgAcqMethod::Run(bool Single)
FetchItem **I = &Queue;
for (; *I != 0; I = &(*I)->Next);
*I = Tmp;
- cout << "GOT " << Tmp->Uri << endl;
-
+
+ // Notify that this item is to be fetched.
if (Fetch(Tmp) == false)
Fail();
+
break;
}
}
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index a02c6bc04..2cbab7720 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-worker.cc,v 1.9 1998/11/01 05:27:33 jgg Exp $
+// $Id: acquire-worker.cc,v 1.10 1998/11/05 07:21:39 jgg Exp $
/* ######################################################################
Acquire Worker
@@ -192,7 +192,7 @@ bool pkgAcquire::Worker::RunMessages()
pkgAcquire::Queue::QItem *Itm = 0;
if (URI.empty() == false)
Itm = OwnerQ->FindItem(URI,this);
-
+
// Determine the message number and dispatch
switch (Number)
{
@@ -237,8 +237,9 @@ bool pkgAcquire::Worker::RunMessages()
break;
}
+ pkgAcquire::Item *Owner = Itm->Owner;
OwnerQ->ItemDone(Itm);
- Itm->Owner->Done(Message,atoi(LookupTag(Message,"Size","0").c_str()),
+ Owner->Done(Message,atoi(LookupTag(Message,"Size","0").c_str()),
LookupTag(Message,"MD5-Hash"));
break;
}
@@ -252,8 +253,9 @@ bool pkgAcquire::Worker::RunMessages()
break;
}
+ pkgAcquire::Item *Owner = Itm->Owner;
OwnerQ->ItemDone(Itm);
- Itm->Owner->Failed(Message);
+ Owner->Failed(Message);
break;
}
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 91b2a7590..16adf3ae2 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.cc,v 1.7 1998/11/01 05:27:34 jgg Exp $
+// $Id: acquire.cc,v 1.8 1998/11/05 07:21:40 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@@ -143,6 +143,8 @@ void pkgAcquire::Enqueue(Item *Itm,string URI,string Description)
if (Running == true)
I->Startup();
}
+
+ Itm->Status = Item::StatIdle;
// Queue it into the named queue
I->Enqueue(Itm,URI,Description);
@@ -164,12 +166,14 @@ void pkgAcquire::Enqueue(Item *Itm,string URI,string Description)
void pkgAcquire::Dequeue(Item *Itm)
{
Queue *I = Queues;
+ bool Res = false;
for (; I != 0; I = I->Next)
- I->Dequeue(Itm);
+ Res |= I->Dequeue(Itm);
if (Debug == true)
clog << "Dequeuing " << Itm->DestFile << endl;
- ToFetch--;
+ if (Res == true)
+ ToFetch--;
}
/*}}}*/
// Acquire::QueueName - Return the name of the queue for this URI /*{{{*/
@@ -371,9 +375,11 @@ void pkgAcquire::Queue::Enqueue(Item *Owner,string URI,string Description)
/*}}}*/
// Queue::Dequeue - Remove an item from the queue /*{{{*/
// ---------------------------------------------------------------------
-/* */
-void pkgAcquire::Queue::Dequeue(Item *Owner)
+/* We return true if we hit something*/
+bool pkgAcquire::Queue::Dequeue(Item *Owner)
{
+ bool Res = false;
+
QItem **I = &Items;
for (; *I != 0;)
{
@@ -383,10 +389,13 @@ void pkgAcquire::Queue::Dequeue(Item *Owner)
*I = (*I)->Next;
Owner->QueueCounter--;
delete Jnk;
+ Res = true;
}
else
I = &(*I)->Next;
}
+
+ return Res;
}
/*}}}*/
// Queue::Startup - Start the worker processes /*{{{*/
@@ -463,6 +472,8 @@ bool pkgAcquire::Queue::Cycle()
if (Items == 0 || Workers == 0)
return true;
+ cout << "Cylce for " << Name << endl;
+
// Look for a queable item
QItem *I = Items;
for (; I != 0; I = I->Next)
@@ -475,6 +486,7 @@ bool pkgAcquire::Queue::Cycle()
I->Worker = Workers;
I->Owner->Status = pkgAcquire::Item::StatFetching;
+ cout << "Item has been queued!" << endl;
return Workers->QueueItem(I);
}
/*}}}*/
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index 25fe4b761..a4ea45bff 100644
--- a/apt-pkg/acquire.h
+++ b/apt-pkg/acquire.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.h,v 1.7 1998/11/01 05:27:35 jgg Exp $
+// $Id: acquire.h,v 1.8 1998/11/05 07:21:41 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@@ -124,7 +124,7 @@ class pkgAcquire::Queue
// Put an item into this queue
void Enqueue(Item *Owner,string URI,string Description);
- void Dequeue(Item *Owner);
+ bool Dequeue(Item *Owner);
// Find a Queued item
QItem *FindItem(string URI,pkgAcquire::Worker *Owner);
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 27299ec6a..da026f0f6 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: configuration.cc,v 1.9 1998/10/30 07:53:42 jgg Exp $
+// $Id: configuration.cc,v 1.10 1998/11/05 07:21:43 jgg Exp $
/* ######################################################################
Configuration Class
@@ -292,8 +292,14 @@ bool ReadConfigFile(Configuration &Conf,string FName)
}
// Discard single line comments
+ bool InQuote = false;
for (char *I = Buffer; *I != 0; I++)
{
+ if (*I == '"')
+ InQuote = !InQuote;
+ if (InQuote == true)
+ continue;
+
if (*I == '/' && I[1] == '/')
{
*I = 0;
@@ -304,6 +310,11 @@ bool ReadConfigFile(Configuration &Conf,string FName)
// Look for multi line comments
for (char *I = Buffer; *I != 0; I++)
{
+ if (*I == '"')
+ InQuote = !InQuote;
+ if (InQuote == true)
+ continue;
+
if (*I == '/' && I[1] == '*')
{
InComment = true;
@@ -398,7 +409,7 @@ bool ReadConfigFile(Configuration &Conf,string FName)
string Word;
if (ParseCWord(LineBuffer.c_str()+Pos,Word) == false)
return _error->Error("Syntax error %s:%u: Malformed value",FName.c_str(),CurLine);
-
+
// Generate the item name
string Item;
if (ParentTag.empty() == true)
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index c99f88c3f..d5f765dd4 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: strutl.cc,v 1.12 1998/11/04 07:11:13 jgg Exp $
+// $Id: strutl.cc,v 1.13 1998/11/05 07:21:44 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@@ -623,23 +623,14 @@ void URI::CopyFrom(string U)
for (; I < U.end() && *I != ':' ; I++);
string::const_iterator FirstColon = I;
- // Determine if this is a host type URI with a leading double //
+ /* Determine if this is a host type URI with a leading double //
+ and then search for the first single / */
string::const_iterator SingleSlash = I;
if (I + 3 < U.end() && I[1] == '/' && I[2] == '/')
- {
- // Locate the single / that starts the path
- for (; I < U.end(); I++)
- {
- if (*I == '/' && I+1 < U.end() && I[1] == '/')
- I += 2;
- else
- if (*I == '/')
- break;
- }
- if (I > U.end())
- I = U.end();
- SingleSlash = I;
- }
+ SingleSlash += 3;
+ for (; SingleSlash < U.end() && *SingleSlash != '/'; SingleSlash++);
+ if (SingleSlash > U.end())
+ SingleSlash = U.end();
// We can now write the access and path specifiers
Access = string(U,0,FirstColon - U.begin());
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index da11e3b40..f79668c54 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: init.cc,v 1.9 1998/10/30 07:53:39 jgg Exp $
+// $Id: init.cc,v 1.10 1998/11/05 07:21:42 jgg Exp $
/* ######################################################################
Init - Initialize the package library
@@ -46,7 +46,7 @@ bool pkgInitialize(Configuration &Cnf)
Cnf.Set("Dir::Etc","/etc/apt/");
Cnf.Set("Dir::Etc::sourcelist","sources.list");
Cnf.Set("Dir::Etc::main","apt.conf");
- Cnf.Set("Dir::Bin::methods","/usr/lib/apt/metods");
+ Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
// Read the main config file
string FName = Cnf.FindFile("Dir::Etc::main");
@@ -57,7 +57,9 @@ bool pkgInitialize(Configuration &Cnf)
// Read an alternate config file
const char *Cfg = getenv("APT_CONFIG");
- if (ReadConfigFile(Cnf,FName) != true || ReadConfigFile(Cnf,Cfg) != true)
+ // Read both config files, either existing will be OK
+ if ((ReadConfigFile(Cnf,FName) != true) |
+ (ReadConfigFile(Cnf,Cfg) != true))
return false;
if (Cnf.FindB("Debug::pkgInitialize",false) == true)