summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:13 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:13 +0000
commitb0b4efb96c3fad90bf978d61b230501bcdadff3d (patch)
tree63c6013b85da3fe3835f1ef37466c91279fa9c47
parent30456e14d97be16516a5a84ce9bf9acba143da87 (diff)
Release support
Author: jgg Date: 1998-12-14 02:23:46 GMT Release support
-rw-r--r--apt-pkg/cacheiterators.h9
-rw-r--r--apt-pkg/contrib/cmndline.cc10
-rw-r--r--apt-pkg/contrib/cmndline.h4
-rw-r--r--apt-pkg/deb/deblistparser.cc112
-rw-r--r--apt-pkg/deb/deblistparser.h7
-rw-r--r--apt-pkg/pkgcache.h12
-rw-r--r--apt-pkg/pkgcachegen.cc16
-rw-r--r--apt-pkg/pkgcachegen.h6
-rw-r--r--apt-pkg/tagfile.cc55
-rw-r--r--apt-pkg/tagfile.h6
-rw-r--r--cmdline/apt-cache.cc125
-rw-r--r--cmdline/apt-get.cc4
-rw-r--r--doc/Bugs27
-rw-r--r--doc/cache.sgml25
14 files changed, 211 insertions, 207 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 0b5044178..c5b4b14c0 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cacheiterators.h,v 1.9 1998/11/27 00:07:23 jgg Exp $
+// $Id: cacheiterators.h,v 1.10 1998/12/14 02:23:46 jgg Exp $
/* ######################################################################
Cache Iterators - Iterators for navigating the cache structure
@@ -268,8 +268,13 @@ class pkgCache::PkgFileIterator
inline operator PackageFile const *() const {return File == Owner->PkgFileP?0:File;};
inline const char *FileName() const {return File->FileName == 0?0:Owner->StrP + File->FileName;};
+ inline const char *Archive() const {return File->Archive == 0?0:Owner->StrP + File->Archive;};
+ inline const char *Component() const {return File->Component == 0?0:Owner->StrP + File->Component;};
inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;};
- inline const char *Distribution() const {return File->Distribution == 0?0:Owner->StrP + File->Distribution;};
+ inline const char *Origin() const {return File->Origin == 0?0:Owner->StrP + File->Origin;};
+ inline const char *Label() const {return File->Origin == 0?0:Owner->StrP + File->Label;};
+ inline const char *Architecture() const {return File->Origin == 0?0:Owner->StrP + File->Architecture;};
+
inline unsigned long Index() const {return File - Owner->PkgFileP;};
bool IsOk();
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 858a5300a..629b8e9e5 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cmndline.cc,v 1.6 1998/11/25 23:54:22 jgg Exp $
+// $Id: cmndline.cc,v 1.7 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Command Line Class - Sophisticated command line parser
@@ -316,7 +316,7 @@ unsigned int CommandLine::FileSize() const
// CommandLine::DispatchArg - Do something with the first arg /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool CommandLine::DispatchArg(Dispatch *Map)
+bool CommandLine::DispatchArg(Dispatch *Map,bool NoMatch)
{
int I;
for (I = 0; Map[I].Match != 0; I++)
@@ -332,7 +332,11 @@ bool CommandLine::DispatchArg(Dispatch *Map)
// No matching name
if (Map[I].Match == 0)
- _error->Error("Invalid operation %s",FileList[0]);
+ {
+ if (NoMatch == true)
+ _error->Error("Invalid operation %s",FileList[0]);
+ }
+
return false;
}
/*}}}*/
diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h
index 2e1e05229..40d7f08ba 100644
--- a/apt-pkg/contrib/cmndline.h
+++ b/apt-pkg/contrib/cmndline.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cmndline.h,v 1.4 1998/11/25 23:54:31 jgg Exp $
+// $Id: cmndline.h,v 1.5 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Command Line Class - Sophisticated command line parser
@@ -78,7 +78,7 @@ class CommandLine
bool Parse(int argc,const char **argv);
void ShowHelp();
unsigned int FileSize() const;
- bool DispatchArg(Dispatch *List);
+ bool DispatchArg(Dispatch *List,bool NoMatch = true);
CommandLine(Args *AList,Configuration *Conf);
~CommandLine();
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 8b778a726..0e5be1266 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.cc,v 1.10 1998/08/09 00:51:35 jgg Exp $
+// $Id: deblistparser.cc,v 1.11 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -25,42 +25,6 @@ debListParser::debListParser(FileFd &File) : Tags(File)
{
}
/*}}}*/
-// ListParser::FindTag - Find the tag and return a string /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-string debListParser::FindTag(const char *Tag)
-{
- const char *Start;
- const char *Stop;
- if (Section.Find(Tag,Start,Stop) == false)
- return string();
- return string(Start,Stop - Start);
-}
- /*}}}*/
-// ListParser::FindTagI - Find the tag and return an int /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-signed long debListParser::FindTagI(const char *Tag,signed long Default)
-{
- const char *Start;
- const char *Stop;
- if (Section.Find(Tag,Start,Stop) == false)
- return Default;
-
- // Copy it into a temp buffer so we can use strtol
- char S[300];
- if ((unsigned)(Stop - Start) >= sizeof(S))
- return Default;
- strncpy(S,Start,Stop-Start);
- S[Stop - Start] = 0;
-
- char *End;
- signed long Result = strtol(S,&End,10);
- if (S == End)
- return Default;
- return Result;
-}
- /*}}}*/
// ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -73,45 +37,12 @@ unsigned long debListParser::UniqFindTagWrite(const char *Tag)
return WriteUniqString(Start,Stop - Start);
}
/*}}}*/
-// ListParser::HandleFlag - Sets a flag variable based on a tag /*{{{*/
-// ---------------------------------------------------------------------
-/* This checks the tag for true/false yes/no etc */
-bool debListParser::HandleFlag(const char *Tag,unsigned long &Flags,
- unsigned long Flag)
-{
- const char *Start;
- const char *Stop;
- if (Section.Find(Tag,Start,Stop) == false)
- return true;
-
- int Set = 2;
- if (stringcasecmp(Start,Stop,"yes") == 0)
- Set = 1;
- if (stringcasecmp(Start,Stop,"true") == 0)
- Set = 1;
- if (stringcasecmp(Start,Stop,"no") == 0)
- Set = 0;
- if (stringcasecmp(Start,Stop,"false") == 0)
- Set = 0;
- if (Set == 2)
- {
- _error->Warning("Unknown flag value");
- return true;
- }
-
- if (Set == 0)
- Flags &= ~Flag;
- if (Set == 1)
- Flags |= Flag;
- return true;
-}
- /*}}}*/
// ListParser::Package - Return the package name /*{{{*/
// ---------------------------------------------------------------------
/* This is to return the name of the package this section describes */
string debListParser::Package()
{
- string Result = FindTag("Package");
+ string Result = Section.FindS("Package");
if (Result.empty() == true)
_error->Error("Encoutered a section with no Package: header");
return Result;
@@ -124,7 +55,7 @@ string debListParser::Package()
entry is assumed to only describe package properties */
string debListParser::Version()
{
- return FindTag("Version");
+ return Section.FindS("Version");
}
/*}}}*/
// ListParser::NewVersion - Fill in the version structure /*{{{*/
@@ -136,10 +67,10 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
Ver->Section = UniqFindTagWrite("Section");
// Archive Size
- Ver->Size = (unsigned)FindTagI("Size");
+ Ver->Size = (unsigned)Section.FindI("Size");
// Unpacked Size (in K)
- Ver->InstalledSize = (unsigned)FindTagI("Installed-Size");
+ Ver->InstalledSize = (unsigned)Section.FindI("Installed-Size");
Ver->InstalledSize *= 1024;
// Priority
@@ -185,9 +116,9 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
{
if (Pkg->Section == 0)
Pkg->Section = UniqFindTagWrite("Section");
- if (HandleFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
+ if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
return false;
- if (HandleFlag("Immediate-Configure",Pkg->Flags,pkgCache::Flag::ImmediateConf) == false)
+ if (Section.FindFlag("Immediate-Configure",Pkg->Flags,pkgCache::Flag::ImmediateConf) == false)
return false;
if (ParseStatus(Pkg,Ver) == false)
return false;
@@ -512,3 +443,32 @@ bool debListParser::Step()
return false;
}
/*}}}*/
+// ListParser::LoadReleaseInfo - Load the release information /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
+ FileFd &File)
+{
+ pkgTagFile Tags(File);
+ pkgTagSection Section;
+ if (Tags.Step(Section) == false)
+ return false;
+
+ const char *Start;
+ const char *Stop;
+ if (Section.Find("Archive",Start,Stop) == true)
+ FileI->Archive = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Component",Start,Stop) == true)
+ FileI->Component = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Version",Start,Stop) == true)
+ FileI->Version = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Origin",Start,Stop) == true)
+ FileI->Origin = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Label",Start,Stop) == true)
+ FileI->Label = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Architecture",Start,Stop) == true)
+ FileI->Architecture = WriteUniqString(Start,Stop - Start);
+
+ return !_error->PendingError();
+}
+ /*}}}*/
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 72e8ed073..6888c1a5e 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.h,v 1.5 1998/07/19 04:42:17 jgg Exp $
+// $Id: deblistparser.h,v 1.6 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Debian Package List Parser - This implements the abstract parser
@@ -28,10 +28,7 @@ class debListParser : public pkgCacheGenerator::ListParser
unsigned char Val;
};
- string FindTag(const char *Tag);
- signed long FindTagI(const char *Tag,signed long Default = 0);
unsigned long UniqFindTagWrite(const char *Tag);
- bool HandleFlag(const char *Tag,unsigned long &Flags,unsigned long Flag);
bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
const char *ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,unsigned int &Op);
@@ -52,6 +49,8 @@ class debListParser : public pkgCacheGenerator::ListParser
virtual unsigned long Size() {return Section.size();};
virtual bool Step();
+
+ bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File);
debListParser(FileFd &File);
};
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 70d08826e..56ab50a37 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcache.h,v 1.12 1998/12/08 01:34:13 jgg Exp $
+// $Id: pkgcache.h,v 1.13 1998/12/14 02:23:46 jgg Exp $
/* ######################################################################
Cache - Structure definitions for the cache file
@@ -198,9 +198,15 @@ struct pkgCache::PackageFile
{
// Names
__apt_ptrloc FileName; // Stringtable
+ __apt_ptrloc Archive; // Stringtable
+ __apt_ptrloc Component; // Stringtable
__apt_ptrloc Version; // Stringtable
- __apt_ptrloc Distribution; // Stringtable
- __apt_ptrloc Size;
+ __apt_ptrloc Origin; // Stringtable
+ __apt_ptrloc Label; // Stringtable
+ __apt_ptrloc Architecture; // Stringtable
+ unsigned long Size;
+ unsigned char NotAutomatic; // Bool
+
// Linked list
__apt_ptrloc NextFile; // PackageFile
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ccb6bedd4..58561bf35 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.cc,v 1.24 1998/12/07 07:26:21 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.25 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -635,8 +635,8 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++)
{
string File = ListDir + URItoFileName(I->PackagesURI());
-
- if (stat(File.c_str(),&Buf) != 0)
+
+ if (FileExists(File) == false)
continue;
FileFd Pkg(File,FileFd::ReadOnly);
@@ -652,6 +652,16 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
if (Gen.MergeList(Parser) == false)
return _error->Error("Problem with MergeList %s",File.c_str());
+
+ // Check the release file
+ string RFile = ListDir + URItoFileName(I->ReleaseURI());
+ if (FileExists(RFile) == true)
+ {
+ FileFd Rel(RFile,FileFd::ReadOnly);
+ if (_error->PendingError() == true)
+ return false;
+ Parser.LoadReleaseInfo(Gen.GetCurFile(),Rel);
+ }
}
// Write the src cache
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 093f979d7..4c22ecf6f 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.h,v 1.10 1998/08/09 00:51:34 jgg Exp $
+// $Id: pkgcachegen.h,v 1.11 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -57,7 +57,9 @@ class pkgCacheGenerator
bool SelectFile(string File,unsigned long Flags = 0);
bool MergeList(ListParser &List);
inline pkgCache &GetCache() {return Cache;};
-
+ inline pkgCache::PkgFileIterator GetCurFile()
+ {return pkgCache::PkgFileIterator(Cache,CurrentFile);};
+
pkgCacheGenerator(DynamicMMap &Map,OpProgress &Progress);
~pkgCacheGenerator();
};
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 7f2bf6b1d..eb0840366 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.cc,v 1.18 1998/12/08 05:24:41 jgg Exp $
+// $Id: tagfile.cc,v 1.19 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -17,6 +17,7 @@
#include <apt-pkg/tagfile.h>
#include <apt-pkg/error.h>
+#include <strutl.h>
#include <string>
#include <stdio.h>
@@ -225,14 +226,54 @@ string pkgTagSection::FindS(const char *Tag)
// TagSection::FindI - Find an integer /*{{{*/
// ---------------------------------------------------------------------
/* */
-unsigned int pkgTagSection::FindI(const char *Tag)
+signed int pkgTagSection::FindI(const char *Tag,signed long Default)
{
const char *Start;
- const char *End;
- if (Find(Tag,Start,End) == false)
- return 0;
+ const char *Stop;
+ if (Find(Tag,Start,Stop) == false)
+ return Default;
+
+ // Copy it into a temp buffer so we can use strtol
+ char S[300];
+ if ((unsigned)(Stop - Start) >= sizeof(S))
+ return Default;
+ strncpy(S,Start,Stop-Start);
+ S[Stop - Start] = 0;
+
+ char *End;
+ signed long Result = strtol(S,&End,10);
+ if (S == End)
+ return Default;
+ return Result;
+}
+ /*}}}*/
+// TagSection::FindFlag - Locate a yes/no type flag /*{{{*/
+// ---------------------------------------------------------------------
+/* The bits marked in Flag are masked on/off in Flags */
+bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
+ unsigned long Flag)
+{
+ const char *Start;
+ const char *Stop;
+ if (Find(Tag,Start,Stop) == false)
+ return true;
- return atoi(string(Start,End).c_str());
+ switch (StringToBool(string(Start,Stop)))
+ {
+ case 0:
+ Flags &= ~Flag;
+ return true;
+
+ case 1:
+ Flags |= Flag;
+ return true;
+
+ default:
+ _error->Warning("Unknown flag value");
+ return true;
+ }
+ return true;
}
/*}}}*/
-
+
+
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index 83dd73d2a..82c856f8d 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.h,v 1.12 1998/12/07 07:26:23 jgg Exp $
+// $Id: tagfile.h,v 1.13 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -45,7 +45,9 @@ class pkgTagSection
bool Find(const char *Tag,const char *&Start, const char *&End);
string FindS(const char *Tag);
- unsigned int FindI(const char *Tag);
+ signed int FindI(const char *Tag,signed long Default = 0);
+ bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
+ unsigned long Flag);
bool Scan(const char *Start,unsigned long MaxLength);
inline unsigned long size() {return Stop - Section;};
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 6f262ae92..b4bb3a818 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.18 1998/12/10 05:39:53 jgg Exp $
+// $Id: apt-cache.cc,v 1.19 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache files
@@ -28,11 +28,14 @@
#include <config.h>
/*}}}*/
+pkgCache *GCache = 0;
+
// UnMet - Show unmet dependencies /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool UnMet(pkgCache &Cache)
+bool UnMet(CommandLine &CmdL)
{
+ pkgCache &Cache = *GCache;
bool Important = _config->FindB("APT::Cache::Important",false);
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
@@ -122,8 +125,9 @@ bool UnMet(pkgCache &Cache)
// DumpPackage - Show a dump of a package record /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool DumpPackage(pkgCache &Cache,CommandLine &CmdL)
+bool DumpPackage(CommandLine &CmdL)
{
+ pkgCache &Cache = *GCache;
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);
@@ -179,8 +183,9 @@ bool DumpPackage(pkgCache &Cache,CommandLine &CmdL)
// Stats - Dump some nice statistics /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Stats(pkgCache &Cache)
+bool Stats(CommandLine &Cmd)
{
+ pkgCache &Cache = *GCache;
cout << "Total Package Names : " << Cache.Head().PackageCount << " (" <<
SizeToStr(Cache.Head().PackageCount*Cache.Head().PackageSz) << ')' << endl;
pkgCache::PkgIterator I = Cache.PkgBegin();
@@ -263,8 +268,9 @@ bool Stats(pkgCache &Cache)
// Check - Check some things about the cache /*{{{*/
// ---------------------------------------------------------------------
/* Debug aide mostly */
-bool Check(pkgCache &Cache)
+bool Check(CommandLine &Cmd)
{
+ pkgCache &Cache = *GCache;
pkgCache::PkgIterator Pkg = Cache.PkgBegin();
for (;Pkg.end() != true; Pkg++)
{
@@ -284,8 +290,9 @@ bool Check(pkgCache &Cache)
// Dump - show everything /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool Dump(pkgCache &Cache)
+bool Dump(CommandLine &Cmd)
{
+ pkgCache &Cache = *GCache;
for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
{
cout << "Package: " << P.Name() << endl;
@@ -304,7 +311,13 @@ bool Dump(pkgCache &Cache)
cout << " Size: " << F->Size << endl;
cout << " ID: " << F->ID << endl;
cout << " Flags: " << F->Flags << endl;
- cout << " Time: " << ctime(&F->mtime) << endl;
+ cout << " Time: " << TimeRFC1123(F->mtime) << endl;
+ cout << " Archive: " << F.Archive() << endl;
+ cout << " Component: " << F.Component() << endl;
+ cout << " Version: " << F.Version() << endl;
+ cout << " Origin: " << F.Origin() << endl;
+ cout << " Label: " << F.Label() << endl;
+ cout << " Architecture: " << F.Architecture() << endl;
}
return true;
@@ -313,8 +326,9 @@ bool Dump(pkgCache &Cache)
// DumpAvail - Print out the available list /*{{{*/
// ---------------------------------------------------------------------
/* This is needed to make dpkg --merge happy */
-bool DumpAvail(pkgCache &Cache)
+bool DumpAvail(CommandLine &Cmd)
{
+ pkgCache &Cache = *GCache;
unsigned char *Buffer = new unsigned char[Cache.HeaderP->MaxVerFileSize];
for (pkgCache::PkgFileIterator I = Cache.FileBegin(); I.end() == false; I++)
@@ -404,7 +418,8 @@ bool DoAdd(CommandLine &CmdL)
}
Progress.Done();
- Stats(Gen.GetCache());
+ GCache = &Gen.GetCache();
+ Stats(CmdL);
return true;
}
@@ -412,7 +427,7 @@ bool DoAdd(CommandLine &CmdL)
// GenCaches - Call the main cache generator /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool GenCaches()
+bool GenCaches(CommandLine &Cmd)
{
OpTextProgress Progress(*_config);
@@ -424,7 +439,7 @@ bool GenCaches()
// ShowHelp - Show a help screen /*{{{*/
// ---------------------------------------------------------------------
/* */
-int ShowHelp()
+bool ShowHelp(CommandLine &Cmd)
{
cout << PACKAGE << ' ' << VERSION << " for " << ARCHITECTURE <<
" compiled on " << __DATE__ << " " << __TIME__ << endl;
@@ -480,6 +495,17 @@ int main(int argc,const char *argv[])
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};
+ CommandLine::Dispatch CmdsA[] = {{"help",&ShowHelp},
+ {"add",&DoAdd},
+ {"gencaches",&GenCaches},
+ {0,0}};
+ CommandLine::Dispatch CmdsB[] = {{"showpkg",&DumpPackage},
+ {"stats",&Stats},
+ {"dump",&Dump},
+ {"dumpavail",&DumpAvail},
+ {"unmet",&UnMet},
+ {"check",&Check},
+ {0,0}};
CacheInitialize();
@@ -495,79 +521,20 @@ int main(int argc,const char *argv[])
// See if the help should be shown
if (_config->FindB("help") == true ||
CmdL.FileSize() == 0)
- return ShowHelp();
-
- while (1)
- {
- if (strcmp(CmdL.FileList[0],"add") == 0)
- {
- ShowHelp();
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"add") == 0)
- {
- DoAdd(CmdL);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"gencaches") == 0)
- {
- GenCaches();
- break;
- }
+ return ShowHelp(CmdL);
+ if (CmdL.DispatchArg(CmdsA,false) == false && _error->PendingError() == false)
+ {
// Open the cache file
FileFd CacheF(_config->FindFile("Dir::Cache::pkgcache"),FileFd::ReadOnly);
- if (_error->PendingError() == true)
- break;
-
MMap Map(CacheF,MMap::Public | MMap::ReadOnly);
- if (_error->PendingError() == true)
- break;
-
- pkgCache Cache(Map);
- if (_error->PendingError() == true)
- break;
-
- if (strcmp(CmdL.FileList[0],"showpkg") == 0)
- {
- DumpPackage(Cache,CmdL);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"stats") == 0)
- {
- Stats(Cache);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"dump") == 0)
+ if (_error->PendingError() == false)
{
- Dump(Cache);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"dumpavail") == 0)
- {
- DumpAvail(Cache);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"unmet") == 0)
- {
- UnMet(Cache);
- break;
- }
-
- if (strcmp(CmdL.FileList[0],"check") == 0)
- {
- Check(Cache);
- break;
- }
-
- _error->Error("Invalid operation %s", CmdL.FileList[0]);
- break;
+ pkgCache Cache(Map);
+ GCache = &Cache;
+ if (_error->PendingError() == false)
+ CmdL.DispatchArg(CmdsB);
+ }
}
// Print any errors or warnings found during parsing
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 3937b3413..f7313a07e 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.30 1998/12/10 04:26:09 jgg Exp $
+// $Id: apt-get.cc,v 1.31 1998/12/14 02:23:47 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@@ -1097,8 +1097,6 @@ int main(int argc,const char *argv[])
{
bool Errors = _error->PendingError();
_error->DumpErrors();
- if (Errors == true)
- cout << "Returning 100." << endl;
return Errors == true?100:0;
}
diff --git a/doc/Bugs b/doc/Bugs
index 633137202..536599aeb 100644
--- a/doc/Bugs
+++ b/doc/Bugs
@@ -4,9 +4,6 @@
Status: Require Status file.
#24717: apt dies early if one postinst/preinst dies
Status: Requires dpkg modifications
-#28184: apt could be smarter regarding mirrors
- Summary: Make use of redundant sources
- Status: 0.3.0 will likely do this, already the information for it is stored.
#25104: APT should retry failed downloads
Summary: FTP method has problems with busy servers
Status: The 0.3.0 ftp method should probably use the configuration mechanism
@@ -137,7 +134,20 @@
#22892: Apt improvements
Summary: Bails if an index file can't be found
Status: Fixed in v3
-
+#28184: apt could be smarter regarding mirrors
+ Summary: Make use of redundant sources
+ Status: 0.3.0 will likely do this, already the information for it is stored.
+#27646: Apt: dpkg --merge-avail
+ Summary: Suggestion to call merge avail after each update operation
+ Status: Unlikely. The dpkg --print-avail functions should be obsoleted
+ by the apt-query program which should be written.
+ Use the dselect script, alias or something.
+#26663: rsync file access
+ Status: Unlikely, rsync does not provide the necessary support to be
+ a terribly good method. I do not intend any 'split mode'
+ support (ie a way to get Package files via rsync and .debs
+ via http)
+
-- Silly things
#26592: apt: Problems with ftpd in SunOS 5.6
#29903: apt-get insists onto sending a SIZE command
@@ -151,18 +161,9 @@
#23934: apt-get source <package>
#27190: apt: installing source packages (wishlist)
Status: Impossible to do without an index file for all source archives.
-#26663: rsync file access
- Status: Unlikely, rsync does not provide the necessary support to be
- a terribly good method. I do not intend any 'split mode'
- support (ie a way to get Package files via rsync and .debs
- via http)
#22551: apt: wish: use dist X iff pkg does not exist in dist Y
#27100: apt: Better support for project/experimental
Status: GUI Feature - Version selection and pinning
-#27646: Apt: dpkg --merge-avail
- Summary: Suggestion to call merge avail after each update operation
- Status: Unlikely. The dpkg --print-avail functions should be obsoleted
- by the apt-query program which should be written.
#30237: apt: 0.1.9 checks dependencies against packages.gz
Summary: For packages with identical version numbers APT prefers
to use the archive index files
diff --git a/doc/cache.sgml b/doc/cache.sgml
index 9516af512..fe3cfdf08 100644
--- a/doc/cache.sgml
+++ b/doc/cache.sgml
@@ -4,7 +4,7 @@
<title>APT Cache File Format</title>
<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
-<version>$Id: cache.sgml,v 1.3 1998/07/19 04:22:11 jgg Exp $</version>
+<version>$Id: cache.sgml,v 1.4 1998/12/14 02:23:47 jgg Exp $</version>
<abstract>
This document describes the complete implementation and format of the APT
@@ -351,10 +351,15 @@ Header.FileList
{
// Names
unsigned long FileName; // Stringtable
+ unsigned long Archive; // Stringtable
+ unsigned long Component; // Stringtable
unsigned long Version; // Stringtable
- unsigned long Distribution; // Stringtable
+ unsigned long Origin; // Stringtable
+ unsigned long Label; // Stringtable
+ unsigned long Architecture; // Stringtable
unsigned long Size;
-
+ unsigned char NotAutomatic; // Bool
+
// Linked list
unsigned long NextFile; // PackageFile
unsigned short ID;
@@ -367,11 +372,15 @@ Header.FileList
<tag>FileName<item>
Refers the the physical disk file that this PacakgeFile represents.
-<tag>Version<item>
-Version is the given version, ie 1.3.1, 2.4_revision_1 etc.
-
-<tag>Distribution<item>
-Distribution is the symbolic name for this PackageFile, hamm,bo,rexx etc
+<tag>Archive
+<tag>Component
+<tag>Version
+<tag>Origin
+<tag>Label
+<tag>Architecture
+<tag>NotAutomatic<item>
+This is the release information. Please see the files document for a
+description of what the release information means.
<tag>Size<item>
Size is provided as a simple check to ensure that the package file has not