diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:04 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:04 +0000 |
commit | 0118833a3b3e65ad7296863aa7d49574eb615f83 (patch) | |
tree | bbeac95408b7a84a983cc602dae3b315ed9976d9 /apt-pkg/acquire-item.cc | |
parent | 7b0229fe01e9b300e1a67d82f7a6511c31444756 (diff) |
Devel acquire module
Author: jgg
Date: 1998-10-15 06:59:59 GMT
Devel acquire module
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r-- | apt-pkg/acquire-item.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc new file mode 100644 index 000000000..ccd72595b --- /dev/null +++ b/apt-pkg/acquire-item.cc @@ -0,0 +1,85 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +// $Id: acquire-item.cc,v 1.1 1998/10/15 06:59:59 jgg Exp $ +/* ###################################################################### + + Acquire Item - Item to acquire + + Each item can download to exactly one file at a time. This means you + cannot create an item that fetches two uri's to two files at the same + time. The pkgAcqIndex class creates a second class upon instantiation + to fetch the other index files because of this. + + ##################################################################### */ + /*}}}*/ +// Include Files /*{{{*/ +#ifdef __GNUG__ +#pragma implementation "apt-pkg/acquire-item.h" +#endif +#include <apt-pkg/acquire-item.h> +#include <apt-pkg/configuration.h> +#include <strutl.h> + /*}}}*/ + +// Acquire::Item::Item - Constructor /*{{{*/ +// --------------------------------------------------------------------- +/* */ +pkgAcquire::Item::Item(pkgAcquire *Owner) : Owner(Owner), QueueCounter(0) +{ + Owner->Add(this); +} + /*}}}*/ +// Acquire::Item::~Item - Destructor /*{{{*/ +// --------------------------------------------------------------------- +/* */ +pkgAcquire::Item::~Item() +{ + Owner->Remove(this); +} + /*}}}*/ + +// AcqIndex::AcqIndex - Constructor /*{{{*/ +// --------------------------------------------------------------------- +/* The package file is added to the queue and a second class is + instantiated to fetch the revision file */ +pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location) : + Item(Owner), Location(Location) +{ + QueueURI(Location->PackagesURI() + ".gz"); + Description = Location->PackagesInfo(); + + new pkgAcqIndexRel(Owner,Location); +} + /*}}}*/ +// pkgAcqIndex::ToFile - File to write the download to /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgAcqIndex::ToFile() +{ + string PartialDir = _config->FindDir("Dir::State::lists") + "/partial/"; + + return PartialDir + URItoFileName(Location->PackagesURI()); +} + /*}}}*/ + +// AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/ +// --------------------------------------------------------------------- +/* The Release file is added to the queue */ +pkgAcqIndexRel::pkgAcqIndexRel(pkgAcquire *Owner, + const pkgSourceList::Item *Location) : + Item(Owner), Location(Location) +{ + QueueURI(Location->ReleaseURI()); + Description = Location->ReleaseInfo(); +} + /*}}}*/ +// AcqIndexRel::ToFile - File to write the download to /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgAcqIndexRel::ToFile() +{ + string PartialDir = _config->FindDir("Dir::State::lists") + "/partial/"; + + return PartialDir + URItoFileName(Location->ReleaseURI()); +} + /*}}}*/ |