Browse Source

Archive acquire code

Author: jgg
Date: 1998-11-13 04:23:26 GMT
Archive acquire code
debian/1.8.y
Arch Librarian 19 years ago
parent
commit
03e39e5923
  1. 97
      apt-pkg/acquire-item.cc
  2. 22
      apt-pkg/acquire-item.h
  3. 4
      apt-pkg/deb/debrecords.cc
  4. 4
      apt-pkg/deb/debrecords.h
  5. 197
      apt-pkg/deb/dpkgpm.cc
  6. 49
      apt-pkg/deb/dpkgpm.h
  7. 5
      apt-pkg/makefile
  8. 23
      apt-pkg/packagemanager.cc
  9. 9
      apt-pkg/packagemanager.h
  10. 4
      apt-pkg/pkgcache.cc
  11. 12
      apt-pkg/pkgcachegen.cc
  12. 12
      apt-pkg/pkgrecords.cc
  13. 8
      apt-pkg/pkgrecords.h
  14. 5
      apt-pkg/tagfile.cc
  15. 11
      cmdline/apt-cache.cc
  16. 40
      cmdline/apt-get.cc

97
apt-pkg/acquire-item.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-item.cc,v 1.10 1998/11/12 04:10:52 jgg Exp $
// $Id: acquire-item.cc,v 1.11 1998/11/13 04:23:26 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
@ -18,6 +18,7 @@
#endif
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <strutl.h>
#include <sys/stat.h>
@ -300,3 +301,97 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5)
Rename(DestFile,FinalFile);
}
/*}}}*/
// AcqArchive::AcqArchive - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs,pkgCache::VerIterator const &Version) :
Item(Owner), Version(Version), Sources(Sources), Recs(Recs)
{
// Select a source
pkgCache::VerFileIterator Vf = Version.FileList();
for (; Vf.end() == false; Vf++)
{
// Ignore not source sources
if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0)
continue;
// Try to cross match against the source list
string PkgFile = flNotDir(Vf.File().FileName());
pkgSourceList::const_iterator Location;
for (Location = Sources->begin(); Location != Sources->end(); Location++)
if (PkgFile == URItoFileName(Location->PackagesURI()))
break;
if (Location == Sources->end())
continue;
// Grab the text package record
pkgRecords::Parser &Parse = Recs->Lookup(Vf);
if (_error->PendingError() == true)
return;
PkgFile = Parse.FileName();
MD5 = Parse.MD5Hash();
if (PkgFile.empty() == true)
{
_error->Error("Unable to locate a file name for package %s, "
"perhaps the package files are corrupted.",
Version.ParentPkg().Name());
return;
}
// Create the item
Desc.URI = Location->ArchiveURI(PkgFile);
Desc.Description = Location->ArchiveInfo(Version);
Desc.Owner = this;
Desc.ShortDesc = Version.ParentPkg().Name();
QueueURI(Desc);
DestFile = _config->FindDir("Dir::Cache::Archives") + "partial/" + flNotDir(PkgFile);
return;
}
_error->Error("I wasn't able to locate file for the %s package. "
"This probably means you need to rerun update.",
Version.ParentPkg().Name());
}
/*}}}*/
// AcqArchive::Done - Finished fetching /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash)
{
Item::Done(Message,Size,MD5);
// Check the size
if (Size != Version->Size)
{
_error->Error("Size mismatch for package %s",Version.ParentPkg().Name());
return;
}
// Check the md5
if (Md5Hash.empty() == false && MD5.empty() == false)
{
if (Md5Hash != MD5)
{
_error->Error("MD5Sum mismatch for package %s",Version.ParentPkg().Name());
return;
}
}
// Store the destination filename
string FileName = LookupTag(Message,"Filename");
if (FileName.empty() == true)
{
Status = StatError;
ErrorText = "Method gave a blank filename";
return;
}
DestFile = FileName;
Complete = true;
}
/*}}}*/

22
apt-pkg/acquire-item.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-item.h,v 1.7 1998/11/11 06:54:14 jgg Exp $
// $Id: acquire-item.h,v 1.8 1998/11/13 04:23:28 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
@ -19,6 +19,7 @@
#include <apt-pkg/acquire.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/pkgrecords.h>
#ifdef __GNUG__
#pragma interface "apt-pkg/acquire-item.h"
@ -95,4 +96,23 @@ class pkgAcqIndexRel : public pkgAcquire::Item
pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
};
// Item class for archive files
class pkgAcqArchive : public pkgAcquire::Item
{
protected:
pkgCache::VerIterator Version;
pkgAcquire::ItemDesc Desc;
pkgSourceList *Sources;
pkgRecords *Recs;
string MD5;
public:
virtual void Done(string Message,unsigned long Size,string Md5Hash);
pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs,pkgCache::VerIterator const &Version);
};
#endif

