summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:34 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:34 +0000
commitf7a08e33bc039e967bf38c2ef78cbb7cd7bb658d (patch)
tree299ad2dfbdbef50a9fda4b44930a16d867b083f3
parent7c57fe64e3cc676bb145c187da03ed9aa1ea3d47 (diff)
Added --print-uris
Author: jgg Date: 1999-01-30 06:07:24 GMT Added --print-uris
-rw-r--r--apt-pkg/acquire-item.h4
-rw-r--r--apt-pkg/acquire.cc18
-rw-r--r--apt-pkg/acquire.h44
-rw-r--r--cmdline/apt-get.cc12
-rw-r--r--doc/apt-get.8.yo6
5 files changed, 79 insertions, 5 deletions
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 0b80ca1de..676766dbc 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.12 1998/12/11 06:32:34 jgg Exp $
+// $Id: acquire-item.h,v 1.13 1999/01/30 06:07:24 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
@@ -59,6 +59,7 @@ class pkgAcquire::Item
virtual void Failed(string Message);
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual void Start(string Message,unsigned long Size);
+ virtual string MD5Sum() {return string();};
virtual string Describe() = 0;
virtual string Custom600Headers() {return string();};
@@ -121,6 +122,7 @@ class pkgAcqArchive : public pkgAcquire::Item
public:
virtual void Failed(string Message);
+ virtual string MD5Sum() {return MD5;};
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual string Describe();
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 125622e66..8b1f522f9 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.24 1999/01/27 02:48:52 jgg Exp $
+// $Id: acquire.cc,v 1.25 1999/01/30 06:07:24 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@@ -413,6 +413,22 @@ unsigned long pkgAcquire::FetchNeeded()
return Total;
}
/*}}}*/
+// pkgAcquire::UriBegin - Start iterator for the uri list /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+pkgAcquire::UriIterator pkgAcquire::UriBegin()
+{
+ return UriIterator(Queues);
+}
+ /*}}}*/
+// pkgAcquire::UriEnd - End iterator for the uri list /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+pkgAcquire::UriIterator pkgAcquire::UriEnd()
+{
+ return UriIterator(0);
+}
+ /*}}}*/
// Acquire::MethodConfig::MethodConfig - Constructor /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index 2f5da7b31..5693615dd 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.18 1998/12/11 07:20:33 jgg Exp $
+// $Id: acquire.h,v 1.19 1999/01/30 06:07:24 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
@@ -98,7 +98,12 @@ class pkgAcquire
Worker *WorkerStep(Worker *I);
inline Item **ItemsBegin() {return Items.begin();};
inline Item **ItemsEnd() {return Items.end();};
-
+
+ // Iterate over queued Item URIs
+ class UriIterator;
+ UriIterator UriBegin();
+ UriIterator UriEnd();
+
// Cleans out the download dir
bool Clean(string Dir);
@@ -123,6 +128,7 @@ struct pkgAcquire::ItemDesc
class pkgAcquire::Queue
{
friend pkgAcquire;
+ friend pkgAcquire::UriIterator;
Queue *Next;
protected:
@@ -172,6 +178,40 @@ class pkgAcquire::Queue
~Queue();
};
+class pkgAcquire::UriIterator
+{
+ pkgAcquire::Queue *CurQ;
+ pkgAcquire::Queue::QItem *CurItem;
+
+ public:
+
+ // Advance to the next item
+ inline void operator ++() {operator ++();};
+ void operator ++(int)
+ {
+ CurItem = CurItem->Next;
+ while (CurItem == 0 && CurQ != 0)
+ {
+ CurItem = CurQ->Items;
+ CurQ = CurQ->Next;
+ }
+ };
+
+ // Accessors
+ inline pkgAcquire::ItemDesc const *operator ->() const {return CurItem;};
+ inline bool operator !=(UriIterator const &rhs) const {return rhs.CurQ != CurQ || rhs.CurItem != CurItem;};
+ inline bool operator ==(UriIterator const &rhs) const {return rhs.CurQ == CurQ && rhs.CurItem == CurItem;};
+
+ UriIterator(pkgAcquire::Queue *Q) : CurQ(Q), CurItem(0)
+ {
+ while (CurItem == 0 && CurQ != 0)
+ {
+ CurItem = CurQ->Items;
+ CurQ = CurQ->Next;
+ }
+ }
+};
+
// Configuration information from each method
struct pkgAcquire::MethodConfig
{
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1cc983e47..bdc9c0672 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.36 1999/01/30 03:35:28 jgg Exp $
+// $Id: apt-get.cc,v 1.37 1999/01/30 06:07:24 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -566,6 +566,15 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
if (YnPrompt() == false)
exit(1);
}
+
+ if (_config->FindB("APT::Get::Print-URIs") == true)
+ {
+ pkgAcquire::UriIterator I = Fetcher.UriBegin();
+ for (; I != Fetcher.UriEnd(); I++)
+ cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' <<
+ I->Owner->FileSize << ' ' << I->Owner->MD5Sum() << endl;
+ return true;
+ }
// Run it
if (Fetcher.Run() == false)
@@ -1091,6 +1100,7 @@ int main(int argc,const char *argv[])
{0,"ignore-hold","APT::Ingore-Hold",0},
{0,"no-upgrade","APT::Get::no-upgrade",0},
{0,"force-yes","APT::Get::force-yes",0},
+ {0,"print-uris","APT::Get::Print-URIs",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};
diff --git a/doc/apt-get.8.yo b/doc/apt-get.8.yo
index 30a2fc691..768b4e695 100644
--- a/doc/apt-get.8.yo
+++ b/doc/apt-get.8.yo
@@ -165,6 +165,12 @@ prompting if it is doing something potentially harmfull. It should not be used
except in very special situations. Using bf(force-yes) can potentially destroy
your system! See bf(APT::Get::force-yes).
+dit(bf(--print-uris))
+Instead of fetching the files to install their URIs are printed. Each
+URI will have the path, the destination file name, the size and the expected
+md5 hash. Note that the file name to write to will not always match
+the file name on the remote site! See bf(APT::Get::Print-URIs).
+
dit(bf(-c, --config-file))
Configuration File; Specify a configuration file to use. bf(apt-get) will
read the default configuration file and then this configuration file. See