diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:55 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:55 +0000 |
commit | f8f410f57e7941a7bf57c5c84b77b2bcd577ac6b (patch) | |
tree | 0e9934672e7bd0a1b29c29ccacc4f451bc0cd26e | |
parent | 9e2a06ff63968286395f3426b689cf7c3914a883 (diff) |
apt-cache showsrc
Author: jgg
Date: 1999-10-18 03:44:39 GMT
apt-cache showsrc
-rw-r--r-- | apt-pkg/deb/debsrcrecords.h | 9 | ||||
-rw-r--r-- | apt-pkg/srcrecords.h | 3 | ||||
-rw-r--r-- | cmdline/apt-cache.cc | 28 | ||||
-rw-r--r-- | debian/changelog | 1 |
4 files changed, 37 insertions, 4 deletions
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index 426b914e8..e09a57f3c 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: debsrcrecords.h,v 1.3 1999/04/07 05:51:01 jgg Exp $ +// $Id: debsrcrecords.h,v 1.4 1999/10/18 03:44:39 jgg Exp $ /* ###################################################################### Debian Source Package Records - Parser implementation for Debian style @@ -38,6 +38,13 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual string Section() {return Sect.FindS("Section");}; virtual const char **Binaries(); virtual unsigned long Offset() {return iOffset;}; + virtual unsigned long Length() {return Sec.size();}; + virtual string AsStr() + { + const char *Start,Stop; + Sect.GetSection(Start,Stop); + return string(Start,Stop); + }; virtual bool Files(vector<pkgSrcRecords::File> &F); debSrcRecordParser(FileFd *File,pkgSourceList::const_iterator SrcItem) : diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index 17297a60e..8391349dd 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: srcrecords.h,v 1.4 1999/07/20 05:53:33 jgg Exp $ +// $Id: srcrecords.h,v 1.5 1999/10/18 03:44:39 jgg Exp $ /* ###################################################################### Source Package Records - Allows access to source package records @@ -46,6 +46,7 @@ class pkgSrcRecords virtual bool Step() = 0; virtual bool Jump(unsigned long Off) = 0; virtual unsigned long Offset() = 0; + virtual string AsStr() = 0; virtual string Package() = 0; virtual string Version() = 0; diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index b825bd4f9..5bb9db7cc 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-cache.cc,v 1.38 1999/10/02 04:14:54 jgg Exp $ +// $Id: apt-cache.cc,v 1.39 1999/10/18 03:44:39 jgg Exp $ /* ###################################################################### apt-cache - Manages the cache files @@ -24,6 +24,7 @@ #include <apt-pkg/cmndline.h> #include <apt-pkg/strutl.h> #include <apt-pkg/pkgrecords.h> +#include <apt-pkg/srcrecords.h> #include <config.h> #include <iostream.h> @@ -597,6 +598,28 @@ bool ShowPackage(CommandLine &CmdL) return true; } /*}}}*/ +// ShowSrcPackage - Show source package records /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool ShowSrcPackage(CommandLine &CmdL) +{ + pkgSourceList List; + List.ReadMainList(); + + // Create the text record parsers + pkgSrcRecords SrcRecs(List); + if (_error->PendingError() == true) + return false; + + for (const char **I = CmdL.FileList + 1; *I != 0; I++) + { + pkgSrcRecords::Parser *Parse; + while ((Parse = SrcRecs.Find(*I,false)) != 0) + cout << Parse->AsStr(); + } + return true; +} + /*}}}*/ // GenCaches - Call the main cache generator /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -680,6 +703,7 @@ int main(int argc,const char *argv[]) CommandLine::Dispatch CmdsA[] = {{"help",&ShowHelp}, {"add",&DoAdd}, {"gencaches",&GenCaches}, + {"showsrc",&ShowSrcPackage}, {0,0}}; CommandLine::Dispatch CmdsB[] = {{"showpkg",&DumpPackage}, {"stats",&Stats}, @@ -725,7 +749,7 @@ int main(int argc,const char *argv[]) // Open the cache file pkgSourceList List; List.ReadMainList(); - + // Generate it and map it OpProgress Prog; Map = pkgMakeStatusCacheMem(List,Prog); diff --git a/debian/changelog b/debian/changelog index 0a2ef08cf..c97f18ae4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ apt (0.3.13.1) unstable; urgency=low * Unmounts CDROMs iff it mounted them Closes: #45299 * Checks for the partial directories before doing downloads Closes: #47392 * no_proxy environment variable (http only!) Closes: #43476 + * apt-cache showsrc Closes: #45799 -- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700 |