4
apt-pkg/deb/debrecords.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: debrecords.cc,v 1.2 1998/10/08 04:55:02 jgg Exp $
// $Id: debrecords.cc,v 1.3 1998/11/13 04:23:37 jgg Exp $
/* ######################################################################
Debian Package Records - Parser for debian package records
@ -25,7 +25,7 @@ debRecordParser::debRecordParser(FileFd &File) : Tags(File,4*1024)
// RecordParser::Jump - Jump to a specific record /*{{{*/
// ---------------------------------------------------------------------
/* */
bool debRecordParser::Jump(pkgCache::VerFileIterator &Ver)
bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
{
return Tags.Jump(Section,Ver->Offset);
}

4
apt-pkg/deb/debrecords.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: debrecords.h,v 1.2 1998/10/08 04:55:04 jgg Exp $
// $Id: debrecords.h,v 1.3 1998/11/13 04:23:38 jgg Exp $
/* ######################################################################
Debian Package Records - Parser for debian package records
@ -31,7 +31,7 @@ class debRecordParser : public pkgRecords::Parser
protected:
virtual bool Jump(pkgCache::VerFileIterator &Ver);
virtual bool Jump(pkgCache::VerFileIterator const &Ver);
public:

197
apt-pkg/deb/dpkgpm.cc

@ -0,0 +1,197 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: dpkgpm.cc,v 1.1 1998/11/13 04:23:39 jgg Exp $
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
##################################################################### */
/*}}}*/
// Includes /*{{{*/
#ifdef __GNUG__
#pragma implementation "apt-pkg/dpkgpm.h"
#endif
#include <apt-pkg/dpkgpm.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
/*}}}*/
// DPkgPM::pkgDPkgPM - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgDPkgPM::pkgDPkgPM(pkgDepCache &Cache) : pkgPackageManager(Cache)
{
}
/*}}}*/
// DPkgPM::pkgDPkgPM - Destructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgDPkgPM::~pkgDPkgPM()
{
}
/*}}}*/
// DPkgPM::Install - Install a package /*{{{*/
// ---------------------------------------------------------------------
/* Add an install operation to the sequence list */
bool pkgDPkgPM::Install(PkgIterator Pkg,string File)
{
if (File.empty() == true || Pkg.end() == true)
return _error->Error("Internal Error, No file name for %s",Pkg.Name());
List.push_back(Item(Item::Install,Pkg,File));
return true;
}
/*}}}*/
// DPkgPM::Configure - Configure a package /*{{{*/
// ---------------------------------------------------------------------
/* Add a configure operation to the sequence list */
bool pkgDPkgPM::Configure(PkgIterator Pkg)
{
if (Pkg.end() == true)
return false;
List.push_back(Item(Item::Configure,Pkg));
return true;
}
/*}}}*/
// DPkgPM::Remove - Remove a package /*{{{*/
// ---------------------------------------------------------------------
/* Add a remove operation to the sequence list */
bool pkgDPkgPM::Remove(PkgIterator Pkg)
{
if (Pkg.end() == true)
return false;
List.push_back(Item(Item::Remove,Pkg));
return true;
}
/*}}}*/
// DPkgPM::Go - Run the sequence /*{{{*/
// ---------------------------------------------------------------------
/* This globs the operations and calls dpkg */
bool pkgDPkgPM::Go()
{
for (vector<Item>::iterator I = List.begin(); I != List.end();)
{
vector<Item>::iterator J = I;
for (; J != List.end() && J->Op == I->Op; J++);
// Generate the argument list
const char *Args[400];
if (J - I > 350)
J = I + 350;
int n= 0;
Args[n++] = "dpkg";
switch (I->Op)
{
case Item::Remove:
Args[n++] = "--force-depends";
Args[n++] = "--force-remove-essential";
Args[n++] = "--remove";
break;
case Item::Configure:
Args[n++] = "--configure";
break;
case Item::Install:
Args[n++] = "--unpack";
break;
}
// Write in the file or package names
if (I->Op == Item::Install)
for (;I != J; I++)
Args[n++] = I->File.c_str();
else
for (;I != J; I++)
Args[n++] = I->Pkg.Name();
Args[n] = 0;
/* for (int k = 0; k != n; k++)
cout << Args[k] << ' ';
cout << endl;*/
cout << flush;
clog << flush;
cerr << flush;
/* Mask off sig int/quit. We do this because dpkg also does when
it forks scripts. What happens is that when you hit ctrl-c it sends
it to all processes in the group. Since dpkg ignores the signal
it doesn't die but we do! So we must also ignore it */
signal(SIGQUIT,SIG_IGN);
signal(SIGINT,SIG_IGN);
// Fork dpkg
pid_t Child = fork();
if (Child < 0)
return _error->Errno("fork","Could't fork");
// This is the child
if (Child == 0)
{
signal(SIGQUIT,SIG_DFL);
signal(SIGINT,SIG_DFL);
signal(SIGWINCH,SIG_DFL);
signal(SIGCONT,SIG_DFL);
signal(SIGTSTP,SIG_DFL);
if (chdir(_config->FindDir("Dir::Cache::Archives").c_str()) != 0)
exit(100);
// Close all of our FDs - just in case
for (int K = 3; K != 40; K++)
fcntl(K,F_SETFD,FD_CLOEXEC);
int Flags,dummy;
if ((Flags = fcntl(STDIN_FILENO,F_GETFL,dummy)) < 0)
exit(100);
// Discard everything in stdin before forking dpkg
if (fcntl(STDIN_FILENO,F_SETFL,Flags | O_NONBLOCK) < 0)
exit(100);
while (read(STDIN_FILENO,&dummy,1) == 1);
if (fcntl(STDIN_FILENO,F_SETFL,Flags & (~(long)O_NONBLOCK)) < 0)
exit(100);
/* No Job Control Stop Env is a magic dpkg var that prevents it
from using sigstop */
setenv("DPKG_NO_TSTP","yes",1);
execvp("dpkg",(char **)Args);
cerr << "Could not exec dpkg!" << endl;
exit(100);
}
// Wait for dpkg
int Status = 0;
while (waitpid(Child,&Status,0) != Child)
{
if (errno == EINTR)
continue;
return _error->Errno("waitpid","Couldn't wait for subprocess");
}
// Check for an error code.
if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
return _error->Error("Sub-process returned an error code");
// Restore sig int/quit
signal(SIGQUIT,SIG_DFL);
signal(SIGINT,SIG_DFL);
}
return true;
}
/*}}}*/

