// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.cc,v 1.7 1998/11/05 07:21:35 jgg Exp $
+// $Id: acquire-item.cc,v 1.8 1998/11/09 01:09:19 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
// Acquire::Item::Item - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-pkgAcquire::Item::Item(pkgAcquire *Owner) : Owner(Owner), QueueCounter(0)
+pkgAcquire::Item::Item(pkgAcquire *Owner) : Owner(Owner), FileSize(0),
+ Complete(false), QueueCounter(0)
{
Owner->Add(this);
Status = StatIdle;
}
}
/*}}}*/
+// Acquire::Item::Start - Item has begun to download /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgAcquire::Item::Start(string Message,unsigned long Size)
+{
+ Status = StatFetching;
+ if (FileSize == 0 && Complete == false)
+ FileSize = Size;
+}
+ /*}}}*/
// Acquire::Item::Done - Item downloaded OK /*{{{*/
// ---------------------------------------------------------------------
/* */
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(Location->PackagesURI());
-
- QueueURI(Location->PackagesURI() + ".gz",Location->PackagesInfo());
+
+ // Create the item
+ Desc.URI = Location->PackagesURI() + ".gz";
+ Desc.Description = Location->PackagesInfo();
+ Desc.Owner = this;
+
+ // Set the short description to the archive component
+ if (Location->Dist[Location->Dist.size() - 1] == '/')
+ Desc.ShortDesc = Location->Dist;
+ else
+ Desc.ShortDesc = Location->Dist + '/' + Location->Section;
+
+ QueueURI(Desc);
// Create the Release fetch class
new pkgAcqIndexRel(Owner,Location);
}
Erase = false;
+ Complete = true;
// Handle the unzipd case
string FileName = LookupTag(Message,"Alt-Filename");
return;
Decompression = true;
+ FileSize = 0;
DestFile += ".decomp";
- QueueURI("copy:" + FileName,string());
+ Desc.URI = "copy:" + FileName;
+ QueueURI(Desc);
return;
}
if (FileName == DestFile)
Erase = true;
+ else
+ FileSize = 0;
Decompression = true;
DestFile += ".decomp";
- QueueURI("gzip:" + FileName,string());
+ Desc.URI = "gzip:" + FileName,Location->PackagesInfo();
+ QueueURI(Desc);
}
/*}}}*/
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(Location->ReleaseURI());
- QueueURI(Location->ReleaseURI(),Location->ReleaseInfo());
+ // Create the item
+ Desc.URI = Location->ReleaseURI();
+ Desc.Description = Location->ReleaseInfo();
+ Desc.Owner = this;
+
+ // Set the short description to the archive component
+ if (Location->Dist[Location->Dist.size() - 1] == '/')
+ Desc.ShortDesc = Location->Dist;
+ else
+ Desc.ShortDesc = Location->Dist + '/' + Location->Section;
+
+ QueueURI(Desc);
}
/*}}}*/
// AcqIndexRel::Custom600Headers - Insert custom request headers /*{{{*/
return;
}
+ Complete = true;
+
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
return;
// We have to copy it into place
if (FileName != DestFile)
{
- QueueURI("copy:" + FileName,string());
+ FileSize = 0;
+ Desc.URI = "copy:" + FileName;
+ QueueURI(Desc);
return;
}