diff options
Diffstat (limited to 'apt-pkg')
-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 |
6 files changed, 97 insertions, 38 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; |