49
apt-pkg/deb/dpkgpm.h

@ -0,0 +1,49 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: dpkgpm.h,v 1.1 1998/11/13 04:23:39 jgg Exp $
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
##################################################################### */
/*}}}*/
// Header section: pkglib
#ifndef PKGLIB_DPKGPM_H
#define PKGLIB_DPKGPM_H
#ifdef __GNUG__
#pragma interface "apt-pkg/dpkgpm.h"
#endif
#include <apt-pkg/packagemanager.h>
#include <vector>
class pkgDPkgPM : public pkgPackageManager
{
protected:
struct Item
{
enum Ops {Install, Configure, Remove} Op;
string File;
PkgIterator Pkg;
Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
File(File), Pkg(Pkg) {};
Item() {};
};
vector<Item> List;
// The Actuall installation implementation
virtual bool Install(PkgIterator Pkg,string File);
virtual bool Configure(PkgIterator Pkg);
virtual bool Remove(PkgIterator Pkg);
virtual bool Go();
public:
pkgDPkgPM(pkgDepCache &Cache);
virtual ~pkgDPkgPM();
};
#endif

5
apt-pkg/makefile

@ -27,14 +27,15 @@ SOURCE+= pkgcache.cc version.cc fileutl.cc pkgcachegen.cc depcache.cc \
acquire-worker.cc acquire-method.cc init.cc templates.cc
# Source code for the debian specific components
SOURCE+= deb/deblistparser.cc deb/debrecords.cc
SOURCE+= deb/deblistparser.cc deb/debrecords.cc deb/dpkgpm.cc
# Public apt-pkg header files
HEADERS = algorithms.h depcache.h mmap.h pkgcachegen.h cacheiterators.h \
error.h orderlist.h sourcelist.h configuration.h fileutl.h \
packagemanager.h tagfile.h deblistparser.h init.h pkgcache.h \
version.h progress.h pkgrecords.h debrecords.h cmndline.h \
acquire.h acquire-worker.h acquire-item.h acquire-method.h md5.h
acquire.h acquire-worker.h acquire-item.h acquire-method.h md5.h \
dpkgpm.h
HEADERS := $(addprefix apt-pkg/,$(HEADERS))

