Browse Source

show progress info while 'downloading' a local .deb file

Showing just "Get: [1234 B]" looks very strange, so we now print the
filename and as usual the package name, version and architecture.
David Kalnischkies 10 years ago
parent
commit
64b66a46a7
3 changed files with 17 additions and 3 deletions
  1. 8 1
      apt-pkg/deb/debindexfile.cc
  2. 3 0
      apt-pkg/deb/debindexfile.h
  3. 6 2
      apt-pkg/indexfile.cc

+ 8 - 1
apt-pkg/deb/debindexfile.cc

@@ -249,7 +249,14 @@ pkgCache::PkgFileIterator debDebPkgFileIndex::FindInCache(pkgCache &Cache) const
 
    return File;
 }
-
+std::string debDebPkgFileIndex::ArchiveInfo_impl(pkgCache::VerIterator const &Ver) const
+{
+   std::string Res = IndexFileName() + " ";
+   Res.append(Ver.ParentPkg().Name()).append(" ");
+   Res.append(Ver.Arch()).append(" ");
+   Res.append(Ver.VerStr());
+   return Res;
+}
 									/*}}}*/
 // DscFile Index - a single .dsc file as an index			/*{{{*/
 debDscFileIndex::debDscFileIndex(std::string const &DscFile)

+ 3 - 0
apt-pkg/deb/debindexfile.h

@@ -144,6 +144,9 @@ public:
 
    debDebPkgFileIndex(std::string const &DebFile);
    virtual ~debDebPkgFileIndex();
+
+   //FIXME: use proper virtual-handling on next ABI break
+   APT_HIDDEN std::string ArchiveInfo_impl(pkgCache::VerIterator const &Ver) const;
 };
 
 class debDscFileIndex : public pkgDebianIndexRealFile

+ 6 - 2
apt-pkg/indexfile.cc

@@ -21,9 +21,10 @@
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/progress.h>
+#include <apt-pkg/deblistparser.h>
 #include <apt-pkg/macros.h>
 
-#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/debindexfile.h>
 
 #include <sys/stat.h>
 
@@ -66,8 +67,11 @@ pkgIndexFile::pkgIndexFile(bool const Trusted) :			/*{{{*/
 }
 									/*}}}*/
 // IndexFile::ArchiveInfo - Stub					/*{{{*/
-std::string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator const &/*Ver*/) const
+std::string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator const &Ver) const
 {
+   debDebPkgFileIndex const * const debfile = dynamic_cast<debDebPkgFileIndex const*>(this);
+   if (debfile != nullptr)
+      return debfile->ArchiveInfo_impl(Ver);
    return std::string();
 }
 									/*}}}*/