diff options
-rw-r--r-- | apt-pkg/acquire-item.cc | 43 | ||||
-rw-r--r-- | apt-pkg/acquire-item.h | 14 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 42 | ||||
-rw-r--r-- | apt-pkg/init.cc | 3 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 30 | ||||
-rw-r--r-- | apt-pkg/packagemanager.h | 3 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 54 | ||||
-rw-r--r-- | doc/Bugs | 9 | ||||
-rw-r--r-- | doc/examples/apt.conf | 5 |
9 files changed, 147 insertions, 56 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 532d4e6f2..cfd0e5d02 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -224,6 +224,14 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5) Mode = "gzip"; } /*}}}*/ +// AcqIndex::Describe - Describe the Item /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgAcqIndex::Describe() +{ + return Location->PackagesURI(); +} + /*}}}*/ // AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/ // --------------------------------------------------------------------- @@ -302,13 +310,23 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5) Rename(DestFile,FinalFile); } /*}}}*/ +// AcqIndexRel::Describe - Describe the Item /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgAcqIndexRel::Describe() +{ + return Location->ReleaseURI(); +} + /*}}}*/ // 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(); @@ -355,7 +373,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, Complete = true; Local = true; Status = StatDone; - DestFile = FinalFile; + StoreFilename = DestFile = FinalFile; return; } @@ -415,11 +433,11 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash) } Complete = true; - - // We have to copy it into place + + // Reference filename if (FileName != DestFile) { - DestFile = FileName; + StoreFilename = DestFile = FileName; Local = true; return; } @@ -429,7 +447,16 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash) FinalFile += flNotDir(DestFile); Rename(DestFile,FinalFile); - DestFile = FinalFile; + StoreFilename = DestFile = FinalFile; Complete = true; } /*}}}*/ +// AcqArchive::Describe - Describe the Item /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgAcqArchive::Describe() +{ + return Desc.URI; +} + /*}}}*/ + diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 67e202355..d550b33db 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -1,6 +1,6 @@ // -*- 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 @@ -46,7 +46,7 @@ class pkgAcquire::Item unsigned long ID; bool Complete; bool Local; - + // Number of queues we are inserted into unsigned int QueueCounter; @@ -56,7 +56,8 @@ class pkgAcquire::Item 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); @@ -77,6 +78,7 @@ class pkgAcqIndex : public pkgAcquire::Item virtual void Done(string Message,unsigned long Size,string Md5Hash); virtual string Custom600Headers(); + virtual string Describe(); pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location); }; @@ -93,6 +95,7 @@ class pkgAcqIndexRel : public pkgAcquire::Item virtual void Done(string Message,unsigned long Size,string Md5Hash); virtual string Custom600Headers(); + virtual string Describe(); pkgAcqIndexRel(pkgAcquire *Owner,const pkgSourceList::Item *Location); }; @@ -107,13 +110,16 @@ class pkgAcqArchive : public pkgAcquire::Item pkgSourceList *Sources; pkgRecords *Recs; string MD5; + string &StoreFilename; public: virtual void Done(string Message,unsigned long Size,string Md5Hash); + virtual string Describe(); pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, - pkgRecords *Recs,pkgCache::VerIterator const &Version); + pkgRecords *Recs,pkgCache::VerIterator const &Version, + string &StoreFilename); }; #endif diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 75a5c77be..dfdc0c4b5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -83,45 +83,67 @@ bool pkgDPkgPM::Go() { 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"; + 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"; + Size += strlen(Args[n-1]); Args[n++] = "--force-remove-essential"; + Size += strlen(Args[n-1]); Args[n++] = "--remove"; + Size += strlen(Args[n-1]); break; case Item::Configure: Args[n++] = "--configure"; + Size += strlen(Args[n-1]); 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) - for (;I != J; I++) + { + for (;I != J && Size < 1024; I++) + { Args[n++] = I->File.c_str(); + Size += strlen(Args[n-1]); + } + } else - for (;I != J; I++) + { + for (;I != J && Size < 1024; I++) + { Args[n++] = I->Pkg.Name(); + Size += strlen(Args[n-1]); + } + } Args[n] = 0; + 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; diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index e0ab46821..3343e197f 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -45,6 +45,7 @@ bool pkgInitialize(Configuration &Cnf) 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"); diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 2b47d425b..e6222f003 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -22,6 +22,8 @@ #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 /*{{{*/ @@ -31,6 +33,7 @@ pkgPackageManager::pkgPackageManager(pkgDepCache &Cache) : Cache(Cache) { FileNames = new string[Cache.Head().PackageCount]; List = 0; + Debug = _config->FindB("Debug::pkgPackageManager",false); } /*}}}*/ // PM::PackageManager - Destructor /*{{{*/ @@ -57,7 +60,8 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, 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]); } return true; } @@ -68,16 +72,11 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, 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++) { - // 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; @@ -85,10 +84,7 @@ bool pkgPackageManager::FixMissing() } // Now downgrade everything that is broken -// Cache.ResolveConflicts(Touch); - delete [] Touch; - - return Cache.BrokenCount() == 0; + return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0; } /*}}}*/ @@ -450,10 +446,16 @@ bool pkgPackageManager::OrderInstall() 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 (Debug == true) + clog << "Done ordering" << endl; + for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) { PkgIterator Pkg(Cache,*I); diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index c6ab82de6..e0e9dc108 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -1,6 +1,6 @@ // -*- 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 @@ -42,6 +42,7 @@ class pkgPackageManager string *FileNames; pkgDepCache &Cache; pkgOrderList *List; + bool Debug; // Bring some usefull types into the local scope typedef pkgCache::PkgIterator PkgIterator; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 215a431f6..e00cf53c3 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.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 @@ -110,8 +110,7 @@ void ShowList(ostream &out,string Title,string List) 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++) { @@ -128,10 +127,15 @@ void ShowBroken(ostream &out,pkgDepCache &Cache) continue; } - 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) @@ -139,17 +143,17 @@ void ShowBroken(ostream &out,pkgDepCache &Cache) out << ' '; First = false; - cout << ' ' << D.DepType() << ": "; + cout << ' ' << End.DepType() << ": " << End.TargetPkg().Name(); // 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 */ - pkgCache::PkgIterator Targ = D.TargetPkg(); + pkgCache::PkgIterator Targ = End.TargetPkg(); if (Targ->ProvidesList == 0) { out << " but "; @@ -494,7 +498,7 @@ bool InstallPackages(pkgDepCache &Cache,bool ShwKept,bool Ask = true) return _error->Error("The list of sources could not be read."); // Create the package manager and prepare to download - pkgPackageManager PM(Cache); + pkgDPkgPM PM(Cache); if (PM.GetArchives(&Fetcher,&List,&Recs) == false) return false; @@ -531,8 +535,31 @@ bool InstallPackages(pkgDepCache &Cache,bool ShwKept,bool Ask = true) // 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; + } - return 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(); } /*}}}*/ @@ -941,7 +968,8 @@ int main(int argc,const char *argv[]) {'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}, @@ -34,10 +34,6 @@ 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? @@ -96,6 +92,11 @@ 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 diff --git a/doc/examples/apt.conf b/doc/examples/apt.conf index 2519fa2ae..ddd7d512d 100644 --- a/doc/examples/apt.conf +++ b/doc/examples/apt.conf @@ -1,4 +1,4 @@ -// $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. @@ -25,6 +25,7 @@ APT { Simulate "false"; Assume-Yes "false"; Fix-Broken "false"; + Fix-Missing "false"; Show-Upgraded "false"; }; @@ -73,6 +74,7 @@ Dir Bin { methods "/home/jgg/work/apt/build/bin/methods/"; gzip "/bin/gzip"; + dpkg "/usr/bin/dpkg"; }; }; @@ -86,6 +88,7 @@ Debug { pkgProblemResolver "false"; pkgAcquire "false"; pkgAcquire::Worker "false"; + pkgDPkgPM "false"; pkgInitialize "false"; // This one will dump the configuration space } |