23
apt-pkg/packagemanager.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: packagemanager.cc,v 1.4 1998/07/12 23:58:30 jgg Exp $
// $Id: packagemanager.cc,v 1.5 1998/11/13 04:23:30 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@ -21,6 +21,7 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
#include <apt-pkg/version.h>
#include <apt-pkg/acquire-item.h>
/*}}}*/
// PM::PackageManager - Constructor /*{{{*/
@ -41,6 +42,26 @@ pkgPackageManager::~pkgPackageManager()
delete [] FileNames;
}
/*}}}*/
// PM::GetArchives - Queue the archives for download /*{{{*/
// ---------------------------------------------------------------------
/* */
bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs)
{
pkgCache::PkgIterator I = Cache.PkgBegin();
for (;I.end() != true; I++)
{
// Not interesting
if ((Cache[I].InstallVer == (pkgCache::Version *)I.CurrentVer() &&
I.State() != pkgCache::PkgIterator::NeedsUnpack) ||
Cache[I].Delete() == true)
continue;
new pkgAcqArchive(Owner,Sources,Recs,Cache[I].InstVerIter(Cache));
}
return true;
}
/*}}}*/
// PM::FixMissing - Keep all missing packages /*{{{*/
// ---------------------------------------------------------------------
/* This is called to correct the installation when packages could not

9
apt-pkg/packagemanager.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: packagemanager.h,v 1.4 1998/07/19 21:24:13 jgg Exp $
// $Id: packagemanager.h,v 1.5 1998/11/13 04:23:31 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@ -31,10 +31,11 @@
#include <string>
#include <apt-pkg/pkgcache.h>
class pkgAquire;
class pkgAcquire;
class pkgDepCache;
class pkgSourceList;
class pkgOrderList;
class pkgRecords;
class pkgPackageManager
{
protected:
@ -68,11 +69,13 @@ class pkgPackageManager
virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
virtual bool Remove(PkgIterator /*Pkg*/) {return false;};
virtual bool Go() {return false;};
virtual bool Go() {return true;};
public:
// Main action members
bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs);
bool DoInstall();
bool FixMissing();

