summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc85
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());
+}
+ /*}}}*/