Author: jgg
Date: 1998-11-22 03:20:30 GMT
By gosh, I think it works
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.cc,v 1.12 1998/11/13 07:08:48 jgg Exp $
+// $Id: acquire-item.cc,v 1.13 1998/11/22 03:20:30 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
/* ######################################################################
Acquire Item - Item to acquire
+// AcqIndex::Describe - Describe the Item /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgAcqIndex::Describe()
+{
+ return Location->PackagesURI();
+}
+ /*}}}*/
// AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/
// ---------------------------------------------------------------------
// AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/
// ---------------------------------------------------------------------
Rename(DestFile,FinalFile);
}
/*}}}*/
Rename(DestFile,FinalFile);
}
/*}}}*/
+// AcqIndexRel::Describe - Describe the Item /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgAcqIndexRel::Describe()
+{
+ return Location->ReleaseURI();
+}
+ /*}}}*/
// AcqArchive::AcqArchive - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
// AcqArchive::AcqArchive - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
- pkgRecords *Recs,pkgCache::VerIterator const &Version) :
- Item(Owner), Version(Version), Sources(Sources), Recs(Recs)
+ pkgRecords *Recs,pkgCache::VerIterator const &Version,
+ string &StoreFilename) :
+ Item(Owner), Version(Version), Sources(Sources), Recs(Recs),
+ StoreFilename(StoreFilename)
{
// Select a source
pkgCache::VerFileIterator Vf = Version.FileList();
{
// Select a source
pkgCache::VerFileIterator Vf = Version.FileList();
Complete = true;
Local = true;
Status = StatDone;
Complete = true;
Local = true;
Status = StatDone;
+ StoreFilename = DestFile = FinalFile;
-
- // We have to copy it into place
+
+ // Reference filename
if (FileName != DestFile)
{
if (FileName != DestFile)
{
+ StoreFilename = DestFile = FileName;
FinalFile += flNotDir(DestFile);
Rename(DestFile,FinalFile);
FinalFile += flNotDir(DestFile);
Rename(DestFile,FinalFile);
+ StoreFilename = DestFile = FinalFile;
Complete = true;
}
/*}}}*/
Complete = true;
}
/*}}}*/
+// AcqArchive::Describe - Describe the Item /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgAcqArchive::Describe()
+{
+ return Desc.URI;
+}
+ /*}}}*/
+
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.h,v 1.9 1998/11/13 07:08:50 jgg Exp $
+// $Id: acquire-item.h,v 1.10 1998/11/22 03:20:31 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
/* ######################################################################
Acquire Item - Item to acquire
unsigned long ID;
bool Complete;
bool Local;
unsigned long ID;
bool Complete;
bool Local;
// Number of queues we are inserted into
unsigned int QueueCounter;
// Number of queues we are inserted into
unsigned int QueueCounter;
virtual void Failed(string Message);
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual void Start(string Message,unsigned long Size);
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 Describe() = 0;
+
virtual string Custom600Headers() {return string();};
Item(pkgAcquire *Owner);
virtual string Custom600Headers() {return string();};
Item(pkgAcquire *Owner);
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual string Custom600Headers();
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual string Custom600Headers();
+ virtual string Describe();
pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
};
pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location);
};
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual string Custom600Headers();
virtual void Done(string Message,unsigned long Size,string Md5Hash);
virtual string Custom600Headers();
+ virtual string Describe();
pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
};
pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location);
};
pkgSourceList *Sources;
pkgRecords *Recs;
string MD5;
pkgSourceList *Sources;
pkgRecords *Recs;
string MD5;
public:
virtual void Done(string Message,unsigned long Size,string Md5Hash);
public:
virtual void Done(string Message,unsigned long Size,string Md5Hash);
+ virtual string Describe();
pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
- pkgRecords *Recs,pkgCache::VerIterator const &Version);
+ pkgRecords *Recs,pkgCache::VerIterator const &Version,
+ string &StoreFilename);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: dpkgpm.cc,v 1.1 1998/11/13 04:23:39 jgg Exp $
+// $Id: dpkgpm.cc,v 1.2 1998/11/22 03:20:35 jgg Exp $
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
{
vector<Item>::iterator J = I;
for (; J != List.end() && J->Op == I->Op; J++);
{
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;
// Generate the argument list
const char *Args[400];
if (J - I > 350)
J = I + 350;
- int n= 0;
- Args[n++] = "dpkg";
+ unsigned int n = 0;
+ unsigned long Size = 0;
+ Args[n++] = _config->Find("Dir::Bin::dpkg","dpkg").c_str();
+ Size += strlen(Args[n-1]);
switch (I->Op)
{
case Item::Remove:
Args[n++] = "--force-depends";
switch (I->Op)
{
case Item::Remove:
Args[n++] = "--force-depends";
+ Size += strlen(Args[n-1]);
Args[n++] = "--force-remove-essential";
Args[n++] = "--force-remove-essential";
+ Size += strlen(Args[n-1]);
+ Size += strlen(Args[n-1]);
break;
case Item::Configure:
Args[n++] = "--configure";
break;
case Item::Configure:
Args[n++] = "--configure";
+ Size += strlen(Args[n-1]);
break;
case Item::Install:
Args[n++] = "--unpack";
break;
case Item::Install:
Args[n++] = "--unpack";
+ Size += strlen(Args[n-1]);
break;
}
// Write in the file or package names
if (I->Op == Item::Install)
break;
}
// Write in the file or package names
if (I->Op == Item::Install)
+ {
+ for (;I != J && Size < 1024; I++)
+ {
Args[n++] = I->File.c_str();
Args[n++] = I->File.c_str();
+ Size += strlen(Args[n-1]);
+ }
+ }
+ {
+ for (;I != J && Size < 1024; I++)
+ {
Args[n++] = I->Pkg.Name();
Args[n++] = I->Pkg.Name();
+ Size += strlen(Args[n-1]);
+ }
+ }
+ J = I;
+
+ if (_config->FindB("Debug::pkgDPkgPM",false) == true)
+ {
+ for (unsigned int k = 0; k != n; k++)
+ clog << Args[k] << ' ';
+ clog << endl;
+ continue;
+ }
-/* for (int k = 0; k != n; k++)
- cout << Args[k] << ' ';
- cout << endl;*/
-
cout << flush;
clog << flush;
cerr << flush;
cout << flush;
clog << flush;
cerr << flush;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: init.cc,v 1.12 1998/11/06 02:52:21 jgg Exp $
+// $Id: init.cc,v 1.13 1998/11/22 03:20:32 jgg Exp $
/* ######################################################################
Init - Initialize the package library
/* ######################################################################
Init - Initialize the package library
Cnf.Set("Dir::Etc::sourcelist","sources.list");
Cnf.Set("Dir::Etc::main","apt.conf");
Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
Cnf.Set("Dir::Etc::sourcelist","sources.list");
Cnf.Set("Dir::Etc::main","apt.conf");
Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+ Cnf.Set("Dir::Bin::dpkg","/usr/bin/dpkg");
// Read the main config file
string FName = Cnf.FindFile("Dir::Etc::main");
// Read the main config file
string FName = Cnf.FindFile("Dir::Etc::main");
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.cc,v 1.5 1998/11/13 04:23:30 jgg Exp $
+// $Id: packagemanager.cc,v 1.6 1998/11/22 03:20:33 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
/* ######################################################################
Package Manager - Abstacts the package manager
#include <apt-pkg/error.h>
#include <apt-pkg/version.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/error.h>
#include <apt-pkg/version.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/configuration.h>
/*}}}*/
// PM::PackageManager - Constructor /*{{{*/
/*}}}*/
// PM::PackageManager - Constructor /*{{{*/
{
FileNames = new string[Cache.Head().PackageCount];
List = 0;
{
FileNames = new string[Cache.Head().PackageCount];
List = 0;
+ Debug = _config->FindB("Debug::pkgPackageManager",false);
}
/*}}}*/
// PM::PackageManager - Destructor /*{{{*/
}
/*}}}*/
// PM::PackageManager - Destructor /*{{{*/
Cache[I].Delete() == true)
continue;
Cache[I].Delete() == true)
continue;
- new pkgAcqArchive(Owner,Sources,Recs,Cache[I].InstVerIter(Cache));
+ new pkgAcqArchive(Owner,Sources,Recs,Cache[I].InstVerIter(Cache),
+ FileNames[I->ID]);
be downloaded. */
bool pkgPackageManager::FixMissing()
{
be downloaded. */
bool pkgPackageManager::FixMissing()
{
- unsigned char *Touch = new unsigned char[Cache.Head().PackageCount];
+ pkgProblemResolver Resolve(Cache);
+
for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
- // Create the status list that ResolveConflicts needs
- if ((Cache[I].DepState & pkgDepCache::DepNowMin) == pkgDepCache::DepNowMin)
- Touch[I->ID] = (1 << 0) | (1 << 1);
- else
- Touch[I->ID] = 1 << 1;
-
- if (Cache[I].Keep() == true)
+ if (Cache[I].Keep() == true)
continue;
if (FileNames[I->ID].empty() == false || Cache[I].Delete() == true)
continue;
continue;
if (FileNames[I->ID].empty() == false || Cache[I].Delete() == true)
continue;
}
// Now downgrade everything that is broken
}
// Now downgrade everything that is broken
-// Cache.ResolveConflicts(Touch);
- delete [] Touch;
-
- return Cache.BrokenCount() == 0;
+ return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;
if ((I->Flags & pkgCache::Flag::ImmediateConf) == pkgCache::Flag::ImmediateConf)
List->Flag(I,pkgOrderList::Immediate);
}
if ((I->Flags & pkgCache::Flag::ImmediateConf) == pkgCache::Flag::ImmediateConf)
List->Flag(I,pkgOrderList::Immediate);
}
+
+ if (Debug == true)
+ clog << "Begining to order" << endl;
if (List->OrderUnpack() == false)
return _error->Error("Internal ordering error");
if (List->OrderUnpack() == false)
return _error->Error("Internal ordering error");
+ if (Debug == true)
+ clog << "Done ordering" << endl;
+
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
{
PkgIterator Pkg(Cache,*I);
for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
{
PkgIterator Pkg(Cache,*I);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.h,v 1.5 1998/11/13 04:23:31 jgg Exp $
+// $Id: packagemanager.h,v 1.6 1998/11/22 03:20:34 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
/* ######################################################################
Package Manager - Abstacts the package manager
string *FileNames;
pkgDepCache &Cache;
pkgOrderList *List;
string *FileNames;
pkgDepCache &Cache;
pkgOrderList *List;
// Bring some usefull types into the local scope
typedef pkgCache::PkgIterator PkgIterator;
// Bring some usefull types into the local scope
typedef pkgCache::PkgIterator PkgIterator;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.14 1998/11/14 08:11:55 jgg Exp $
+// $Id: apt-get.cc,v 1.15 1998/11/22 03:20:36 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
/* ######################################################################
apt-get - Cover for dpkg
description. */
void ShowBroken(ostream &out,pkgDepCache &Cache)
{
description. */
void ShowBroken(ostream &out,pkgDepCache &Cache)
{
- out << "Sorry, but the following packages are broken - this means they have unmet" << endl;
- out << "dependencies:" << endl;
+ out << "Sorry, but the following packages have unmet dependencies:" << endl;
pkgCache::PkgIterator I = Cache.PkgBegin();
for (;I.end() != true; I++)
{
pkgCache::PkgIterator I = Cache.PkgBegin();
for (;I.end() != true; I++)
{
- for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; D++)
+ for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;)
- if (Cache.IsImportantDep(D) == false || (Cache[D] &
- pkgDepCache::DepInstall) != 0)
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End);
+
+ if (Cache.IsImportantDep(End) == false ||
+ (Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
if (First == false)
continue;
if (First == false)
out << ' ';
First = false;
out << ' ';
First = false;
- cout << ' ' << D.DepType() << ": ";
+ cout << ' ' << End.DepType() << ": " << End.TargetPkg().Name();
// Show a quick summary of the version requirements
// Show a quick summary of the version requirements
- if (D.TargetVer() != 0)
- out << " (" << D.CompType() << " " << D.TargetVer() <<
+ if (End.TargetVer() != 0)
+ out << " (" << End.CompType() << " " << End.TargetVer() <<
")";
/* Show a summary of the target package if possible. In the case
of virtual packages we show nothing */
")";
/* Show a summary of the target package if possible. In the case
of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = D.TargetPkg();
+ pkgCache::PkgIterator Targ = End.TargetPkg();
if (Targ->ProvidesList == 0)
{
out << " but ";
if (Targ->ProvidesList == 0)
{
out << " but ";
return _error->Error("The list of sources could not be read.");
// Create the package manager and prepare to download
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;
if (PM.GetArchives(&Fetcher,&List,&Recs) == false)
return false;
// Run it
if (Fetcher.Run() == false)
return false;
// Run it
if (Fetcher.Run() == false)
return false;
+
+ // Print out errors
+ bool Failed = false;
+ for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+ {
+ if ((*I)->Status == pkgAcquire::Item::StatDone &&
+ (*I)->Complete == true)
+ continue;
+
+ cerr << "Failed to fetch " << (*I)->Describe() << endl;
+ cerr << " " << (*I)->ErrorText << endl;
+ Failed = true;
+ }
+ if (Failed == true && _config->FindB("APT::Fix-Missing",false) == false)
+ return _error->Error("Unable to fetch some archives, maybe try with --fix-missing?");
+
+ // Try to deal with missing package files
+/* if (PM.FixMissing() == false)
+ {
+ cerr << "Unable to correct missing packages." << endl;
+ return _error->Error("Aborting Install.");
+ }*/
+
+ return PM.DoInstall();
{'y',"assume-yes","APT::Get::Assume-Yes",0},
{'f',"fix-broken","APT::Get::Fix-Broken",0},
{'u',"show-upgraded","APT::Get::Show-Upgraded",0},
{'y',"assume-yes","APT::Get::Assume-Yes",0},
{'f',"fix-broken","APT::Get::Fix-Broken",0},
{'u',"show-upgraded","APT::Get::Show-Upgraded",0},
- {'m',"ignore-missing","APT::Get::Fix-Broken",0},
+ {'m',"ignore-missing","APT::Get::Fix-Missing",0},
+ {0,"fix-missing","APT::Get::Fix-Missing",0},
{0,"ignore-hold","APT::Ingore-Hold",0},
{0,"no-upgrade","APT::Get::no-upgrade",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{0,"ignore-hold","APT::Ingore-Hold",0},
{0,"no-upgrade","APT::Get::no-upgrade",0},
{'c',"config-file",0,CommandLine::ConfigFile},
Summary: The man pages have references to several non-existent items,
ftp.conf is only one of them.
Status: Fix the man pages. This certainly will be done in 0.3.0
Summary: The man pages have references to several non-existent items,
ftp.conf is only one of them.
Status: Fix the man pages. This certainly will be done in 0.3.0
-#28391: apt-get install without upgrading
- Summary: Make install leave the package in the keep state if it is already
- installed
- Status: Will be implemented in 0.3.0
-- Fixed but unclosed things
#25026: apt: Why do you list the packages you're _not_ doing anything to instead of the ones you are?
-- Fixed but unclosed things
#25026: apt: Why do you list the packages you're _not_ doing anything to instead of the ones you are?
though it failed. I'm paying very close attention to this in
0.3.x. Not to mention that the clean behavior will be
configurable..
though it failed. I'm paying very close attention to this in
0.3.x. Not to mention that the clean behavior will be
configurable..
+#28391: apt-get install without upgrading
+ Summary: Make install leave the package in the keep state if it is already
+ installed
+ Status: Will be implemented in 0.3.0
+ Try the --no-upgrade options
-- Silly things
#26592: apt: Problems with ftpd in SunOS 5.6
-- Silly things
#26592: apt: Problems with ftpd in SunOS 5.6
-// $Id: apt.conf,v 1.11 1998/11/11 06:54:18 jgg Exp $
+// $Id: apt.conf,v 1.12 1998/11/22 03:20:38 jgg Exp $
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
valid file.
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
valid file.
Simulate "false";
Assume-Yes "false";
Fix-Broken "false";
Simulate "false";
Assume-Yes "false";
Fix-Broken "false";
Show-Upgraded "false";
};
Show-Upgraded "false";
};
Bin {
methods "/home/jgg/work/apt/build/bin/methods/";
gzip "/bin/gzip";
Bin {
methods "/home/jgg/work/apt/build/bin/methods/";
gzip "/bin/gzip";
pkgProblemResolver "false";
pkgAcquire "false";
pkgAcquire::Worker "false";
pkgProblemResolver "false";
pkgAcquire "false";
pkgAcquire::Worker "false";
pkgInitialize "false"; // This one will dump the configuration space
}
pkgInitialize "false"; // This one will dump the configuration space
}