4
apt-pkg/pkgcache.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: pkgcache.cc,v 1.14 1998/11/08 23:29:19 jgg Exp $
// $Id: pkgcache.cc,v 1.15 1998/11/13 04:23:32 jgg Exp $
/* ######################################################################
Package Cache - Accessor code for the cache
@ -44,7 +44,7 @@ pkgCache::Header::Header()
/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
MajorVersion = 2;
MinorVersion = 1;
MinorVersion = 2;
Dirty = true;
HeaderSz = sizeof(pkgCache::Header);

12
apt-pkg/pkgcachegen.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: pkgcachegen.cc,v 1.22 1998/11/12 03:28:31 jgg Exp $
// $Id: pkgcachegen.cc,v 1.23 1998/11/13 04:23:33 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@ -176,8 +176,14 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
pkgCache::VerFileIterator VF(Cache,Cache.VerFileP + VerFile);
VF->File = CurrentFile - Cache.PkgFileP;
VF->NextFile = Ver->FileList;
Ver->FileList = VF.Index();
// Link it to the end of the list
__apt_ptrloc *Last = &Ver->FileList;
for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; V++)
Last = &V->NextFile;
VF->NextFile = *Last;
*Last = VF.Index();
VF->Offset = List.Offset();
VF->Size = List.Size();
if (Cache.HeaderP->MaxVerFileSize < VF->Size)

12
apt-pkg/pkgrecords.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: pkgrecords.cc,v 1.3 1998/10/20 02:39:23 jgg Exp $
// $Id: pkgrecords.cc,v 1.4 1998/11/13 04:23:34 jgg Exp $
/* ######################################################################
Package Records - Allows access to complete package description records
@ -23,9 +23,7 @@
/* This will create the necessary structures to access the status files */
pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0)
{
string ListDir = _config->FindFile("Dir::State::lists");
Files = new PkgFile[Cache.HeaderP->PackageFileCount];
Files = new PkgFile[Cache.HeaderP->PackageFileCount];
for (pkgCache::PkgFileIterator I = Cache.FileBegin();
I.end() == false; I++)
{
@ -37,7 +35,7 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache), Files(0)
}
// Create the file
Files[I->ID].File = new FileFd(ListDir + I.FileName(),FileFd::ReadOnly);
Files[I->ID].File = new FileFd(I.FileName(),FileFd::ReadOnly);
if (_error->PendingError() == true)
return;
@ -59,8 +57,8 @@ pkgRecords::~pkgRecords()
// Records::Lookup - Get a parser for the package version file /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgRecords::Parser &pkgRecords::Lookup(pkgCache::VerFileIterator &Ver)
{
pkgRecords::Parser &pkgRecords::Lookup(pkgCache::VerFileIterator const &Ver)
{
PkgFile &File = Files[Ver.File()->ID];
File.Parse->Jump(Ver);

8
apt-pkg/pkgrecords.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: pkgrecords.h,v 1.2 1998/10/08 04:55:00 jgg Exp $
// $Id: pkgrecords.h,v 1.3 1998/11/13 04:23:35 jgg Exp $
/* ######################################################################
Package Records - Allows access to complete package description records
@ -48,8 +48,8 @@ class pkgRecords
public:
// Lookup function
Parser &Lookup(pkgCache::VerFileIterator &Ver);
Parser &Lookup(pkgCache::VerFileIterator const &Ver);
// Construct destruct
pkgRecords(pkgCache &Cache);
~pkgRecords();
@ -59,7 +59,7 @@ class pkgRecords::Parser
{
protected:
virtual bool Jump(pkgCache::VerFileIterator &Ver) = 0;
virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
public:
friend pkgRecords;

5
apt-pkg/tagfile.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: tagfile.cc,v 1.13 1998/10/30 07:53:41 jgg Exp $
// $Id: tagfile.cc,v 1.14 1998/11/13 04:23:36 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@ -94,7 +94,8 @@ bool pkgTagFile::Fill()
/*}}}*/
// TagFile::Jump - Jump to a pre-recorded location in the file /*{{{*/
// ---------------------------------------------------------------------
/* This jumps to a pre-recorded file location and */
/* This jumps to a pre-recorded file location and reads the record
that is there */
bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
{
iOffset = Offset;

11
cmdline/apt-cache.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: apt-cache.cc,v 1.10 1998/10/19 23:45:35 jgg Exp $
// $Id: apt-cache.cc,v 1.11 1998/11/13 04:24:01 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache files
@ -44,7 +44,13 @@ bool DumpPackage(pkgCache &Cache,CommandLine &CmdL)
cout << "Package: " << Pkg.Name() << endl;
cout << "Versions: ";
for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
cout << Cur.VerStr() << ',';
{
cout << Cur.VerStr();
for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; Vf++)
cout << "(" << Vf.File().FileName() << ")";
cout << ',';
}
cout << endl;
cout << "Reverse Depends: " << endl;
@ -72,6 +78,7 @@ bool DumpPackage(pkgCache &Cache,CommandLine &CmdL)
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
cout << Prv.OwnerPkg().Name() << " " << Prv.OwnerVer().VerStr();
cout << endl;
}
return true;

40
cmdline/apt-get.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: apt-get.cc,v 1.8 1998/11/12 05:30:10 jgg Exp $
// $Id: apt-get.cc,v 1.9 1998/11/13 04:24:03 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
@ -33,6 +33,7 @@
#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/dpkgpm.h>
#include <config.h>
@ -421,7 +422,7 @@ bool CacheFile::Open()
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
happen and then calls the download routines */
bool InstallPackages(pkgDepCache &Cache,bool ShwKept)
bool InstallPackages(pkgDepCache &Cache,bool ShwKept,bool Ask = true)
{
ShowDel(c1out,Cache);
ShowNew(c1out,Cache);
@ -443,7 +444,35 @@ bool InstallPackages(pkgDepCache &Cache,bool ShwKept)
if (Cache.DelCount() == 0 && Cache.InstCount() == 0 &&
Cache.BadCount() == 0)
return true;
// Run the simulator ..
if (_config->FindB("APT::Get::Simulate") == true)
{
pkgSimulate PM(Cache);
return PM.DoInstall();
}
// Create the text record parser
pkgRecords Recs(Cache);
// Create the download object
AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
// Read the source list
pkgSourceList List;
if (List.ReadMainList() == false)
return _error->Error("The list of sources could not be read.");
// Create the package manager and prepare to download
pkgPackageManager PM(Cache);
if (PM.GetArchives(&Fetcher,&List,&Recs) == false)
return false;
// Run it
if (Fetcher.Run() == false)
return false;
return true;
}
/*}}}*/
@ -654,7 +683,10 @@ bool DoInstall(CommandLine &CmdL)
ShowList(c1out,"The following extra packages will be installed:",List);
}
return InstallPackages(Cache,false);
// See if we need to prompt
if (Cache->InstCount() != ExpectedInst || Cache->DelCount() != 0)
return InstallPackages(Cache,false,true);
return InstallPackages(Cache,false);
}
/*}}}*/
// DoDistUpgrade - Automatic smart upgrader /*{{{*/

Loading…
Cancel
Save