diff options
323 files changed, 4301 insertions, 3020 deletions
diff --git a/.gitignore b/.gitignore index 69a229c3e..2c619ab57 100644 --- a/.gitignore +++ b/.gitignore @@ -39,5 +39,5 @@ /debian/libapt-inst*.install /debian/libapt-pkg-dev.install /vendor/current -/vendor/debian/sources.list -/vendor/ubuntu/sources.list +/vendor/*/sources.list +/vendor/*/makefile.auto diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index 77dbc55d6..905110781 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -21,7 +21,9 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> -#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <string> #include <apti18n.h> /*}}}*/ diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 41301d1a6..0ba3f0521 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -23,9 +23,11 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/macros.h> +#include <apt-pkg/fileutl.h> -#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include <string> #include <unistd.h> #include <signal.h> #include <fcntl.h> @@ -120,7 +122,7 @@ bool ExtractTar::StartGzip() int Pipes[2]; if (pipe(Pipes) != 0) return _error->Errno("pipe",_("Failed to create pipes")); - + // Fork off the process GZPid = ExecFork(); @@ -136,9 +138,9 @@ bool ExtractTar::StartGzip() dup2(Fd,STDERR_FILENO); close(Fd); SetCloseExec(STDOUT_FILENO,false); - SetCloseExec(STDIN_FILENO,false); + SetCloseExec(STDIN_FILENO,false); SetCloseExec(STDERR_FILENO,false); - + const char *Args[3]; string confvar = string("dir::bin::") + DecompressProg; string argv0 = _config->Find(confvar.c_str(),DecompressProg.c_str()); diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index a811bbe88..3803329fa 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -21,11 +21,17 @@ #include <apt-pkg/debfile.h> #include <apt-pkg/extracttar.h> #include <apt-pkg/error.h> -#include <apt-pkg/deblistparser.h> #include <apt-pkg/aptconfiguration.h> - +#include <apt-pkg/arfile.h> +#include <apt-pkg/dirstream.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/tagfile.h> + +#include <string.h> +#include <string> +#include <vector> #include <sys/stat.h> -#include <unistd.h> + #include <apti18n.h> /*}}}*/ @@ -194,7 +200,7 @@ bool debDebFile::MemControlExtract::DoItem(Item &Itm,int &Fd) // --------------------------------------------------------------------- /* Just memcopy the block from the tar extractor and put it in the right place in the pre-allocated memory block. */ -bool debDebFile::MemControlExtract::Process(Item &Itm,const unsigned char *Data, +bool debDebFile::MemControlExtract::Process(Item &/*Itm*/,const unsigned char *Data, unsigned long Size,unsigned long Pos) { memcpy(Control + Pos, Data,Size); diff --git a/apt-inst/deb/debfile.h b/apt-inst/deb/debfile.h index ecef71d21..880bcf6c5 100644 --- a/apt-inst/deb/debfile.h +++ b/apt-inst/deb/debfile.h @@ -27,11 +27,15 @@ #include <apt-pkg/arfile.h> #include <apt-pkg/dirstream.h> #include <apt-pkg/tagfile.h> -#include <apt-pkg/pkgcache.h> + +#include <string> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/md5.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/pkgcache.h> +#endif class FileFd; diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index e06c30a57..39ebb3bb4 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -18,7 +18,6 @@ #include <fcntl.h> #include <sys/stat.h> -#include <sys/types.h> #include <sys/time.h> #include <errno.h> #include <unistd.h> @@ -110,7 +109,7 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd) // DirStream::Fail - Failed processing a file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgDirStream::Fail(Item &Itm,int Fd) +bool pkgDirStream::Fail(Item &/*Itm*/, int Fd) { if (Fd < 0) return true; diff --git a/apt-inst/dirstream.h b/apt-inst/dirstream.h index 9d1af2188..1be2688a1 100644 --- a/apt-inst/dirstream.h +++ b/apt-inst/dirstream.h @@ -49,8 +49,8 @@ class pkgDirStream virtual bool DoItem(Item &Itm,int &Fd); virtual bool Fail(Item &Itm,int Fd); virtual bool FinishedFile(Item &Itm,int Fd); - virtual bool Process(Item &Itm,const unsigned char *Data, - unsigned long Size,unsigned long Pos) {return true;}; + virtual bool Process(Item &/*Itm*/,const unsigned char * /*Data*/, + unsigned long /*Size*/,unsigned long /*Pos*/) {return true;}; virtual ~pkgDirStream() {}; }; diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index b3dfccfc6..b60784450 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -50,13 +50,20 @@ #include <apt-pkg/error.h> #include <apt-pkg/debversion.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/dirstream.h> +#include <apt-pkg/filelist.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <string.h> +#include <string> #include <sys/stat.h> #include <stdio.h> -#include <unistd.h> #include <errno.h> #include <dirent.h> #include <iostream> + #include <apti18n.h> /*}}}*/ using namespace std; @@ -79,7 +86,7 @@ pkgExtract::pkgExtract(pkgFLCache &FLCache,pkgCache::VerIterator Ver) : // Extract::DoItem - Handle a single item from the stream /*{{{*/ // --------------------------------------------------------------------- /* This performs the setup for the extraction.. */ -bool pkgExtract::DoItem(Item &Itm,int &Fd) +bool pkgExtract::DoItem(Item &Itm, int &/*Fd*/) { /* Strip any leading/trailing /s from the filename, then copy it to the temp buffer and re-apply the leading / We use a class variable @@ -253,7 +260,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) // Extract::Finished - Sequence finished, erase the temp files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgExtract::Finished() +APT_CONST bool pkgExtract::Finished() { return true; } diff --git a/apt-inst/extract.h b/apt-inst/extract.h index 7143fa409..8ad9ac629 100644 --- a/apt-inst/extract.h +++ b/apt-inst/extract.h @@ -17,11 +17,12 @@ #ifndef PKGLIB_EXTRACT_H #define PKGLIB_EXTRACT_H - - #include <apt-pkg/dirstream.h> #include <apt-pkg/filelist.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <string> class pkgExtract : public pkgDirStream { diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index defc4f4df..4dbc4a2d7 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -39,8 +39,6 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include <iostream> #include <apti18n.h> @@ -87,7 +85,7 @@ pkgFLCache::Header::Header() // FLCache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/ // --------------------------------------------------------------------- /* Compare to make sure we are matching versions */ -bool pkgFLCache::Header::CheckSizes(Header &Against) const +APT_PURE bool pkgFLCache::Header::CheckSizes(Header &Against) const { if (HeaderSz == Against.HeaderSz && NodeSz == Against.NodeSz && @@ -355,7 +353,7 @@ pkgFLCache::NodeIterator pkgFLCache::GetNode(const char *Name, // --------------------------------------------------------------------- /* This is one of two hashing functions. The other is inlined into the GetNode routine. */ -pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) +APT_PURE pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) { // Hash the node unsigned long HashPos = 0; @@ -572,7 +570,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, // --------------------------------------------------------------------- /* Since the package pointer is indirected in all sorts of interesting ways this is used to get a pointer to the owning package */ -pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const +APT_PURE pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const { if (Nde->Pointer == 0) return 0; diff --git a/apt-inst/filelist.h b/apt-inst/filelist.h index 0405d61df..8c4891bcf 100644 --- a/apt-inst/filelist.h +++ b/apt-inst/filelist.h @@ -42,25 +42,25 @@ class pkgFLCache struct Package; struct Diversion; struct ConfFile; - + class NodeIterator; class DirIterator; class PkgIterator; class DiverIterator; - + protected: std::string CacheFile; DynamicMMap ⤅ map_ptrloc LastTreeLookup; unsigned long LastLookupSize; - + // Helpers for the addition algorithms map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *TextEnd, unsigned long Size,unsigned int *Count = 0, bool Insert = false); - + public: - + // Pointers to the arrays of items Header *HeaderP; Node *NodeP; @@ -70,10 +70,10 @@ class pkgFLCache ConfFile *ConfP; char *StrP; unsigned char *AnyP; - + // Quick accessors Node *FileHash; - + // Accessors Header &Head() {return *HeaderP;}; void PrintTree(map_ptrloc Base,unsigned long Size); @@ -89,7 +89,7 @@ class pkgFLCache void DropNode(map_ptrloc Node); inline DiverIterator DiverBegin(); - + // Diversion control void BeginDiverLoad(); void FinishDiverLoad(); @@ -97,7 +97,7 @@ class pkgFLCache const char *To); bool AddConfFile(const char *Name,const char *NameEnd, PkgIterator const &Owner,const unsigned char *Sum); - + pkgFLCache(DynamicMMap &Map); // ~pkgFLCache(); }; @@ -109,7 +109,7 @@ struct pkgFLCache::Header short MajorVersion; short MinorVersion; bool Dirty; - + // Size of structure values unsigned HeaderSz; unsigned NodeSz; @@ -117,7 +117,7 @@ struct pkgFLCache::Header unsigned PackageSz; unsigned DiversionSz; unsigned ConfFileSz; - + // Structure Counts; unsigned int NodeCount; unsigned int DirCount; @@ -126,13 +126,13 @@ struct pkgFLCache::Header unsigned int ConfFileCount; unsigned int HashSize; unsigned long UniqNodes; - + // Offsets map_ptrloc FileHash; map_ptrloc DirTree; map_ptrloc Packages; map_ptrloc Diversions; - + /* Allocation pools, there should be one of these for each structure excluding the header */ DynamicMMap::Pool Pools[5]; @@ -177,7 +177,7 @@ struct pkgFLCache::Diversion map_ptrloc OwnerPkg; // Package map_ptrloc DivertFrom; // Node map_ptrloc DivertTo; // String - + map_ptrloc Next; // Diversion unsigned long Flags; @@ -194,120 +194,120 @@ class pkgFLCache::PkgIterator { Package *Pkg; pkgFLCache *Owner; - + public: - + inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;} - + // Accessors - inline Package *operator ->() {return Pkg;}; - inline Package const *operator ->() const {return Pkg;}; - inline Package const &operator *() const {return *Pkg;}; - inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}; - inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}; - - inline unsigned long Offset() const {return Pkg - Owner->PkgP;}; - inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}; + inline Package *operator ->() {return Pkg;} + inline Package const *operator ->() const {return Pkg;} + inline Package const &operator *() const {return *Pkg;} + inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;} + inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;} + + inline unsigned long Offset() const {return Pkg - Owner->PkgP;} + inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;} inline pkgFLCache::NodeIterator Files() const; - PkgIterator() : Pkg(0), Owner(0) {}; - PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {}; + PkgIterator() : Pkg(0), Owner(0) {} + PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {} }; class pkgFLCache::DirIterator { Directory *Dir; pkgFLCache *Owner; - + public: - + // Accessors - inline Directory *operator ->() {return Dir;}; - inline Directory const *operator ->() const {return Dir;}; - inline Directory const &operator *() const {return *Dir;}; - inline operator Directory *() {return Dir == Owner->DirP?0:Dir;}; - inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;}; + inline Directory *operator ->() {return Dir;} + inline Directory const *operator ->() const {return Dir;} + inline Directory const &operator *() const {return *Dir;} + inline operator Directory *() {return Dir == Owner->DirP?0:Dir;} + inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;} - inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;}; + inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;} - DirIterator() : Dir(0), Owner(0) {}; - DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {}; + DirIterator() : Dir(0), Owner(0) {} + DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {} }; class pkgFLCache::DiverIterator { Diversion *Diver; pkgFLCache *Owner; - + public: // Iteration - void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;}; + void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;} // Accessors - inline Diversion *operator ->() {return Diver;}; - inline Diversion const *operator ->() const {return Diver;}; - inline Diversion const &operator *() const {return *Diver;}; - inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;}; - inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;}; + inline Diversion *operator ->() {return Diver;} + inline Diversion const *operator ->() const {return Diver;} + inline Diversion const &operator *() const {return *Diver;} + inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;} + inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;} - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);}; + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);} inline NodeIterator DivertFrom() const; inline NodeIterator DivertTo() const; DiverIterator() : Diver(0), Owner(0) {}; - DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {}; + DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {} }; class pkgFLCache::NodeIterator { Node *Nde; - enum {NdePkg, NdeHash} Type; + enum {NdePkg, NdeHash} Type; pkgFLCache *Owner; - + public: - + // Iteration - void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + - (Type == NdePkg?Nde->NextPkg:Nde->Next);}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;}; + void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + + (Type == NdePkg?Nde->NextPkg:Nde->Next);} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;} // Accessors - inline Node *operator ->() {return Nde;}; - inline Node const *operator ->() const {return Nde;}; - inline Node const &operator *() const {return *Nde;}; - inline operator Node *() {return Nde == Owner->NodeP?0:Nde;}; - inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;}; - inline unsigned long Offset() const {return Nde - Owner->NodeP;}; - inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);}; - inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);}; - inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;}; - inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;}; + inline Node *operator ->() {return Nde;} + inline Node const *operator ->() const {return Nde;} + inline Node const &operator *() const {return *Nde;} + inline operator Node *() {return Nde == Owner->NodeP?0:Nde;} + inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;} + inline unsigned long Offset() const {return Nde - Owner->NodeP;} + inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);} + inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);} + inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;} + inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;} Package *RealPackage() const; - + NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {}; - NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}; + NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {} }; /* Inlines with forward references that cannot be included directly in their respsective classes */ -inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);}; +inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);} inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertTo() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);}; + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);} inline pkgFLCache::NodeIterator pkgFLCache::PkgIterator::Files() const - {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);}; + {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);} inline pkgFLCache::DiverIterator pkgFLCache::DiverBegin() - {return DiverIterator(*this,DiverP + HeaderP->Diversions);}; + {return DiverIterator(*this,DiverP + HeaderP->Diversions);} -inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) - {return GetPkg(Name,Name+strlen(Name),Insert);}; +inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) + {return GetPkg(Name,Name+strlen(Name),Insert);} #endif diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index de03011bf..30743addf 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -22,12 +22,21 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/md5.h> #include <apt-pkg/sha1.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/indexrecords.h> -#include <apt-pkg/metaindex.h> - +#include <apt-pkg/acquire.h> +#include <apt-pkg/hashes.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgrecords.h> + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <iostream> +#include <vector> #include <sys/stat.h> #include <unistd.h> #include <errno.h> @@ -108,8 +117,8 @@ void pkgAcquire::Item::Start(string /*Message*/,unsigned long long Size) // Acquire::Item::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Item::Done(string Message,unsigned long long Size,string Hash, - pkgAcquire::MethodConfig *Cnf) +void pkgAcquire::Item::Done(string Message,unsigned long long Size,string /*Hash*/, + pkgAcquire::MethodConfig * /*Cnf*/) { // We just downloaded something.. string FileName = LookupTag(Message,"Filename"); @@ -253,10 +262,10 @@ string pkgAcqSubIndex::Custom600Headers() return "\nIndex-File: true\nFail-Ignore: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ -void pkgAcqSubIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ +void pkgAcqSubIndex::Failed(string Message,pkgAcquire::MethodConfig * /*Cnf*/)/*{{{*/ { if(Debug) - std::clog << "pkgAcqSubIndex failed: " << Desc.URI << std::endl; + std::clog << "pkgAcqSubIndex failed: " << Desc.URI << " with " << Message << std::endl; Complete = false; Status = StatDone; @@ -544,10 +553,10 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/ return false; } /*}}}*/ -void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ +void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig * /*Cnf*/)/*{{{*/ { if(Debug) - std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << std::endl + std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << " with " << Message << std::endl << "Falling back to normal index file acquire" << std::endl; new pkgAcqIndex(Owner, RealURI, Description, Desc.ShortDesc, @@ -624,10 +633,10 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, } } /*}}}*/ -void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ +void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig * /*Cnf*/)/*{{{*/ { if(Debug) - std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << std::endl + std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << " with " << Message << std::endl << "Falling back to normal index file acquire" << std::endl; new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, ExpectedHash); @@ -709,7 +718,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/ } // queue the right diff - Desc.URI = string(RealURI) + ".diff/" + available_patches[0].file + ".gz"; + Desc.URI = RealURI + ".diff/" + available_patches[0].file + ".gz"; Desc.Description = Description + " " + available_patches[0].file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + available_patches[0].file); @@ -797,7 +806,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner, Desc.Owner = this; Desc.ShortDesc = ShortDesc; - Desc.URI = string(RealURI) + ".diff/" + patch.file + ".gz"; + Desc.URI = RealURI + ".diff/" + patch.file + ".gz"; Desc.Description = Description + " " + patch.file + string(".pdiff"); DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(RealURI + ".diff/" + patch.file); @@ -808,7 +817,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire *Owner, QueueURI(Desc); } /*}}}*/ -void pkgAcqIndexMergeDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)/*{{{*/ +void pkgAcqIndexMergeDiffs::Failed(string Message,pkgAcquire::MethodConfig * /*Cnf*/)/*{{{*/ { if(Debug) std::clog << "pkgAcqIndexMergeDiffs failed: " << Desc.URI << " with " << Message << std::endl; @@ -1558,7 +1567,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ { std::vector<std::string> types = APT::Configuration::getCompressionTypes(); for (std::vector<std::string>::const_iterator t = types.begin(); t != types.end(); ++t) - if (MetaIndexParser->Exists(string((*Target)->MetaKey).append(".").append(*t)) == true) + if (MetaIndexParser->Exists((*Target)->MetaKey + "." + *t) == true) { compressedAvailable = true; break; @@ -1596,7 +1605,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ else if (transInRelease == false || Record != NULL || compressedAvailable == true) { if (_config->FindB("Acquire::PDiffs",true) == true && transInRelease == true && - MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true) + MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexHash); else @@ -1610,7 +1619,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ in the Meta-Index file. Ideal would be if pkgAcqDiffIndex would test this instead, but passing the required info to it is to much hassle */ if(_config->FindB("Acquire::PDiffs",true) == true && (verify == false || - MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true)) + MetaIndexParser->Exists((*Target)->MetaKey + ".diff/Index") == true)) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexHash); else @@ -1635,7 +1644,7 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/ missingkeys += (Fingerprint); } if(!missingkeys.empty()) - _error->Warning("%s", string(msg+missingkeys).c_str()); + _error->Warning("%s", (msg + missingkeys).c_str()); string Transformed = MetaIndexParser->GetExpectedDist(); @@ -1698,7 +1707,7 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/ // pkgAcqMetaIndex::Failed - no Release file present or no signature file present /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) +void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig * /*Cnf*/) { if (AuthPass == true) { @@ -1856,7 +1865,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources, _error->Error(_("I wasn't able to locate a file for the %s package. " "This might mean you need to manually fix this package. " "(due to missing arch)"), - Version.ParentPkg().Name()); + Version.ParentPkg().FullName().c_str()); return; } @@ -1984,7 +1993,7 @@ bool pkgAcqArchive::QueueNext() Desc.URI = Index->ArchiveURI(PkgFile); Desc.Description = Index->ArchiveInfo(Version); Desc.Owner = this; - Desc.ShortDesc = Version.ParentPkg().Name(); + Desc.ShortDesc = Version.ParentPkg().FullName(true); // See if we already have the file. (Legacy filenames) FileSize = Version->Size; @@ -2051,10 +2060,6 @@ bool pkgAcqArchive::QueueNext() // Create the item Local = false; - Desc.URI = Index->ArchiveURI(PkgFile); - Desc.Description = Index->ArchiveInfo(Version); - Desc.Owner = this; - Desc.ShortDesc = Version.ParentPkg().Name(); QueueURI(Desc); ++Vf; @@ -2153,7 +2158,7 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*}}}*/ // AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source /*{{{*/ // --------------------------------------------------------------------- -bool pkgAcqArchive::IsTrusted() +APT_PURE bool pkgAcqArchive::IsTrusted() { return Trusted; } diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 5a1c7979c..f48d2a0d7 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -24,6 +24,10 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/weakptr.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <string> +#include <vector> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/indexfile.h> @@ -64,7 +68,7 @@ class pkgAcquire::Item : public WeakPointable /** \brief Insert this item into its owner's queue. * - * \param ItemDesc Metadata about this item (its URI and + * \param Item Metadata about this item (its URI and * description). */ inline void QueueURI(ItemDesc &Item) @@ -79,7 +83,7 @@ class pkgAcquire::Item : public WeakPointable * * \param From The file to be renamed. * - * \param To The new name of #From. If #To exists it will be + * \param To The new name of \a From. If \a To exists it will be * overwritten. */ void Rename(std::string From,std::string To); @@ -115,7 +119,7 @@ class pkgAcquire::Item : public WeakPointable } Status; /** \brief Contains a textual description of the error encountered - * if #Status is #StatError or #StatAuthError. + * if #ItemState is #StatError or #StatAuthError. */ std::string ErrorText; @@ -293,7 +297,6 @@ class pkgAcquire::Item : public WeakPointable /** \brief Rename failed file and set error * * \param state respresenting the error we encountered - * \param errorMsg a message describing the error */ bool RenameOnError(RenameOnErrorState const state); }; @@ -636,7 +639,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item /** \brief Create an index diff item. * * After filling in its basic fields, this invokes Finish(true) if - * #diffs is empty, or QueueNextDiff() otherwise. + * \a diffs is empty, or QueueNextDiff() otherwise. * * \param Owner The pkgAcquire object that owns this item. * @@ -651,6 +654,8 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item * reconstructed package index file; the index file will be tested * against this value when it is entirely reconstructed. * + * \param ServerSha1 is the sha1sum of the current file on the server + * * \param diffs The remaining diffs from the index of diffs. They * should be ordered so that each diff appears before any diff * that depends on it. @@ -1162,8 +1167,8 @@ class pkgAcqFile : public pkgAcquire::Item * \param IsIndexFile The file is considered a IndexFile and cache-control * headers like "cache-control: max-age=0" are send * - * If DestFilename is empty, download to DestDir/<basename> if - * DestDir is non-empty, $CWD/<basename> otherwise. If + * If DestFilename is empty, download to DestDir/\<basename\> if + * DestDir is non-empty, $CWD/\<basename\> otherwise. If * DestFilename is NOT empty, DestDir is ignored and DestFilename * is the absolute name to which the file should be downloaded. */ diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 5bc1c159a..746c553f1 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -23,10 +23,18 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/hashes.h> - +#include <apt-pkg/md5.h> +#include <apt-pkg/sha1.h> +#include <apt-pkg/sha2.h> + +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <string> +#include <vector> #include <iostream> #include <stdio.h> -#include <sys/signal.h> /*}}}*/ using namespace std; diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 00f99e0a0..f0f2a537a 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -21,6 +21,7 @@ #define PKGLIB_ACQUIRE_METHOD_H #include <stdarg.h> +#include <time.h> #include <string> #include <vector> diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index de62080da..047a655ce 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -14,20 +14,23 @@ // Include Files /*{{{*/ #include <config.h> +#include <apt-pkg/acquire.h> #include <apt-pkg/acquire-worker.h> #include <apt-pkg/acquire-item.h> #include <apt-pkg/configuration.h> #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/hashes.h> +#include <string> +#include <vector> #include <iostream> #include <sstream> -#include <fstream> #include <sys/stat.h> +#include <stdlib.h> #include <unistd.h> -#include <fcntl.h> #include <signal.h> #include <stdio.h> #include <errno.h> diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h index 848a6bad7..67aee4b59 100644 --- a/apt-pkg/acquire-worker.h +++ b/apt-pkg/acquire-worker.h @@ -22,6 +22,9 @@ #include <apt-pkg/acquire.h> #include <apt-pkg/weakptr.h> +#include <sys/types.h> +#include <string> +#include <vector> /** \brief A fetch subprocess. * @@ -136,8 +139,8 @@ class pkgAcquire::Worker : public WeakPointable /** \brief Retrieve any available messages from the subprocess. * - * The messages are retrieved as in ::ReadMessages(), and - * MessageFailure() is invoked if an error occurs; in particular, + * The messages are retrieved as in \link strutl.h ReadMessages()\endlink, and + * #MethodFailure() is invoked if an error occurs; in particular, * if the pipe to the subprocess dies unexpectedly while a message * is being read. * diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 120e809e1..a187a00ae 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -23,12 +23,18 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> +#include <string> +#include <vector> #include <iostream> #include <sstream> #include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include <dirent.h> #include <sys/time.h> +#include <sys/select.h> #include <errno.h> #include <apti18n.h> @@ -468,7 +474,7 @@ void pkgAcquire::Bump() pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I) { return I->NextAcquire; -}; +} /*}}}*/ // Acquire::Clean - Cleans a directory /*{{{*/ // --------------------------------------------------------------------- @@ -520,7 +526,7 @@ bool pkgAcquire::Clean(string Dir) // Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/ // --------------------------------------------------------------------- /* This is the total number of bytes needed */ -unsigned long long pkgAcquire::TotalNeeded() +APT_PURE unsigned long long pkgAcquire::TotalNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -531,7 +537,7 @@ unsigned long long pkgAcquire::TotalNeeded() // Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::FetchNeeded() +APT_PURE unsigned long long pkgAcquire::FetchNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -543,7 +549,7 @@ unsigned long long pkgAcquire::FetchNeeded() // Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::PartialPresent() +APT_PURE unsigned long long pkgAcquire::PartialPresent() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 3d5d7a4b7..ef16d8556 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -72,8 +72,13 @@ #include <vector> #include <string> +#include <stddef.h> #include <sys/time.h> +#include <sys/select.h> + +#ifndef APT_10_CLEANER_HEADERS #include <unistd.h> +#endif #ifndef APT_8_CLEANER_HEADERS using std::vector; @@ -282,18 +287,18 @@ class pkgAcquire */ void Shutdown(); - /** \brief Get the first #Worker object. + /** \brief Get the first Worker object. * * \return the first active worker in this download process. */ inline Worker *WorkersBegin() {return Workers;}; - /** \brief Advance to the next #Worker object. + /** \brief Advance to the next Worker object. * * \return the worker immediately following I, or \b NULL if none * exists. */ - Worker *WorkerStep(Worker *I); + Worker *WorkerStep(Worker *I) APT_PURE; /** \brief Get the head of the list of items. */ inline ItemIterator ItemsBegin() {return Items.begin();}; @@ -353,7 +358,7 @@ class pkgAcquire void SetLog(pkgAcquireStatus *Progress) { Log = Progress; } /** \brief Construct a new pkgAcquire. */ - pkgAcquire(pkgAcquireStatus *Log) __deprecated; + pkgAcquire(pkgAcquireStatus *Log) APT_DEPRECATED; pkgAcquire(); /** \brief Destroy this pkgAcquire object. @@ -476,7 +481,7 @@ class pkgAcquire::Queue * \return the first item in the queue whose URI is #URI and that * is being downloaded by #Owner. */ - QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner); + QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner) APT_PURE; /** Presumably this should start downloading an item? * diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0363ab3e2..a7b676660 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -19,19 +19,18 @@ #include <apt-pkg/algorithms.h> #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/version.h> #include <apt-pkg/sptr.h> -#include <apt-pkg/acquire-item.h> #include <apt-pkg/edsp.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/fileutl.h> #include <apt-pkg/progress.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/packagemanager.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> -#include <sys/types.h> +#include <string.h> +#include <string> #include <cstdlib> -#include <algorithm> #include <iostream> -#include <stdio.h> #include <apti18n.h> /*}}}*/ @@ -394,8 +393,18 @@ void pkgProblemResolver::MakeScores() }; int PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100); int PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1); - int PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1); - int PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1); + int DepMap[] = { + 0, + _config->FindI("pkgProblemResolver::Scores::Depends",1), + _config->FindI("pkgProblemResolver::Scores::PreDepends",1), + _config->FindI("pkgProblemResolver::Scores::Suggests",0), + _config->FindI("pkgProblemResolver::Scores::Recommends",1), + _config->FindI("pkgProblemResolver::Scores::Conflicts",-1), + _config->FindI("pkgProblemResolver::Scores::Replaces",0), + _config->FindI("pkgProblemResolver::Scores::Obsoletes",0), + _config->FindI("pkgProblemResolver::Scores::Breaks",-1), + _config->FindI("pkgProblemResolver::Scores::Enhances",0) + }; int AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000); int AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000); @@ -408,8 +417,15 @@ void pkgProblemResolver::MakeScores() << " Extra => " << PrioMap[pkgCache::State::Extra] << endl << " Essentials => " << PrioEssentials << endl << " InstalledAndNotObsolete => " << PrioInstalledAndNotObsolete << endl - << " Depends => " << PrioDepends << endl - << " Recommends => " << PrioRecommends << endl + << " Pre-Depends => " << DepMap[pkgCache::Dep::PreDepends] << endl + << " Depends => " << DepMap[pkgCache::Dep::Depends] << endl + << " Recommends => " << DepMap[pkgCache::Dep::Recommends] << endl + << " Suggests => " << DepMap[pkgCache::Dep::Suggests] << endl + << " Conflicts => " << DepMap[pkgCache::Dep::Conflicts] << endl + << " Breaks => " << DepMap[pkgCache::Dep::DpkgBreaks] << endl + << " Replaces => " << DepMap[pkgCache::Dep::Replaces] << endl + << " Obsoletes => " << DepMap[pkgCache::Dep::Obsoletes] << endl + << " Enhances => " << DepMap[pkgCache::Dep::Enhances] << endl << " AddProtected => " << AddProtected << endl << " AddEssential => " << AddEssential << endl; @@ -439,24 +455,23 @@ void pkgProblemResolver::MakeScores() */ if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable()) Score += PrioInstalledAndNotObsolete; - } - // Now that we have the base scores we go and propagate dependencies - for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) - { - if (Cache[I].InstallVer == 0) - continue; - + // propagate score points along dependencies for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D) { - if (D->Type == pkgCache::Dep::Depends || - D->Type == pkgCache::Dep::PreDepends) - Scores[D.TargetPkg()->ID] += PrioDepends; - else if (D->Type == pkgCache::Dep::Recommends) - Scores[D.TargetPkg()->ID] += PrioRecommends; + if (DepMap[D->Type] == 0) + continue; + pkgCache::PkgIterator const T = D.TargetPkg(); + if (D->Version != 0) + { + pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache); + if (IV.end() == true || D.IsSatisfied(IV) != D.IsNegative()) + continue; + } + Scores[T->ID] += DepMap[D->Type]; } - } - + } + // Copy the scores to advoid additive looping SPtrArray<int> OldScores = new int[Size]; memcpy(OldScores,Scores,sizeof(*Scores)*Size); @@ -869,8 +884,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) } if (Debug == true) - clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] << - " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl; + clog << " Considering " << Pkg.FullName(false) << ' ' << Scores[Pkg->ID] << + " as a solution to " << I.FullName(false) << ' ' << Scores[I->ID] << endl; /* Try to fix the package under consideration rather than fiddle with the VList package */ diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 489d81159..f35bd9a13 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -33,8 +33,11 @@ #include <apt-pkg/packagemanager.h> #include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <iostream> +#include <string> #include <apt-pkg/macros.h> @@ -111,7 +114,7 @@ class pkgProblemResolver /*{{{*/ // Sort stuff static pkgProblemResolver *This; - static int ScoreSort(const void *a,const void *b); + static int ScoreSort(const void *a,const void *b) APT_PURE; struct PackageKill { @@ -140,7 +143,7 @@ class pkgProblemResolver /*{{{*/ // Try to resolve problems only by using keep bool ResolveByKeep(); - __deprecated void InstallProtect(); + APT_DEPRECATED void InstallProtect(); pkgProblemResolver(pkgDepCache *Cache); ~pkgProblemResolver(); diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 0b0b546c5..6ba047560 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -17,14 +17,19 @@ #include <apt-pkg/macros.h> #include <apt-pkg/strutl.h> -#include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <fcntl.h> - +#include <ctype.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include <algorithm> #include <string> #include <vector> + +#include <apti18n.h> /*}}}*/ namespace APT { // getCompressionTypes - Return Vector of usable compressiontypes /*{{{*/ @@ -49,11 +54,6 @@ const Configuration::getCompressionTypes(bool const &Cached) { setDefaultConfigurationForCompressors(); std::vector<APT::Configuration::Compressor> const compressors = getCompressors(); - // accept non-list order as override setting for config settings on commandline - std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order",""); - if (overrideOrder.empty() == false) - types.push_back(overrideOrder); - // load the order setting into our vector std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order"); for (std::vector<std::string>::const_iterator o = order.begin(); @@ -227,61 +227,11 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, } } } else { + // cornercase: LANG=C, so we use only "en" Translation environment.push_back("en"); } - // Support settings like Acquire::Languages=none on the command line to - // override the configuration settings vector of languages. - string const forceLang = _config->Find("Acquire::Languages",""); - if (forceLang.empty() == false) { - if (forceLang == "none") { - codes.clear(); - allCodes.clear(); - allCodes.push_back("none"); - } else { - if (forceLang == "environment") - codes = environment; - else - codes.push_back(forceLang); - allCodes = codes; - for (std::vector<string>::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); - } - if (All == true) - return allCodes; - else - return codes; - } - - // cornercase: LANG=C, so we use only "en" Translation - if (envShort == "C") { - allCodes = codes = environment; - allCodes.insert(allCodes.end(), builtin.begin(), builtin.end()); - if (All == true) - return allCodes; - else - return codes; - } - - std::vector<string> const lang = _config->FindVector("Acquire::Languages"); - // the default setting -> "environment, en" - if (lang.empty() == true) { - codes = environment; - if (envShort != "en") - codes.push_back("en"); - allCodes = codes; - for (std::vector<string>::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); - if (All == true) - return allCodes; - else - return codes; - } - + std::vector<string> const lang = _config->FindVector("Acquire::Languages", "environment,en"); // the configs define the order, so add the environment // then needed and ensure the codes are not listed twice. bool noneSeen = false; @@ -308,10 +258,15 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, allCodes.push_back(*l); } - for (std::vector<string>::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); + if (allCodes.empty() == false) { + for (std::vector<string>::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + } else { + // "none" was forced + allCodes.push_back("none"); + } if (All == true) return allCodes; @@ -320,7 +275,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, } /*}}}*/ // checkLanguage - are we interested in the given Language? /*{{{*/ -bool const Configuration::checkLanguage(std::string Lang, bool const All) { +bool Configuration::checkLanguage(std::string Lang, bool const All) { // the empty Language is always interesting as it is the original if (Lang.empty() == true) return true; @@ -440,7 +395,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache } /*}}}*/ // checkArchitecture - are we interested in the given Architecture? /*{{{*/ -bool const Configuration::checkArchitecture(std::string const &Arch) { +bool Configuration::checkArchitecture(std::string const &Arch) { if (Arch == "all") return true; std::vector<std::string> const archs = getArchitectures(true); @@ -476,7 +431,7 @@ void Configuration::setDefaultConfigurationForCompressors() { } } /*}}}*/ -// getCompressors - Return Vector of usbale compressors /*{{{*/ +// getCompressors - Return Vector of usealbe compressors /*{{{*/ // --------------------------------------------------------------------- /* return a vector of compressors used by apt-ftparchive in the multicompress functionality or to detect data.tar files */ @@ -507,8 +462,16 @@ const Configuration::getCompressors(bool const Cached) { #endif if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true) compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4)); +#ifdef HAVE_LZMA + else + compressors.push_back(Compressor("xz",".xz","false", NULL, NULL, 4)); +#endif if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5)); +#ifdef HAVE_LZMA + else + compressors.push_back(Compressor("lzma",".lzma","false", NULL, NULL, 5)); +#endif std::vector<std::string> const comp = _config->FindVector("APT::Compressor"); for (std::vector<std::string>::const_iterator c = comp.begin(); @@ -558,4 +521,28 @@ Configuration::Compressor::Compressor(char const *name, char const *extension, UncompressArgs.push_back(uncompressArg); } /*}}}*/ +// getBuildProfiles - return a vector of enabled build profiles /*{{{*/ +std::vector<std::string> const Configuration::getBuildProfiles() { + // order is: override value (~= commandline), environment variable, list (~= config file) + std::string profiles_env = getenv("DEB_BUILD_PROFILES") == 0 ? "" : getenv("DEB_BUILD_PROFILES"); + if (profiles_env.empty() == false) { + profiles_env = SubstVar(profiles_env, " ", ","); + std::string const bp = _config->Find("APT::Build-Profiles"); + _config->Clear("APT::Build-Profiles"); + if (bp.empty() == false) + _config->Set("APT::Build-Profiles", bp); + } + return _config->FindVector("APT::Build-Profiles", profiles_env); +} +std::string const Configuration::getBuildProfilesString() { + std::vector<std::string> profiles = getBuildProfiles(); + if (profiles.empty() == true) + return ""; + std::vector<std::string>::const_iterator p = profiles.begin(); + std::string list = *p; + for (; p != profiles.end(); ++p) + list.append(",").append(*p); + return list; +} + /*}}}*/ } diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index bf7deae85..dfed194ae 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -73,7 +73,7 @@ public: /*{{{*/ * \param All defines if we check against all codes or only against used codes * \return true if we are interested, false otherwise */ - bool static const checkLanguage(std::string Lang, bool const All = false); + bool static checkLanguage(std::string Lang, bool const All = false); /** \brief Returns a vector of Architectures we support * @@ -89,7 +89,7 @@ public: /*{{{*/ * \param Arch we want to check * \return true if we are interested, false otherwise */ - bool static const checkArchitecture(std::string const &Arch); + bool static checkArchitecture(std::string const &Arch); /** \brief Representation of supported compressors */ struct Compressor { @@ -117,6 +117,11 @@ public: /*{{{*/ /** \brief Return a vector of extensions supported for data.tar's */ std::vector<std::string> static const getCompressorExtensions(); + + /** \return Return a vector of enabled build profile specifications */ + std::vector<std::string> static const getBuildProfiles(); + /** \return Return a comma-separated list of enabled build profile specifications */ + std::string static const getBuildProfilesString(); /*}}}*/ private: /*{{{*/ void static setDefaultConfigurationForCompressors(); diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 7c2276185..0fd40106f 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -21,9 +21,16 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/policy.h> #include <apt-pkg/pkgsystem.h> -#include <apt-pkg/acquire-item.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/progress.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> + +#include <string.h> +#include <unistd.h> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -99,7 +106,7 @@ bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock) // CacheFile::BuildSourceList - Open and build all relevant sources.list/*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgCacheFile::BuildSourceList(OpProgress *Progress) +bool pkgCacheFile::BuildSourceList(OpProgress * /*Progress*/) { if (SrcList != NULL) return true; @@ -113,7 +120,7 @@ bool pkgCacheFile::BuildSourceList(OpProgress *Progress) // CacheFile::BuildPolicy - Open and build all relevant preferences /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgCacheFile::BuildPolicy(OpProgress *Progress) +bool pkgCacheFile::BuildPolicy(OpProgress * /*Progress*/) { if (Policy != NULL) return true; diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 802b12b61..36b20893a 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -17,8 +17,12 @@ #ifndef PKGLIB_CACHEFILE_H #define PKGLIB_CACHEFILE_H +#include <stddef.h> + #include <apt-pkg/depcache.h> #include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/acquire.h> @@ -26,6 +30,7 @@ #include <apt-pkg/sourcelist.h> #endif +class MMap; class pkgPolicy; class pkgSourceList; class OpProgress; @@ -60,13 +65,13 @@ class pkgCacheFile inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];}; bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true); - __deprecated bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); }; + APT_DEPRECATED bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); }; bool BuildSourceList(OpProgress *Progress = NULL); bool BuildPolicy(OpProgress *Progress = NULL); bool BuildDepCache(OpProgress *Progress = NULL); bool Open(OpProgress *Progress = NULL, bool WithLock = true); inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); }; - __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; + APT_DEPRECATED bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; static void RemoveCaches(); void Close(); diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc index 57b9af159..e388f2450 100644 --- a/apt-pkg/cachefilter.cc +++ b/apt-pkg/cachefilter.cc @@ -9,10 +9,12 @@ #include <apt-pkg/cachefilter.h> #include <apt-pkg/error.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/macros.h> #include <string> - +#include <string.h> #include <regex.h> #include <fnmatch.h> diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h index 34b7d0b46..49d2855f5 100644 --- a/apt-pkg/cachefilter.h +++ b/apt-pkg/cachefilter.h @@ -7,6 +7,7 @@ #define APT_CACHEFILTER_H // Include Files /*{{{*/ #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <string> @@ -47,7 +48,7 @@ public: /** \class PackageArchitectureMatchesSpecification \brief matching against architecture specification strings - The strings are of the format <kernel>-<cpu> where either component, + The strings are of the format \<kernel\>-\<cpu\> where either component, or the whole string, can be the wildcard "any" as defined in debian-policy §11.1 "Architecture specification strings". diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index ea6a4afba..2fdf8404d 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -29,7 +29,12 @@ /*}}}*/ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H +#include<apt-pkg/pkgcache.h> +#include<apt-pkg/macros.h> + #include<iterator> +#include <iosfwd> +#include <string> #include<string.h> @@ -55,36 +60,36 @@ template<typename Str, typename Itr> class pkgCache::Iterator : public: // Iteration virtual void operator ++(int) = 0; - virtual void operator ++() = 0; // Should be {operator ++(0);}; - inline bool end() const {return Owner == 0 || S == OwnerPointer();}; + virtual void operator ++() = 0; // Should be {operator ++(0);} + inline bool end() const {return Owner == 0 || S == OwnerPointer();} // Comparison - inline bool operator ==(const Itr &B) const {return S == B.S;}; - inline bool operator !=(const Itr &B) const {return S != B.S;}; + inline bool operator ==(const Itr &B) const {return S == B.S;} + inline bool operator !=(const Itr &B) const {return S != B.S;} // Accessors - inline Str *operator ->() {return S;}; - inline Str const *operator ->() const {return S;}; - inline operator Str *() {return S == OwnerPointer() ? 0 : S;}; - inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;}; - inline Str &operator *() {return *S;}; - inline Str const &operator *() const {return *S;}; - inline pkgCache *Cache() const {return Owner;}; + inline Str *operator ->() {return S;} + inline Str const *operator ->() const {return S;} + inline operator Str *() {return S == OwnerPointer() ? 0 : S;} + inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;} + inline Str &operator *() {return *S;} + inline Str const &operator *() const {return *S;} + inline pkgCache *Cache() const {return Owner;} // Mixed stuff - inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;}; - inline bool IsGood() const { return S && Owner && ! end();}; - inline unsigned long Index() const {return S - OwnerPointer();}; + inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;} + inline bool IsGood() const { return S && Owner && ! end();} + inline unsigned long Index() const {return S - OwnerPointer();} void ReMap(void const * const oldMap, void const * const newMap) { if (Owner == 0 || S == 0) return; - S += (Str*)(newMap) - (Str*)(oldMap); + S += (Str const * const)(newMap) - (Str const * const)(oldMap); } // Constructors - look out for the variable assigning - inline Iterator() : S(0), Owner(0) {}; - inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}; + inline Iterator() : S(0), Owner(0) {} + inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {} }; /*}}}*/ // Group Iterator /*{{{*/ @@ -98,19 +103,19 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> { protected: inline Group* OwnerPointer() const { return (Owner != 0) ? Owner->GrpP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} inline PkgIterator PackageList() const; PkgIterator FindPkg(std::string Arch = "any") const; /** \brief find the package with the "best" architecture @@ -127,8 +132,8 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> { inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator<Group, GrpIterator>(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline GrpIterator() : Iterator<Group, GrpIterator>(), HashIndex(0) {}; + } + inline GrpIterator() : Iterator<Group, GrpIterator>(), HashIndex(0) {} }; /*}}}*/ @@ -139,35 +144,35 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> { protected: inline Package* OwnerPointer() const { return (Owner != 0) ? Owner->PkgP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline PkgIterator(pkgCache &Owner) : Iterator<Package, PkgIterator>(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure}; // Accessors - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || - (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}; - inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}; - inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}; - - inline VerIterator VersionList() const; - inline VerIterator CurrentVer() const; - inline DepIterator RevDependsList() const; - inline PrvIterator ProvidesList() const; - OkState State() const; - const char *CandVersion() const; - const char *CurVersion() const; + (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} + inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} + inline APT_PURE GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} + + inline VerIterator VersionList() const APT_PURE; + inline VerIterator CurrentVer() const APT_PURE; + inline DepIterator RevDependsList() const APT_PURE; + inline PrvIterator ProvidesList() const APT_PURE; + OkState State() const APT_PURE; + const char *CandVersion() const APT_PURE; + const char *CurVersion() const APT_PURE; //Nice printable representation friend std::ostream& operator <<(std::ostream& out, PkgIterator i); @@ -177,8 +182,8 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> { inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator<Package, PkgIterator>(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline PkgIterator() : Iterator<Package, PkgIterator>(), HashIndex(0) {}; + } + inline PkgIterator() : Iterator<Package, PkgIterator>(), HashIndex(0) {} }; /*}}}*/ // Version Iterator /*{{{*/ @@ -186,12 +191,12 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> { protected: inline Version* OwnerPointer() const { return (Owner != 0) ? Owner->VerP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;} + inline void operator ++() {operator ++(0);} // Comparison int CompareVer(const VerIterator &B) const; @@ -201,17 +206,17 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> { referring to the same "real" version */ inline bool SimilarVer(const VerIterator &B) const { return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0); - }; + } // Accessors - inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline const char *Arch() const { if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All) return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; - }; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; + } + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} inline DescIterator DescriptionList() const; DescIterator TranslatedDescription() const; @@ -219,8 +224,8 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> { inline PrvIterator ProvidesList() const; inline VerFileIterator FileList() const; bool Downloadable() const; - inline const char *PriorityType() const {return Owner->Priority(S->Priority);}; - const char *MultiArchType() const; + inline const char *PriorityType() const {return Owner->Priority(S->Priority);} + const char *MultiArchType() const APT_PURE; std::string RelStr() const; bool Automatic() const; @@ -229,8 +234,8 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> { inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator<Version, VerIterator>(Owner, Trg) { if (S == 0) S = OwnerPointer(); - }; - inline VerIterator() : Iterator<Version, VerIterator>() {}; + } + inline VerIterator() : Iterator<Version, VerIterator>() {} }; /*}}}*/ // Description Iterator /*{{{*/ @@ -238,26 +243,26 @@ class pkgCache::DescIterator : public Iterator<Description, DescIterator> { protected: inline Description* OwnerPointer() const { return (Owner != 0) ? Owner->DescP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;} + inline void operator ++() {operator ++(0);} // Comparison int CompareDesc(const DescIterator &B) const; // Accessors - inline const char *LanguageCode() const {return Owner->StrP + S->language_code;}; - inline const char *md5() const {return Owner->StrP + S->md5sum;}; + inline const char *LanguageCode() const {return Owner->StrP + S->language_code;} + inline const char *md5() const {return Owner->StrP + S->md5sum;} inline DescFileIterator FileList() const; - inline DescIterator() : Iterator<Description, DescIterator>() {}; + inline DescIterator() : Iterator<Description, DescIterator>() {} inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator<Description, DescIterator>(Owner, Trg) { if (S == 0) S = Owner.DescP; - }; + } }; /*}}}*/ // Dependency iterator /*{{{*/ @@ -267,33 +272,33 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> { protected: inline Dependency* OwnerPointer() const { return (Owner != 0) ? Owner->DepP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP + - (Type == DepVer ? S->NextDepends : S->NextRevDepends);}; - inline void operator ++() {operator ++(0);}; + (Type == DepVer ? S->NextDepends : S->NextRevDepends);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);}; - inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}; - inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);}; - inline bool Reverse() const {return Type == DepRev;}; - bool IsCritical() const; - bool IsNegative() const; - bool IsIgnorable(PrvIterator const &Prv) const; - bool IsIgnorable(PkgIterator const &Pkg) const; - bool IsMultiArchImplicit() const; - bool IsSatisfied(VerIterator const &Ver) const; - bool IsSatisfied(PrvIterator const &Prv) const; + inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);} + inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;} + inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);} + inline bool Reverse() const {return Type == DepRev;} + bool IsCritical() const APT_PURE; + bool IsNegative() const APT_PURE; + bool IsIgnorable(PrvIterator const &Prv) const APT_PURE; + bool IsIgnorable(PkgIterator const &Pkg) const APT_PURE; + bool IsMultiArchImplicit() const APT_PURE; + bool IsSatisfied(VerIterator const &Ver) const APT_PURE; + bool IsSatisfied(PrvIterator const &Prv) const APT_PURE; void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; - inline const char *CompType() const {return Owner->CompType(S->CompareOp);}; - inline const char *DepType() const {return Owner->DepType(S->Type);}; + inline const char *CompType() const {return Owner->CompType(S->CompareOp);} + inline const char *DepType() const {return Owner->DepType(S->Type);} //Nice printable representation friend std::ostream& operator <<(std::ostream& out, DepIterator D); @@ -302,13 +307,13 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> { Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepVer) { if (S == 0) S = Owner.DepP; - }; + } inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) : Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepRev) { if (S == 0) S = Owner.DepP; - }; - inline DepIterator() : Iterator<Dependency, DepIterator>(), Type(DepVer) {}; + } + inline DepIterator() : Iterator<Dependency, DepIterator>(), Type(DepVer) {} }; /*}}}*/ // Provides iterator /*{{{*/ @@ -318,34 +323,34 @@ class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> { protected: inline Provides* OwnerPointer() const { return (Owner != 0) ? Owner->ProvideP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP + - (Type == PrvVer?S->NextPkgProv:S->NextProvides);}; - inline void operator ++() {operator ++(0);}; + (Type == PrvVer?S->NextPkgProv:S->NextProvides);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;}; - inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; - inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}; - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}; + inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;} + inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} + inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);} + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);} - bool IsMultiArchImplicit() const; + bool IsMultiArchImplicit() const APT_PURE; - inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {}; + inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {} inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) { if (S == 0) S = Owner.ProvideP; - }; + } inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) : Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvPkg) { if (S == 0) S = Owner.ProvideP; - }; + } }; /*}}}*/ // Package file /*{{{*/ @@ -353,32 +358,32 @@ class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator> protected: inline PackageFile* OwnerPointer() const { return (Owner != 0) ? Owner->PkgFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}; - inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;}; - inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;}; - inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;}; - inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;}; - inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;}; - inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;}; - inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;}; - inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;}; + inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;} + inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;} + inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;} + inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;} + inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;} + inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;} + inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;} + inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;} + inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;} bool IsOk(); std::string RelStr(); // Constructors - inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {}; - inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgFileIterator>(Owner, Owner.PkgFileP) {}; - inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator<PackageFile, PkgFileIterator>(Owner, Trg) {}; + inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {} + inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgFileIterator>(Owner, Owner.PkgFileP) {} + inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator<PackageFile, PkgFileIterator>(Owner, Trg) {} }; /*}}}*/ // Version File /*{{{*/ @@ -386,18 +391,18 @@ class pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFileIter protected: inline VerFile* OwnerPointer() const { return (Owner != 0) ? Owner->VerFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline VerFileIterator() : Iterator<VerFile, VerFileIterator>() {}; - inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator<VerFile, VerFileIterator>(Owner, Trg) {}; + inline VerFileIterator() : Iterator<VerFile, VerFileIterator>() {} + inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator<VerFile, VerFileIterator>(Owner, Trg) {} }; /*}}}*/ // Description File /*{{{*/ @@ -405,40 +410,40 @@ class pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterator> { protected: inline DescFile* OwnerPointer() const { return (Owner != 0) ? Owner->DescFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline DescFileIterator() : Iterator<DescFile, DescFileIterator>() {}; - inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator<DescFile, DescFileIterator>(Owner, Trg) {}; + inline DescFileIterator() : Iterator<DescFile, DescFileIterator>() {} + inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator<DescFile, DescFileIterator>(Owner, Trg) {} }; /*}}}*/ // Inlined Begin functions can't be in the class because of order problems /*{{{*/ inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const - {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}; + {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);} inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const - {return VerIterator(*Owner,Owner->VerP + S->VersionList);}; + {return VerIterator(*Owner,Owner->VerP + S->VersionList);} inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const - {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);}; + {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);} inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const - {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);}; + {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);} inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const - {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);}; + {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);} inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const - {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);}; + {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);} inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const - {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}; + {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);} inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const - {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}; + {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);} /*}}}*/ #endif diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 6b6fdb5ad..d453a2bfb 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -16,14 +16,22 @@ #include <apt-pkg/cachefilter.h> #include <apt-pkg/cacheset.h> #include <apt-pkg/error.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/versionmatch.h> #include <apt-pkg/pkgrecords.h> #include <apt-pkg/policy.h> - -#include <vector> - +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> + +#include <stddef.h> +#include <stdio.h> +#include <string.h> #include <regex.h> +#include <list> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -588,13 +596,13 @@ pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache, } /*}}}*/ // canNotFindTask - handle the case no package is found for a task /*{{{*/ -void CacheSetHelper::canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) { +void CacheSetHelper::canNotFindTask(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) { if (ShowError == true) _error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str()); } /*}}}*/ // canNotFindRegEx - handle the case no package is found by a regex /*{{{*/ -void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) { +void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string pattern) { if (ShowError == true) _error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str()); } @@ -606,25 +614,25 @@ void CacheSetHelper::canNotFindFnmatch(PackageContainerInterface * const pci, pk } #endif /*}}}*/ // canNotFindPackage - handle the case no package is found from a string/*{{{*/ -void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) { +APT_CONST void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) { } /*}}}*/ // canNotFindAllVer /*{{{*/ -void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, +void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/, pkgCache::PkgIterator const &Pkg) { if (ShowError == true) _error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str()); } /*}}}*/ // canNotFindInstCandVer /*{{{*/ -void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, +void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/, pkgCache::PkgIterator const &Pkg) { if (ShowError == true) _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str()); } /*}}}*/ // canNotFindInstCandVer /*{{{*/ -void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, +void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*vci*/, pkgCacheFile &/*Cache*/, pkgCache::PkgIterator const &Pkg) { if (ShowError == true) _error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str()); @@ -655,27 +663,27 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache } /*}}}*/ // showTaskSelection /*{{{*/ -void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &pkg, - std::string const &pattern) { +APT_CONST void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/, + std::string const &/*pattern*/) { } /*}}}*/ // showRegExSelection /*{{{*/ -void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &pkg, - std::string const &pattern) { +APT_CONST void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/, + std::string const &/*pattern*/) { } /*}}}*/ #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) // showFnmatchSelection /*{{{*/ -void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, +APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern) { } /*}}}*/ #endif // showSelectedVersion /*{{{*/ -void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &Pkg, - pkgCache::VerIterator const Ver, - std::string const &ver, - bool const verIsRel) { +APT_CONST void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, + pkgCache::VerIterator const /*Ver*/, + std::string const &/*ver*/, + bool const /*verIsRel*/) { } /*}}}*/ } diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index b69d74b8e..16a3daa42 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -9,7 +9,6 @@ #ifndef APT_CACHESET_H #define APT_CACHESET_H // Include Files /*{{{*/ -#include <iostream> #include <fstream> #include <map> #include <set> @@ -17,12 +16,18 @@ #include <string> #include <iterator> +#include <stddef.h> + #include <apt-pkg/error.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/cachefile.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <iostream> +#endif /*}}}*/ class pkgCacheFile; @@ -43,8 +48,8 @@ class CacheSetHelper { /*{{{*/ public: /*{{{*/ CacheSetHelper(bool const ShowError = true, GlobalError::MsgType ErrorType = GlobalError::ERROR) : - ShowError(ShowError), ErrorType(ErrorType) {}; - virtual ~CacheSetHelper() {}; + ShowError(ShowError), ErrorType(ErrorType) {} + virtual ~CacheSetHelper() {} virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); @@ -76,9 +81,9 @@ public: /*{{{*/ virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - bool showErrors() const { return ShowError; }; - bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }; - GlobalError::MsgType errorType() const { return ErrorType; }; + bool showErrors() const { return ShowError; } + bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); } + GlobalError::MsgType errorType() const { return ErrorType; } GlobalError::MsgType errorType(GlobalError::MsgType const &newValue) { if (ErrorType == newValue) return ErrorType; @@ -87,7 +92,7 @@ public: /*{{{*/ ErrorType = newValue; return oldValue; } - }; + } /*}}}*/ protected: @@ -124,12 +129,12 @@ public: inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); } inline const char *CandVersion() const { return getPkg().CandVersion(); } inline const char *CurVersion() const { return getPkg().CurVersion(); } - inline pkgCache *Cache() const { return getPkg().Cache(); }; - inline unsigned long Index() const {return getPkg().Index();}; + inline pkgCache *Cache() const { return getPkg().Cache(); } + inline unsigned long Index() const {return getPkg().Index();} // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Package const * operator->() const {return &*getPkg();}; + inline pkgCache::Package const * operator->() const {return &*getPkg();} }; /*}}}*/ @@ -154,7 +159,7 @@ public: unsigned short ID; const char * const Alias; Position Pos; - Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}; + Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {} }; static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci, @@ -177,12 +182,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public PackageContainerInterface::const_iterator, @@ -191,43 +196,43 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename PackageContainer<Container>::const_iterator() { return typename PackageContainer<Container>::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; }; - template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; + bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; } + template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }; + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); } - void setConstructor(Constructor const &by) { ConstructedBy = by; }; - Constructor getConstructor() const { return ConstructedBy; }; + void setConstructor(Constructor const &by) { ConstructedBy = by; } + Constructor getConstructor() const { return ConstructedBy; } - PackageContainer() : ConstructedBy(UNKNOWN) {}; - PackageContainer(Constructor const &by) : ConstructedBy(by) {}; + PackageContainer() : ConstructedBy(UNKNOWN) {} + PackageContainer(Constructor const &by) : ConstructedBy(by) {} /** \brief returns all packages in the cache who belong to the given task @@ -365,7 +370,7 @@ private: /*{{{*/ template<> template<class Cont> void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) { for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p) _cont.push_back(*p); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) { @@ -373,11 +378,11 @@ template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::inse return false; _cont.push_back(P); return true; -}; +} template<> inline void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) { for (const_iterator p = begin; p != end; ++p) _cont.push_back(*p); -}; +} typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet; typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList; @@ -392,27 +397,27 @@ public: virtual pkgCache::VerIterator getVer() const = 0; operator pkgCache::VerIterator(void) { return getVer(); } - inline pkgCache *Cache() const { return getVer().Cache(); }; - inline unsigned long Index() const {return getVer().Index();}; - inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); }; - inline const char *VerStr() const { return getVer().VerStr(); }; - inline const char *Section() const { return getVer().Section(); }; - inline const char *Arch() const { return getVer().Arch(); }; - inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); }; - inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); }; - inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); }; - inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); }; - inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); }; - inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); }; - inline bool Downloadable() const { return getVer().Downloadable(); }; - inline const char *PriorityType() const { return getVer().PriorityType(); }; - inline std::string RelStr() const { return getVer().RelStr(); }; - inline bool Automatic() const { return getVer().Automatic(); }; - inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); }; + inline pkgCache *Cache() const { return getVer().Cache(); } + inline unsigned long Index() const {return getVer().Index();} + inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); } + inline const char *VerStr() const { return getVer().VerStr(); } + inline const char *Section() const { return getVer().Section(); } + inline const char *Arch() const { return getVer().Arch(); } + inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); } + inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); } + inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); } + inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); } + inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); } + inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); } + inline bool Downloadable() const { return getVer().Downloadable(); } + inline const char *PriorityType() const { return getVer().PriorityType(); } + inline std::string RelStr() const { return getVer().RelStr(); } + inline bool Automatic() const { return getVer().Automatic(); } + inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); } // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Version const * operator->() const { return &*getVer(); }; + inline pkgCache::Version const * operator->() const { return &*getVer(); } }; /*}}}*/ @@ -446,7 +451,7 @@ public: Version SelectVersion; Modifier (unsigned short const &id, const char * const alias, Position const &pos, Version const &select) : ID(id), Alias(alias), Pos(pos), - SelectVersion(select) {}; + SelectVersion(select) {} }; static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache, @@ -479,14 +484,16 @@ protected: /*{{{*/ /** \brief returns the candidate version of the package \param Cache to be used to query for information - \param Pkg we want the candidate version from this package */ + \param Pkg we want the candidate version from this package + \param helper used in this container instance */ static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); /** \brief returns the installed version of the package \param Cache to be used to query for information - \param Pkg we want the installed version from this package */ + \param Pkg we want the installed version from this package + \param helper used in this container instance */ static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper); /*}}}*/ @@ -507,12 +514,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public VersionContainerInterface::const_iterator, @@ -521,36 +528,36 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename VersionContainer<Container>::const_iterator() { return typename VersionContainer<Container>::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; }; - template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; } + template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; - - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } + + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); } /** \brief returns all versions specified on the commandline @@ -558,6 +565,7 @@ public: /*{{{*/ non specifically requested and executes regex's if needed on names. \param Cache the packages and versions are in \param cmdline Command line the versions should be extracted from + \param fallback version specification \param helper responsible for error and message handling */ static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, Version const &fallback, CacheSetHelper &helper) { @@ -656,7 +664,7 @@ public: /*{{{*/ template<> template<class Cont> void VersionContainer<std::list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) { for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v) _cont.push_back(*v); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) { @@ -664,11 +672,11 @@ template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::inse return false; _cont.push_back(V); return true; -}; +} template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) { for (const_iterator v = begin; v != end; ++v) _cont.push_back(*v); -}; +} typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet; typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList; } diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 3ae1e8b1d..2635ede76 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -1,28 +1,30 @@ /* */ -#include<config.h> - -#include<apt-pkg/init.h> -#include<apt-pkg/error.h> -#include<apt-pkg/cdromutl.h> -#include<apt-pkg/strutl.h> -#include<apt-pkg/cdrom.h> -#include<apt-pkg/aptconfiguration.h> -#include<apt-pkg/configuration.h> -#include<apt-pkg/fileutl.h> - -#include<sstream> -#include<fstream> +#include <config.h> + +#include <apt-pkg/error.h> +#include <apt-pkg/cdromutl.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/cdrom.h> +#include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/indexcopy.h> + + +#include <string.h> +#include <iostream> +#include <string> +#include <vector> +#include <sstream> +#include <fstream> #include <sys/stat.h> -#include <fcntl.h> #include <dirent.h> #include <unistd.h> #include <stdio.h> #include <algorithm> #include <dlfcn.h> -#include "indexcopy.h" - #include<apti18n.h> using namespace std; @@ -369,7 +371,7 @@ bool pkgCdrom::DropRepeats(vector<string> &List,const char *Name) // --------------------------------------------------------------------- /* This takes the list of source list expressed entires and collects similar ones to form a single entry for each dist */ -void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List) +void pkgCdrom::ReduceSourcelist(string /*CD*/,vector<string> &List) { sort(List.begin(),List.end()); @@ -440,7 +442,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) Out.close(); if (FileExists(DFile) == true) - rename(DFile.c_str(), string(DFile + '~').c_str()); + rename(DFile.c_str(), (DFile + '~').c_str()); if (rename(NewFile.c_str(),DFile.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", DFile.c_str(),DFile.c_str()); @@ -553,7 +555,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source) Out.close(); - rename(File.c_str(),string(File + '~').c_str()); + rename(File.c_str(), (File + '~').c_str()); if (rename(NewFile.c_str(),File.c_str()) != 0) return _error->Errno("rename","Failed to rename %s.new to %s", File.c_str(),File.c_str()); @@ -561,7 +563,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source) return true; } /*}}}*/ -bool pkgCdrom::MountAndIdentCDROM(Configuration &Database, std::string &CDROM, std::string &ident, pkgCdromStatus * const log)/*{{{*/ +bool pkgCdrom::MountAndIdentCDROM(Configuration &Database, std::string &CDROM, std::string &ident, pkgCdromStatus * const log, bool const interactive)/*{{{*/ { // Startup CDROM = _config->FindDir("Acquire::cdrom::mount"); @@ -579,16 +581,19 @@ bool pkgCdrom::MountAndIdentCDROM(Configuration &Database, std::string &CDROM, s // Unmount the CD and get the user to put in the one they want if (_config->FindB("APT::CDROM::NoMount", false) == false) { - if(log != NULL) - log->Update(_("Unmounting CD-ROM\n"), STEP_UNMOUNT); - UnmountCdrom(CDROM); - - if(log != NULL) + if (interactive == true) { - log->Update(_("Waiting for disc...\n"), STEP_WAIT); - if(!log->ChangeCdrom()) { - // user aborted - return false; + if(log != NULL) + log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST); + UnmountCdrom(CDROM); + + if(log != NULL) + { + log->Update(_("Waiting for disc...\n"), STEP_WAIT); + if(!log->ChangeCdrom()) { + // user aborted + return false; + } } } @@ -602,7 +607,7 @@ bool pkgCdrom::MountAndIdentCDROM(Configuration &Database, std::string &CDROM, s // Hash the CD to get an ID if (log != NULL) - log->Update(_("Identifying.. "), STEP_IDENT); + log->Update(_("Identifying... "), STEP_IDENT); if (IdentCdrom(CDROM,ident) == false) { @@ -634,7 +639,7 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log) /*{{{*/ { Configuration Database; std::string CDROM; - if (MountAndIdentCDROM(Database, CDROM, ident, log) == false) + if (MountAndIdentCDROM(Database, CDROM, ident, log, false) == false) return false; if (log != NULL) @@ -660,11 +665,11 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ { Configuration Database; std::string ID, CDROM; - if (MountAndIdentCDROM(Database, CDROM, ID, log) == false) + if (MountAndIdentCDROM(Database, CDROM, ID, log, true) == false) return false; if(log != NULL) - log->Update(_("Scanning disc for index files..\n"),STEP_SCAN); + log->Update(_("Scanning disc for index files...\n"),STEP_SCAN); // Get the CD structure vector<string> List; @@ -737,7 +742,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ if (InfoDir.empty() == false && FileExists(InfoDir + "/info") == true) { - ifstream F(string(InfoDir + "/info").c_str()); + ifstream F((InfoDir + "/info").c_str()); if (!F == 0) getline(F,Name); @@ -933,10 +938,10 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ // convenience interface, this will just call ScanForRemovable vector<CdromDevice> pkgUdevCdromDevices::Scan() -{ +{ bool CdromOnly = _config->FindB("APT::cdrom::CdromOnly", true); - return ScanForRemovable(CdromOnly); -}; + return ScanForRemovable(CdromOnly); +} /*}}}*/ /*{{{*/ vector<CdromDevice> @@ -981,7 +986,7 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly) cdrom.DeviceName = string(devnode); if (mountpath != "") { cdrom.MountPath = mountpath; - string s = string(mountpath); + string s = mountpath; cdrom.Mounted = IsMounted(s); } else { cdrom.Mounted = false; diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index c58593550..0ed4a6a73 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -4,6 +4,8 @@ #include<string> #include<vector> +#include <stddef.h> + #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/init.h> using namespace std; @@ -72,7 +74,7 @@ class pkgCdrom /*{{{*/ private: bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM, - std::string &ident, pkgCdromStatus * const log); + std::string &ident, pkgCdromStatus * const log, bool const interactive); }; /*}}}*/ diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 2dea8ffdd..0ee3b765d 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -16,7 +16,11 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <string> +#include <string.h> #include <dirent.h> #include <sys/stat.h> #include <unistd.h> diff --git a/apt-pkg/clean.h b/apt-pkg/clean.h index ad4049e83..930d54a7f 100644 --- a/apt-pkg/clean.h +++ b/apt-pkg/clean.h @@ -10,8 +10,13 @@ #ifndef APTPKG_CLEAN_H #define APTPKG_CLEAN_H - +#ifndef APT_10_CLEANER_HEADERS #include <apt-pkg/pkgcache.h> +#endif + +#include <string> + +class pkgCache; class pkgArchiveCleaner { diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 20210ec0a..936e377fb 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -19,7 +19,11 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> -#include <sys/wait.h> +#include <stdlib.h> +#include <string.h> +#include <iostream> +#include <string> +#include <vector> #include <sys/statvfs.h> #include <dirent.h> #include <fcntl.h> @@ -42,11 +46,16 @@ bool IsMounted(string &Path) { if (Path.empty() == true) return false; - + // Need that trailing slash for directories if (Path[Path.length() - 1] != '/') Path += '/'; - + + // if the path has a ".disk" directory we treat it as mounted + // this way even extracted copies of disks are recognized + if (DirectoryExists(Path + ".disk/") == true) + return true; + /* First we check if the path is actually mounted, we do this by stating the path and the previous directory (careful of links!) and comparing their device fields. */ @@ -66,7 +75,13 @@ bool IsMounted(string &Path) leave /etc/mtab inconsitant. We drop all messages this produces. */ bool UnmountCdrom(string Path) { - if (IsMounted(Path) == false) + // do not generate errors, even if the mountpoint does not exist + // the mountpoint might be auto-created by the mount command + // and a non-existing mountpoint is surely not mounted + _error->PushToStack(); + bool const mounted = IsMounted(Path); + _error->RevertToStack(); + if (mounted == false) return true; for (int i=0;i<3;i++) @@ -78,8 +93,9 @@ bool UnmountCdrom(string Path) if (Child == 0) { // Make all the fds /dev/null - for (int I = 0; I != 3; I++) - dup2(open("/dev/null",O_RDWR),I); + int const null_fd = open("/dev/null",O_RDWR); + for (int I = 0; I != 3; ++I) + dup2(null_fd, I); if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true) { @@ -113,19 +129,24 @@ bool UnmountCdrom(string Path) /* We fork mount and drop all messages */ bool MountCdrom(string Path, string DeviceName) { - if (IsMounted(Path) == true) + // do not generate errors, even if the mountpoint does not exist + // the mountpoint might be auto-created by the mount command + _error->PushToStack(); + bool const mounted = IsMounted(Path); + _error->RevertToStack(); + if (mounted == true) return true; - + int Child = ExecFork(); // The child if (Child == 0) { // Make all the fds /dev/null - int null_fd = open("/dev/null",O_RDWR); - for (int I = 0; I != 3; I++) + int const null_fd = open("/dev/null",O_RDWR); + for (int I = 0; I != 3; ++I) dup2(null_fd, I); - + if (_config->Exists("Acquire::cdrom::"+Path+"::Mount") == true) { if (system(_config->Find("Acquire::cdrom::"+Path+"::Mount").c_str()) != 0) @@ -242,37 +263,34 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) return true; } /*}}}*/ - // FindMountPointForDevice - Find mountpoint for the given device /*{{{*/ string FindMountPointForDevice(const char *devnode) { - char buf[255]; - char *out[10]; - int i=0; - // this is the order that mount uses as well - const char *mount[] = { "/etc/mtab", - "/proc/mount", - NULL }; + std::vector<std::string> const mounts = _config->FindVector("Dir::state::MountPoints", "/etc/mtab,/proc/mount"); - for (i=0; mount[i] != NULL; i++) { - if (FileExists(mount[i])) { - FILE *f=fopen(mount[i], "r"); - while ( fgets(buf, sizeof(buf), f) != NULL) { - if (strncmp(buf, devnode, strlen(devnode)) == 0) { - if(TokSplitString(' ', buf, out, 10)) - { - fclose(f); - // unescape the \0XXX chars in the path - string mount_point = out[1]; - return DeEscapeString(mount_point); - } - } - } - fclose(f); + for (std::vector<std::string>::const_iterator m = mounts.begin(); m != mounts.end(); ++m) + if (FileExists(*m) == true) + { + char * line = NULL; + size_t line_len = 0; + FILE * f = fopen(m->c_str(), "r"); + while(getline(&line, &line_len, f) != -1) + { + char * out[] = { NULL, NULL, NULL }; + TokSplitString(' ', line, out, 3); + if (out[2] != NULL || out[1] == NULL || out[0] == NULL) + continue; + if (strcmp(out[0], devnode) != 0) + continue; + fclose(f); + // unescape the \0XXX chars in the path + string mount_point = out[1]; + return DeEscapeString(mount_point); + } + fclose(f); } - } - + return string(); } /*}}}*/ diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index ed5800007..3799c822d 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -18,6 +18,11 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <string> + #include <apti18n.h> /*}}}*/ using namespace std; diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h index 180276633..143df58b2 100644 --- a/apt-pkg/contrib/cmndline.h +++ b/apt-pkg/contrib/cmndline.h @@ -44,6 +44,8 @@ #ifndef PKGLIB_CMNDLINE_H #define PKGLIB_CMNDLINE_H +#include <apt-pkg/macros.h> + #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/configuration.h> #endif @@ -80,14 +82,14 @@ class CommandLine bool Parse(int argc,const char **argv); void ShowHelp(); - unsigned int FileSize() const; + unsigned int FileSize() const APT_PURE; bool DispatchArg(Dispatch *List,bool NoMatch = true); static char const * GetCommand(Dispatch const * const Map, - unsigned int const argc, char const * const * const argv); + unsigned int const argc, char const * const * const argv) APT_PURE; static CommandLine::Args MakeArgs(char ShortOpt, char const *LongOpt, - char const *ConfName, unsigned long Flags); + char const *ConfName, unsigned long Flags) APT_CONST; CommandLine(Args *AList,Configuration *Conf); ~CommandLine(); diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 4ef4663c0..00f6ad0f9 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -21,10 +21,18 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> - +#include <apt-pkg/macros.h> + +#include <ctype.h> +#include <regex.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include <string> #include <vector> #include <fstream> -#include <iostream> #include <apti18n.h> @@ -42,8 +50,7 @@ Configuration::Configuration() : ToFree(true) } Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false) { -}; - +} /*}}}*/ // Configuration::~Configuration - Destructor /*{{{*/ // --------------------------------------------------------------------- @@ -246,12 +253,18 @@ string Configuration::FindDir(const char *Name,const char *Default) const // Configuration::FindVector - Find a vector of values /*{{{*/ // --------------------------------------------------------------------- /* Returns a vector of config values under the given item */ -vector<string> Configuration::FindVector(const char *Name) const +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) +vector<string> Configuration::FindVector(const char *Name) const { return FindVector(Name, ""); } +#endif +vector<string> Configuration::FindVector(const char *Name, std::string const &Default) const { vector<string> Vec; const Item *Top = Lookup(Name); if (Top == NULL) - return Vec; + return VectorizeString(Default, ','); + + if (Top->Value.empty() == false) + return VectorizeString(Top->Value, ','); Item *I = Top->Child; while(I != NULL) @@ -259,6 +272,9 @@ vector<string> Configuration::FindVector(const char *Name) const Vec.push_back(I->Value); I = I->Next; } + if (Vec.empty() == true) + return VectorizeString(Default, ','); + return Vec; } /*}}}*/ diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 8e09ea0a6..c256139f4 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -74,8 +74,22 @@ class Configuration std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());}; std::string FindFile(const char *Name,const char *Default = 0) const; std::string FindDir(const char *Name,const char *Default = 0) const; + /** return a list of child options + * + * Options like Acquire::Languages are handled as lists which + * can be overridden and have a default. For the later two a comma + * separated list of values is supported. + * + * \param Name of the parent node + * \param Default list of values separated by commas */ + std::vector<std::string> FindVector(const char *Name, std::string const &Default) const; + std::vector<std::string> FindVector(std::string const &Name, std::string const &Default) const { return FindVector(Name.c_str(), Default); }; +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + std::vector<std::string> FindVector(const char *Name) const { return FindVector(Name, ""); }; +#else std::vector<std::string> FindVector(const char *Name) const; - std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str()); }; +#endif + std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str(), ""); }; int FindI(const char *Name,int const &Default = 0) const; int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);}; bool FindB(const char *Name,bool const &Default = false) const; diff --git a/apt-pkg/contrib/crc-16.h b/apt-pkg/contrib/crc-16.h index 702de40b2..08acdafb7 100644 --- a/apt-pkg/contrib/crc-16.h +++ b/apt-pkg/contrib/crc-16.h @@ -10,8 +10,10 @@ #ifndef APTPKG_CRC16_H #define APTPKG_CRC16_H +#include <apt-pkg/macros.h> + #define INIT_FCS 0xffff unsigned short AddCRC16(unsigned short fcs, void const *buf, - unsigned long long len); + unsigned long long len) APT_PURE; #endif diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index d457781c3..892cd4874 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -17,12 +17,14 @@ #include <apt-pkg/error.h> +#include <stdarg.h> +#include <stddef.h> +#include <list> #include <iostream> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> - #include <string> #include <cstring> @@ -223,7 +225,7 @@ void GlobalError::DumpErrors(std::ostream &out, MsgType const &threshold, void GlobalError::Discard() { Messages.clear(); PendingFlag = false; -}; +} /*}}}*/ // GlobalError::empty - does our error list include anything? /*{{{*/ bool GlobalError::empty(MsgType const &trashhold) const { diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index bcee70b1a..ed8c19153 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -46,6 +46,7 @@ #include <list> #include <string> +#include <stddef.h> #include <stdarg.h> class GlobalError /*{{{*/ @@ -73,7 +74,7 @@ public: /*{{{*/ * * \return \b false */ - bool FatalE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool FatalE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add an Error message with errno to the list * @@ -82,7 +83,7 @@ public: /*{{{*/ * * \return \b false */ - bool Errno(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool Errno(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a warning message with errno to the list * @@ -94,7 +95,7 @@ public: /*{{{*/ * * \return \b false */ - bool WarningE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool WarningE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a notice message with errno to the list * @@ -103,7 +104,7 @@ public: /*{{{*/ * * \return \b false */ - bool NoticeE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool NoticeE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief add a debug message with errno to the list * @@ -112,7 +113,7 @@ public: /*{{{*/ * * \return \b false */ - bool DebugE(const char *Function,const char *Description,...) __like_printf(3) __cold; + bool DebugE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD; /** \brief adds an errno message with the given type * @@ -121,7 +122,7 @@ public: /*{{{*/ * \param Description of the error */ bool InsertErrno(MsgType const &type, const char* Function, - const char* Description,...) __like_printf(4) __cold; + const char* Description,...) APT_PRINTF(4) APT_COLD; /** \brief adds an errno message with the given type * @@ -140,7 +141,7 @@ public: /*{{{*/ */ bool InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args, - int const errsv, size_t &msgSize); + int const errsv, size_t &msgSize) APT_COLD; /** \brief add an fatal error message to the list * @@ -155,7 +156,7 @@ public: /*{{{*/ * * \return \b false */ - bool Fatal(const char *Description,...) __like_printf(2) __cold; + bool Fatal(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add an Error message to the list * @@ -163,7 +164,7 @@ public: /*{{{*/ * * \return \b false */ - bool Error(const char *Description,...) __like_printf(2) __cold; + bool Error(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a warning message to the list * @@ -174,7 +175,7 @@ public: /*{{{*/ * * \return \b false */ - bool Warning(const char *Description,...) __like_printf(2) __cold; + bool Warning(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a notice message to the list * @@ -187,7 +188,7 @@ public: /*{{{*/ * * \return \b false */ - bool Notice(const char *Description,...) __like_printf(2) __cold; + bool Notice(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief add a debug message to the list * @@ -195,14 +196,14 @@ public: /*{{{*/ * * \return \b false */ - bool Debug(const char *Description,...) __like_printf(2) __cold; + bool Debug(const char *Description,...) APT_PRINTF(2) APT_COLD; /** \brief adds an error message with the given type * * \param type of the error message * \param Description of the error */ - bool Insert(MsgType const &type, const char* Description,...) __like_printf(3) __cold; + bool Insert(MsgType const &type, const char* Description,...) APT_PRINTF(3) APT_COLD; /** \brief adds an error message with the given type * @@ -218,13 +219,13 @@ public: /*{{{*/ * should call this method again in that case */ bool Insert(MsgType type, const char* Description, - va_list &args, size_t &msgSize) __cold; + va_list &args, size_t &msgSize) APT_COLD; /** \brief is an error in the list? * * \return \b true if an error is included in the list, \b false otherwise */ - inline bool PendingError() const {return PendingFlag;}; + inline bool PendingError() const APT_PURE {return PendingFlag;}; /** \brief is the list empty? * @@ -232,11 +233,11 @@ public: /*{{{*/ * if you want to check if also no notices happened set the parameter * flag to \b false. * - * \param WithoutNotice does notices count, default is \b true, so no + * \param threshold minimim level considered * * \return \b true if an the list is empty, \b false otherwise */ - bool empty(MsgType const &trashhold = WARNING) const; + bool empty(MsgType const &threshold = WARNING) const APT_PURE; /** \brief returns and removes the first (or last) message in the list * @@ -302,7 +303,7 @@ public: /*{{{*/ void MergeWithStack(); /** \brief return the deep of the stack */ - size_t StackCount() const { + size_t StackCount() const APT_PURE { return Stacks.size(); } diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 79bcf112c..1eabf37f4 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: fileutl.cc,v 1.42 2002/09/14 05:29:22 jgg Exp $ /* ###################################################################### File Utilities @@ -26,16 +25,22 @@ #include <apt-pkg/sptr.h> #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/configuration.h> - +#include <apt-pkg/macros.h> + +#include <ctype.h> +#include <stdarg.h> +#include <stddef.h> +#include <sys/select.h> +#include <time.h> +#include <string> +#include <vector> #include <cstdlib> #include <cstring> #include <cstdio> - #include <iostream> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> -#include <sys/types.h> #include <sys/time.h> #include <sys/wait.h> #include <dirent.h> @@ -52,6 +57,10 @@ #ifdef HAVE_BZ2 #include <bzlib.h> #endif +#ifdef HAVE_LZMA + #include <stdint.h> + #include <lzma.h> +#endif #ifdef WORDS_BIGENDIAN #include <inttypes.h> @@ -62,54 +71,6 @@ using namespace std; -class FileFdPrivate { - public: -#ifdef HAVE_ZLIB - gzFile gz; -#else - void* gz; -#endif -#ifdef HAVE_BZ2 - BZFILE* bz2; -#else - void* bz2; -#endif - int compressed_fd; - pid_t compressor_pid; - bool pipe; - APT::Configuration::Compressor compressor; - unsigned int openmode; - unsigned long long seekpos; - FileFdPrivate() : gz(NULL), bz2(NULL), - compressed_fd(-1), compressor_pid(-1), pipe(false), - openmode(0), seekpos(0) {}; - bool CloseDown(std::string const &FileName) - { - bool Res = true; -#ifdef HAVE_ZLIB - if (gz != NULL) { - int const e = gzclose(gz); - gz = NULL; - // gzdclose() on empty files always fails with "buffer error" here, ignore that - if (e != 0 && e != Z_BUF_ERROR) - Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str()); - } -#endif -#ifdef HAVE_BZ2 - if (bz2 != NULL) { - BZ2_bzclose(bz2); - bz2 = NULL; - } -#endif - if (compressor_pid > 0) - ExecWait(compressor_pid, "FileFdCompressor", true); - compressor_pid = -1; - - return Res; - } - ~FileFdPrivate() { CloseDown(""); } -}; - // RunScripts - Run a set of scripts from a configuration subtree /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -874,6 +835,122 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap) } /*}}}*/ +class FileFdPrivate { /*{{{*/ + public: +#ifdef HAVE_ZLIB + gzFile gz; +#endif +#ifdef HAVE_BZ2 + BZFILE* bz2; +#endif +#ifdef HAVE_LZMA + struct LZMAFILE { + FILE* file; + uint8_t buffer[4096]; + lzma_stream stream; + lzma_ret err; + bool eof; + bool compressing; + + LZMAFILE() : file(NULL), eof(false), compressing(false) {} + ~LZMAFILE() { + if (compressing == true) + { + for (;;) { + stream.avail_out = sizeof(buffer)/sizeof(buffer[0]); + stream.next_out = buffer; + err = lzma_code(&stream, LZMA_FINISH); + if (err != LZMA_OK && err != LZMA_STREAM_END) + { + _error->Error("~LZMAFILE: Compress finalisation failed"); + break; + } + size_t const n = sizeof(buffer)/sizeof(buffer[0]) - stream.avail_out; + if (n && fwrite(buffer, 1, n, file) != n) + { + _error->Errno("~LZMAFILE",_("Write error")); + break; + } + if (err == LZMA_STREAM_END) + break; + } + } + lzma_end(&stream); + fclose(file); + } + }; + LZMAFILE* lzma; +#endif + int compressed_fd; + pid_t compressor_pid; + bool pipe; + APT::Configuration::Compressor compressor; + unsigned int openmode; + unsigned long long seekpos; + FileFdPrivate() : +#ifdef HAVE_ZLIB + gz(NULL), +#endif +#ifdef HAVE_BZ2 + bz2(NULL), +#endif +#ifdef HAVE_LZMA + lzma(NULL), +#endif + compressed_fd(-1), compressor_pid(-1), pipe(false), + openmode(0), seekpos(0) {}; + bool InternalClose(std::string const &FileName) + { + if (false) + /* dummy so that the rest can be 'else if's */; +#ifdef HAVE_ZLIB + else if (gz != NULL) { + int const e = gzclose(gz); + gz = NULL; + // gzdclose() on empty files always fails with "buffer error" here, ignore that + if (e != 0 && e != Z_BUF_ERROR) + return _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str()); + } +#endif +#ifdef HAVE_BZ2 + else if (bz2 != NULL) { + BZ2_bzclose(bz2); + bz2 = NULL; + } +#endif +#ifdef HAVE_LZMA + else if (lzma != NULL) { + delete lzma; + lzma = NULL; + } +#endif + return true; + } + bool CloseDown(std::string const &FileName) + { + bool const Res = InternalClose(FileName); + + if (compressor_pid > 0) + ExecWait(compressor_pid, "FileFdCompressor", true); + compressor_pid = -1; + + return Res; + } + bool InternalStream() const { + return false +#ifdef HAVE_BZ2 + || bz2 != NULL +#endif +#ifdef HAVE_LZMA + || lzma != NULL +#endif + ; + } + + + ~FileFdPrivate() { CloseDown(""); } +}; + /*}}}*/ // FileFd::Open - Open a file /*{{{*/ // --------------------------------------------------------------------- /* The most commonly used open mode combinations are given with Mode */ @@ -891,7 +968,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress, { for (; compressor != compressors.end(); ++compressor) { - std::string file = std::string(FileName).append(compressor->Extension); + std::string file = FileName + compressor->Extension; if (FileExists(file) == false) continue; FileName = file; @@ -1061,30 +1138,12 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration: { Close(); Flags = (AutoClose) ? FileFd::AutoClose : 0; - if (AutoClose == false && ( -#ifdef HAVE_ZLIB - compressor.Name == "gzip" || -#endif -#ifdef HAVE_BZ2 - compressor.Name == "bzip2" || -#endif - false)) - { - // Need to duplicate fd here or gzclose for cleanup will close the fd as well - iFd = dup(Fd); - } - else - iFd = Fd; + iFd = Fd; this->FileName = ""; - if (Fd == -1 || OpenInternDescriptor(Mode, compressor) == false) + if (OpenInternDescriptor(Mode, compressor) == false) { if (iFd != -1 && ( -#ifdef HAVE_ZLIB - compressor.Name == "gzip" || -#endif -#ifdef HAVE_BZ2 - compressor.Name == "bzip2" || -#endif + (Flags & Compressed) == Compressed || AutoClose == true)) { close (iFd); @@ -1096,52 +1155,121 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration: } bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor) { + if (iFd == -1) + return false; if (compressor.Name == "." || compressor.Binary.empty() == true) return true; +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA + // the API to open files is similar, so setup to avoid code duplicates later + // and while at it ensure that we close before opening (if its a reopen) + void* (*compress_open)(int, const char *) = NULL; + if (false) + /* dummy so that the rest can be 'else if's */; +#define APT_COMPRESS_INIT(NAME,OPEN) \ + else if (compressor.Name == NAME) \ + { \ + compress_open = (void*(*)(int, const char *)) OPEN; \ + if (d != NULL) d->InternalClose(FileName); \ + } +#ifdef HAVE_ZLIB + APT_COMPRESS_INIT("gzip", gzdopen) +#endif +#ifdef HAVE_BZ2 + APT_COMPRESS_INIT("bzip2", BZ2_bzdopen) +#endif +#ifdef HAVE_LZMA + APT_COMPRESS_INIT("xz", fdopen) + APT_COMPRESS_INIT("lzma", fdopen) +#endif +#undef APT_COMPRESS_INIT +#endif + if (d == NULL) { d = new FileFdPrivate(); d->openmode = Mode; d->compressor = compressor; +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA + if (AutoClose == false && compress_open != NULL) + { + // Need to duplicate fd here or gz/bz2 close for cleanup will close the fd as well + int const internFd = dup(iFd); + if (internFd == -1) + return FileFdErrno("OpenInternDescriptor", _("Could not open file descriptor %d"), iFd); + iFd = internFd; + } +#endif } -#ifdef HAVE_ZLIB - if (compressor.Name == "gzip") +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA + if (compress_open != NULL) { - if (d->gz != NULL) - { - gzclose(d->gz); - d->gz = NULL; - } + void* compress_struct = NULL; if ((Mode & ReadWrite) == ReadWrite) - d->gz = gzdopen(iFd, "r+"); + compress_struct = compress_open(iFd, "r+"); else if ((Mode & WriteOnly) == WriteOnly) - d->gz = gzdopen(iFd, "w"); + compress_struct = compress_open(iFd, "w"); else - d->gz = gzdopen(iFd, "r"); - if (d->gz == NULL) + compress_struct = compress_open(iFd, "r"); + if (compress_struct == NULL) return false; - Flags |= Compressed; - return true; - } + + if (false) + /* dummy so that the rest can be 'else if's */; +#ifdef HAVE_ZLIB + else if (compressor.Name == "gzip") + d->gz = (gzFile) compress_struct; #endif #ifdef HAVE_BZ2 - if (compressor.Name == "bzip2") - { - if (d->bz2 != NULL) + else if (compressor.Name == "bzip2") + d->bz2 = (BZFILE*) compress_struct; +#endif +#ifdef HAVE_LZMA + else if (compressor.Name == "xz" || compressor.Name == "lzma") { - BZ2_bzclose(d->bz2); - d->bz2 = NULL; + uint32_t const xzlevel = 6; + uint64_t const memlimit = UINT64_MAX; + if (d->lzma == NULL) + d->lzma = new FileFdPrivate::LZMAFILE; + d->lzma->file = (FILE*) compress_struct; + d->lzma->stream = LZMA_STREAM_INIT; + + if ((Mode & ReadWrite) == ReadWrite) + return FileFdError("ReadWrite mode is not supported for file %s", FileName.c_str()); + + if ((Mode & WriteOnly) == WriteOnly) + { + if (compressor.Name == "xz") + { + if (lzma_easy_encoder(&d->lzma->stream, xzlevel, LZMA_CHECK_CRC32) != LZMA_OK) + return false; + } + else + { + lzma_options_lzma options; + lzma_lzma_preset(&options, xzlevel); + if (lzma_alone_encoder(&d->lzma->stream, &options) != LZMA_OK) + return false; + } + d->lzma->compressing = true; + } + else + { + if (compressor.Name == "xz") + { + if (lzma_auto_decoder(&d->lzma->stream, memlimit, 0) != LZMA_OK) + return false; + } + else + { + if (lzma_alone_decoder(&d->lzma->stream, memlimit) != LZMA_OK) + return false; + } + d->lzma->compressing = false; + } } - if ((Mode & ReadWrite) == ReadWrite) - d->bz2 = BZ2_bzdopen(iFd, "r+"); - else if ((Mode & WriteOnly) == WriteOnly) - d->bz2 = BZ2_bzdopen(iFd, "w"); - else - d->bz2 = BZ2_bzdopen(iFd, "r"); - if (d->bz2 == NULL) - return false; +#endif Flags |= Compressed; return true; } @@ -1198,7 +1326,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C } else { - if (FileName.empty() == true) + if (d->compressed_fd != -1) dup2(d->compressed_fd,STDIN_FILENO); dup2(Pipe[1],STDOUT_FILENO); } @@ -1267,24 +1395,55 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) *((char *)To) = '\0'; do { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) Res = gzread(d->gz,To,Size); - else #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) Res = BZ2_bzread(d->bz2,To,Size); - else #endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + { + if (d->lzma->eof == true) + break; + + d->lzma->stream.next_out = (uint8_t *) To; + d->lzma->stream.avail_out = Size; + if (d->lzma->stream.avail_in == 0) + { + d->lzma->stream.next_in = d->lzma->buffer; + d->lzma->stream.avail_in = fread(d->lzma->buffer, 1, sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]), d->lzma->file); + } + d->lzma->err = lzma_code(&d->lzma->stream, LZMA_RUN); + if (d->lzma->err == LZMA_STREAM_END) + { + d->lzma->eof = true; + Res = Size - d->lzma->stream.avail_out; + } + else if (d->lzma->err != LZMA_OK) + { + Res = -1; + errno = 0; + } + else + Res = Size - d->lzma->stream.avail_out; + } +#endif + else Res = read(iFd,To,Size); if (Res < 0) { if (errno == EINTR) continue; + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) { int err; char const * const errmsg = gzerror(d->gz, &err); @@ -1293,7 +1452,7 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) } #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) { int err; char const * const errmsg = BZ2_bzerror(d->bz2, &err); @@ -1301,6 +1460,10 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) return FileFdError("BZ2_bzread: %s (%d: %s)", _("Read error"), err, errmsg); } #endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + return FileFdError("lzma_read: %s (%d)", _("Read error"), d->lzma->err); +#endif return FileFdErrno("read",_("Read error")); } @@ -1364,23 +1527,45 @@ bool FileFd::Write(const void *From,unsigned long long Size) errno = 0; do { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) - Res = gzwrite(d->gz,From,Size); - else + else if (d != NULL && d->gz != NULL) + Res = gzwrite(d->gz,From,Size); #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) - Res = BZ2_bzwrite(d->bz2,(void*)From,Size); - else + else if (d != NULL && d->bz2 != NULL) + Res = BZ2_bzwrite(d->bz2,(void*)From,Size); +#endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + { + d->lzma->stream.next_in = (uint8_t *)From; + d->lzma->stream.avail_in = Size; + d->lzma->stream.next_out = d->lzma->buffer; + d->lzma->stream.avail_out = sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]); + d->lzma->err = lzma_code(&d->lzma->stream, LZMA_RUN); + if (d->lzma->err != LZMA_OK) + return false; + size_t const n = sizeof(d->lzma->buffer)/sizeof(d->lzma->buffer[0]) - d->lzma->stream.avail_out; + size_t const m = (n == 0) ? 0 : fwrite(d->lzma->buffer, 1, n, d->lzma->file); + if (m != n) + Res = -1; + else + Res = Size - d->lzma->stream.avail_in; + } #endif - Res = write(iFd,From,Size); + else + Res = write(iFd,From,Size); + if (Res < 0 && errno == EINTR) continue; if (Res < 0) { + if (false) + /* dummy so that the rest can be 'else if's */; #ifdef HAVE_ZLIB - if (d != NULL && d->gz != NULL) + else if (d != NULL && d->gz != NULL) { int err; char const * const errmsg = gzerror(d->gz, &err); @@ -1389,7 +1574,7 @@ bool FileFd::Write(const void *From,unsigned long long Size) } #endif #ifdef HAVE_BZ2 - if (d != NULL && d->bz2 != NULL) + else if (d != NULL && d->bz2 != NULL) { int err; char const * const errmsg = BZ2_bzerror(d->bz2, &err); @@ -1397,10 +1582,14 @@ bool FileFd::Write(const void *From,unsigned long long Size) return FileFdError("BZ2_bzwrite: %s (%d: %s)", _("Write error"), err, errmsg); } #endif +#ifdef HAVE_LZMA + else if (d != NULL && d->lzma != NULL) + return FileFdErrno("lzma_fwrite", _("Write error")); +#endif return FileFdErrno("write",_("Write error")); } - From = (char *)From + Res; + From = (char const *)From + Res; Size -= Res; if (d != NULL) d->seekpos += Res; @@ -1424,7 +1613,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size) if (Res < 0) return _error->Errno("write",_("Write error")); - From = (char *)From + Res; + From = (char const *)From + Res; Size -= Res; } while (Res > 0 && Size > 0); @@ -1440,11 +1629,7 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size) /* */ bool FileFd::Seek(unsigned long long To) { - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) { // Our poor man seeking in pipes is costly, so try to avoid it unsigned long long seekpos = Tell(); @@ -1455,13 +1640,7 @@ bool FileFd::Seek(unsigned long long To) if ((d->openmode & ReadOnly) != ReadOnly) return FileFdError("Reopen is only implemented for read-only files!"); -#ifdef HAVE_BZ2 - if (d->bz2 != NULL) - { - BZ2_bzclose(d->bz2); - d->bz2 = NULL; - } -#endif + d->InternalClose(FileName); if (iFd != -1) close(iFd); iFd = -1; @@ -1507,11 +1686,7 @@ bool FileFd::Seek(unsigned long long To) /* */ bool FileFd::Skip(unsigned long long Over) { - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) { d->seekpos += Over; char buffer[1024]; @@ -1548,8 +1723,12 @@ bool FileFd::Truncate(unsigned long long To) // truncating /dev/null is always successful - as we get an error otherwise if (To == 0 && FileName == "/dev/null") return true; -#if defined HAVE_ZLIB || defined HAVE_BZ2 - if (d != NULL && (d->gz != NULL || d->bz2 != NULL)) +#if defined HAVE_ZLIB || defined HAVE_BZ2 || defined HAVE_LZMA + if (d != NULL && (d->InternalStream() == true +#ifdef HAVE_ZLIB + || d->gz != NULL +#endif + )) return FileFdError("Truncating compressed files is not implemented (%s)", FileName.c_str()); #endif if (ftruncate(iFd,To) != 0) @@ -1567,11 +1746,7 @@ unsigned long long FileFd::Tell() // seeking around, but not all users of FileFd use always Seek() and co // so d->seekpos isn't always true and we can just use it as a hint if // we have nothing else, but not always as an authority… - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || d->bz2 != NULL -#endif - )) + if (d != NULL && (d->pipe == true || d->InternalStream() == true)) return d->seekpos; off_t Res; @@ -1646,11 +1821,7 @@ unsigned long long FileFd::Size() // for compressor pipes st_size is undefined and at 'best' zero, // so we 'read' the content and 'seek' back - see there - if (d != NULL && (d->pipe == true -#ifdef HAVE_BZ2 - || (d->bz2 && size > 0) -#endif - )) + if (d != NULL && (d->pipe == true || (d->InternalStream() == true && size > 0))) { unsigned long long const oldSeek = Tell(); char ignore[1000]; @@ -1793,7 +1964,13 @@ bool FileFd::FileFdError(const char *Description,...) { } /*}}}*/ -gzFile FileFd::gzFd() { return (gzFile) d->gz; } +APT_DEPRECATED gzFile FileFd::gzFd() { +#ifdef HAVE_ZLIB + return d->gz; +#else + return NULL; +#endif +} // Glob - wrapper around "glob()" /*{{{*/ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index f0569b6fd..278a25742 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -27,6 +27,7 @@ #include <string> #include <vector> #include <set> +#include <time.h> #include <zlib.h> @@ -94,7 +95,7 @@ class FileFd And as the auto-conversation converts a 'unsigned long *' to a 'bool' instead of 'unsigned long long *' we need to provide this explicitely - otherwise applications magically start to fail… */ - __deprecated bool Read(void *To,unsigned long long Size,unsigned long *Actual) + bool Read(void *To,unsigned long long Size,unsigned long *Actual) APT_DEPRECATED { unsigned long long R; bool const T = Read(To, Size, &R); @@ -118,7 +119,7 @@ class FileFd // Simple manipulators inline int Fd() {return iFd;}; inline void Fd(int fd) { OpenDescriptor(fd, ReadWrite);}; - __deprecated gzFile gzFd(); + gzFile gzFd() APT_DEPRECATED APT_PURE; inline bool IsOpen() {return iFd >= 0;}; inline bool Failed() {return (Flags & Fail) == Fail;}; @@ -152,8 +153,8 @@ class FileFd bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor); // private helpers to set Fail flag and call _error->Error - bool FileFdErrno(const char* Function, const char* Description,...) __like_printf(3) __cold; - bool FileFdError(const char* Description,...) __like_printf(2) __cold; + bool FileFdErrno(const char* Function, const char* Description,...) APT_PRINTF(3) APT_COLD; + bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; bool RunScripts(const char *Cnf); @@ -161,7 +162,7 @@ bool CopyFile(FileFd &From,FileFd &To); int GetLock(std::string File,bool Errors = true); bool FileExists(std::string File); bool RealFileExists(std::string File); -bool DirectoryExists(std::string const &Path) __attrib_const; +bool DirectoryExists(std::string const &Path) APT_CONST; bool CreateDirectory(std::string const &Parent, std::string const &Path); time_t GetModificationTime(std::string const &Path); bool Rename(std::string From, std::string To); diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index 9de227062..f24dd9640 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -2,21 +2,23 @@ // Include Files /*{{{*/ #include<config.h> +#include<apt-pkg/configuration.h> +#include<apt-pkg/error.h> +#include<apt-pkg/strutl.h> +#include<apt-pkg/fileutl.h> +#include<apt-pkg/gpgv.h> + #include <errno.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <fcntl.h> -#include <sys/stat.h> -#include <sys/types.h> #include <sys/wait.h> #include <unistd.h> - -#include<apt-pkg/configuration.h> -#include<apt-pkg/error.h> -#include<apt-pkg/strutl.h> -#include<apt-pkg/fileutl.h> -#include<apt-pkg/gpgv.h> +#include <stddef.h> +#include <iostream> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 1d79a52ac..f018893fd 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -9,17 +9,17 @@ #ifndef CONTRIB_GPGV_H #define CONTRIB_GPGV_H +#include <apt-pkg/macros.h> + #include <string> #include <vector> +#ifndef APT_10_CLEANER_HEADERS #include <apt-pkg/fileutl.h> - -#if __GNUC__ >= 4 - #define APT_noreturn __attribute__ ((noreturn)) -#else - #define APT_noreturn /* no support */ #endif +class FileFd; + /** \brief generates and run the command to verify a file with gpgv * * If File and FileSig specify the same file it is assumed that we @@ -40,14 +40,12 @@ * @param FileSig is the signature (detached or clear-signed) */ void ExecGPGV(std::string const &File, std::string const &FileSig, - int const &statusfd, int fd[2]) APT_noreturn; -inline void ExecGPGV(std::string const &File, std::string const &FileSig, + int const &statusfd, int fd[2]) APT_NORETURN; +inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); -}; - -#undef APT_noreturn +} /** \brief Split an inline signature into message and signature * diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 890573d9c..1fce0d75f 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -16,8 +16,12 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/macros.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/sha1.h> +#include <apt-pkg/sha2.h> +#include <stddef.h> +#include <algorithm> #include <unistd.h> #include <string> #include <iostream> @@ -112,7 +116,7 @@ const char** HashString::SupportedHashes() return _SupportedHashes; } -bool HashString::empty() const +APT_PURE bool HashString::empty() const { return (Type.empty() || Hash.empty()); } diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 0a8bcd259..5cd1af03b 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -17,17 +17,22 @@ #include <apt-pkg/md5.h> #include <apt-pkg/sha1.h> #include <apt-pkg/sha2.h> -#include <apt-pkg/fileutl.h> -#include <algorithm> -#include <vector> #include <cstring> - +#include <string> #ifndef APT_8_CLEANER_HEADERS using std::min; using std::vector; #endif +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/fileutl.h> +#include <algorithm> +#include <vector> +#endif + + +class FileFd; // helper class that contains hash function name // and hash @@ -61,7 +66,7 @@ class HashString bool empty() const; // return the list of hashes we support - static const char** SupportedHashes(); + static APT_CONST const char** SupportedHashes(); }; class Hashes @@ -77,7 +82,7 @@ class Hashes { return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size); }; - inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));}; + inline bool Add(const char *Data) {return Add((unsigned char const *)Data,strlen(Data));}; inline bool AddFD(int const Fd,unsigned long long Size = 0) { return AddFD(Fd, Size, true, true, true, true); }; bool AddFD(int const Fd, unsigned long long Size, bool const addMD5, diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc index d02177724..25ccc187d 100644 --- a/apt-pkg/contrib/hashsum.cc +++ b/apt-pkg/contrib/hashsum.cc @@ -1,6 +1,9 @@ // Cryptographic API Base #include <config.h> +#include <apt-pkg/fileutl.h> + +#include <algorithm> #include <unistd.h> #include "hashsum_template.h" diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 9bf160b2b..869dc5cb7 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -10,36 +10,40 @@ #ifndef APTPKG_HASHSUM_TEMPLATE_H #define APTPKG_HASHSUM_TEMPLATE_H -#include <apt-pkg/fileutl.h> #include <string> #include <cstring> -#include <algorithm> -#include <stdint.h> #include <apt-pkg/strutl.h> +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/fileutl.h> +#include <algorithm> +#include <stdint.h> +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; #endif +class FileFd; + template<int N> class HashSumValue { unsigned char Sum[N/8]; - + public: // Accessors bool operator ==(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0; - }; + } bool operator !=(const HashSumValue &rhs) const { return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0; - }; + } std::string Value() const { @@ -49,7 +53,7 @@ class HashSumValue }; char Result[((N/8)*2)+1]; Result[(N/8)*2] = 0; - + // Convert each char into two letters int J = 0; int I = 0; @@ -59,31 +63,31 @@ class HashSumValue Result[I + 1] = Conv[Sum[J] & 0xF]; } return std::string(Result); - }; - + } + inline void Value(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) S[I] = Sum[I]; - }; + } - inline operator std::string() const + inline operator std::string() const { return Value(); - }; + } - bool Set(std::string Str) + bool Set(std::string Str) { return Hex2Num(Str,Sum,sizeof(Sum)); - }; + } - inline void Set(unsigned char S[N/8]) + inline void Set(unsigned char S[N/8]) { - for (int I = 0; I != sizeof(Sum); I++) + for (int I = 0; I != sizeof(Sum); ++I) Sum[I] = S[I]; - }; + } - HashSumValue(std::string Str) + HashSumValue(std::string Str) { memset(Sum,0,sizeof(Sum)); Set(Str); @@ -99,17 +103,17 @@ class SummationImplementation public: virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0; inline bool Add(const char *inbuf, unsigned long long const inlen) - { return Add((unsigned char *)inbuf, inlen); }; + { return Add((const unsigned char *)inbuf, inlen); } inline bool Add(const unsigned char *Data) - { return Add(Data, strlen((const char *)Data)); }; + { return Add(Data, strlen((const char *)Data)); } inline bool Add(const char *Data) - { return Add((const unsigned char *)Data, strlen((const char *)Data)); }; + { return Add((const unsigned char *)Data, strlen(Data)); } inline bool Add(const unsigned char *Beg, const unsigned char *End) - { return Add(Beg, End - Beg); }; + { return Add(Beg, End - Beg); } inline bool Add(const char *Beg, const char *End) - { return Add((const unsigned char *)Beg, End - Beg); }; + { return Add((const unsigned char *)Beg, End - Beg); } bool AddFD(int Fd, unsigned long long Size = 0); bool AddFD(FileFd &Fd, unsigned long long Size = 0); diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index e53d01b8f..d97053553 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -54,37 +54,87 @@ #define CLRFLAG(v,f) ((v) &=~FLAG(f)) #define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false) -// some nice optional GNUC features -#if __GNUC__ >= 3 - #define __must_check __attribute__ ((warn_unused_result)) - #define __deprecated __attribute__ ((deprecated)) - #define __attrib_const __attribute__ ((__const__)) - /* likely() and unlikely() can be used to mark boolean expressions - as (not) likely true which will help the compiler to optimise */ +#ifdef __GNUC__ +#define APT_GCC_VERSION (__GNUC__ << 8 | __GNUC_MINOR__) +#else +#define APT_GCC_VERSION 0 +#endif + +/* likely() and unlikely() can be used to mark boolean expressions + as (not) likely true which will help the compiler to optimise */ +#if APT_GCC_VERSION >= 0x0300 #define likely(x) __builtin_expect (!!(x), 1) #define unlikely(x) __builtin_expect (!!(x), 0) #else - #define __must_check /* no warn_unused_result */ - #define __deprecated /* no deprecated */ - #define __attrib_const /* no const attribute */ #define likely(x) (x) #define unlikely(x) (x) #endif +#if APT_GCC_VERSION >= 0x0300 + #define APT_DEPRECATED __attribute__ ((deprecated)) + #define APT_CONST __attribute__((const)) + #define APT_PURE __attribute__((pure)) + #define APT_NORETURN __attribute__((noreturn)) + #define APT_PRINTF(n) __attribute__((format(printf, n, n + 1))) +#else + #define APT_DEPRECATED + #define APT_CONST + #define APT_PURE + #define APT_NORETURN + #define APT_PRINTF(n) +#endif + +#if APT_GCC_VERSION > 0x0302 + #define APT_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) + #define APT_MUSTCHECK __attribute__((warn_unused_result)) +#else + #define APT_NONNULL(...) + #define APT_REQRET +#endif + +#if APT_GCC_VERSION >= 0x0400 + #define APT_SENTINEL __attribute__((sentinel)) +#else + #define APT_SENTINEL +#endif + // cold functions are unlikely() to be called -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 - #define __cold __attribute__ ((__cold__)) - #define __hot __attribute__ ((__hot__)) +#if APT_GCC_VERSION >= 0x0403 + #define APT_COLD __attribute__ ((__cold__)) + #define APT_HOT __attribute__ ((__hot__)) #else - #define __cold /* no cold marker */ - #define __hot /* no hot marker */ + #define APT_COLD + #define APT_HOT #endif -#ifdef __GNUG__ -// Methods have a hidden this parameter that is visible to this attribute +#ifndef APT_10_CLEANER_HEADERS +#if APT_GCC_VERSION >= 0x0300 + #define __must_check __attribute__ ((warn_unused_result)) + #define __deprecated __attribute__ ((deprecated)) + #define __attrib_const __attribute__ ((__const__)) #define __like_printf(n) __attribute__((format(printf, n, n + 1))) #else + #define __must_check /* no warn_unused_result */ + #define __deprecated /* no deprecated */ + #define __attrib_const /* no const attribute */ #define __like_printf(n) /* no like-printf */ #endif +#if APT_GCC_VERSION >= 0x0403 + #define __cold __attribute__ ((__cold__)) + #define __hot __attribute__ ((__hot__)) +#else + #define __cold /* no cold marker */ + #define __hot /* no hot marker */ +#endif +#endif + +// These lines are extracted by the makefiles and the buildsystem +// Increasing MAJOR or MINOR results in the need of recompiling all +// reverse-dependencies of libapt-pkg against the new SONAME. +// Non-ABI-Breaks should only increase RELEASE number. +// See also buildlib/libversion.mak +#define APT_PKG_MAJOR 4 +#define APT_PKG_MINOR 12 +#define APT_PKG_RELEASE 0 #endif diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index 4351aeb22..b487a96f9 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -38,13 +38,9 @@ #include <config.h> #include <apt-pkg/md5.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/macros.h> +#include <stdint.h> #include <string.h> -#include <unistd.h> -#include <netinet/in.h> // For htonl -#include <inttypes.h> /*}}}*/ // byteSwap - Swap bytes in a buffer /*{{{*/ diff --git a/apt-pkg/contrib/md5.h b/apt-pkg/contrib/md5.h index 195455645..f4992c223 100644 --- a/apt-pkg/contrib/md5.h +++ b/apt-pkg/contrib/md5.h @@ -23,14 +23,15 @@ #ifndef APTPKG_MD5_H #define APTPKG_MD5_H - -#include <string> -#include <cstring> -#include <algorithm> #include <stdint.h> #include "hashsum_template.h" +#ifndef APT_10_CLEANER_HEADERS +#include <string> +#include <cstring> +#include <algorithm> +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 51e8eb30f..b2a53a6cb 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -22,11 +22,11 @@ #include <apt-pkg/mmap.h> #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/macros.h> +#include <string> #include <sys/mman.h> -#include <sys/stat.h> #include <unistd.h> -#include <fcntl.h> #include <stdlib.h> #include <errno.h> #include <cstring> @@ -198,7 +198,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) { #ifdef _POSIX_SYNCHRONIZED_IO unsigned long long const PSize = sysconf(_SC_PAGESIZE); - if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) + if (msync((char *)Base+(Start/PSize)*PSize, Stop - Start, MS_SYNC) < 0) return _error->Errno("msync", _("Unable to synchronize mmap")); #endif } diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index de95aa4ab..feaed67c8 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -15,14 +15,13 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> -#include <apt-pkg/error.h> -#include <apt-pkg/fileutl.h> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <stddef.h> #include <pwd.h> #include "netrc.h" @@ -198,7 +197,7 @@ void maybe_add_auth (URI &Uri, string NetRCFile) // if host did not work, try Host+Path next, this will trigger // a lookup uri.startswith(host) in the netrc file parser (because // of the "/" - char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str()); + char *hostpath = strdup((Uri.Host + Uri.Path).c_str()); if (hostpath && parsenetrc_string(hostpath, login, password, netrcfile) == 0) { if (_config->FindB("Debug::Acquire::netrc", false) == true) diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h index 6feb5b726..dbeb45386 100644 --- a/apt-pkg/contrib/netrc.h +++ b/apt-pkg/contrib/netrc.h @@ -16,6 +16,8 @@ #include <string> +#include <apt-pkg/macros.h> + #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/strutl.h> #endif @@ -25,9 +27,9 @@ class URI; -// kill this export on the next ABI break - strongly doubt its in use anyway +// FIXME: kill this export on the next ABI break - strongly doubt its in use anyway // outside of the apt itself, its really a internal interface -__deprecated int parsenetrc (char *host, char *login, char *password, char *filename); +APT_DEPRECATED int parsenetrc (char *host, char *login, char *password, char *filename); void maybe_add_auth (URI &Uri, std::string NetRCFile); #endif diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 916e1d730..4ff4f181d 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -14,6 +14,8 @@ #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> +#include <sys/time.h> +#include <string> #include <iostream> #include <stdio.h> #include <cstring> @@ -125,14 +127,14 @@ bool OpProgress::CheckChange(float Interval) // OpTextProgress::OpTextProgress - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -OpTextProgress::OpTextProgress(Configuration &Config) : - NoUpdate(false), NoDisplay(false), LastLen(0) +OpTextProgress::OpTextProgress(Configuration &Config) : + NoUpdate(false), NoDisplay(false), LastLen(0) { if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true) NoUpdate = true; if (Config.FindI("quiet",0) >= 2) NoDisplay = true; -}; +} /*}}}*/ // OpTextProgress::Done - Clean up the display /*{{{*/ // --------------------------------------------------------------------- @@ -150,12 +152,12 @@ void OpTextProgress::Done() cout << endl; OldOp = string(); } - + if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false) { OldOp = string(); - cout << endl; - } + cout << endl; + } } /*}}}*/ // OpTextProgress::Update - Simple text spinner /*{{{*/ diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index b5a6a2440..bf6bc6cb6 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -32,12 +32,9 @@ #include <config.h> #include <apt-pkg/sha1.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/macros.h> +#include <stdint.h> #include <string.h> -#include <unistd.h> -#include <inttypes.h> /*}}}*/ // SHA1Transform - Alters an existing SHA-1 hash /*{{{*/ diff --git a/apt-pkg/contrib/sha1.h b/apt-pkg/contrib/sha1.h index a8d55eb13..5770c315a 100644 --- a/apt-pkg/contrib/sha1.h +++ b/apt-pkg/contrib/sha1.h @@ -14,12 +14,13 @@ #ifndef APTPKG_SHA1_H #define APTPKG_SHA1_H +#include "hashsum_template.h" + +#ifndef APT_10_CLEANER_HEADERS #include <string> #include <cstring> #include <algorithm> - -#include "hashsum_template.h" - +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::min; diff --git a/apt-pkg/contrib/sha2.h b/apt-pkg/contrib/sha2.h index 8e0c99a1b..a25ad4d32 100644 --- a/apt-pkg/contrib/sha2.h +++ b/apt-pkg/contrib/sha2.h @@ -14,14 +14,18 @@ #ifndef APTPKG_SHA2_H #define APTPKG_SHA2_H -#include <string> #include <cstring> -#include <algorithm> -#include <stdint.h> #include "sha2_internal.h" #include "hashsum_template.h" +#ifndef APT_10_CLEANER_HEADERS +#include <string> +#include <algorithm> +#include <stdint.h> +#endif + + typedef HashSumValue<512> SHA512SumValue; typedef HashSumValue<256> SHA256SumValue; diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc index bb2560252..131ff5beb 100644 --- a/apt-pkg/contrib/sha2_internal.cc +++ b/apt-pkg/contrib/sha2_internal.cc @@ -33,6 +33,7 @@ */ #include <config.h> +#include <endian.h> #include <string.h> /* memcpy()/memset() or bcopy()/bzero() */ #include <assert.h> /* assert() */ #include "sha2_internal.h" diff --git a/apt-pkg/contrib/sha2_internal.h b/apt-pkg/contrib/sha2_internal.h index d9d429c92..1b82d965d 100644 --- a/apt-pkg/contrib/sha2_internal.h +++ b/apt-pkg/contrib/sha2_internal.h @@ -44,6 +44,7 @@ #ifdef SHA2_USE_INTTYPES_H +#include <stddef.h> #include <inttypes.h> #endif /* SHA2_USE_INTTYPES_H */ diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index d4f53ea3a..2100ee47b 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -21,6 +21,11 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> +#include <stddef.h> +#include <stdlib.h> +#include <time.h> +#include <string> +#include <vector> #include <ctype.h> #include <string.h> #include <sstream> @@ -33,9 +38,9 @@ #include <iconv.h> #include <apti18n.h> - -using namespace std; /*}}}*/ +using namespace std; + // Strip - Remove white space from the front and back of a string /*{{{*/ // --------------------------------------------------------------------- namespace APT { @@ -153,7 +158,7 @@ char *_strrstrip(char *String) End++; *End = 0; return String; -}; +} /*}}}*/ // strtabexpand - Converts tabs into 8 spaces /*{{{*/ // --------------------------------------------------------------------- @@ -1130,9 +1135,11 @@ bool TokSplitString(char Tok,char *Input,char **List, also, but the advantage is that we have an iteratable vector */ vector<string> VectorizeString(string const &haystack, char const &split) { + vector<string> exploded; + if (haystack.empty() == true) + return exploded; string::const_iterator start = haystack.begin(); string::const_iterator end = start; - vector<string> exploded; do { for (; end != haystack.end() && *end != split; ++end); exploded.push_back(string(start, end)); @@ -1182,7 +1189,7 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, R->Hit = false; unsigned long Hits = 0; - for (; ListBegin != ListEnd; ListBegin++) + for (; ListBegin < ListEnd; ++ListBegin) { // Check if the name is a regex const char *I; diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 8d746f10e..185cdc3fc 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -18,15 +18,18 @@ #include <limits> -#include <stdlib.h> #include <string> #include <cstring> #include <vector> #include <iostream> #include <time.h> +#include <stddef.h> #include "macros.h" +#ifndef APT_10_CLEANER_HEADERS +#include <stdlib.h> +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::vector; @@ -37,8 +40,8 @@ namespace APT { namespace String { std::string Strip(const std::string &s); bool Endswith(const std::string &s, const std::string &ending); - }; -}; + } +} bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); @@ -60,9 +63,9 @@ std::string Base64Encode(const std::string &Str); std::string OutputInDepth(const unsigned long Depth, const char* Separator=" "); std::string URItoFileName(const std::string &URI); std::string TimeRFC1123(time_t Date); -bool RFC1123StrToTime(const char* const str,time_t &time) __must_check; -bool FTPMDTMStrToTime(const char* const str,time_t &time) __must_check; -__deprecated bool StrToTime(const std::string &Val,time_t &Result); +bool RFC1123StrToTime(const char* const str,time_t &time) APT_MUSTCHECK; +bool FTPMDTMStrToTime(const char* const str,time_t &time) APT_MUSTCHECK; +APT_DEPRECATED bool StrToTime(const std::string &Val,time_t &Result); std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0); int StringToBool(const std::string &Text,int Default = -1); bool ReadMessages(int Fd, std::vector<std::string> &List); @@ -76,7 +79,7 @@ bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); // split a given string by a char -std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) __attrib_const; +std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) APT_CONST; /* \brief Return a vector of strings from string "input" where "sep" * is used as the delimiter string. @@ -94,56 +97,56 @@ std::vector<std::string> VectorizeString(std::string const &haystack, char const */ std::vector<std::string> StringSplit(std::string const &input, std::string const &sep, - unsigned int maxsplit=std::numeric_limits<unsigned int>::max()) __attrib_const; + unsigned int maxsplit=std::numeric_limits<unsigned int>::max()) APT_CONST; -void ioprintf(std::ostream &out,const char *format,...) __like_printf(2); -void strprintf(std::string &out,const char *format,...) __like_printf(2); -char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3); +void ioprintf(std::ostream &out,const char *format,...) APT_PRINTF(2); +void strprintf(std::string &out,const char *format,...) APT_PRINTF(2); +char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_PRINTF(3); bool CheckDomainList(const std::string &Host, const std::string &List); -int tolower_ascii(int const c) __attrib_const __hot; +int tolower_ascii(int const c) APT_CONST APT_HOT; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ -inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);}; +inline APT_PURE int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} #define APT_MKSTRCMP2(name,func) \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);}; +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} -int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); -int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); /* We assume that GCC 3 indicates that libstdc++3 is in use too. In that case the definition of string::const_iterator is not the same as const char * and we need these extra functions */ #if __GNUC__ >= 3 -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));}; -inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));}; +inline APT_PURE int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} +inline APT_PURE int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} #endif -APT_MKSTRCMP2(stringcmp,stringcmp); -APT_MKSTRCMP2(stringcasecmp,stringcasecmp); +APT_MKSTRCMP2(stringcmp,stringcmp) +APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array -size_t strv_length(const char **str_array); +size_t APT_PURE strv_length(const char **str_array); -inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);}; +inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} class URI { @@ -159,13 +162,13 @@ class URI unsigned int Port; operator std::string(); - inline void operator =(const std::string &From) {CopyFrom(From);}; + inline void operator =(const std::string &From) {CopyFrom(From);} inline bool empty() {return Access.empty();}; static std::string SiteOnly(const std::string &URI); static std::string NoUserPassword(const std::string &URI); - URI(std::string Path) {CopyFrom(Path);}; - URI() : Port(0) {}; + URI(std::string Path) {CopyFrom(Path);} + URI() : Port(0) {} }; struct SubstVar diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 909dfcf47..eee758b7a 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -15,7 +15,6 @@ #include <apt-pkg/debsrcrecords.h> #include <apt-pkg/deblistparser.h> #include <apt-pkg/debrecords.h> -#include <apt-pkg/sourcelist.h> #include <apt-pkg/configuration.h> #include <apt-pkg/progress.h> #include <apt-pkg/error.h> @@ -23,7 +22,18 @@ #include <apt-pkg/acquire-item.h> #include <apt-pkg/debmetaindex.h> #include <apt-pkg/gpgv.h> - +#include <apt-pkg/fileutl.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcachegen.h> +#include <apt-pkg/pkgrecords.h> +#include <apt-pkg/srcrecords.h> + +#include <stdio.h> +#include <iostream> +#include <string> #include <sys/stat.h> /*}}}*/ @@ -650,7 +660,7 @@ pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const // StatusIndex::Exists - Check if the index is available /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debStatusIndex::Exists() const +APT_CONST bool debStatusIndex::Exists() const { // Abort if the file does not exist. return true; diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 9e64d4476..017c69a0a 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -16,9 +16,17 @@ #ifndef PKGLIB_DEBINDEXFILE_H #define PKGLIB_DEBINDEXFILE_H +#include <apt-pkg/indexfile.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/srcrecords.h> +#include <string> + +class OpProgress; +class pkgAcquire; +class pkgCacheGenerator; -#include <apt-pkg/indexfile.h> class debStatusIndex : public pkgIndexFile { @@ -30,10 +38,10 @@ class debStatusIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire - virtual std::string Describe(bool Short) const {return File;}; + virtual std::string Describe(bool /*Short*/) const {return File;}; // Interface for the Cache Generator virtual bool Exists() const; @@ -63,7 +71,7 @@ class debPackagesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; @@ -102,7 +110,7 @@ class debTranslationsIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire virtual std::string Describe(bool Short) const; @@ -134,7 +142,7 @@ class debSourcesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index acdcc4554..a1bcfb710 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -21,8 +21,17 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/crc-16.h> #include <apt-pkg/md5.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/tagfile.h> #include <apt-pkg/macros.h> +#include <stddef.h> +#include <string.h> +#include <algorithm> +#include <string> +#include <vector> #include <ctype.h> /*}}}*/ @@ -34,7 +43,7 @@ static debListParser::WordList PrioList[] = { {"standard",pkgCache::State::Standard}, {"optional",pkgCache::State::Optional}, {"extra",pkgCache::State::Extra}, - {}}; + {NULL, 0}}; // ListParser::debListParser - Constructor /*{{{*/ // --------------------------------------------------------------------- @@ -95,44 +104,49 @@ string debListParser::Version() return Section.FindS("Version"); } /*}}}*/ -// ListParser::NewVersion - Fill in the version structure /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debListParser::NewVersion(pkgCache::VerIterator &Ver) +unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/ { - // Parse the section - Ver->Section = UniqFindTagWrite("Section"); - - // Parse multi-arch + unsigned char MA; string const MultiArch = Section.FindS("Multi-Arch"); if (MultiArch.empty() == true) - Ver->MultiArch = pkgCache::Version::None; + MA = pkgCache::Version::None; else if (MultiArch == "same") { - // Parse multi-arch if (ArchitectureAll() == true) { - /* Arch all packages can't be Multi-Arch: same */ - _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", - Section.FindS("Package").c_str()); - Ver->MultiArch = pkgCache::Version::None; + if (showErrors == true) + _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", + Section.FindS("Package").c_str()); + MA = pkgCache::Version::None; } else - Ver->MultiArch = pkgCache::Version::Same; + MA = pkgCache::Version::Same; } else if (MultiArch == "foreign") - Ver->MultiArch = pkgCache::Version::Foreign; + MA = pkgCache::Version::Foreign; else if (MultiArch == "allowed") - Ver->MultiArch = pkgCache::Version::Allowed; + MA = pkgCache::Version::Allowed; else { - _error->Warning("Unknown Multi-Arch type '%s' for package '%s'", - MultiArch.c_str(), Section.FindS("Package").c_str()); - Ver->MultiArch = pkgCache::Version::None; + if (showErrors == true) + _error->Warning("Unknown Multi-Arch type '%s' for package '%s'", + MultiArch.c_str(), Section.FindS("Package").c_str()); + MA = pkgCache::Version::None; } if (ArchitectureAll() == true) - Ver->MultiArch |= pkgCache::Version::All; + MA |= pkgCache::Version::All; + return MA; +} + /*}}}*/ +// ListParser::NewVersion - Fill in the version structure /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool debListParser::NewVersion(pkgCache::VerIterator &Ver) +{ + // Parse the section + Ver->Section = UniqFindTagWrite("Section"); + Ver->MultiArch = ParseMultiArch(true); // Archive Size Ver->Size = Section.FindULL("Size"); // Unpacked Size (in K) @@ -354,7 +368,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg, {"hold",pkgCache::State::Hold}, {"deinstall",pkgCache::State::DeInstall}, {"purge",pkgCache::State::Purge}, - {}}; + {NULL, 0}}; if (GrabWord(string(Start,I-Start),WantList,Pkg->SelectedState) == false) return _error->Error("Malformed 1st word in the Status line"); @@ -370,7 +384,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg, {"reinstreq",pkgCache::State::ReInstReq}, {"hold",pkgCache::State::HoldInst}, {"hold-reinstreq",pkgCache::State::HoldReInstReq}, - {}}; + {NULL, 0}}; if (GrabWord(string(Start,I-Start),FlagList,Pkg->InstState) == false) return _error->Error("Malformed 2nd word in the Status line"); @@ -392,7 +406,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg, {"triggers-pending",pkgCache::State::TriggersPending}, {"post-inst-failed",pkgCache::State::HalfConfigured}, {"removal-failed",pkgCache::State::HalfInstalled}, - {}}; + {NULL, 0}}; if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false) return _error->Error("Malformed 3rd word in the Status line"); @@ -475,17 +489,30 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) /* This parses the dependency elements out of a standard string in place, bit by bit. */ const char *debListParser::ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op) + { return ParseDepends(Start, Stop, Package, Ver, Op, false, true, false); } +const char *debListParser::ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags) + { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, true, false); } +const char *debListParser::ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags, bool const &StripMultiArch) + { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, StripMultiArch, false); } +const char *debListParser::ParseDepends(const char *Start,const char *Stop, string &Package,string &Ver, unsigned int &Op, bool const &ParseArchFlags, - bool const &StripMultiArch) + bool const &StripMultiArch, + bool const &ParseRestrictionsList) { // Strip off leading space - for (;Start != Stop && isspace(*Start) != 0; Start++); + for (;Start != Stop && isspace(*Start) != 0; ++Start); // Parse off the package name const char *I = Start; for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' && - *I != ',' && *I != '|' && *I != '[' && *I != ']'; I++); + *I != ',' && *I != '|' && *I != '[' && *I != ']' && + *I != '<' && *I != '>'; ++I); // Malformed, no '(' if (I != Stop && *I == ')') @@ -602,6 +629,76 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, for (;I != Stop && isspace(*I) != 0; I++); } + if (ParseRestrictionsList == true) + { + // Parse a restrictions list + if (I != Stop && *I == '<') + { + ++I; + // malformed + if (unlikely(I == Stop)) + return 0; + + std::vector<string> const profiles = APT::Configuration::getBuildProfiles(); + + const char *End = I; + bool Found = false; + bool NegRestriction = false; + while (I != Stop) + { + // look for whitespace or ending '>' + for (;End != Stop && !isspace(*End) && *End != '>'; ++End); + + if (unlikely(End == Stop)) + return 0; + + if (*I == '!') + { + NegRestriction = true; + ++I; + } + + std::string restriction(I, End); + + std::string prefix = "profile."; + // only support for "profile" prefix, ignore others + if (restriction.size() > prefix.size() && + restriction.substr(0, prefix.size()) == prefix) + { + // get the name of the profile + restriction = restriction.substr(prefix.size()); + + if (restriction.empty() == false && profiles.empty() == false && + std::find(profiles.begin(), profiles.end(), restriction) != profiles.end()) + { + Found = true; + if (I[-1] != '!') + NegRestriction = false; + // we found a match, so fast-forward to the end of the wildcards + for (; End != Stop && *End != '>'; ++End); + } + } + + if (*End++ == '>') { + I = End; + break; + } + + I = End; + for (;I != Stop && isspace(*I) != 0; I++); + } + + if (NegRestriction == true) + Found = !Found; + + if (Found == false) + Package = ""; /* not for this restriction */ + } + + // Skip whitespace + for (;I != Stop && isspace(*I) != 0; I++); + } + if (I != Stop && *I == '|') Op |= pkgCache::Dep::Or; @@ -635,7 +732,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, string Version; unsigned int Op; - Start = ParseDepends(Start, Stop, Package, Version, Op, false, false); + Start = ParseDepends(Start, Stop, Package, Version, Op, false, false, false); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); size_t const found = Package.rfind(':'); @@ -841,3 +938,24 @@ unsigned char debListParser::GetPrio(string Str) return Out; } /*}}}*/ +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +bool debListParser::SameVersion(unsigned short const Hash, /*{{{*/ + pkgCache::VerIterator const &Ver) +{ + if (pkgCacheGenerator::ListParser::SameVersion(Hash, Ver) == false) + return false; + // status file has no (Download)Size, but all others are fair game + // status file is parsed last, so the first version we encounter is + // probably also the version we have downloaded + unsigned long long const Size = Section.FindULL("Size"); + if (Size != 0 && Size != Ver->Size) + return false; + // available everywhere, but easier to check here than to include in VersionHash + unsigned char MultiArch = ParseMultiArch(false); + if (MultiArch != Ver->MultiArch) + return false; + // for all practical proposes (we can check): same version + return true; +} + /*}}}*/ +#endif diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 386d291a2..286244cc9 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -13,11 +13,18 @@ #include <apt-pkg/pkgcachegen.h> #include <apt-pkg/tagfile.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/pkgcache.h> + +#include <string> +#include <vector> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/indexfile.h> #endif +class FileFd; + class debListParser : public pkgCacheGenerator::ListParser { public: @@ -63,6 +70,9 @@ class debListParser : public pkgCacheGenerator::ListParser virtual std::string DescriptionLanguage(); virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); +#endif virtual bool UsePackage(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver); virtual unsigned long Offset() {return iOffset;}; @@ -72,15 +82,27 @@ class debListParser : public pkgCacheGenerator::ListParser bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, std::string section); - + + static const char *ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op); static const char *ParseDepends(const char *Start,const char *Stop, - std::string &Package,std::string &Ver,unsigned int &Op, - bool const &ParseArchFlags = false, - bool const &StripMultiArch = true); + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags); + static const char *ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags, bool const &StripMultiArch); + static const char *ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags, bool const &StripMultiArch, + bool const &ParseRestrictionsList); + static const char *ConvertRelation(const char *I,unsigned int &Op); debListParser(FileFd *File, std::string const &Arch = ""); virtual ~debListParser() {}; + + private: + unsigned char ParseMultiArch(bool const showErrors); }; #endif diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 504877558..6fd12add8 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -9,8 +9,15 @@ #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/indexrecords.h> #include <apt-pkg/sourcelist.h> -#include <apt-pkg/error.h> - +#include <apt-pkg/hashes.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/metaindex.h> + +#include <string.h> +#include <map> +#include <string> +#include <utility> +#include <vector> #include <set> #include <algorithm> diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index cef8d68f7..2286fa8b2 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -3,7 +3,7 @@ #define PKGLIB_DEBMETAINDEX_H #include <apt-pkg/metaindex.h> -#include <apt-pkg/init.h> +#include <apt-pkg/macros.h> #include <map> #include <string> @@ -12,6 +12,12 @@ #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/sourcelist.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/init.h> +#endif + +class pkgAcquire; +class pkgIndexFile; class debReleaseIndex : public metaIndex { public: diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 184c07c33..6063db5a8 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -12,10 +12,16 @@ #include <apt-pkg/debrecords.h> #include <apt-pkg/strutl.h> -#include <apt-pkg/error.h> #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/tagfile.h> +#include <string.h> +#include <algorithm> +#include <string> +#include <vector> #include <langinfo.h> /*}}}*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index b5e3bbdba..bdac6c90b 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -17,6 +17,9 @@ #include <apt-pkg/pkgrecords.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/pkgcache.h> + +#include <string> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/indexfile.h> diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index ce55ccd1f..b09588dd3 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -15,12 +15,19 @@ #include <apt-pkg/debsrcrecords.h> #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> -#include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/srcrecords.h> +#include <apt-pkg/tagfile.h> -using std::max; +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include <string> +#include <vector> /*}}}*/ +using std::max; using std::string; // SrcRecordParser::Binaries - Return the binaries field /*{{{*/ @@ -57,7 +64,7 @@ const char **debSrcRecordParser::Binaries() } while (*bin != '\0'); StaticBinList.push_back(NULL); - return (const char **) &StaticBinList[0]; + return &StaticBinList[0]; } /*}}}*/ // SrcRecordParser::BuildDepends - Return the Build-Depends information /*{{{*/ @@ -90,7 +97,7 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe while (1) { Start = debListParser::ParseDepends(Start, Stop, - rec.Package,rec.Version,rec.Op,true, StripMultiArch); + rec.Package,rec.Version,rec.Op,true,StripMultiArch,true); if (Start == 0) return _error->Error("Problem parsing dependency: %s", fields[I]); diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index a8fb465bb..b65d1480b 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -11,11 +11,16 @@ #ifndef PKGLIB_DEBSRCRECORDS_H #define PKGLIB_DEBSRCRECORDS_H - #include <apt-pkg/srcrecords.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/fileutl.h> +#include <stddef.h> +#include <string> +#include <vector> + +class pkgIndexFile; + class debSrcRecordParser : public pkgSrcRecords::Parser { /** \brief dpointer placeholder (for later in case we need it) */ diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index b95ff15df..142f3a6e6 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -19,7 +19,14 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> -#include <sys/types.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <string> +#include <vector> #include <unistd.h> #include <dirent.h> #include <errno.h> @@ -195,7 +202,7 @@ bool debSystem::Initialize(Configuration &Cnf) // --------------------------------------------------------------------- /* The standard name for a deb is 'deb'.. There are no separate versions of .deb to worry about.. */ -bool debSystem::ArchiveSupported(const char *Type) +APT_PURE bool debSystem::ArchiveSupported(const char *Type) { if (strcmp(Type,"deb") == 0) return true; diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h index 855123516..a945f68fb 100644 --- a/apt-pkg/deb/debsystem.h +++ b/apt-pkg/deb/debsystem.h @@ -12,11 +12,19 @@ #include <apt-pkg/pkgsystem.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <vector> +class Configuration; +class pkgIndexFile; +class pkgPackageManager; class debSystemPrivate; -class debStatusIndex; class pkgDepCache; +#ifndef APT_10_CLEANER_HEADERS +class debStatusIndex; +#endif + class debSystem : public pkgSystem { // private d-pointer diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index 74e2552ff..a5eacb7f5 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -15,6 +15,8 @@ #include <apt-pkg/debversion.h> #include <apt-pkg/pkgcache.h> +#include <string.h> +#include <string> #include <stdlib.h> #include <ctype.h> /*}}}*/ diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h index f1d6f3cc5..434ff4a2e 100644 --- a/apt-pkg/deb/debversion.h +++ b/apt-pkg/deb/debversion.h @@ -12,26 +12,26 @@ #ifndef PKGLIB_DEBVERSION_H #define PKGLIB_DEBVERSION_H +#include <apt-pkg/version.h> +#include <string> -#include <apt-pkg/version.h> - class debVersioningSystem : public pkgVersioningSystem -{ +{ public: - + static int CmpFragment(const char *A, const char *AEnd, const char *B, - const char *BEnd); - + const char *BEnd) APT_PURE; + // Compare versions.. virtual int DoCmpVersion(const char *A,const char *Aend, - const char *B,const char *Bend); - virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer); - virtual int DoCmpReleaseVer(const char *A,const char *Aend, + const char *B,const char *Bend) APT_PURE; + virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) APT_PURE; + virtual APT_PURE int DoCmpReleaseVer(const char *A,const char *Aend, const char *B,const char *Bend) { return DoCmpVersion(A,Aend,B,Bend); - } + } virtual std::string UpstreamVersion(const char *A); debVersioningSystem(); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 91893c4e1..9fee7c923 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -10,41 +10,45 @@ // Includes /*{{{*/ #include <config.h> -#include <apt-pkg/dpkgpm.h> -#include <apt-pkg/error.h> +#include <apt-pkg/cachefile.h> #include <apt-pkg/configuration.h> #include <apt-pkg/depcache.h> -#include <apt-pkg/pkgrecords.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/dpkgpm.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/cachefile.h> -#include <apt-pkg/packagemanager.h> #include <apt-pkg/install-progress.h> +#include <apt-pkg/packagemanager.h> +#include <apt-pkg/pkgrecords.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> -#include <unistd.h> -#include <stdlib.h> +#include <errno.h> #include <fcntl.h> +#include <grp.h> +#include <pty.h> +#include <pwd.h> +#include <signal.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/ioctl.h> #include <sys/select.h> #include <sys/stat.h> -#include <sys/types.h> +#include <sys/time.h> #include <sys/wait.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <string.h> -#include <algorithm> -#include <sstream> -#include <map> -#include <pwd.h> -#include <grp.h> -#include <iomanip> - #include <termios.h> +#include <time.h> #include <unistd.h> -#include <sys/ioctl.h> -#include <pty.h> -#include <stdio.h> +#include <algorithm> +#include <cstring> +#include <iostream> +#include <map> +#include <set> +#include <string> +#include <utility> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -1581,7 +1585,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress) return true; } -void SigINT(int sig) { +void SigINT(int /*sig*/) { pkgPackageManager::SigINTStop = true; } /*}}}*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 02e12a6d9..859c74b46 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -11,11 +11,20 @@ #define PKGLIB_DPKGPM_H #include <apt-pkg/packagemanager.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/macros.h> + #include <vector> #include <map> #include <stdio.h> -#include <apt-pkg/macros.h> +#include <string> + +#ifndef APT_10_CLEANER_HEADERS #include <apt-pkg/init.h> +#endif + +class pkgDepCache; +namespace APT { namespace Progress { class PackageManager; } } #ifndef APT_8_CLEANER_HEADERS using std::vector; @@ -82,7 +91,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); - __deprecated bool SendV2Pkgs(FILE *F); + APT_DEPRECATED bool SendV2Pkgs(FILE *F); bool SendPkgsInfo(FILE * const F, unsigned int const &Version); void WriteHistoryTag(std::string const &tag, std::string value); std::string ExpandShortPackageName(pkgDepCache &Cache, @@ -109,10 +118,10 @@ class pkgDPkgPM : public pkgPackageManager void DoDpkgStatusFd(int statusfd); void ProcessDpkgStatusLine(char *line); #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) - void DoDpkgStatusFd(int statusfd, int unused) { + void DoDpkgStatusFd(int statusfd, int /*unused*/) { DoDpkgStatusFd(statusfd); } - void ProcessDpkgStatusLine(int unused, char *line) { + void ProcessDpkgStatusLine(int /*unused*/, char *line) { ProcessDpkgStatusLine(line); } #endif diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a12e6963d..e2c412757 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -11,20 +11,26 @@ #include<config.h> #include <apt-pkg/depcache.h> -#include <apt-pkg/version.h> #include <apt-pkg/versionmatch.h> #include <apt-pkg/error.h> #include <apt-pkg/sptr.h> -#include <apt-pkg/algorithms.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/strutl.h> #include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> -#include <apt-pkg/pkgsystem.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/progress.h> #include <apt-pkg/cacheset.h> - +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/macros.h> + +#include <stdio.h> +#include <string.h> +#include <list> +#include <string> +#include <utility> +#include <vector> #include <algorithm> #include <iostream> #include <sstream> @@ -222,7 +228,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ return true; } /*}}}*/ -bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/ +bool pkgDepCache::writeStateFile(OpProgress * /*prog*/, bool InstalledOnly) /*{{{*/ { bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false); @@ -868,7 +874,7 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, return IsDeleteOkProtectInstallRequests(Pkg, rPurge, Depth, FromUser); } bool pkgDepCache::IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg, - bool const rPurge, unsigned long const Depth, bool const FromUser) + bool const /*rPurge*/, unsigned long const Depth, bool const FromUser) { if (FromUser == false && Pkg->CurrentVer == 0) { @@ -889,7 +895,7 @@ bool pkgDepCache::IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg, and prevents mode changes for packages on hold for example. If you want to check Mode specific stuff you can use the virtual public Is<Mode>Ok methods instead */ -char const* PrintMode(char const mode) +static char const* PrintMode(char const mode) { switch (mode) { @@ -1297,7 +1303,7 @@ bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst, return IsInstallOkMultiArchSameVersionSynced(Pkg,AutoInst, Depth, FromUser); } bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, - bool const AutoInst, unsigned long const Depth, bool const FromUser) + bool const /*AutoInst*/, unsigned long const Depth, bool const FromUser) { if (FromUser == true) // as always: user is always right return true; @@ -1685,10 +1691,10 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) } /*}}}*/ // Policy::GetPriority - Get the priority of the package pin /*{{{*/ -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg) -{ return 0; }; -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File) -{ return 0; }; +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/) +{ return 0; } +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/) +{ return 0; } /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ { diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index f6848f383..bde648c65 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -40,18 +40,27 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/macros.h> + +#include <stddef.h> -#include <vector> #include <memory> -#include <set> #include <list> +#include <string> +#include <utility> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/progress.h> #include <apt-pkg/error.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <set> +#include <vector> +#endif class OpProgress; +class pkgVersioningSystem; class pkgDepCache : protected pkgCache::Namespace { @@ -61,7 +70,7 @@ class pkgDepCache : protected pkgCache::Namespace class InRootSetFunc { public: - virtual bool InRootSet(const pkgCache::PkgIterator &pkg) {return false;}; + virtual bool InRootSet(const pkgCache::PkgIterator &/*pkg*/) {return false;}; virtual ~InRootSetFunc() {}; }; @@ -231,7 +240,7 @@ class pkgDepCache : protected pkgCache::Namespace unsigned char DepState; // DepState Flags // Update of candidate version - const char *StripEpoch(const char *Ver); + const char *StripEpoch(const char *Ver) APT_PURE; void Update(PkgIterator Pkg,pkgCache &Cache); // Various test members for the current status of the package @@ -381,8 +390,8 @@ class pkgDepCache : protected pkgCache::Namespace /** \brief Update the Marked and Garbage fields of all packages. * * This routine is implicitly invoked after all state manipulators - * and when an ActionGroup is destroyed. It invokes #MarkRequired - * and #Sweep to do its dirty work. + * and when an ActionGroup is destroyed. It invokes the private + * MarkRequired() and Sweep() to do its dirty work. * * \param rootFunc A predicate that returns \b true for packages * that should be added to the root set. @@ -465,7 +474,7 @@ class pkgDepCache : protected pkgCache::Namespace * * The parameters are the same as in the calling MarkDelete: * \param Pkg the package that MarkDelete wants to remove. - * \param Purge should we purge instead of "only" remove? + * \param MarkPurge should we purge instead of "only" remove? * \param Depth recursive deep of this Marker call * \param FromUser was the remove requested by the user? */ diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index e90598392..ee42267bc 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -11,16 +11,25 @@ #include <apt-pkg/error.h> #include <apt-pkg/cacheset.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/version.h> -#include <apt-pkg/policy.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/progress.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/strutl.h> -#include <limits> +#include <ctype.h> +#include <stddef.h> +#include <string.h> +#include <time.h> +#include <unistd.h> #include <stdio.h> - +#include <iostream> +#include <vector> +#include <limits> #include <string> +#include <list> #include <apti18n.h> /*}}}*/ @@ -44,7 +53,7 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress) for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver, ++p) { WriteScenarioVersion(Cache, output, Pkg, Ver); - WriteScenarioDependency(Cache, output, Pkg, Ver); + WriteScenarioDependency(output, Ver); fprintf(output, "\n"); if (Progress != NULL && p % 100 == 0) Progress->Progress(p); @@ -64,7 +73,7 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output, for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver) { WriteScenarioVersion(Cache, output, Pkg, Ver); - WriteScenarioLimitedDependency(Cache, output, Pkg, Ver, pkgset); + WriteScenarioLimitedDependency(output, Ver, pkgset); fprintf(output, "\n"); if (Progress != NULL && p % 100 == 0) Progress->Progress(p); @@ -111,8 +120,7 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI } /*}}}*/ // EDSP::WriteScenarioDependency /*{{{*/ -void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg, - pkgCache::VerIterator const &Ver) +void EDSP::WriteScenarioDependency( FILE* output, pkgCache::VerIterator const &Ver) { std::string dependencies[pkgCache::Dep::Enhances + 1]; bool orGroup = false; @@ -148,8 +156,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P } /*}}}*/ // EDSP::WriteScenarioLimitedDependency /*{{{*/ -void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output, - pkgCache::PkgIterator const &Pkg, +void EDSP::WriteScenarioLimitedDependency(FILE* output, pkgCache::VerIterator const &Ver, APT::PackageSet const &pkgset) { diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index fd4436f60..ae20ed7db 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -9,8 +9,11 @@ #ifndef PKGLIB_EDSP_H #define PKGLIB_EDSP_H -#include <apt-pkg/pkgcache.h> #include <apt-pkg/cacheset.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <stdio.h> #include <list> #include <string> @@ -35,11 +38,9 @@ class EDSP /*{{{*/ void static WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver); - void static WriteScenarioDependency(pkgDepCache &Cache, FILE* output, - pkgCache::PkgIterator const &Pkg, + void static WriteScenarioDependency(FILE* output, pkgCache::VerIterator const &Ver); - void static WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output, - pkgCache::PkgIterator const &Pkg, + void static WriteScenarioLimitedDependency(FILE* output, pkgCache::VerIterator const &Ver, APT::PackageSet const &pkgset); public: diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 98ce4497a..10313fd61 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -10,15 +10,20 @@ #include <apt-pkg/edspindexfile.h> #include <apt-pkg/edsplistparser.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/configuration.h> -#include <apt-pkg/progress.h> #include <apt-pkg/error.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/acquire-item.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/debindexfile.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcachegen.h> +#include <apt-pkg/pkgrecords.h> -#include <sys/stat.h> +#include <stddef.h> +#include <unistd.h> +#include <string> /*}}}*/ // edspIndex::edspIndex - Constructor /*{{{*/ @@ -63,7 +68,7 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const class edspIFType: public pkgIndexFile::Type { public: - virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const + virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const { // we don't have a record parser for this type as the file is not presistent return NULL; diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index de10f2d2f..609a2cde4 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -9,11 +9,15 @@ #define PKGLIB_EDSPINDEXFILE_H #include <apt-pkg/debindexfile.h> +#include <string> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/indexfile.h> #endif +class OpProgress; +class pkgCacheGenerator; + class edspIndex : public debStatusIndex { /** \brief dpointer placeholder (for later in case we need it) */ @@ -21,7 +25,7 @@ class edspIndex : public debStatusIndex public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index bcfdb1017..212dc7840 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -12,11 +12,13 @@ #include <config.h> #include <apt-pkg/edsplistparser.h> -#include <apt-pkg/error.h> -#include <apt-pkg/configuration.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/md5.h> -#include <apt-pkg/macros.h> +#include <apt-pkg/deblistparser.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/tagfile.h> + +#include <string> /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ @@ -84,8 +86,8 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, } /*}}}*/ // ListParser::LoadReleaseInfo - Load the release information /*{{{*/ -bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, - FileFd &File, std::string component) +APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, + FileFd & /*File*/, std::string /*component*/) { return true; } diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index a7bf9de95..959fb587f 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -12,6 +12,10 @@ #define PKGLIB_EDSPLISTPARSER_H #include <apt-pkg/deblistparser.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/pkgcache.h> + +#include <string> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/pkgcachegen.h> diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index aae969d9d..92edb8d77 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -11,16 +11,17 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/edspsystem.h> +#include <apt-pkg/configuration.h> #include <apt-pkg/debversion.h> #include <apt-pkg/edspindexfile.h> -#include <apt-pkg/configuration.h> -#include <apt-pkg/error.h> +#include <apt-pkg/edspsystem.h> #include <apt-pkg/fileutl.h> -#include <sys/types.h> -#include <unistd.h> -#include <dirent.h> -#include <errno.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <stddef.h> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -49,7 +50,7 @@ bool edspSystem::Lock() } /*}}}*/ // System::UnLock - Drop a lock /*{{{*/ -bool edspSystem::UnLock(bool NoErrors) +bool edspSystem::UnLock(bool /*NoErrors*/) { return true; } @@ -58,7 +59,7 @@ bool edspSystem::UnLock(bool NoErrors) // --------------------------------------------------------------------- /* we can't use edsp input as input for real installations - just a simulation can work, but everything else will fail bigtime */ -pkgPackageManager *edspSystem::CreatePM(pkgDepCache *Cache) const +pkgPackageManager *edspSystem::CreatePM(pkgDepCache * /*Cache*/) const { return NULL; } @@ -81,7 +82,7 @@ bool edspSystem::Initialize(Configuration &Cnf) } /*}}}*/ // System::ArchiveSupported - Is a file format supported /*{{{*/ -bool edspSystem::ArchiveSupported(const char *Type) +bool edspSystem::ArchiveSupported(const char * /*Type*/) { return false; } diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index ca703fa84..65e36d714 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -11,8 +11,17 @@ #define PKGLIB_EDSPSYSTEM_H #include <apt-pkg/pkgsystem.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcache.h> +#include <vector> + +class Configuration; +class pkgDepCache; +class pkgIndexFile; +class pkgPackageManager; class edspIndex; + class edspSystem : public pkgSystem { /** \brief dpointer placeholder (for later in case we need it) */ @@ -22,11 +31,11 @@ class edspSystem : public pkgSystem public: - virtual bool Lock(); - virtual bool UnLock(bool NoErrors = false); - virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const; + virtual bool Lock() APT_CONST; + virtual bool UnLock(bool NoErrors = false) APT_CONST; + virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_CONST; virtual bool Initialize(Configuration &Cnf); - virtual bool ArchiveSupported(const char *Type); + virtual bool ArchiveSupported(const char *Type) APT_CONST; virtual signed Score(Configuration const &Cnf); virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List); virtual bool FindIndex(pkgCache::PkgFileIterator File, diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 7694cb1dd..854ba1bd7 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -20,17 +20,17 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/indexrecords.h> -#include <apt-pkg/md5.h> #include <apt-pkg/cdrom.h> +#include <apt-pkg/gpgv.h> +#include <apt-pkg/hashes.h> #include <iostream> #include <sstream> #include <unistd.h> #include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "indexcopy.h" #include <apti18n.h> @@ -65,7 +65,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin(); c != compressor.end(); ++c) { - if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0) + if (stat((file + c->Extension).c_str(), &Buf) != 0) continue; found = true; break; @@ -160,7 +160,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, // Get the size struct stat Buf; - if (stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0 || + if (stat((CDROM + Prefix + File).c_str(),&Buf) != 0 || Buf.st_size == 0) { bool Mangled = false; @@ -175,7 +175,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, } if (Mangled == false || - stat(string(CDROM + Prefix + File).c_str(),&Buf) != 0) + stat((CDROM + Prefix + File).c_str(),&Buf) != 0) { if (Debug == true) clog << "Missed(2): " << OrigFile << endl; @@ -286,7 +286,7 @@ bool IndexCopy::ReconstructPrefix(string &Prefix,string OrigPath,string CD, while (1) { struct stat Buf; - if (stat(string(CD + MyPrefix + File).c_str(),&Buf) != 0) + if (stat((CD + MyPrefix + File).c_str(),&Buf) != 0) { if (Debug == true) cout << "Failed, " << CD + MyPrefix + File << endl; @@ -315,7 +315,7 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File) while (1) { struct stat Buf; - if (stat(string(Dir + File).c_str(),&Buf) != 0) + if (stat((Dir + File).c_str(),&Buf) != 0) { File = ChopDirs(File,1); Depth++; @@ -436,8 +436,8 @@ bool PackageCopy::GetFile(string &File,unsigned long long &Size) /* */ bool PackageCopy::RewriteEntry(FILE *Target,string File) { - TFRewriteData Changes[] = {{"Filename",File.c_str()}, - {}}; + TFRewriteData Changes[] = {{ "Filename", File.c_str(), NULL }, + { NULL, NULL, NULL }}; if (TFRewrite(Target,*Section,TFRewritePackageOrder,Changes) == false) return false; @@ -482,8 +482,8 @@ bool SourceCopy::GetFile(string &File,unsigned long long &Size) bool SourceCopy::RewriteEntry(FILE *Target,string File) { string Dir(File,0,File.rfind('/')); - TFRewriteData Changes[] = {{"Directory",Dir.c_str()}, - {}}; + TFRewriteData Changes[] = {{ "Directory", Dir.c_str(), NULL }, + { NULL, NULL, NULL }}; if (TFRewrite(Target,*Section,TFRewriteSourceOrder,Changes) == false) return false; @@ -551,7 +551,7 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName, /*{{{*/ } /*}}}*/ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList, /*{{{*/ - vector<string> PkgList,vector<string> SrcList) + vector<string> /*PkgList*/,vector<string> /*SrcList*/) { if (SigList.empty() == true) return true; @@ -642,16 +642,14 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList, } /*}}}*/ // SigVerify::RunGPGV - deprecated wrapper calling ExecGPGV /*{{{*/ -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]) { ExecGPGV(File, FileOut, statusfd, fd); - return false; -}; -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +} +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd) { ExecGPGV(File, FileOut, statusfd); - return false; -}; +} /*}}}*/ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ vector<string> &List, pkgCdromStatus *log) @@ -676,7 +674,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin(); c != compressor.end(); ++c) { - if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0) + if (stat((file + c->Extension).c_str(), &Buf) != 0) continue; found = true; break; diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index e6a07a887..43cdb3f0a 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -14,16 +14,18 @@ #include <string> #include <stdio.h> -#include <apt-pkg/gpgv.h> #include <apt-pkg/macros.h> +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/gpgv.h> +class FileFd; +#endif #ifndef APT_8_CLEANER_HEADERS using std::string; using std::vector; #endif class pkgTagSection; -class FileFd; class indexRecords; class pkgCdromStatus; @@ -99,9 +101,9 @@ class SigVerify /*{{{*/ bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList, std::vector<std::string> PkgList,std::vector<std::string> SrcList); - __deprecated static bool RunGPGV(std::string const &File, std::string const &FileOut, + APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]); - __deprecated static bool RunGPGV(std::string const &File, std::string const &FileOut, + APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd = -1); }; /*}}}*/ diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index 642a750d4..89615cb41 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -13,7 +13,13 @@ #include <apt-pkg/indexfile.h> #include <apt-pkg/error.h> #include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/srcrecords.h> +#include <apt-pkg/macros.h> +#include <string> +#include <vector> #include <clocale> #include <cstring> /*}}}*/ @@ -47,7 +53,7 @@ pkgIndexFile::Type *pkgIndexFile::Type::GetType(const char *Type) // IndexFile::ArchiveInfo - Stub /*{{{*/ // --------------------------------------------------------------------- /* */ -std::string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator Ver) const +std::string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator /*Ver*/) const { return std::string(); } @@ -63,8 +69,8 @@ pkgCache::PkgFileIterator pkgIndexFile::FindInCache(pkgCache &Cache) const // IndexFile::SourceIndex - Stub /*{{{*/ // --------------------------------------------------------------------- /* */ -std::string pkgIndexFile::SourceInfo(pkgSrcRecords::Parser const &Record, - pkgSrcRecords::File const &File) const +std::string pkgIndexFile::SourceInfo(pkgSrcRecords::Parser const &/*Record*/, + pkgSrcRecords::File const &/*File*/) const { return std::string(); } @@ -82,7 +88,7 @@ bool pkgIndexFile::TranslationsAvailable() { is already done in getLanguages(). Note also that this check is rather bad (doesn't take three character like ast into account). TODO: Remove method with next API break */ -__attribute__ ((deprecated)) bool pkgIndexFile::CheckLanguageCode(const char *Lang) +APT_DEPRECATED bool pkgIndexFile::CheckLanguageCode(const char *Lang) { if (strlen(Lang) == 2 || (strlen(Lang) == 5 && Lang[2] == '_')) return true; @@ -98,7 +104,7 @@ __attribute__ ((deprecated)) bool pkgIndexFile::CheckLanguageCode(const char *La /* As we have now possibly more than one LanguageCode this method is supersided by a) private classmembers or b) getLanguages(). TODO: Remove method with next API break */ -__attribute__ ((deprecated)) std::string pkgIndexFile::LanguageCode() { +APT_DEPRECATED std::string pkgIndexFile::LanguageCode() { if (TranslationsAvailable() == false) return ""; return APT::Configuration::getLanguages()[0]; diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index a0096fa34..b5c9ac77e 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -22,18 +22,21 @@ #ifndef PKGLIB_INDEXFILE_H #define PKGLIB_INDEXFILE_H - -#include <string> -#include <apt-pkg/pkgcache.h> #include <apt-pkg/srcrecords.h> #include <apt-pkg/pkgrecords.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/macros.h> +#include <string> + #ifndef APT_8_CLEANER_HEADERS using std::string; #endif - +#ifndef APT_10_CLEANER_HEADERS class pkgAcquire; +#endif + class pkgCacheGenerator; class OpProgress; @@ -51,7 +54,7 @@ class pkgIndexFile // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Label; @@ -78,11 +81,11 @@ class pkgIndexFile virtual bool Exists() const = 0; virtual bool HasPackages() const = 0; virtual unsigned long Size() const = 0; - virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* Prog) const { return false; }; - __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const + virtual bool Merge(pkgCacheGenerator &/*Gen*/, OpProgress* /*Prog*/) const { return false; }; + APT_DEPRECATED virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const { return Merge(Gen, &Prog); }; - virtual bool MergeFileProvides(pkgCacheGenerator &Gen,OpProgress* Prog) const {return true;}; - __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const + virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;}; + APT_DEPRECATED virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const {return MergeFileProvides(Gen, &Prog);}; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index f8097c3c6..5353d1098 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -14,41 +14,46 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/gpgv.h> -#include <sys/stat.h> +#include <stdlib.h> +#include <time.h> #include <clocale> +#include <map> +#include <string> +#include <utility> +#include <vector> #include <apti18n.h> /*}}}*/ using std::string; -string indexRecords::GetDist() const +APT_PURE string indexRecords::GetDist() const { return this->Dist; } -string indexRecords::GetSuite() const +APT_PURE string indexRecords::GetSuite() const { return this->Suite; } -bool indexRecords::CheckDist(const string MaybeDist) const +APT_PURE bool indexRecords::CheckDist(const string MaybeDist) const { return (this->Dist == MaybeDist || this->Suite == MaybeDist); } -string indexRecords::GetExpectedDist() const +APT_PURE string indexRecords::GetExpectedDist() const { return this->ExpectedDist; } -time_t indexRecords::GetValidUntil() const +APT_PURE time_t indexRecords::GetValidUntil() const { return this->ValidUntil; } -const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) +APT_PURE const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) { std::map<std::string, indexRecords::checkSum* >::const_iterator sum = Entries.find(MetaKey); if (sum == Entries.end()) @@ -56,7 +61,7 @@ const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) return sum->second; } -bool indexRecords::Exists(string const &MetaKey) const +APT_PURE bool indexRecords::Exists(string const &MetaKey) const { return Entries.count(MetaKey) == 1; } @@ -129,10 +134,10 @@ bool indexRecords::Load(const string Filename) /*{{{*/ // get the user settings for this archive and use what expires earlier int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0); if (Label.empty() == false) - MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); + MaxAge = _config->FindI(("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); int MinAge = _config->FindI("Acquire::Min-ValidTime", 0); if (Label.empty() == false) - MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge); + MinAge = _config->FindI(("Acquire::Min-ValidTime::" + Label).c_str(), MinAge); if(MaxAge == 0 && (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index d003ec0fa..e31f889ad 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -5,17 +5,19 @@ #ifndef PKGLIB_INDEXRECORDS_H #define PKGLIB_INDEXRECORDS_H - -#include <apt-pkg/pkgcache.h> #include <apt-pkg/hashes.h> #include <map> #include <vector> #include <ctime> +#include <string> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/fileutl.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/pkgcache.h> +#endif class indexRecords { diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 6ab5ec42d..3a35f852e 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -15,9 +15,11 @@ #include <apt-pkg/error.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <string.h> +#include <string> #include <cstdlib> -#include <sys/stat.h> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/init.h b/apt-pkg/init.h index b6f3df753..d062392e3 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: init.h,v 1.9.2.2 2004/01/02 18:51:00 mdz Exp $ /* ###################################################################### Init - Initialize the package library @@ -17,19 +16,13 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/pkgsystem.h> #endif +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/macros.h> +#endif class pkgSystem; class Configuration; -// These lines are extracted by the makefiles and the buildsystem -// Increasing MAJOR or MINOR results in the need of recompiling all -// reverse-dependencies of libapt-pkg against the new SONAME. -// Non-ABI-Breaks should only increase RELEASE number. -// See also buildlib/libversion.mak -#define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 12 -#define APT_PKG_RELEASE 0 - extern const char *pkgVersion; extern const char *pkgLibVersion; diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index a3a4cc0e1..dfe4fb18c 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -1,17 +1,23 @@ +#include <config.h> + #include <apt-pkg/configuration.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/strutl.h> #include <apt-pkg/install-progress.h> -#include <apti18n.h> - -#include <termios.h> +#include <signal.h> +#include <unistd.h> +#include <iostream> +#include <string> +#include <vector> #include <sys/ioctl.h> #include <sstream> #include <fcntl.h> #include <algorithm> #include <stdio.h> +#include <apti18n.h> + namespace APT { namespace Progress { @@ -41,10 +47,10 @@ PackageManager* PackageManagerProgressFactory() return progress; } -bool PackageManager::StatusChanged(std::string PackageName, +bool PackageManager::StatusChanged(std::string /*PackageName*/, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) + std::string /*HumanReadableAction*/) { int reporting_steps = _config->FindI("DpkgPM::Reporting-Steps", 1); percentage = StepsDone/(float)TotalSteps * 100.0; @@ -87,7 +93,7 @@ void PackageManagerProgressFd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressFd::Stop() +APT_CONST void PackageManagerProgressFd::Stop() { } @@ -170,7 +176,7 @@ void PackageManagerProgressDeb822Fd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressDeb822Fd::Stop() +APT_CONST void PackageManagerProgressDeb822Fd::Stop() { } @@ -329,15 +335,15 @@ bool PackageManagerFancy::StatusChanged(std::string PackageName, int row = GetNumberTerminalRows(); - static string save_cursor = "\033[s"; - static string restore_cursor = "\033[u"; - - static string set_bg_color = "\033[42m"; // green - static string set_fg_color = "\033[30m"; // black - - static string restore_bg = "\033[49m"; - static string restore_fg = "\033[39m"; - + static std::string save_cursor = "\033[s"; + static std::string restore_cursor = "\033[u"; + + static std::string set_bg_color = "\033[42m"; // green + static std::string set_fg_color = "\033[30m"; // black + + static std::string restore_bg = "\033[49m"; + static std::string restore_fg = "\033[39m"; + std::cout << save_cursor // move cursor position to last row << "\033[" << row << ";0f" @@ -371,5 +377,5 @@ bool PackageManagerText::StatusChanged(std::string PackageName, -}; // namespace progress -}; // namespace apt +} // namespace progress +} // namespace apt diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 8a5b68a8f..baf245376 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -24,16 +24,16 @@ namespace Progress { int last_reported_progress; public: - PackageManager() + PackageManager() : percentage(0.0), last_reported_progress(-1) {}; virtual ~PackageManager() {}; /* Global Start/Stop */ - virtual void Start(int child_pty=-1) {}; + virtual void Start(int /*child_pty*/=-1) {}; virtual void Stop() {}; - /* When dpkg is invoked (may happen multiple times for each - * install/remove block + /* When dpkg is invoked (may happen multiple times for each + * install/remove block */ virtual void StartDpkg() {}; @@ -44,18 +44,18 @@ namespace Progress { return 500000; }; - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) ; - virtual void Error(std::string PackageName, - unsigned int StepsDone, - unsigned int TotalSteps, - std::string ErrorMessage) {}; - virtual void ConffilePrompt(std::string PackageName, - unsigned int StepsDone, - unsigned int TotalSteps, - std::string ConfMessage) {}; + std::string HumanReadableAction); + virtual void Error(std::string /*PackageName*/, + unsigned int /*StepsDone*/, + unsigned int /*TotalSteps*/, + std::string /*ErrorMessage*/) {} + virtual void ConffilePrompt(std::string /*PackageName*/, + unsigned int /*StepsDone*/, + unsigned int /*TotalSteps*/, + std::string /*ConfMessage*/) {} }; class PackageManagerProgressFd : public PackageManager @@ -72,11 +72,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -101,11 +101,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -134,7 +134,7 @@ namespace Progress { ~PackageManagerFancy(); virtual void Start(int child_pty=-1); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); @@ -143,14 +143,14 @@ namespace Progress { class PackageManagerText : public PackageManager { public: - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); }; -}; // namespace Progress -}; // namespace APT +} // namespace Progress +} // namespace APT #endif diff --git a/apt-pkg/makefile b/apt-pkg/makefile index a90131f80..1d456873b 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -21,6 +21,9 @@ endif ifeq ($(HAVE_BZ2),yes) SLIBS+= -lbz2 endif +ifeq ($(HAVE_LZMA),yes) +SLIBS+= -llzma +endif APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR) # Source code for the contributed non-core things diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 18a90a29d..ffabaadbf 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -1,12 +1,19 @@ #ifndef PKGLIB_METAINDEX_H #define PKGLIB_METAINDEX_H - -#include <string> -#include <apt-pkg/pkgcache.h> #include <apt-pkg/indexfile.h> #include <apt-pkg/init.h> +#include <stddef.h> + +#include <string> +#include <vector> + +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/pkgcache.h> +class pkgCacheGenerator; +class OpProgress; +#endif #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/srcrecords.h> #include <apt-pkg/pkgrecords.h> @@ -15,8 +22,6 @@ using std::string; #endif class pkgAcquire; -class pkgCacheGenerator; -class OpProgress; class metaIndex { diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 21b5fc4e7..a1fcbcc98 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -68,10 +68,14 @@ #include <apt-pkg/orderlist.h> #include <apt-pkg/depcache.h> #include <apt-pkg/error.h> -#include <apt-pkg/version.h> #include <apt-pkg/sptr.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcache.h> +#include <stdlib.h> +#include <string.h> +#include <string> #include <iostream> /*}}}*/ diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index a2d7b321b..b8bad81b3 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -16,10 +16,12 @@ #ifndef PKGLIB_ORDERLIST_H #define PKGLIB_ORDERLIST_H - #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/macros.h> +#include <string> + class pkgDepCache; class pkgOrderList : protected pkgCache::Namespace { @@ -46,7 +48,7 @@ class pkgOrderList : protected pkgCache::Namespace bool Debug; // Main visit function - __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); }; + APT_DEPRECATED bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); }; bool VisitNode(PkgIterator Pkg, char const* from); bool VisitDeps(DepFunc F,PkgIterator Pkg); bool VisitRDeps(DepFunc F,PkgIterator Pkg); @@ -68,9 +70,9 @@ class pkgOrderList : protected pkgCache::Namespace // For pre sorting static pkgOrderList *Me; - static int OrderCompareA(const void *a, const void *b); - static int OrderCompareB(const void *a, const void *b); - int FileCmp(PkgIterator A,PkgIterator B); + static int OrderCompareA(const void *a, const void *b) APT_PURE; + static int OrderCompareB(const void *a, const void *b) APT_PURE; + int FileCmp(PkgIterator A,PkgIterator B) APT_PURE; public: @@ -100,7 +102,7 @@ class pkgOrderList : protected pkgCache::Namespace inline void RmFlag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] &= ~F;}; // IsNow will return true if the Pkg has been not been either configured or unpacked inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; - bool IsMissing(PkgIterator Pkg); + bool IsMissing(PkgIterator Pkg) APT_PURE; void WipeFlags(unsigned long F); void SetFileList(std::string *FileList) {this->FileList = FileList;}; diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 5f9a31264..5d6bc6bd2 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -13,7 +13,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include<config.h> +#include <config.h> #include <apt-pkg/packagemanager.h> #include <apt-pkg/orderlist.h> @@ -24,7 +24,14 @@ #include <apt-pkg/algorithms.h> #include <apt-pkg/configuration.h> #include <apt-pkg/sptr.h> - +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/strutl.h> + +#include <stddef.h> +#include <list> +#include <string> #include <iostream> #include <apti18n.h> @@ -615,6 +622,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c clog << " (replace version " << Pkg.CurrentVer().VerStr() << " with " << InstallVer.VerStr() << ")"; if (PkgLoop) clog << " (Only Perform PreUnpack Checks)"; + if (Immediate) + clog << " immediately"; clog << endl; } @@ -741,7 +750,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c // See if the current version is conflicting if (ConflictPkg.CurrentVer() == Ver && List->IsNow(ConflictPkg)) { - clog << OutputInDepth(Depth) << Pkg.FullName() << " conflicts with " << ConflictPkg.FullName() << endl; + if (Debug) + clog << OutputInDepth(Depth) << Pkg.FullName() << " conflicts with " << ConflictPkg.FullName() << endl; /* If a loop is not present or has not yet been detected, attempt to unpack packages to resolve this conflict. If there is a loop present, remove packages to resolve this conflict */ if (List->IsFlag(ConflictPkg,pkgOrderList::Loop) == false) @@ -955,21 +965,14 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { PkgIterator Pkg(Cache,*I); - + if (List->IsNow(Pkg) == false) { - if (!List->IsFlag(Pkg,pkgOrderList::Configured) && !NoImmConfigure) { - if (SmartConfigure(Pkg, 0) == false && Debug) - _error->Warning("Internal Error, Could not configure %s",Pkg.FullName().c_str()); - // FIXME: The above warning message might need changing - } else { - if (Debug == true) - clog << "Skipping already done " << Pkg.FullName() << endl; - } + if (Debug == true) + clog << "Skipping already done " << Pkg.FullName() << endl; continue; - } - + if (List->IsMissing(Pkg) == true) { if (Debug == true) diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index 853b9bac8..344ed9192 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -23,15 +23,17 @@ #ifndef PKGLIB_PACKAGEMANAGER_H #define PKGLIB_PACKAGEMANAGER_H -#include <apt-pkg/macros.h> #include <apt-pkg/pkgcache.h> -#include <apt-pkg/install-progress.h> #include <apt-pkg/init.h> +#include <apt-pkg/macros.h> #include <string> -#include <iostream> #include <set> +#ifndef APT_10_CLEANER_HEADERS +#include <apt-pkg/install-progress.h> +#include <iostream> +#endif #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/depcache.h> using std::string; @@ -73,7 +75,7 @@ class pkgPackageManager : protected pkgCache::Namespace bool CreateOrderList(); // Analysis helpers - bool DepAlwaysTrue(DepIterator D); + bool DepAlwaysTrue(DepIterator D) APT_PURE; // Install helpers bool ConfigureAll(); @@ -89,9 +91,9 @@ class pkgPackageManager : protected pkgCache::Namespace virtual bool Configure(PkgIterator /*Pkg*/) {return false;}; virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;}; #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) - virtual bool Go(APT::Progress::PackageManager *progress) {return true;}; + virtual bool Go(APT::Progress::PackageManager * /*progress*/) {return true;}; #else - virtual bool Go(int statusFd=-1) {return true;}; + virtual bool Go(int /*statusFd*/=-1) {return true;}; #endif virtual void Reset() {}; @@ -109,7 +111,7 @@ class pkgPackageManager : protected pkgCache::Namespace #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) OrderResult DoInstall(APT::Progress::PackageManager *progress); // compat - __deprecated OrderResult DoInstall(int statusFd=-1); + APT_DEPRECATED OrderResult DoInstall(int statusFd=-1); #else OrderResult DoInstall(int statusFd=-1); #endif @@ -124,7 +126,7 @@ class pkgPackageManager : protected pkgCache::Namespace // stuff that needs to be done after the fork OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress); // compat - __deprecated OrderResult DoInstallPostFork(int statusFd=-1); + APT_DEPRECATED OrderResult DoInstallPostFork(int statusFd=-1); #else OrderResult DoInstallPostFork(int statusFd=-1); #endif diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 67a2a709d..91b75f52e 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -29,12 +29,15 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/mmap.h> #include <apt-pkg/macros.h> +#include <stddef.h> +#include <string.h> +#include <ostream> +#include <vector> #include <string> #include <sys/stat.h> -#include <unistd.h> -#include <ctype.h> #include <apti18n.h> /*}}}*/ @@ -52,7 +55,11 @@ pkgCache::Header::Header() /* Whenever the structures change the major version should be bumped, whenever the generator changes the minor version should be bumped. */ MajorVersion = 8; +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + MinorVersion = 2; +#else MinorVersion = 1; +#endif Dirty = false; HeaderSz = sizeof(pkgCache::Header); @@ -414,7 +421,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const // GrpIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical group in the hash table. */ -void pkgCache::GrpIterator::operator ++(int) +void pkgCache::GrpIterator::operator ++(int) { // Follow the current links if (S != Owner->GrpP) @@ -426,12 +433,12 @@ void pkgCache::GrpIterator::operator ++(int) HashIndex++; S = Owner->GrpP + Owner->HeaderP->GrpHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical package in the hash table. */ -void pkgCache::PkgIterator::operator ++(int) +void pkgCache::PkgIterator::operator ++(int) { // Follow the current links if (S != Owner->PkgP) @@ -443,7 +450,7 @@ void pkgCache::PkgIterator::operator ++(int) HashIndex++; S = Owner->PkgP + Owner->HeaderP->PkgHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::State - Check the State of the package /*{{{*/ // --------------------------------------------------------------------- @@ -475,26 +482,26 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const // --------------------------------------------------------------------- /* Return string representing of the candidate version. */ const char * -pkgCache::PkgIterator::CandVersion() const +pkgCache::PkgIterator::CandVersion() const { //TargetVer is empty, so don't use it. VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this); if (version.IsGood()) return version.VerStr(); return 0; -}; +} /*}}}*/ // PkgIterator::CurVersion - Returns the current version string /*{{{*/ // --------------------------------------------------------------------- /* Return string representing of the current version. */ const char * -pkgCache::PkgIterator::CurVersion() const +pkgCache::PkgIterator::CurVersion() const { VerIterator version = CurrentVer(); if (version.IsGood()) return CurrentVer().VerStr(); return 0; -}; +} /*}}}*/ // ostream operator to handle string representation of a package /*{{{*/ // --------------------------------------------------------------------- @@ -695,7 +702,7 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End) // --------------------------------------------------------------------- /* Deps like self-conflicts should be ignored as well as implicit conflicts on virtual packages. */ -bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &Pkg) const +bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &/*Pkg*/) const { if (IsNegative() == false) return false; @@ -978,7 +985,7 @@ string pkgCache::PkgFileIterator::RelStr() /*}}}*/ // VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/ // --------------------------------------------------------------------- -/* return a DescIter for the current locale or the default if none is +/* return a DescIter for the current locale or the default if none is * found */ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const @@ -1012,7 +1019,7 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const if (strcmp(Desc.LanguageCode(), "") == 0) return Desc; return DescriptionList(); -}; +} /*}}}*/ // PrvIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index c31c5f30b..5e8a9630a 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,9 +74,11 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H +#include <apt-pkg/mmap.h> +#include <apt-pkg/macros.h> + #include <string> #include <time.h> -#include <apt-pkg/mmap.h> #ifndef APT_8_CLEANER_HEADERS using std::string; @@ -156,8 +158,8 @@ class pkgCache /*{{{*/ std::string CacheFile; MMap ⤅ - unsigned long sHash(const std::string &S) const; - unsigned long sHash(const char *S) const; + unsigned long sHash(const std::string &S) const APT_PURE; + unsigned long sHash(const char *S) const APT_PURE; public: @@ -176,13 +178,13 @@ class pkgCache /*{{{*/ char *StrP; virtual bool ReMap(bool const &Errorchecks = true); - inline bool Sync() {return Map.Sync();}; - inline MMap &GetMap() {return Map;}; - inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; + inline bool Sync() {return Map.Sync();} + inline MMap &GetMap() {return Map;} + inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();} // String hashing function (512 range) - inline unsigned long Hash(const std::string &S) const {return sHash(S);}; - inline unsigned long Hash(const char *S) const {return sHash(S);}; + inline unsigned long Hash(const std::string &S) const {return sHash(S);} + inline unsigned long Hash(const char *S) const {return sHash(S);} // Useful transformation things const char *Priority(unsigned char Priority); @@ -192,7 +194,7 @@ class pkgCache /*{{{*/ PkgIterator FindPkg(const std::string &Name); PkgIterator FindPkg(const std::string &Name, const std::string &Arch); - Header &Head() {return *HeaderP;}; + Header &Head() {return *HeaderP;} inline GrpIterator GrpBegin(); inline GrpIterator GrpEnd(); inline PkgIterator PkgBegin(); @@ -200,19 +202,19 @@ class pkgCache /*{{{*/ inline PkgFileIterator FileBegin(); inline PkgFileIterator FileEnd(); - inline bool MultiArchCache() const { return MultiArchEnabled; }; - inline char const * const NativeArch() const; + inline bool MultiArchCache() const { return MultiArchEnabled; } + inline char const * NativeArch(); // Make me a function pkgVersioningSystem *VS; // Converters - static const char *CompTypeDeb(unsigned char Comp); - static const char *CompType(unsigned char Comp); + static const char *CompTypeDeb(unsigned char Comp) APT_CONST; + static const char *CompType(unsigned char Comp) APT_CONST; static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); - virtual ~pkgCache() {}; + virtual ~pkgCache() {} private: bool MultiArchEnabled; @@ -318,7 +320,7 @@ struct pkgCache::Header /** \brief Size of the complete cache file */ unsigned long CacheFileSize; - bool CheckSizes(Header &Against) const; + bool CheckSizes(Header &Against) const APT_PURE; Header(); }; /*}}}*/ @@ -451,7 +453,7 @@ struct pkgCache::PackageFile /** \brief Modification time for the file */ time_t mtime; - /* @TODO document PackageFile::Flags */ + /** @TODO document PackageFile::Flags */ unsigned long Flags; // Linked list @@ -474,7 +476,7 @@ struct pkgCache::VerFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the package file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::VerFile::Size */ + /** @TODO document pkgCache::VerFile::Size */ unsigned long Size; }; /*}}}*/ @@ -488,7 +490,7 @@ struct pkgCache::DescFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::DescFile::Size */ + /** @TODO document pkgCache::DescFile::Size */ unsigned long Size; }; /*}}}*/ @@ -571,7 +573,7 @@ struct pkgCache::Description and to check that the Translation is up-to-date. */ map_ptrloc md5sum; // StringItem - /* @TODO document pkgCache::Description::FileList */ + /** @TODO document pkgCache::Description::FileList */ map_ptrloc FileList; // DescFile /** \brief next translation for this description */ map_ptrloc NextDesc; // Description @@ -661,27 +663,27 @@ struct pkgCache::StringItem /*}}}*/ -inline char const * const pkgCache::NativeArch() const - { return StrP + HeaderP->Architecture; }; +inline char const * pkgCache::NativeArch() + { return StrP + HeaderP->Architecture; } #include <apt-pkg/cacheiterators.h> -inline pkgCache::GrpIterator pkgCache::GrpBegin() - {return GrpIterator(*this);}; -inline pkgCache::GrpIterator pkgCache::GrpEnd() - {return GrpIterator(*this,GrpP);}; -inline pkgCache::PkgIterator pkgCache::PkgBegin() - {return PkgIterator(*this);}; -inline pkgCache::PkgIterator pkgCache::PkgEnd() - {return PkgIterator(*this,PkgP);}; +inline pkgCache::GrpIterator pkgCache::GrpBegin() + {return GrpIterator(*this);} +inline pkgCache::GrpIterator pkgCache::GrpEnd() + {return GrpIterator(*this,GrpP);} +inline pkgCache::PkgIterator pkgCache::PkgBegin() + {return PkgIterator(*this);} +inline pkgCache::PkgIterator pkgCache::PkgEnd() + {return PkgIterator(*this,PkgP);} inline pkgCache::PkgFileIterator pkgCache::FileBegin() - {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}; + {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);} inline pkgCache::PkgFileIterator pkgCache::FileEnd() - {return PkgFileIterator(*this,PkgFileP);}; + {return PkgFileIterator(*this,PkgFileP);} // Oh I wish for Real Name Space Support class pkgCache::Namespace /*{{{*/ -{ +{ public: typedef pkgCache::GrpIterator GrpIterator; typedef pkgCache::PkgIterator PkgIterator; @@ -690,7 +692,7 @@ class pkgCache::Namespace /*{{{*/ typedef pkgCache::DepIterator DepIterator; typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PkgFileIterator PkgFileIterator; - typedef pkgCache::VerFileIterator VerFileIterator; + typedef pkgCache::VerFileIterator VerFileIterator; typedef pkgCache::Version Version; typedef pkgCache::Description Description; typedef pkgCache::Package Package; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 7ce7aba7b..810f0b022 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -18,20 +18,26 @@ #include <apt-pkg/progress.h> #include <apt-pkg/sourcelist.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/aptconfiguration.h> #include <apt-pkg/strutl.h> #include <apt-pkg/sptr.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/macros.h> -#include <apt-pkg/tagfile.h> #include <apt-pkg/metaindex.h> #include <apt-pkg/fileutl.h> - +#include <apt-pkg/hashsum_template.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <stddef.h> +#include <string.h> +#include <iostream> +#include <string> #include <vector> #include <sys/stat.h> #include <unistd.h> -#include <errno.h> -#include <stdio.h> #include <apti18n.h> /*}}}*/ @@ -118,11 +124,11 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM Cache.ReMap(false); - CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap; + CurrentFile += (pkgCache::PackageFile const * const) newMap - (pkgCache::PackageFile const * const) oldMap; for (size_t i = 0; i < _count(UniqHash); ++i) if (UniqHash[i] != 0) - UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap; + UniqHash[i] += (pkgCache::StringItem const * const) newMap - (pkgCache::StringItem const * const) oldMap; for (std::vector<pkgCache::GrpIterator*>::const_iterator i = Dynamic<pkgCache::GrpIterator>::toReMap.begin(); i != Dynamic<pkgCache::GrpIterator>::toReMap.end(); ++i) @@ -350,7 +356,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator map_ptrloc *LastVer = &Pkg->VersionList; void const * oldMap = Map.Data(); - unsigned long const Hash = List.VersionHash(); + unsigned short const Hash = List.VersionHash(); if (Ver.end() == false) { /* We know the list is sorted so we use that fact in the search. @@ -363,7 +369,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator if (Res > 0) break; // Versionstrings are equal - is hash also equal? - if (Res == 0 && Ver->Hash == Hash) + if (Res == 0 && List.SameVersion(Hash, Ver) == true) break; // proceed with the next till we have either the right // or we found another version (which will be lower) @@ -398,7 +404,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator Pkg.Name(), "NewVersion", 1); if (oldMap != Map.Data()) - LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + LastVer += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; *LastVer = verindex; if (unlikely(List.NewVersion(Ver) == false)) @@ -552,12 +558,12 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List) if (Counter % 100 == 0 && Progress != 0) Progress->Progress(List.Offset()); - unsigned long Hash = List.VersionHash(); + unsigned short Hash = List.VersionHash(); pkgCache::VerIterator Ver = Pkg.VersionList(); Dynamic<pkgCache::VerIterator> DynVer(Ver); for (; Ver.end() == false; ++Ver) { - if (Ver->Hash == Hash && Version == Ver.VerStr()) + if (List.SameVersion(Hash, Ver) == true && Version == Ver.VerStr()) { if (List.CollectFileProvides(Cache,Ver) == false) return _error->Error(_("Error occurred while processing %s (%s%d)"), @@ -909,7 +915,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, if (unlikely(index == 0)) return false; if (OldDepLast != 0 && oldMap != Map.Data()) - OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; } } return NewDepends(Pkg, Ver, index, Op, Type, OldDepLast); @@ -948,7 +954,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D) OldDepLast = &D->NextDepends; } else if (oldMap != Map.Data()) - OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + OldDepLast += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; Dep->NextDepends = *OldDepLast; *OldDepLast = Dep.Index(); @@ -1045,6 +1051,12 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, return true; } /*}}}*/ +bool pkgCacheGenerator::ListParser::SameVersion(unsigned short const Hash,/*{{{*/ + pkgCache::VerIterator const &Ver) +{ + return Hash == Ver->Hash; +} + /*}}}*/ // CacheGenerator::SelectFile - Select the current file being parsed /*{{{*/ // --------------------------------------------------------------------- /* This is used to select which file is to be associated with all newly @@ -1125,8 +1137,8 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S, if (unlikely(idxString == 0)) return 0; if (oldMap != Map.Data()) { - Last += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; - I += (pkgCache::StringItem*) Map.Data() - (pkgCache::StringItem*) oldMap; + Last += (map_ptrloc const * const) Map.Data() - (map_ptrloc const * const) oldMap; + I += (pkgCache::StringItem const * const) Map.Data() - (pkgCache::StringItem const * const) oldMap; } *Last = Item; @@ -1249,10 +1261,10 @@ static bool CheckValidity(const string &CacheFile, static unsigned long ComputeSize(FileIterator Start,FileIterator End) { unsigned long TotalSize = 0; - for (; Start != End; ++Start) + for (; Start < End; ++Start) { if ((*Start)->HasPackages() == false) - continue; + continue; TotalSize += (*Start)->Size(); } return TotalSize; @@ -1333,7 +1345,7 @@ DynamicMMap* pkgCacheGenerator::CreateDynamicMMap(FileFd *CacheF, unsigned long the cache will be stored there. This is pretty much mandetory if you are using AllowMem. AllowMem lets the function be run as non-root where it builds the cache 'fast' into a memory buffer. */ -__deprecated bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, +APT_DEPRECATED bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, MMap **OutMap, bool AllowMem) { return pkgCacheGenerator::MakeStatusCache(List, &Progress, OutMap, AllowMem); } bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress, @@ -1534,7 +1546,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress // CacheGenerator::MakeOnlyStatusCache - Build only a status files cache/*{{{*/ // --------------------------------------------------------------------- /* */ -__deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) +APT_DEPRECATED bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); } bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap) { @@ -1580,7 +1592,7 @@ static bool IsDuplicateDescription(pkgCache::DescIterator Desc, } /*}}}*/ // CacheGenerator::FinishCache /*{{{*/ -bool pkgCacheGenerator::FinishCache(OpProgress *Progress) +bool pkgCacheGenerator::FinishCache(OpProgress * /*Progress*/) { return true; } diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 428e8459b..5994dab9f 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -19,16 +19,18 @@ #ifndef PKGLIB_PKGCACHEGEN_H #define PKGLIB_PKGCACHEGEN_H - -#include <apt-pkg/pkgcache.h> #include <apt-pkg/md5.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/macros.h> #include <vector> +#include <string> +class FileFd; class pkgSourceList; class OpProgress; -class MMap; class pkgIndexFile; class pkgCacheGenerator /*{{{*/ @@ -80,7 +82,7 @@ class pkgCacheGenerator /*{{{*/ bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, map_ptrloc const Version, unsigned int const &Op, unsigned int const &Type, map_ptrloc* &OldDepLast); - __deprecated unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next) + unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next) APT_DEPRECATED { return NewVersion(Ver, VerStr, 0, 0, Next); } unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr, map_ptrloc const ParentPkg, unsigned long const Hash, @@ -102,7 +104,7 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - __deprecated bool FinishCache(OpProgress *Progress); + bool FinishCache(OpProgress *Progress) APT_DEPRECATED APT_CONST; static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap = 0,bool AllowMem = false); @@ -162,6 +164,15 @@ class pkgCacheGenerator::ListParser virtual std::string DescriptionLanguage() = 0; virtual MD5SumValue Description_md5() = 0; virtual unsigned short VersionHash() = 0; + /** compare currently parsed version with given version + * + * \param Hash of the currently parsed version + * \param Ver to compare with + */ +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + virtual +#endif + APT_PURE bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); virtual bool UsePackage(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver) = 0; virtual unsigned long Offset() = 0; @@ -170,8 +181,8 @@ class pkgCacheGenerator::ListParser virtual bool Step() = 0; inline bool HasFileDeps() {return FoundFileDeps;}; - virtual bool CollectFileProvides(pkgCache &Cache, - pkgCache::VerIterator &Ver) {return true;}; + virtual bool CollectFileProvides(pkgCache &/*Cache*/, + pkgCache::VerIterator &/*Ver*/) {return true;}; ListParser() : FoundFileDeps(false) {}; virtual ~ListParser() {}; diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index 36dab3480..c403e4dc3 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -14,7 +14,11 @@ #include <apt-pkg/pkgrecords.h> #include <apt-pkg/indexfile.h> #include <apt-pkg/error.h> -#include <apt-pkg/configuration.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <stddef.h> +#include <vector> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index 3658435e8..b5237b3a0 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -17,8 +17,9 @@ #ifndef PKGLIB_PKGRECORDS_H #define PKGLIB_PKGRECORDS_H - #include <apt-pkg/pkgcache.h> + +#include <string> #include <vector> class pkgRecords /*{{{*/ @@ -70,7 +71,7 @@ class pkgRecords::Parser /*{{{*/ virtual std::string Homepage() {return std::string();} // An arbitrary custom field - virtual std::string RecordField(const char *fieldName) { return std::string();}; + virtual std::string RecordField(const char * /*fieldName*/) { return std::string();}; // The record in binary form virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc index 05ba6e0e6..14d090c7a 100644 --- a/apt-pkg/pkgsystem.cc +++ b/apt-pkg/pkgsystem.cc @@ -13,7 +13,8 @@ #include<config.h> #include <apt-pkg/pkgsystem.h> -#include <apt-pkg/policy.h> +#include <apt-pkg/macros.h> + #include <cassert> #include <cstring> /*}}}*/ @@ -36,7 +37,7 @@ pkgSystem::pkgSystem() : Label(NULL), VS(NULL) // System::GetSystem - Get the named system /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgSystem *pkgSystem::GetSystem(const char *Label) +APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label) { for (unsigned I = 0; I != GlobalListLen; I++) if (strcmp(SysList[I]->Label,Label) == 0) diff --git a/apt-pkg/pkgsystem.h b/apt-pkg/pkgsystem.h index eb75df412..6e33c67ed 100644 --- a/apt-pkg/pkgsystem.h +++ b/apt-pkg/pkgsystem.h @@ -38,6 +38,7 @@ #define PKGLIB_PKGSYSTEM_H #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <vector> @@ -50,7 +51,6 @@ class pkgPackageManager; class pkgVersioningSystem; class Configuration; class pkgIndexFile; -class PkgFileIterator; class pkgSystem { diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index d0f97441d..3cfc32829 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -33,7 +33,15 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> #include <apt-pkg/sptr.h> - +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/versionmatch.h> + +#include <ctype.h> +#include <stddef.h> +#include <string.h> +#include <string> +#include <vector> #include <iostream> #include <sstream> @@ -325,7 +333,7 @@ pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator const &Pkg) // Policy::GetPriority - Get the priority of the package pin /*{{{*/ // --------------------------------------------------------------------- /* */ -signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) { if (Pins[Pkg->ID].Type != pkgVersionMatch::None) { @@ -337,7 +345,7 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) return 0; } -signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { return PFPriority[File->ID]; } @@ -349,7 +357,7 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) all over the place rather than forcing a special format */ class PreferenceSection : public pkgTagSection { - void TrimRecord(bool BeforeRecord, const char* &End) + void TrimRecord(bool /*BeforeRecord*/, const char* &End) { for (; Stop < End && (Stop[0] == '\n' || Stop[0] == '\r' || Stop[0] == '#'); Stop++) if (Stop[0] == '#') diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h index 5172a3c3b..f15d8c0a0 100644 --- a/apt-pkg/policy.h +++ b/apt-pkg/policy.h @@ -33,10 +33,13 @@ #ifndef PKGLIB_POLICY_H #define PKGLIB_POLICY_H - #include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/versionmatch.h> + #include <vector> +#include <string> #ifndef APT_8_CLEANER_HEADERS using std::vector; diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 1f5179885..e37899ec6 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -18,7 +18,16 @@ #include <apt-pkg/metaindex.h> #include <apt-pkg/indexfile.h> #include <apt-pkg/tagfile.h> - +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <ctype.h> +#include <stddef.h> +#include <time.h> +#include <cstring> +#include <map> +#include <string> +#include <vector> #include <fstream> #include <algorithm> diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index 0ccb4aa00..9df0c1d74 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -27,18 +27,27 @@ #ifndef PKGLIB_SOURCELIST_H #define PKGLIB_SOURCELIST_H +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/macros.h> + +#include <time.h> + #include <string> #include <vector> #include <map> -#include <apt-pkg/pkgcache.h> -#include <apt-pkg/tagfile.h> #ifndef APT_8_CLEANER_HEADERS +#include <apt-pkg/tagfile.h> +#endif +#ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/metaindex.h> using std::string; using std::vector; #endif +class FileFd; +class pkgTagSection; class pkgAcquire; class pkgIndexFile; class metaIndex; @@ -55,7 +64,7 @@ class pkgSourceList // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Name; const char *Label; diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc index 60b62850a..775cf2e5f 100644 --- a/apt-pkg/srcrecords.cc +++ b/apt-pkg/srcrecords.cc @@ -16,8 +16,13 @@ #include <apt-pkg/srcrecords.h> #include <apt-pkg/error.h> #include <apt-pkg/sourcelist.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/metaindex.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/macros.h> + +#include <string.h> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index ed69d0d72..9915debfe 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -13,6 +13,7 @@ #ifndef PKGLIB_SRCRECORDS_H #define PKGLIB_SRCRECORDS_H +#include <apt-pkg/macros.h> #include <string> #include <vector> @@ -73,7 +74,7 @@ class pkgSrcRecords //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0; - static const char *BuildDepType(unsigned char const &Type); + static const char *BuildDepType(unsigned char const &Type) APT_PURE; virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 832a40d1e..91d176e3c 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -21,6 +21,8 @@ #include <string> #include <stdio.h> #include <ctype.h> +#include <stdlib.h> +#include <string.h> #include <apti18n.h> /*}}}*/ @@ -83,7 +85,7 @@ pkgTagFile::~pkgTagFile() } /*}}}*/ // TagFile::Offset - Return the current offset in the buffer /*{{{*/ -unsigned long pkgTagFile::Offset() +APT_PURE unsigned long pkgTagFile::Offset() { return d->iOffset; } @@ -471,7 +473,7 @@ bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags, return true; return FindFlag(Flags, Flag, Start, Stop); } -bool const pkgTagSection::FindFlag(unsigned long &Flags, unsigned long Flag, +bool pkgTagSection::FindFlag(unsigned long &Flags, unsigned long Flag, char const* Start, char const* Stop) { switch (StringToBool(string(Start, Stop))) diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 518d3dbcd..2f600d397 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -65,7 +65,7 @@ class pkgTagSection unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const; bool FindFlag(const char *Tag,unsigned long &Flags, unsigned long Flag) const; - bool static const FindFlag(unsigned long &Flags, unsigned long Flag, + bool static FindFlag(unsigned long &Flags, unsigned long Flag, const char* Start, const char* Stop); bool Scan(const char *Start,unsigned long MaxLength); inline unsigned long size() const {return Stop - Section;}; diff --git a/apt-pkg/update.cc b/apt-pkg/update.cc index 97be5490b..5d5b19626 100644 --- a/apt-pkg/update.cc +++ b/apt-pkg/update.cc @@ -1,24 +1,17 @@ - // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/update.h> -#include <apt-pkg/error.h> -#include <apt-pkg/configuration.h> -#include <apt-pkg/version.h> -#include <apt-pkg/sptr.h> #include <apt-pkg/acquire-item.h> -#include <apt-pkg/edsp.h> -#include <apt-pkg/sourcelist.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/progress.h> +#include <apt-pkg/sourcelist.h> +#include <apt-pkg/acquire.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/update.h> -#include <sys/types.h> -#include <cstdlib> -#include <algorithm> -#include <iostream> -#include <stdio.h> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/upgrade.cc b/apt-pkg/upgrade.cc index d6f6933dd..7926845c2 100644 --- a/apt-pkg/upgrade.cc +++ b/apt-pkg/upgrade.cc @@ -1,24 +1,17 @@ - // Include Files /*{{{*/ #include <config.h> #include <apt-pkg/algorithms.h> -#include <apt-pkg/upgrade.h> -#include <apt-pkg/error.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/version.h> -#include <apt-pkg/sptr.h> -#include <apt-pkg/acquire-item.h> #include <apt-pkg/edsp.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/fileutl.h> +#include <apt-pkg/error.h> #include <apt-pkg/progress.h> +#include <apt-pkg/upgrade.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> -#include <sys/types.h> -#include <cstdlib> -#include <algorithm> -#include <iostream> -#include <stdio.h> +#include <string> #include <apti18n.h> /*}}}*/ diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h index c4973472f..aa883df10 100644 --- a/apt-pkg/upgrade.h +++ b/apt-pkg/upgrade.h @@ -10,12 +10,14 @@ #ifndef PKGLIB_UPGRADE_H #define PKGLIB_UPGRADE_H +class pkgDepCache; + namespace APT { namespace Upgrade { // FIXME: make this "enum class UpgradeMode {" once we enable c++11 enum UpgradeMode { FORBID_REMOVE_PACKAGES = 1, - FORBID_INSTALL_NEW_PACKAGES = 2, + FORBID_INSTALL_NEW_PACKAGES = 2 }; bool Upgrade(pkgDepCache &Cache, int UpgradeMode); } diff --git a/apt-pkg/vendor.cc b/apt-pkg/vendor.cc index fc03ec845..d4add560e 100644 --- a/apt-pkg/vendor.cc +++ b/apt-pkg/vendor.cc @@ -1,10 +1,14 @@ #include<config.h> -#include <iostream> -#include <apt-pkg/error.h> #include <apt-pkg/vendor.h> #include <apt-pkg/configuration.h> +#include <iostream> +#include <map> +#include <string> +#include <utility> +#include <vector> + Vendor::Vendor(std::string VendorID, std::string Origin, std::vector<struct Vendor::Fingerprint *> *FingerprintList) @@ -31,7 +35,7 @@ const std::string Vendor::LookupFingerprint(std::string Print) const return (*Elt).second; } -bool Vendor::CheckDist(std::string Dist) +APT_CONST bool Vendor::CheckDist(std::string /*Dist*/) { return true; } diff --git a/apt-pkg/vendor.h b/apt-pkg/vendor.h index 6484adf9b..2d2e2b0ae 100644 --- a/apt-pkg/vendor.h +++ b/apt-pkg/vendor.h @@ -11,7 +11,7 @@ using std::string; #endif // A class representing a particular software provider. -class __deprecated Vendor +class APT_DEPRECATED Vendor { public: struct Fingerprint diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc index 602425624..fb33ff17d 100644 --- a/apt-pkg/vendorlist.cc +++ b/apt-pkg/vendorlist.cc @@ -3,9 +3,16 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> + +#include <stddef.h> +#include <iostream> +#include <string> +#include <vector> + #include <apti18n.h> #if __GNUC__ >= 4 + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -157,5 +164,5 @@ const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput) /* /*}}}*/ #if __GNUC__ >= 4 - #pragma GCC diagnostic warning "-Wdeprecated-declarations" + #pragma GCC diagnostic pop #endif diff --git a/apt-pkg/vendorlist.h b/apt-pkg/vendorlist.h index a86ccde7c..bc3702a93 100644 --- a/apt-pkg/vendorlist.h +++ b/apt-pkg/vendorlist.h @@ -27,7 +27,7 @@ using std::vector; class Vendor; class Configuration; -class __deprecated pkgVendorList +class APT_DEPRECATED pkgVendorList { protected: std::vector<Vendor const *> VendorList; diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc index cb2c34c0f..29bee46da 100644 --- a/apt-pkg/version.cc +++ b/apt-pkg/version.cc @@ -11,8 +11,8 @@ #include<config.h> #include <apt-pkg/version.h> -#include <apt-pkg/pkgcache.h> +#include <string.h> #include <stdlib.h> /*}}}*/ diff --git a/apt-pkg/version.h b/apt-pkg/version.h index e0e0e6c14..d98809f7e 100644 --- a/apt-pkg/version.h +++ b/apt-pkg/version.h @@ -33,7 +33,7 @@ class pkgVersioningSystem // Global list of VS's static pkgVersioningSystem **GlobalList; static unsigned long GlobalListLen; - static pkgVersioningSystem *GetVS(const char *Label); + static pkgVersioningSystem *GetVS(const char *Label) APT_PURE; const char *Label; diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index 26262a010..284098bdf 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -16,11 +16,16 @@ #include <apt-pkg/versionmatch.h> #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <string> #include <stdio.h> #include <ctype.h> #include <fnmatch.h> -#include <sys/types.h> #include <regex.h> /*}}}*/ diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index 433396fc9..4c8f704c8 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -35,16 +35,17 @@ #ifndef PKGLIB_VERSIONMATCH_H #define PKGLIB_VERSIONMATCH_H +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <string> -#include <apt-pkg/pkgcache.h> #ifndef APT_8_CLEANER_HEADERS using std::string; #endif class pkgVersionMatch -{ +{ // Version Matching std::string VerStr; bool VerPrefixMatch; @@ -60,20 +61,20 @@ class pkgVersionMatch std::string RelComponent; std::string RelArchitecture; bool MatchAll; - + // Origin Matching std::string OrSite; - + public: - + enum MatchType {None = 0,Version,Release,Origin} Type; - - bool MatchVer(const char *A,std::string B,bool Prefix); + + bool MatchVer(const char *A,std::string B,bool Prefix) APT_PURE; bool ExpressionMatches(const char *pattern, const char *string); bool ExpressionMatches(const std::string& pattern, const char *string); bool FileMatch(pkgCache::PkgFileIterator File); pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); - + pkgVersionMatch(std::string Data,MatchType Type); }; diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d25ffef75..fe7a45e12 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -10,18 +10,21 @@ // Include files /*{{{*/ #include<config.h> +#include <apt-pkg/acquire.h> #include <apt-pkg/acquire-item.h> #include <apt-pkg/acquire-worker.h> #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> +#include <apt-private/acqprogress.h> + +#include <string.h> #include <stdio.h> #include <signal.h> #include <iostream> #include <unistd.h> -#include "acqprogress.h" #include <apti18n.h> /*}}}*/ @@ -42,12 +45,12 @@ AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet) // AcqTextStatus::Start - Downloading has started /*{{{*/ // --------------------------------------------------------------------- /* */ -void AcqTextStatus::Start() +void AcqTextStatus::Start() { - pkgAcquireStatus::Start(); + pkgAcquireStatus::Start(); BlankLine[0] = 0; ID = 1; -}; +} /*}}}*/ // AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/ // --------------------------------------------------------------------- @@ -58,14 +61,14 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm) return; if (Quiet <= 0) - cout << '\r' << BlankLine << '\r'; - + cout << '\r' << BlankLine << '\r'; + cout << _("Hit ") << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fetch - An item has started to download /*{{{*/ // --------------------------------------------------------------------- @@ -75,28 +78,28 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) Update = true; if (Itm.Owner->Complete == true) return; - + Itm.Owner->ID = ID++; - + if (Quiet > 1) return; if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; -}; +} /*}}}*/ // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- /* We don't display anything... */ -void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) +void AcqTextStatus::Done(pkgAcquire::ItemDesc &/*Itm*/) { Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fail - Called when an item fails to download /*{{{*/ // --------------------------------------------------------------------- @@ -109,10 +112,10 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) // Ignore certain kinds of transient failures (bad code) if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) return; - + if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + if (Itm.Owner->Status == pkgAcquire::Item::StatDone) { cout << _("Ign ") << Itm.Description << endl; @@ -122,9 +125,9 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) cout << _("Err ") << Itm.Description << endl; cout << " " << Itm.Owner->ErrorText << endl; } - + Update = true; -}; +} /*}}}*/ // AcqTextStatus::Stop - Finished downloading /*{{{*/ // --------------------------------------------------------------------- @@ -154,12 +157,12 @@ void AcqTextStatus::Stop() bool AcqTextStatus::Pulse(pkgAcquire *Owner) { pkgAcquireStatus::Pulse(Owner); - + if (Quiet > 0) return true; - + enum {Long = 0,Medium,Short} Mode = Medium; - + char Buffer[sizeof(BlankLine)]; char *End = Buffer + sizeof(Buffer); char *S = Buffer; @@ -174,8 +177,8 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) I = Owner->WorkerStep(I)) { S += strlen(S); - - // There is no item running + + // There is no item running if (I->CurrentItem == 0) { if (I->Status.empty() == false) @@ -183,12 +186,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," [%s]",I->Status.c_str()); Shown = true; } - + continue; } Shown = true; - + // Add in the short description if (I->CurrentItem->Owner->ID != 0) snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID, @@ -203,7 +206,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode); S += strlen(S); } - + // Add the current progress if (Mode == Long) snprintf(S,End-S," %llu",I->CurrentSize); @@ -213,7 +216,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str()); } S += strlen(S); - + // Add the total size and percent if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false) { @@ -223,7 +226,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) else snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(), (I->CurrentSize*100.0)/I->TotalSize); - } + } S += strlen(S); snprintf(S,End-S,"]"); } @@ -231,26 +234,26 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) // Show something.. if (Shown == false) snprintf(S,End-S,_(" [Working]")); - + /* Put in the ETA and cps meter, block off signals to prevent strangeness during resizing */ sigset_t Sigs,OldSigs; sigemptyset(&Sigs); sigaddset(&Sigs,SIGWINCH); sigprocmask(SIG_BLOCK,&Sigs,&OldSigs); - + if (CurrentCPS != 0) - { + { char Tmp[300]; unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS; sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str()); unsigned int Len = strlen(Buffer); unsigned int LenT = strlen(Tmp); if (Len + LenT < ScreenWidth) - { + { memset(Buffer + Len,' ',ScreenWidth - Len); strcpy(Buffer + ScreenWidth - LenT,Tmp); - } + } } Buffer[ScreenWidth] = 0; BlankLine[ScreenWidth] = 0; @@ -268,7 +271,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) memset(BlankLine,' ',strlen(Buffer)); BlankLine[strlen(Buffer)] = 0; - + Update = false; return true; diff --git a/apt-private/private-cachefile.cc b/apt-private/private-cachefile.cc index c822b9bad..5e955ac39 100644 --- a/apt-private/private-cachefile.cc +++ b/apt-private/private-cachefile.cc @@ -4,11 +4,17 @@ #include <apt-pkg/algorithms.h> #include <apt-pkg/upgrade.h> #include <apt-pkg/error.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> -#include <cstdlib> +#include <apt-private/private-output.h> +#include <apt-private/private-cachefile.h> -#include "private-output.h" -#include "private-cachefile.h" +#include <string.h> +#include <ostream> +#include <cstdlib> #include <apti18n.h> /*}}}*/ diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index f24d93020..67c5e8cdc 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -3,6 +3,8 @@ #include <apt-pkg/cachefile.h> #include <apt-pkg/progress.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/pkgcache.h> // class CacheFile - Cover class for some dependency cache functions /*{{{*/ @@ -11,7 +13,7 @@ class CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b); + static int NameComp(const void *a,const void *b) APT_PURE; public: pkgCache::Package **List; diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index a7dc0e800..4a63c7e81 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -1,9 +1,18 @@ +#include <config.h> + #include <apt-pkg/cachefile.h> #include <apt-pkg/pkgcache.h> #include <apt-pkg/depcache.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/policy.h> + +#include <apt-private/private-cacheset.h> + +#include <stddef.h> -#include "private-cacheset.h" +#include <apti18n.h> bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, LocalitySortedVersionSet &output_set, diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 322b3be6b..854d16922 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -1,17 +1,32 @@ #ifndef APT_PRIVATE_CACHESET_H #define APT_PRIVATE_CACHESET_H +#include <apt-pkg/aptconfiguration.h> #include <apt-pkg/cachefile.h> #include <apt-pkg/cacheset.h> #include <apt-pkg/sptr.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/error.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/macros.h> #include <algorithm> #include <vector> +#include <string.h> +#include <list> +#include <ostream> +#include <set> +#include <string> +#include <utility> #include "private-output.h" #include <apti18n.h> +class OpProgress; + struct VersionSortDescriptionLocality { bool operator () (const pkgCache::VerIterator &v_lhs, @@ -42,8 +57,8 @@ typedef APT::VersionContainer< class Matcher { public: - virtual bool operator () (const pkgCache::PkgIterator &P) { - return true;}; + virtual bool operator () (const pkgCache::PkgIterator &/*P*/) { + return true;} }; // FIXME: add default argument for OpProgress (or overloaded function) @@ -111,8 +126,8 @@ public: Pkg.FullName(true).c_str(), pattern.c_str()); explicitlyNamed = false; } - virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver, - std::string const &ver, bool const verIsRel) { + virtual void showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const Ver, + std::string const &ver, bool const /*verIsRel*/) { if (ver == Ver.VerStr()) return; selectedByRelease.push_back(make_pair(Ver, ver)); diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index ef7d65f3c..682be0a19 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -2,19 +2,17 @@ #include <config.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/configuration.h> -#include <vector> +#include <apt-private/private-cmndline.h> +#include <vector> #include <stdarg.h> #include <string.h> -#include "private-cmndline.h" - #include <apti18n.h> /*}}}*/ -bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ +APT_SENTINEL static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ { va_list args; bool found = false; @@ -33,7 +31,7 @@ bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ /*}}}*/ #define addArg(w,x,y,z) Args.push_back(CommandLine::MakeArgs(w,x,y,z)) #define CmdMatches(...) strcmp_match_in_list(Cmd, __VA_ARGS__, NULL) -bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("depends", "rdepends", "xvcg", "dotty")) { @@ -82,7 +80,7 @@ bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char const * con return true; } /*}}}*/ -bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("add", "ident") == false) return false; @@ -100,7 +98,7 @@ bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * con return true; } /*}}}*/ -bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("dump")) { @@ -115,7 +113,7 @@ bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char const * co return true; } /*}}}*/ -bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade", "dselect-upgrade", "autoremove")) @@ -141,6 +139,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const { addArg('b', "compile", "APT::Get::Compile", 0); addArg('b', "build", "APT::Get::Compile", 0); + addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "diff-only", "APT::Get::Diff-Only", 0); addArg(0, "debian-only", "APT::Get::Diff-Only", 0); addArg(0, "tar-only", "APT::Get::Tar-Only", 0); @@ -149,6 +148,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const else if (CmdMatches("build-dep")) { addArg('a', "host-architecture", "APT::Get::Host-Architecture", CommandLine::HasArg); + addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "purge", "APT::Get::Purge", 0); addArg(0, "solver", "APT::Solver", CommandLine::HasArg); // this has no effect *but* sbuild is using it (see LP: #1255806) @@ -200,7 +200,7 @@ bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const return true; } /*}}}*/ -bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("auto", "manual", "hold", "unhold", "showauto", "showmanual", "showhold", "showholds", "install", @@ -220,7 +220,7 @@ bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * cons return true; } /*}}}*/ -bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ +static bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/ { if (CmdMatches("list")) { diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc index f02991cde..a095f0c67 100644 --- a/apt-private/private-download.cc +++ b/apt-private/private-download.cc @@ -7,9 +7,8 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> -#include "private-output.h" - -#include <locale.h> +#include <apt-private/private-output.h> +#include <apt-private/private-download.h> #include <fstream> #include <string> diff --git a/apt-private/private-download.h b/apt-private/private-download.h index b8cc8da1e..1447845ed 100644 --- a/apt-private/private-download.h +++ b/apt-private/private-download.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_DOWNLOAD_H #define APT_PRIVATE_DOWNLOAD_H -#include <apt-pkg/acquire.h> +class pkgAcquire; bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser); bool AcquireRun(pkgAcquire &Fetcher, int const PulseInterval, bool * const Failure, bool * const TransientNetworkFailure); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 3adb00b23..107ed398e 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1,57 +1,45 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/aptconfiguration.h> -#include <apt-pkg/error.h> -#include <apt-pkg/cmndline.h> -#include <apt-pkg/init.h> -#include <apt-pkg/depcache.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/algorithms.h> +#include <apt-pkg/acquire.h> #include <apt-pkg/acquire-item.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/clean.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> +#include <apt-pkg/algorithms.h> #include <apt-pkg/cachefile.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/sptr.h> -#include <apt-pkg/md5.h> -#include <apt-pkg/versionmatch.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/pkgsystem.h> +#include <apt-pkg/cmndline.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/install-progress.h> -#include <apt-pkg/init.h> +#include <apt-pkg/pkgsystem.h> +#include <apt-pkg/sptr.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/packagemanager.h> +#include <apt-pkg/pkgcache.h> -#include <set> -#include <locale.h> -#include <langinfo.h> -#include <fstream> -#include <termios.h> -#include <sys/ioctl.h> -#include <sys/stat.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> #include <sys/statfs.h> #include <sys/statvfs.h> -#include <signal.h> -#include <unistd.h> -#include <stdio.h> -#include <errno.h> -#include <regex.h> -#include <sys/wait.h> -#include <sstream> +#include <algorithm> +#include <iostream> +#include <set> +#include <vector> -#include "private-install.h" -#include "private-download.h" -#include "private-cachefile.h" -#include "private-output.h" -#include "private-cacheset.h" -#include "acqprogress.h" +#include <apt-private/acqprogress.h> +#include <apt-private/private-install.h> +#include <apt-private/private-cachefile.h> +#include <apt-private/private-cacheset.h> +#include <apt-private/private-download.h> +#include <apt-private/private-output.h> #include <apti18n.h> /*}}}*/ +class pkgSourceList; // InstallPackages - Actually download and install the packages /*{{{*/ // --------------------------------------------------------------------- @@ -156,7 +144,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) if (DebBytes != Cache->DebSize()) { c0out << DebBytes << ',' << Cache->DebSize() << std::endl; - c0out << _("How odd.. The sizes didn't match, email apt@packages.debian.org") << std::endl; + c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl; } // Number of bytes @@ -386,7 +374,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety) // DoAutomaticRemove - Remove all automatic unused packages /*{{{*/ // --------------------------------------------------------------------- /* Remove unused automatic packages */ -bool DoAutomaticRemove(CacheFile &Cache) +static bool DoAutomaticRemove(CacheFile &Cache) { bool Debug = _config->FindI("Debug::pkgAutoRemove",false); bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false); diff --git a/apt-private/private-install.h b/apt-private/private-install.h index 2187146d3..79769d470 100644 --- a/apt-private/private-install.h +++ b/apt-private/private-install.h @@ -1,15 +1,29 @@ #ifndef APT_PRIVATE_INSTALL_H #define APT_PRIVATE_INSTALL_H +#include <apt-pkg/cachefile.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/cmndline.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/algorithms.h> + +#include <stddef.h> +#include <iosfwd> +#include <list> +#include <map> +#include <string> +#include <utility> -#include "private-cachefile.h" #include "private-output.h" #include <apti18n.h> +class CacheFile; +class CommandLine; + #define RAMFS_MAGIC 0x858458f6 bool DoInstall(CommandLine &Cmd); diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index 44a766c84..7664ca134 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -1,43 +1,28 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/error.h> #include <apt-pkg/cachefile.h> #include <apt-pkg/cachefilter.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/init.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/sourcelist.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> -#include <apt-pkg/policy.h> -#include <apt-pkg/tagfile.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/sptr.h> -#include <apt-pkg/pkgsystem.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/metaindex.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <apt-private/private-cacheset.h> +#include <apt-private/private-list.h> +#include <apt-private/private-output.h> +#include <iostream> #include <sstream> -#include <vector> +#include <map> +#include <string> #include <utility> -#include <cassert> -#include <locale.h> -#include <iostream> -#include <unistd.h> -#include <errno.h> -#include <regex.h> -#include <stdio.h> -#include <algorithm> - -#include "private-cmndline.h" -#include "private-list.h" -#include "private-output.h" -#include "private-cacheset.h" +#include <vector> #include <apti18n.h> /*}}}*/ @@ -99,7 +84,7 @@ private: #undef PackageMatcher }; /*}}}*/ -void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/ +static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/ pkgCache::PkgIterator P, std::ostream &outs, bool include_summary=true) diff --git a/apt-private/private-list.h b/apt-private/private-list.h index 6f5aad27a..749744dd1 100644 --- a/apt-private/private-list.h +++ b/apt-private/private-list.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_LIST_H #define APT_PRIVATE_LIST_H -#include <apt-pkg/cmndline.h> +class CommandLine; bool List(CommandLine &Cmd); diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index 1fdf3f0be..2d3965172 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -1,9 +1,13 @@ +#include <config.h> -#include<unistd.h> -#include<cstring> - +#include <apt-pkg/cmndline.h> #include <apt-pkg/configuration.h> -#include "private-main.h" + +#include <apt-private/private-main.h> + +#include <iostream> +#include <string.h> +#include <unistd.h> #include <apti18n.h> diff --git a/apt-private/private-main.h b/apt-private/private-main.h index f9a95c4ec..257c51a0b 100644 --- a/apt-private/private-main.h +++ b/apt-private/private-main.h @@ -1,9 +1,8 @@ #ifndef APT_PRIVATE_MAIN_H #define APT_PRIVATE_MAIN_H -#include <apt-pkg/cmndline.h> +class CommandLine; void CheckSimulateMode(CommandLine &CmdL); - #endif diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc index 9b5b94654..a87999150 100644 --- a/apt-private/private-moo.cc +++ b/apt-private/private-moo.cc @@ -13,16 +13,20 @@ #include <apt-pkg/cmndline.h> #include <apt-pkg/strutl.h> -#include <strings.h> -#include <sstream> +#include <apt-private/private-moo.h> +#include <apt-private/private-output.h> -#include "private-moo.h" -#include "private-output.h" +#include <stddef.h> +#include <string.h> +#include <time.h> +#include <iostream> +#include <sstream> +#include <string> #include <apti18n.h> /*}}}*/ -std::string getMooLine() { /*{{{*/ +static std::string getMooLine() { /*{{{*/ time_t const timenow = time(NULL); struct tm special; localtime_r(&timenow, &special); @@ -60,12 +64,12 @@ std::string getMooLine() { /*{{{*/ return out.str(); } /*}}}*/ -bool printMooLine() { /*{{{*/ +static bool printMooLine() { /*{{{*/ std::cerr << getMooLine() << std::endl; return true; } /*}}}*/ -bool DoMoo1(CommandLine &CmdL) /*{{{*/ +bool DoMoo1(CommandLine &) /*{{{*/ { // our trustworthy super cow since 2001 if (_config->FindI("quiet") >= 2) @@ -83,7 +87,7 @@ bool DoMoo1(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ -bool DoMoo2(CommandLine &CmdL) /*{{{*/ +bool DoMoo2(CommandLine &) /*{{{*/ { // by Fernando Ribeiro in lp:56125 if (_config->FindI("quiet") >= 2) @@ -102,22 +106,22 @@ bool DoMoo2(CommandLine &CmdL) /*{{{*/ else { c1out << - OutputInDepth(depth, " ") << " \e[1;97m(\e[0;33m__\e[1;97m)\e[0m\n" << - OutputInDepth(depth, " ") << " \e[31m_______\e[33m~(\e[1;34m..\e[0;33m)~\e[0m\n" << - OutputInDepth(depth, " ") << " \e[33m,----\e[31m\\\e[33m(\e[1;4;35moo\e[0;33m)\e[0m\n" << - OutputInDepth(depth, " ") << " \e[33m/|____|,'\e[0m\n" << - OutputInDepth(depth, " ") << " \e[1;5;97m*\e[0;33m /\\ /\\\e[0m\n" << - "\e[32m"; + OutputInDepth(depth, " ") << " \033[1;97m(\033[0;33m__\033[1;97m)\033[0m\n" << + OutputInDepth(depth, " ") << " \033[31m_______\033[33m~(\033[1;34m..\033[0;33m)~\033[0m\n" << + OutputInDepth(depth, " ") << " \033[33m,----\033[31m\\\033[33m(\033[1;4;35moo\033[0;33m)\033[0m\n" << + OutputInDepth(depth, " ") << " \033[33m/|____|,'\033[0m\n" << + OutputInDepth(depth, " ") << " \033[1;5;97m*\033[0;33m /\\ /\\\033[0m\n" << + "\033[32m"; for (size_t i = moo.length()/2; i > 1; --i) c1out << "wW"; - c1out << "w\e[0m\n" << moo; + c1out << "w\033[0m\n" << moo; } return true; } /*}}}*/ -bool DoMoo3(CommandLine &CmdL) /*{{{*/ +bool DoMoo3(CommandLine &) /*{{{*/ { // by Robert Millan in deb:134156 if (_config->FindI("quiet") >= 2) @@ -134,7 +138,7 @@ bool DoMoo3(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ -bool DoMooApril(CommandLine &CmdL) /*{{{*/ +bool DoMooApril(CommandLine &) /*{{{*/ { // by Christopher Allan Webber and proposed by Paul Tagliamonte // in a "Community outreach": https://lists.debian.org/debian-devel/2013/04/msg00045.html diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 420ca14d5..bbd8545ad 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -7,16 +7,22 @@ #include <apt-pkg/cachefile.h> #include <apt-pkg/pkgrecords.h> #include <apt-pkg/policy.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-private/private-output.h> +#include <apt-private/private-cachefile.h> + +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <iomanip> #include <iostream> -#include <locale.h> #include <langinfo.h> #include <unistd.h> -#include "private-output.h" -#include "private-cachefile.h" - #include <apti18n.h> /*}}}*/ @@ -63,7 +69,7 @@ bool InitOutput() /*{{{*/ return true; } /*}}}*/ -std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) /*{{{*/ +static std::string GetArchiveSuite(pkgCacheFile &/*CacheFile*/, pkgCache::VerIterator ver) /*{{{*/ { std::string suite = ""; if (ver && ver.FileList() && ver.FileList()) @@ -82,7 +88,7 @@ std::string GetArchiveSuite(pkgCacheFile &CacheFile, pkgCache::VerIterator ver) return suite; } /*}}}*/ -std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgDepCache *DepCache = CacheFile.GetDepCache(); pkgDepCache::StateCache &state = (*DepCache)[P]; @@ -99,7 +105,7 @@ std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ return flags_str; } /*}}}*/ -std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); @@ -107,14 +113,14 @@ std::string GetCandidateVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P return cand ? cand.VerStr() : "(none)"; } /*}}}*/ -std::string GetInstalledVersion(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetInstalledVersion(pkgCacheFile &/*CacheFile*/, pkgCache::PkgIterator P)/*{{{*/ { pkgCache::VerIterator inst = P.CurrentVer(); return inst ? inst.VerStr() : "(none)"; } /*}}}*/ -std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ +static std::string GetVersion(pkgCacheFile &/*CacheFile*/, pkgCache::VerIterator V)/*{{{*/ { pkgCache::PkgIterator P = V.ParentPkg(); if (V == P.CurrentVer()) @@ -134,16 +140,16 @@ std::string GetVersion(pkgCacheFile &CacheFile, pkgCache::VerIterator V)/*{{{*/ return "(none)"; } /*}}}*/ -std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); pkgCache::VerIterator inst = P.CurrentVer(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); - + return inst ? inst.Arch() : cand.Arch(); } /*}}}*/ -std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)/*{{{*/ +static std::string GetShortDescription(pkgCacheFile &CacheFile, pkgRecords &records, pkgCache::PkgIterator P)/*{{{*/ { pkgPolicy *policy = CacheFile.GetPolicy(); diff --git a/apt-private/private-output.h b/apt-private/private-output.h index 2a2a69458..81643f90a 100644 --- a/apt-private/private-output.h +++ b/apt-private/private-output.h @@ -1,17 +1,14 @@ #ifndef APT_PRIVATE_OUTPUT_H #define APT_PRIVATE_OUTPUT_H +#include <apt-pkg/pkgcache.h> -#include <iostream> #include <fstream> #include <string> -#include "private-cachefile.h" - // forward declaration class pkgCacheFile; class CacheFile; -class pkgCache; class pkgDepCache; class pkgRecords; diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc index 0b1a929b0..8106333b6 100644 --- a/apt-private/private-search.cc +++ b/apt-private/private-search.cc @@ -1,40 +1,30 @@ // Includes /*{{{*/ -#include <apt-pkg/error.h> +#include <config.h> + #include <apt-pkg/cachefile.h> -#include <apt-pkg/cachefilter.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/init.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/sourcelist.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> #include <apt-pkg/policy.h> -#include <apt-pkg/tagfile.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/sptr.h> -#include <apt-pkg/pkgsystem.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/metaindex.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> -#include <sstream> -#include <utility> -#include <cassert> -#include <locale.h> +#include <apt-private/private-cacheset.h> +#include <apt-private/private-output.h> +#include <apt-private/private-search.h> + +#include <string.h> #include <iostream> -#include <unistd.h> -#include <errno.h> -#include <regex.h> -#include <stdio.h> -#include <iomanip> -#include <algorithm> +#include <sstream> #include <map> +#include <string> +#include <utility> -#include "private-search.h" -#include "private-cacheset.h" +#include <apti18n.h> /*}}}*/ bool FullTextSearch(CommandLine &CmdL) /*{{{*/ diff --git a/apt-private/private-search.h b/apt-private/private-search.h index 17faffebc..539915f1f 100644 --- a/apt-private/private-search.h +++ b/apt-private/private-search.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SEARCH_H #define APT_PRIVATE_SEARCH_H -#include <apt-pkg/cmndline.h> +class CommandLine; bool FullTextSearch(CommandLine &CmdL); diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 60d951316..8ae6a6dac 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -1,29 +1,32 @@ // Includes /*{{{*/ -#include <apt-pkg/error.h> +#include <config.h> + #include <apt-pkg/cachefile.h> -#include <apt-pkg/cachefilter.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/init.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/sourcelist.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/indexfile.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> -#include <apt-pkg/policy.h> -#include <apt-pkg/tagfile.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/sptr.h> #include <apt-pkg/pkgsystem.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/metaindex.h> +#include <apt-pkg/sourcelist.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> -#include <apti18n.h> +#include <apt-private/private-cacheset.h> +#include <apt-private/private-output.h> +#include <apt-private/private-show.h> + +#include <stdio.h> +#include <ostream> +#include <string> -#include "private-output.h" -#include "private-cacheset.h" +#include <apti18n.h> /*}}}*/ namespace APT { @@ -31,8 +34,8 @@ namespace APT { // DisplayRecord - Displays the complete record for the package /*{{{*/ // --------------------------------------------------------------------- -bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, - ostream &out) +static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, + std::ostream &out) { pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) @@ -96,23 +99,23 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, // FIXME: add verbose that does not do the removal of the tags? TFRewriteData RW[] = { // delete, apt-cache show has this info and most users do not care - {"MD5sum", 0}, - {"SHA1", 0}, - {"SHA256", 0}, - {"Filename", 0}, - {"Multi-Arch", 0}, - {"Architecture", 0}, - {"Conffiles",0}, + {"MD5sum", NULL, NULL}, + {"SHA1", NULL, NULL}, + {"SHA256", NULL, NULL}, + {"Filename", NULL, NULL}, + {"Multi-Arch", NULL, NULL}, + {"Architecture", NULL, NULL}, + {"Conffiles", NULL, NULL}, // we use the translated description - {"Description",0}, - {"Description-md5",0}, + {"Description", NULL, NULL}, + {"Description-md5", NULL, NULL}, // improve - {"Installed-Size", installed_size.c_str(), 0}, + {"Installed-Size", installed_size.c_str(), NULL}, {"Size", package_size.c_str(), "Download-Size"}, // add - {"APT-Manual-Installed", manual_installed, 0}, - {"APT-Sources", source_index_file.c_str(), 0}, - {} + {"APT-Manual-Installed", manual_installed, NULL}, + {"APT-Sources", source_index_file.c_str(), NULL}, + {NULL, NULL, NULL} }; if(TFRewrite(stdout, Tags, NULL, RW) == false) @@ -148,8 +151,9 @@ bool ShowPackage(CommandLine &CmdL) /*{{{*/ if (select == APT::VersionList::CANDIDATE) { APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper); - if (verset_all.size() > verset.size()) - _error->Notice(ngettext("There is %lu additional record. Please use the '-a' switch to see it", "There are %lu additional records. Please use the '-a' switch to see them.", verset_all.size() - verset.size()), verset_all.size() - verset.size()); + int const records = verset_all.size() - verset.size(); + if (records > 0) + _error->Notice(P_("There is %i additional record. Please use the '-a' switch to see it", "There are %i additional records. Please use the '-a' switch to see them.", records), records); } for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin(); diff --git a/apt-private/private-show.h b/apt-private/private-show.h index b428c7af0..a15367e28 100644 --- a/apt-private/private-show.h +++ b/apt-private/private-show.h @@ -1,7 +1,7 @@ #ifndef APT_PRIVATE_SHOW_H #define APT_PRIVATE_SHOW_H -#include <apt-pkg/cmndline.h> +class CommandLine; namespace APT { namespace Cmd { diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc index 41cf6b313..301936b9d 100644 --- a/apt-private/private-sources.cc +++ b/apt-private/private-sources.cc @@ -1,10 +1,23 @@ +#include <config.h> #include <apt-pkg/hashes.h> -#include <apti18n.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/sourcelist.h> +#include <apt-pkg/cmndline.h> +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> + +#include <apt-private/private-output.h> +#include <apt-private/private-sources.h> +#include <apt-private/private-utils.h> -#include "private-output.h" -#include "private-sources.h" -#include "private-utils.h" +#include <stddef.h> +#include <unistd.h> +#include <iostream> +#include <string> + +#include <apti18n.h> /* Interface discussion with donkult (for the future): apt [add-{archive,release,component}|edit|change-release|disable]-sources diff --git a/apt-private/private-sources.h b/apt-private/private-sources.h index b394622be..4c58af180 100644 --- a/apt-private/private-sources.h +++ b/apt-private/private-sources.h @@ -1,3 +1,8 @@ -#include <apt-pkg/cmndline.h> +#ifndef APT_PRIVATE_SOURCES_H +#define APT_PRIVATE_SOURCES_H + +class CommandLine; bool EditSources(CommandLine &CmdL); + +#endif diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc index f6c12c26a..da83d7741 100644 --- a/apt-private/private-update.cc +++ b/apt-private/private-update.cc @@ -1,37 +1,23 @@ // Include files /*{{{*/ #include<config.h> -#include <apt-pkg/aptconfiguration.h> -#include <apt-pkg/error.h> -#include <apt-pkg/cmndline.h> -#include <apt-pkg/init.h> -#include <apt-pkg/depcache.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/algorithms.h> #include <apt-pkg/acquire-item.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/clean.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> #include <apt-pkg/cachefile.h> -#include <apt-pkg/cacheset.h> -#include <apt-pkg/sptr.h> -#include <apt-pkg/md5.h> -#include <apt-pkg/versionmatch.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/pkgsystem.h> -#include <apt-pkg/pkgrecords.h> -#include <apt-pkg/indexfile.h> +#include <apt-pkg/cmndline.h> +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/sourcelist.h> #include <apt-pkg/update.h> +#include <apt-pkg/acquire.h> +#include <apt-pkg/configuration.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> +#include <apt-private/acqprogress.h> +#include <apt-private/private-cachefile.h> +#include <apt-private/private-output.h> +#include <apt-private/private-update.h> -#include "private-cachefile.h" -#include "private-output.h" -#include "acqprogress.h" +#include <ostream> +#include <string> #include <apti18n.h> /*}}}*/ diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc index a97e6d25b..68b2c5e00 100644 --- a/apt-private/private-upgrade.cc +++ b/apt-private/private-upgrade.cc @@ -1,12 +1,18 @@ - // Includes /*{{{*/ -#include <apt-pkg/algorithms.h> +#include <config.h> + #include <apt-pkg/upgrade.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/error.h> + +#include <apt-private/private-install.h> +#include <apt-private/private-cachefile.h> +#include <apt-private/private-upgrade.h> +#include <apt-private/private-output.h> + #include <iostream> -#include "private-install.h" -#include "private-cachefile.h" -#include "private-upgrade.h" -#include "private-output.h" + +#include <apti18n.h> /*}}}*/ // this is actually performing the various upgrade operations diff --git a/apt-private/private-upgrade.h b/apt-private/private-upgrade.h index 5efc66bf7..64c4c0874 100644 --- a/apt-private/private-upgrade.h +++ b/apt-private/private-upgrade.h @@ -1,13 +1,11 @@ #ifndef APTPRIVATE_PRIVATE_UPGRADE_H #define APTPRIVATE_PRIVATE_UPGRADE_H -#include <apt-pkg/cmndline.h> - +class CommandLine; bool DoDistUpgrade(CommandLine &CmdL); bool DoUpgrade(CommandLine &CmdL); bool DoUpgradeNoNewPackages(CommandLine &CmdL); bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL); - #endif diff --git a/apt-private/private-utils.cc b/apt-private/private-utils.cc index 813f19329..9547a1b75 100644 --- a/apt-private/private-utils.cc +++ b/apt-private/private-utils.cc @@ -1,9 +1,12 @@ -#include <cstdlib> +#include <config.h> #include <apt-pkg/configuration.h> #include <apt-pkg/fileutl.h> -#include "private-utils.h" +#include <apt-private/private-utils.h> + +#include <cstdlib> +#include <unistd.h> // DisplayFileInPager - Display File with pager /*{{{*/ void DisplayFileInPager(std::string filename) @@ -26,7 +29,6 @@ void DisplayFileInPager(std::string filename) ExecWait(Process, "sensible-pager", false); } /*}}}*/ - // EditFileInSensibleEditor - Edit File with editor /*{{{*/ void EditFileInSensibleEditor(std::string filename) { diff --git a/apt-private/private-utils.h b/apt-private/private-utils.h index 258dd06a8..4bb535e86 100644 --- a/apt-private/private-utils.h +++ b/apt-private/private-utils.h @@ -6,6 +6,4 @@ void DisplayFileInPager(std::string filename); void EditFileInSensibleEditor(std::string filename); - - #endif diff --git a/buildlib/apti18n.h.in b/buildlib/apti18n.h.in index a9d48dd97..2202c5b19 100644 --- a/buildlib/apti18n.h.in +++ b/buildlib/apti18n.h.in @@ -8,7 +8,8 @@ #ifdef USE_NLS // apt will use the gettext implementation of the C library -# include <libintl.h> +#include <libintl.h> +#include <locale.h> # ifdef APT_DOMAIN # define _(x) dgettext(APT_DOMAIN,x) # define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n) diff --git a/buildlib/config.h.in b/buildlib/config.h.in index bd43a40b9..6b72fb393 100644 --- a/buildlib/config.h.in +++ b/buildlib/config.h.in @@ -11,6 +11,9 @@ /* Define if we have the bz2 library for bzip2 */ #undef HAVE_BZ2 +/* Define if we have the lzma library for lzma/xz */ +#undef HAVE_LZMA + /* These two are used by the statvfs shim for glibc2.0 and bsd */ /* Define if we have sys/vfs.h */ #undef HAVE_VFS_H @@ -42,3 +45,4 @@ #define APT_8_CLEANER_HEADERS #define APT_9_CLEANER_HEADERS +#define APT_10_CLEANER_HEADERS diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in index fc859951e..c1bf29672 100644 --- a/buildlib/environment.mak.in +++ b/buildlib/environment.mak.in @@ -7,9 +7,13 @@ PACKAGE_MAIL = @PACKAGE_MAIL@ # C++ compiler options CC = @CC@ -CPPFLAGS+= @CPPFLAGS@ @DEFS@ -D_REENTRANT -Wall +CPPFLAGS+= @CPPFLAGS@ @DEFS@ -D_REENTRANT -D_FORTIFY_SOURCE=2 CXX = @CXX@ -CXXFLAGS+= @CXXFLAGS@ +CXXFLAGS+= @CXXFLAGS@ -Wall -Wextra +CXXFLAGS+= -Wcast-align -Wlogical-op -Wredundant-decls -Wmissing-declarations -Wunsafe-loop-optimizations +CXXFLAGS+= -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn +# a bit too pedantic to be run by default +#CXXFLAGS+= -Wpedantic -Wno-long-long -Wno-vla -Wno-variadic-macros NUM_PROCS = @NUM_PROCS@ # Linker stuff @@ -57,6 +61,7 @@ INTLLIBS = @INTLLIBS@ HAVE_STATVFS = @HAVE_STATVFS@ HAVE_ZLIB = @HAVE_ZLIB@ HAVE_BZ2 = @HAVE_BZ2@ +HAVE_LZMA = @HAVE_LZMA@ NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@ # Shared library things @@ -68,4 +73,3 @@ else # Do not know how to create shared libraries here. ONLYSTATICLIBS = yes endif - diff --git a/buildlib/libversion.mak b/buildlib/libversion.mak index 796c956e7..deb3da377 100644 --- a/buildlib/libversion.mak +++ b/buildlib/libversion.mak @@ -2,9 +2,9 @@ # Version number of libapt-pkg. # Please increase MAJOR with each ABI break, # with each non-ABI break to the lib, please increase RELEASE. -# The versionnumber is extracted from apt-pkg/init.h - see also there. -LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/init.h | sed 's/\.$$//') -LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/init.h | cut -d ' ' -f 3) +# The versionnumber is extracted from apt-pkg/macros.h - see also there. +LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/contrib/macros.h | sed 's/\.$$//') +LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/contrib/macros.h | cut -d ' ' -f 3) # Version number of libapt-inst # Please increase MAJOR with each ABI break, diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index 3ac350aca..c362c1edf 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -10,12 +10,14 @@ // Include files /*{{{*/ #include<config.h> +#include <apt-pkg/acquire.h> #include <apt-pkg/acquire-item.h> #include <apt-pkg/acquire-worker.h> #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> +#include <string.h> #include <stdio.h> #include <signal.h> #include <iostream> diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index b8892d23d..84b775390 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -15,40 +15,49 @@ // Include Files /*{{{*/ #include<config.h> -#include <apt-pkg/error.h> +#include <apt-pkg/algorithms.h> #include <apt-pkg/cachefile.h> #include <apt-pkg/cacheset.h> -#include <apt-pkg/init.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/sourcelist.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/init.h> +#include <apt-pkg/metaindex.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> +#include <apt-pkg/pkgsystem.h> #include <apt-pkg/policy.h> -#include <apt-pkg/tagfile.h> -#include <apt-pkg/algorithms.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/sourcelist.h> #include <apt-pkg/sptr.h> -#include <apt-pkg/pkgsystem.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/metaindex.h> +#include <apt-pkg/srcrecords.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile.h> +#include <apt-pkg/version.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/mmap.h> +#include <apt-pkg/pkgcache.h> -#include <apt-private/private-list.h> -#include <apt-private/private-cmndline.h> -#include <apt-private/private-show.h> #include <apt-private/private-cacheset.h> +#include <apt-private/private-cmndline.h> -#include <cassert> -#include <locale.h> -#include <iostream> -#include <unistd.h> -#include <errno.h> #include <regex.h> +#include <stddef.h> #include <stdio.h> -#include <iomanip> +#include <stdlib.h> +#include <unistd.h> #include <algorithm> +#include <cstring> +#include <iomanip> +#include <iostream> +#include <list> +#include <map> +#include <set> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -58,7 +67,7 @@ using namespace std; // LocalitySort - Sort a version list by package file locality /*{{{*/ // --------------------------------------------------------------------- /* */ -int LocalityCompare(const void *a, const void *b) +static int LocalityCompare(const void *a, const void *b) { pkgCache::VerFile *A = *(pkgCache::VerFile **)a; pkgCache::VerFile *B = *(pkgCache::VerFile **)b; @@ -75,13 +84,13 @@ int LocalityCompare(const void *a, const void *b) return A->File - B->File; } -void LocalitySort(pkgCache::VerFile **begin, +static void LocalitySort(pkgCache::VerFile **begin, unsigned long Count,size_t Size) { qsort(begin,Count,Size,LocalityCompare); } -void LocalitySort(pkgCache::DescFile **begin, +static void LocalitySort(pkgCache::DescFile **begin, unsigned long Count,size_t Size) { qsort(begin,Count,Size,LocalityCompare); @@ -90,7 +99,7 @@ void LocalitySort(pkgCache::DescFile **begin, // UnMet - Show unmet dependencies /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) +static bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) { bool Header = false; for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;) @@ -163,7 +172,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) } return true; } -bool UnMet(CommandLine &CmdL) +static bool UnMet(CommandLine &CmdL) { bool const Important = _config->FindB("APT::Cache::Important",false); @@ -193,7 +202,7 @@ bool UnMet(CommandLine &CmdL) // DumpPackage - Show a dump of a package record /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DumpPackage(CommandLine &CmdL) +static bool DumpPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; APT::CacheSetHelper helper(true, GlobalError::NOTICE); @@ -258,7 +267,7 @@ bool DumpPackage(CommandLine &CmdL) // Stats - Dump some nice statistics /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Stats(CommandLine &Cmd) +static bool Stats(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -371,7 +380,7 @@ bool Stats(CommandLine &Cmd) // Dump - show everything /*{{{*/ // --------------------------------------------------------------------- /* This is worthless except fer debugging things */ -bool Dump(CommandLine &Cmd) +static bool Dump(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -423,7 +432,7 @@ bool Dump(CommandLine &Cmd) // --------------------------------------------------------------------- /* This is needed to make dpkg --merge happy.. I spent a bit of time to make this run really fast, perhaps I went a little overboard.. */ -bool DumpAvail(CommandLine &Cmd) +static bool DumpAvail(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -532,7 +541,7 @@ bool DumpAvail(CommandLine &Cmd) if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource) { pkgTagSection Tags; - TFRewriteData RW[] = {{"Status",0},{"Config-Version",0},{}}; + TFRewriteData RW[] = {{"Status", NULL, NULL},{"Config-Version", NULL, NULL},{NULL, NULL, NULL}}; const char *Zero = 0; if (Tags.Scan(Buffer+Jitter,VF.Size+1) == false || TFRewrite(stdout,Tags,&Zero,RW) == false) @@ -562,7 +571,7 @@ bool DumpAvail(CommandLine &Cmd) } /*}}}*/ // ShowDepends - Helper for printing out a dependency tree /*{{{*/ -bool ShowDepends(CommandLine &CmdL, bool const RevDepends) +static bool ShowDepends(CommandLine &CmdL, bool const RevDepends) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -676,7 +685,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends) // Depends - Print out a dependency tree /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Depends(CommandLine &CmdL) +static bool Depends(CommandLine &CmdL) { return ShowDepends(CmdL, false); } @@ -684,7 +693,7 @@ bool Depends(CommandLine &CmdL) // RDepends - Print out a reverse dependency tree /*{{{*/ // --------------------------------------------------------------------- /* */ -bool RDepends(CommandLine &CmdL) +static bool RDepends(CommandLine &CmdL) { return ShowDepends(CmdL, true); } @@ -693,7 +702,7 @@ bool RDepends(CommandLine &CmdL) // --------------------------------------------------------------------- // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002. -bool XVcg(CommandLine &CmdL) +static bool XVcg(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -905,7 +914,7 @@ bool XVcg(CommandLine &CmdL) /* Dotty is the graphvis program for generating graphs. It is a fairly simple queuing algorithm that just writes dependencies and nodes. http://www.research.att.com/sw/tools/graphviz/ */ -bool Dotty(CommandLine &CmdL) +static bool Dotty(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1109,7 +1118,7 @@ bool Dotty(CommandLine &CmdL) /* This displays the package record from the proper package index file. It is not used by DumpAvail for performance reasons. */ -static unsigned char const* skipDescriptionFields(unsigned char const * DescP) +static APT_PURE unsigned char const* skipDescriptionFields(unsigned char const * DescP) { char const * const TagName = "\nDescription"; size_t const TagLen = strlen(TagName); @@ -1126,7 +1135,7 @@ static unsigned char const* skipDescriptionFields(unsigned char const * DescP) ++DescP; return DescP; } -bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V) +static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V) { pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) @@ -1228,7 +1237,7 @@ struct ExDescFile // Search - Perform a search /*{{{*/ // --------------------------------------------------------------------- /* This searches the package names and package descriptions for a pattern */ -bool Search(CommandLine &CmdL) +static bool Search(CommandLine &CmdL) { bool const ShowFull = _config->FindB("APT::Cache::ShowFull",false); bool const NamesOnly = _config->FindB("APT::Cache::NamesOnly",false); @@ -1388,7 +1397,7 @@ bool Search(CommandLine &CmdL) } /*}}}*/ /* ShowAuto - show automatically installed packages (sorted) {{{*/ -bool ShowAuto(CommandLine &CmdL) +static bool ShowAuto(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1415,7 +1424,7 @@ bool ShowAuto(CommandLine &CmdL) // ShowPackage - Dump the package record to the screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowPackage(CommandLine &CmdL) +static bool ShowPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); @@ -1439,7 +1448,7 @@ bool ShowPackage(CommandLine &CmdL) // ShowPkgNames - Show package names /*{{{*/ // --------------------------------------------------------------------- /* This does a prefix match on the first argument */ -bool ShowPkgNames(CommandLine &CmdL) +static bool ShowPkgNames(CommandLine &CmdL) { pkgCacheFile CacheFile; if (unlikely(CacheFile.BuildCaches(NULL, false) == false)) @@ -1478,7 +1487,7 @@ bool ShowPkgNames(CommandLine &CmdL) // ShowSrcPackage - Show source package records /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowSrcPackage(CommandLine &CmdL) +static bool ShowSrcPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgSourceList *List = CacheFile.GetSourceList(); @@ -1515,7 +1524,7 @@ bool ShowSrcPackage(CommandLine &CmdL) // Policy - Show the results of the preferences file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Policy(CommandLine &CmdL) +static bool Policy(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1644,7 +1653,7 @@ bool Policy(CommandLine &CmdL) // Madison - Look a bit like katie's madison /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Madison(CommandLine &CmdL) +static bool Madison(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgSourceList *SrcList = CacheFile.GetSourceList(); @@ -1717,7 +1726,7 @@ bool Madison(CommandLine &CmdL) // GenCaches - Call the main cache generator /*{{{*/ // --------------------------------------------------------------------- /* */ -bool GenCaches(CommandLine &Cmd) +static bool GenCaches(CommandLine &) { OpTextProgress Progress(*_config); @@ -1728,7 +1737,7 @@ bool GenCaches(CommandLine &Cmd) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &Cmd) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 20c6e8892..53efe65b8 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -20,33 +20,20 @@ #include <apt-pkg/progress.h> #include <apt-pkg/cdromutl.h> #include <apt-pkg/strutl.h> -#include <apt-pkg/acquire.h> -#include <apt-pkg/acquire-item.h> #include <apt-pkg/cdrom.h> #include <apt-pkg/configuration.h> #include <apt-pkg/pkgsystem.h> -#include <locale.h> #include <iostream> -#include <fstream> #include <vector> -#include <algorithm> +#include <string> #include <sys/stat.h> -#include <fcntl.h> -#include <dirent.h> #include <unistd.h> -#include <stdio.h> #include <apt-private/private-cmndline.h> #include <apti18n.h> /*}}}*/ -static const char *W_NO_CDROM_FOUND = \ - N_("No CD-ROM could be auto-detected or found using " - "the default mount point.\n" - "You may try the --cdrom option to set the CD-ROM mount point. " - "See 'man apt-cdrom' for more " - "information about the CD-ROM auto-detection and mount point."); using namespace std; @@ -54,7 +41,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/ { protected: OpTextProgress Progress; - void Prompt(const char *Text); + void Prompt(const char *Text); string PromptLine(const char *Text); bool AskCdromName(string &name); @@ -64,12 +51,12 @@ public: virtual OpProgress* GetOpProgress(); }; -void pkgCdromTextStatus::Prompt(const char *Text) +void pkgCdromTextStatus::Prompt(const char *Text) { char C; cout << Text << ' ' << flush; if (read(STDIN_FILENO,&C,1) < 0) - _error->Errno("pkgCdromTextStatus::Prompt", + _error->Errno("pkgCdromTextStatus::Prompt", "Failed to read from standard input (not a terminal?)"); if (C != '\n') cout << endl; @@ -78,176 +65,144 @@ void pkgCdromTextStatus::Prompt(const char *Text) string pkgCdromTextStatus::PromptLine(const char *Text) { cout << Text << ':' << endl; - + string Res; getline(cin,Res); return Res; } -bool pkgCdromTextStatus::AskCdromName(string &name) +bool pkgCdromTextStatus::AskCdromName(string &name) { cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush; name = PromptLine(""); - + return true; } - -void pkgCdromTextStatus::Update(string text, int current) + +void pkgCdromTextStatus::Update(string text, int /*current*/) { if(text.size() > 0) cout << text << flush; } -bool pkgCdromTextStatus::ChangeCdrom() +bool pkgCdromTextStatus::ChangeCdrom() { Prompt(_("Please insert a Disc in the drive and press enter")); return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() -{ - return &Progress; -}; - /*}}}*/ -// SetupAutoDetect /*{{{*/ -bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) +APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress() { - bool Debug = _config->FindB("Debug::Acquire::cdrom", false); - - automounted = false; - - vector<struct CdromDevice> v = UdevCdroms.Scan(); - if (i >= v.size()) - return false; - - if (Debug) - clog << "Looking at devce " << i - << " DeviveName: " << v[i].DeviceName - << " IsMounted: '" << v[i].Mounted << "'" - << " MountPoint: '" << v[i].MountPath << "'" - << endl; - - if (v[i].Mounted) - { - // set the right options - _config->Set("Acquire::cdrom::mount", v[i].MountPath); - _config->Set("APT::CDROM::NoMount", true); - } else { - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - if (!FileExists(AptMountPoint)) - mkdir(AptMountPoint.c_str(), 0750); - if(MountCdrom(AptMountPoint, v[i].DeviceName) == false) - _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str()); - else - automounted = true; - _config->Set("Acquire::cdrom::mount", AptMountPoint); - _config->Set("APT::CDROM::NoMount", true); - } - i++; - - return true; + return &Progress; } /*}}}*/ -// DoAdd - Add a new CDROM /*{{{*/ -// --------------------------------------------------------------------- -/* This does the main add bit.. We show some status and things. The - sequence is to mount/umount the CD, Ident it then scan it for package - files and reduce that list. Then we copy over the package files and - verify them. Then rewrite the database files */ -bool DoAdd(CommandLine &) +// AddOrIdent - Add or Ident a CDROM /*{{{*/ +static bool AddOrIdent(bool const Add) { pkgUdevCdromDevices UdevCdroms; pkgCdromTextStatus log; pkgCdrom cdrom; - bool res = true; + bool oneSuccessful = false; bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); - unsigned int count = 0; - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - bool automounted = false; - if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count, automounted)) { - if (count == 1) { - // begin loop with res false to detect any success using OR - res = false; + if (AutoDetect == true && UdevCdroms.Dlopen() == true) + { + bool const Debug = _config->FindB("Debug::Acquire::cdrom", false); + std::string const CDMount = _config->Find("Acquire::cdrom::mount"); + bool const NoMount = _config->FindB("APT::CDROM::NoMount", false); + if (NoMount == false) + _config->Set("APT::CDROM::NoMount", true); + + vector<struct CdromDevice> const v = UdevCdroms.Scan(); + for (std::vector<struct CdromDevice>::const_iterator cd = v.begin(); cd != v.end(); ++cd) + { + if (Debug) + clog << "Looking at device:" + << "\tDeviveName: '" << cd->DeviceName << "'" + << "\tIsMounted: '" << cd->Mounted << "'" + << "\tMountPoint: '" << cd->MountPath << "'" + << endl; + + std::string AptMountPoint; + if (cd->Mounted) + _config->Set("Acquire::cdrom::mount", cd->MountPath); + else if (NoMount == true) + continue; + else + { + AptMountPoint = _config->FindDir("Dir::Media::MountPath"); + if (FileExists(AptMountPoint) == false) + mkdir(AptMountPoint.c_str(), 0750); + if(MountCdrom(AptMountPoint, cd->DeviceName) == false) + { + _error->Warning(_("Failed to mount '%s' to '%s'"), cd->DeviceName.c_str(), AptMountPoint.c_str()); + continue; + } + _config->Set("Acquire::cdrom::mount", AptMountPoint); } - // dump any warnings/errors from autodetect - if (_error->empty() == false) - _error->DumpErrors(); - - res |= cdrom.Add(&log); + _error->PushToStack(); + if (Add == true) + oneSuccessful = cdrom.Add(&log); + else + { + std::string id; + oneSuccessful = cdrom.Ident(id, &log); + } + _error->MergeWithStack(); - if (automounted) + if (AptMountPoint.empty() == false) UnmountCdrom(AptMountPoint); - - // dump any warnings/errors from add/unmount - if (_error->empty() == false) - _error->DumpErrors(); } + if (NoMount == false) + _config->Set("APT::CDROM::NoMount", NoMount); + _config->Set("Acquire::cdrom::mount", CDMount); + } - if (count == 0) - res = cdrom.Add(&log); + // fallback if auto-detect didn't work + if (oneSuccessful == false) + { + _error->PushToStack(); + if (Add == true) + oneSuccessful = cdrom.Add(&log); + else + { + std::string id; + oneSuccessful = cdrom.Ident(id, &log); + } + _error->MergeWithStack(); + } - if (res == false) - _error->Error("%s", _(W_NO_CDROM_FOUND)); - else + if (oneSuccessful == false) + _error->Error("%s", _("No CD-ROM could be auto-detected or found using the default mount point.\n" + "You may try the --cdrom option to set the CD-ROM mount point.\n" + "See 'man apt-cdrom' for more information about the CD-ROM auto-detection and mount point.")); + else if (Add == true) cout << _("Repeat this process for the rest of the CDs in your set.") << endl; - return res; + return oneSuccessful; } /*}}}*/ -// DoIdent - Ident a CDROM /*{{{*/ +// DoAdd - Add a new CDROM /*{{{*/ // --------------------------------------------------------------------- -/* */ -bool DoIdent(CommandLine &) +/* This does the main add bit.. We show some status and things. The + sequence is to mount/umount the CD, Ident it then scan it for package + files and reduce that list. Then we copy over the package files and + verify them. Then rewrite the database files */ +static bool DoAdd(CommandLine &) { - pkgUdevCdromDevices UdevCdroms; - string ident; - pkgCdromTextStatus log; - pkgCdrom cdrom; - bool res = true; - - bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); - - unsigned int count = 0; - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - bool automounted = false; - if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count, automounted)) { - if (count == 1) { - // begin loop with res false to detect any success using OR - res = false; - } - - // dump any warnings/errors from autodetect - if (_error->empty() == false) - _error->DumpErrors(); - - res |= cdrom.Ident(ident, &log); - - if (automounted) - UnmountCdrom(AptMountPoint); - - // dump any warnings/errors from add/unmount - if (_error->empty() == false) - _error->DumpErrors(); - } - - if (count == 0) - res = cdrom.Ident(ident, &log); - - if (res == false) - _error->Error("%s", _(W_NO_CDROM_FOUND)); - - return res; + return AddOrIdent(true); +} + /*}}}*/ +// DoIdent - Ident a CDROM /*{{{*/ +static bool DoIdent(CommandLine &) +{ + return AddOrIdent(false); } /*}}}*/ // ShowHelp - Show the help screen /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool ShowHelp(CommandLine &) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -313,14 +268,12 @@ int main(int argc,const char *argv[]) /*{{{*/ _config->Set("quiet","1"); // Match the operation - CmdL.DispatchArg(Cmds); + bool returned = CmdL.DispatchArg(Cmds); - // Print any errors or warnings found during parsing - bool const Errors = _error->PendingError(); if (_config->FindI("quiet",0) > 0) _error->DumpErrors(); else _error->DumpErrors(GlobalError::DEBUG); - return Errors == true ? 100 : 0; + return returned == true ? 0 : 100; } /*}}}*/ diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 30c2a22d5..40ba468eb 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -26,10 +26,10 @@ #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/pkgsystem.h> -#include <locale.h> #include <iostream> #include <string> #include <vector> +#include <string.h> #include <apt-private/private-cmndline.h> @@ -40,7 +40,7 @@ using namespace std; // DoShell - Handle the shell command /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoShell(CommandLine &CmdL) +static bool DoShell(CommandLine &CmdL) { for (const char **I = CmdL.FileList + 1; *I != 0; I += 2) { @@ -63,7 +63,7 @@ bool DoShell(CommandLine &CmdL) // DoDump - Dump the configuration space /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoDump(CommandLine &CmdL) +static bool DoDump(CommandLine &CmdL) { bool const empty = _config->FindB("APT::Config::Dump::EmptyValue", true); std::string const format = _config->Find("APT::Config::Dump::Format", "%f \"%v\";\n"); @@ -78,7 +78,7 @@ bool DoDump(CommandLine &CmdL) // ShowHelp - Show the help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -108,7 +108,7 @@ int main(int argc,const char *argv[]) /*{{{*/ {"help",&ShowHelp}, {0,0}}; - std::vector<CommandLine::Args> Args = getCommandArgs("apt-cdrom", CommandLine::GetCommand(Cmds, argc, argv)); + std::vector<CommandLine::Args> Args = getCommandArgs("apt-config", CommandLine::GetCommand(Cmds, argc, argv)); // Set up gettext support setlocale(LC_ALL,""); @@ -155,6 +155,11 @@ int main(int argc,const char *argv[]) /*{{{*/ _config->Set(comp + "UncompressArg::", *a); } + std::vector<std::string> const profiles = APT::Configuration::getBuildProfiles(); + _config->Clear("APT::Build-Profiles"); + for (std::vector<std::string>::const_iterator p = profiles.begin(); p != profiles.end(); ++p) + _config->Set("APT::Build-Profiles::", *p); + // Match the operation CmdL.DispatchArg(Cmds); diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index aa16b1271..04e13bde9 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -9,16 +9,18 @@ // Include Files /*{{{*/ #include <apt-pkg/edsp.h> -#include <config.h> - +#include <string.h> +#include <unistd.h> #include <cstdio> #include <iostream> + +#include <config.h> /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp() { +static bool ShowHelp() { std::cout << PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl << diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 2408a7d9d..a82623444 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -18,8 +18,8 @@ #include <apt-pkg/init.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/progress.h> #include <apt-pkg/sourcelist.h> #include <apt-pkg/pkgcachegen.h> #include <apt-pkg/version.h> @@ -30,14 +30,13 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/pkgsystem.h> +#include <apt-pkg/dirstream.h> +#include <apt-pkg/mmap.h> +#include <iostream> #include <stdio.h> #include <string.h> -#include <stdlib.h> #include <unistd.h> -#include <locale.h> - -#include <fstream> #include "apt-extracttemplates.h" @@ -137,7 +136,7 @@ bool DebFile::DoItem(Item &I, int &Fd) // DebFile::Process examine element in package and copy /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DebFile::Process(Item &I, const unsigned char *data, +bool DebFile::Process(Item &/*I*/, const unsigned char *data, unsigned long size, unsigned long pos) { switch (Which) @@ -212,7 +211,7 @@ bool DebFile::ParseInfo() // ShowHelp - show a short help text /*{{{*/ // --------------------------------------------------------------------- /* */ -int ShowHelp(void) +static int ShowHelp(void) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -237,7 +236,7 @@ int ShowHelp(void) // WriteFile - write the contents of the passed string to a file /*{{{*/ // --------------------------------------------------------------------- /* */ -string WriteFile(const char *package, const char *prefix, const char *data) +static string WriteFile(const char *package, const char *prefix, const char *data) { char fn[512]; static int i; @@ -265,7 +264,7 @@ string WriteFile(const char *package, const char *prefix, const char *data) // WriteConfig - write out the config data from a debian package file /*{{{*/ // --------------------------------------------------------------------- /* */ -void WriteConfig(const DebFile &file) +static void WriteConfig(const DebFile &file) { string templatefile = WriteFile(file.Package.c_str(), "template", file.Template); string configscript = WriteFile(file.Package.c_str(), "config", file.Config); @@ -279,7 +278,7 @@ void WriteConfig(const DebFile &file) // InitCache - initialize the package cache /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Go(CommandLine &CmdL) +static bool Go(CommandLine &CmdL) { // Initialize the apt cache MMap *Map = 0; diff --git a/cmdline/apt-extracttemplates.h b/cmdline/apt-extracttemplates.h index 6d07a09c2..9cc3f5f25 100644 --- a/cmdline/apt-extracttemplates.h +++ b/cmdline/apt-extracttemplates.h @@ -11,11 +11,12 @@ #define _APTEXTRACTTEMPLATE_H_ #include <apt-pkg/fileutl.h> -#include <apt-pkg/pkgcache.h> #include <apt-pkg/dirstream.h> #include <string> +class pkgCache; + class DebFile : public pkgDirStream { FileFd File; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 12e385b69..caf69da2a 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -27,66 +27,67 @@ // Include Files /*{{{*/ #include <config.h> +#include <apt-pkg/acquire-item.h> +#include <apt-pkg/algorithms.h> #include <apt-pkg/aptconfiguration.h> -#include <apt-pkg/error.h> +#include <apt-pkg/cachefile.h> +#include <apt-pkg/cacheset.h> +#include <apt-pkg/clean.h> #include <apt-pkg/cmndline.h> -#include <apt-pkg/init.h> +#include <apt-pkg/debmetaindex.h> #include <apt-pkg/depcache.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/acquire-item.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/clean.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> -#include <apt-pkg/cachefile.h> -#include <apt-pkg/cacheset.h> -#include <apt-pkg/sptr.h> +#include <apt-pkg/indexfile.h> +#include <apt-pkg/indexrecords.h> +#include <apt-pkg/init.h> #include <apt-pkg/md5.h> -#include <apt-pkg/versionmatch.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/pkgsystem.h> +#include <apt-pkg/metaindex.h> #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/indexfile.h> +#include <apt-pkg/pkgsystem.h> +#include <apt-pkg/progress.h> +#include <apt-pkg/sourcelist.h> +#include <apt-pkg/srcrecords.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/version.h> +#include <apt-pkg/acquire.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> #include <apt-pkg/upgrade.h> -#include <apt-pkg/metaindex.h> -#include <apt-pkg/indexrecords.h> +#include <apt-private/acqprogress.h> +#include <apt-private/private-cacheset.h> +#include <apt-private/private-cachefile.h> +#include <apt-private/private-cmndline.h> #include <apt-private/private-download.h> #include <apt-private/private-install.h> -#include <apt-private/private-upgrade.h> +#include <apt-private/private-main.h> +#include <apt-private/private-moo.h> #include <apt-private/private-output.h> -#include <apt-private/private-cacheset.h> #include <apt-private/private-update.h> -#include <apt-private/private-cmndline.h> -#include <apt-private/private-moo.h> +#include <apt-private/private-upgrade.h> #include <apt-private/private-utils.h> -#include <apt-pkg/debmetaindex.h> - -#include <apt-private/acqprogress.h> - -#include <set> -#include <fstream> -#include <sstream> - -#include <locale.h> -#include <langinfo.h> -#include <termios.h> +#include <errno.h> +#include <signal.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/statfs.h> #include <sys/statvfs.h> -#include <signal.h> -#include <unistd.h> -#include <stdio.h> -#include <errno.h> -#include <regex.h> #include <sys/wait.h> - -#include <apt-private/private-output.h> -#include <apt-private/private-main.h> +#include <unistd.h> +#include <algorithm> +#include <fstream> +#include <iostream> +#include <set> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -97,7 +98,7 @@ using namespace std; // --------------------------------------------------------------------- /* This used to be inlined in DoInstall, but with the advent of regex package name matching it was split out.. */ -bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, +static bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, pkgProblemResolver &Fix,bool Remove,bool BrokenFix, bool AllowFail = true) { @@ -138,7 +139,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, // helper that can go wit hthe next ABI break #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) -std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) +static std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) { // FIXME: this cast is the horror, the horror debReleaseIndex *r = (debReleaseIndex*)metaindex; @@ -159,7 +160,7 @@ std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) // GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/ // --------------------------------------------------------------------- /* */ -std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, +static std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, pkgSrcRecords::Parser *Parse) { // try to find release @@ -194,7 +195,7 @@ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, // FindSrc - Find a source record /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, +static pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords &SrcRecs,string &Src, CacheFile &CacheFile) { @@ -430,7 +431,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, } /*}}}*/ /* mark packages as automatically/manually installed. {{{*/ -bool DoMarkAuto(CommandLine &CmdL) +static bool DoMarkAuto(CommandLine &CmdL) { bool Action = true; int AutoMarkChanged = 0; @@ -475,7 +476,7 @@ bool DoMarkAuto(CommandLine &CmdL) // DoDSelectUpgrade - Do an upgrade by following dselects selections /*{{{*/ // --------------------------------------------------------------------- /* Follows dselect's selections */ -bool DoDSelectUpgrade(CommandLine &CmdL) +static bool DoDSelectUpgrade(CommandLine &) { CacheFile Cache; if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false) @@ -551,7 +552,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) // DoClean - Remove download archives /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoClean(CommandLine &CmdL) +static bool DoClean(CommandLine &) { std::string const archivedir = _config->FindDir("Dir::Cache::archives"); std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache"); @@ -599,7 +600,7 @@ class LogCleaner : public pkgArchiveCleaner }; }; -bool DoAutoClean(CommandLine &CmdL) +static bool DoAutoClean(CommandLine &) { // Lock the archive directory FileFd Lock; @@ -623,7 +624,7 @@ bool DoAutoClean(CommandLine &CmdL) /*}}}*/ // DoDownload - download a binary /*{{{*/ // --------------------------------------------------------------------- -bool DoDownload(CommandLine &CmdL) +static bool DoDownload(CommandLine &CmdL) { CacheFile Cache; if (Cache.ReadOnlyOpen() == false) @@ -696,7 +697,7 @@ bool DoDownload(CommandLine &CmdL) // --------------------------------------------------------------------- /* Opening automatically checks the system, this command is mostly used for debugging */ -bool DoCheck(CommandLine &CmdL) +static bool DoCheck(CommandLine &) { CacheFile Cache; Cache.Open(); @@ -715,7 +716,7 @@ struct DscFile string Dsc; }; -bool DoSource(CommandLine &CmdL) +static bool DoSource(CommandLine &CmdL) { CacheFile Cache; if (Cache.Open(false) == false) @@ -740,7 +741,7 @@ bool DoSource(CommandLine &CmdL) pkgAcquire Fetcher; Fetcher.SetLog(&Stat); - DscFile *Dsc = new DscFile[CmdL.FileSize()]; + SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()]; // insert all downloaded uris into this set to avoid downloading them // twice @@ -761,7 +762,6 @@ bool DoSource(CommandLine &CmdL) pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache); if (Last == 0) { - delete[] Dsc; return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); } @@ -795,7 +795,6 @@ bool DoSource(CommandLine &CmdL) // Back track vector<pkgSrcRecords::File> Lst; if (Last->Files(Lst) == false) { - delete[] Dsc; return false; } @@ -858,7 +857,6 @@ bool DoSource(CommandLine &CmdL) struct statvfs Buf; string OutputDir = "."; if (statvfs(OutputDir.c_str(),&Buf) != 0) { - delete[] Dsc; if (errno == EOVERFLOW) return _error->WarningE("statvfs",_("Couldn't determine free space in %s"), OutputDir.c_str()); @@ -873,7 +871,6 @@ bool DoSource(CommandLine &CmdL) || unsigned(Stat.f_type) != RAMFS_MAGIC #endif ) { - delete[] Dsc; return _error->Error(_("You don't have enough free space in %s"), OutputDir.c_str()); } @@ -895,7 +892,6 @@ bool DoSource(CommandLine &CmdL) { for (unsigned I = 0; I != J; I++) ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str()); - delete[] Dsc; return true; } @@ -906,7 +902,6 @@ bool DoSource(CommandLine &CmdL) for (; I != Fetcher.UriEnd(); ++I) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; - delete[] Dsc; return true; } @@ -914,14 +909,12 @@ bool DoSource(CommandLine &CmdL) bool Failed = false; if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true) { - delete[] Dsc; return _error->Error(_("Failed to fetch some archives.")); } if (_config->FindB("APT::Get::Download-only",false) == true) { c1out << _("Download complete and in download only mode") << endl; - delete[] Dsc; return true; } @@ -970,6 +963,12 @@ bool DoSource(CommandLine &CmdL) string buildopts = _config->Find("APT::Get::Host-Architecture"); if (buildopts.empty() == false) buildopts = "-a" + buildopts + " "; + + // get all active build profiles + std::string const profiles = APT::Configuration::getBuildProfilesString(); + if (profiles.empty() == false) + buildopts.append(" -P").append(profiles).append(" "); + buildopts.append(_config->Find("DPkg::Build-Options","-b -uc")); // Call dpkg-buildpackage @@ -989,7 +988,6 @@ bool DoSource(CommandLine &CmdL) _exit(0); } - delete[] Dsc; // Wait for the subprocess int Status = 0; @@ -1010,7 +1008,7 @@ bool DoSource(CommandLine &CmdL) // --------------------------------------------------------------------- /* This function will look at the build depends list of the given source package and install the necessary packages to make it true, or fail. */ -bool DoBuildDep(CommandLine &CmdL) +static bool DoBuildDep(CommandLine &CmdL) { CacheFile Cache; @@ -1404,7 +1402,7 @@ bool DoBuildDep(CommandLine &CmdL) * pool/ next to the deb itself) * Example return: "pool/main/a/apt/apt_0.8.8ubuntu3" */ -string GetChangelogPath(CacheFile &Cache, +static string GetChangelogPath(CacheFile &Cache, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver) { @@ -1431,7 +1429,7 @@ string GetChangelogPath(CacheFile &Cache, * apt-get changelog mplayer-doc: * http://packages.medibuntu.org/pool/non-free/m/mplayer/mplayer_1.0~rc4~try1.dsfg1-1ubuntu1+medibuntu1.changelog */ -bool GuessThirdPartyChangelogUri(CacheFile &Cache, +static bool GuessThirdPartyChangelogUri(CacheFile &Cache, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver, string &out_uri) @@ -1456,7 +1454,7 @@ bool GuessThirdPartyChangelogUri(CacheFile &Cache, /*}}}*/ // DownloadChangelog - Download the changelog /*{{{*/ // --------------------------------------------------------------------- -bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, +static bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, pkgCache::VerIterator Ver, string targetfile) /* Download a changelog file for the given package version to * targetfile. This will first try the server from Apt::Changelogs::Server @@ -1511,7 +1509,7 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, /*}}}*/ // DoChangelog - Get changelog from the command line /*{{{*/ // --------------------------------------------------------------------- -bool DoChangelog(CommandLine &CmdL) +static bool DoChangelog(CommandLine &CmdL) { CacheFile Cache; if (Cache.ReadOnlyOpen() == false) @@ -1575,7 +1573,7 @@ bool DoChangelog(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -1671,7 +1669,7 @@ bool ShowHelp(CommandLine &CmdL) // SigWinch - Window size change signal handler /*{{{*/ // --------------------------------------------------------------------- /* */ -void SigWinch(int) +static void SigWinch(int) { // Riped from GNU ls #ifdef TIOCGWINSZ diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index e3652d1ee..2c1107d90 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -7,6 +7,7 @@ // Include Files /*{{{*/ #include <config.h> +#include <apt-pkg/configuration.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/error.h> #include <apt-pkg/init.h> @@ -18,22 +19,17 @@ #include <apt-private/acqprogress.h> #include <apt-private/private-output.h> +#include <apt-private/private-download.h> #include <apt-private/private-cmndline.h> -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <fcntl.h> - - +#include <iostream> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ -using namespace std; -bool DoDownloadFile(CommandLine &CmdL) +static bool DoDownloadFile(CommandLine &CmdL) { if (CmdL.FileSize() <= 2) return _error->Error(_("Must specify at least one pair url/filename")); @@ -44,38 +40,28 @@ bool DoDownloadFile(CommandLine &CmdL) Fetcher.Setup(&Stat); std::string download_uri = CmdL.FileList[1]; std::string targetfile = CmdL.FileList[2]; - HashString hash; + std::string hash; if (CmdL.FileSize() > 3) - hash = HashString(CmdL.FileList[3]); - new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc", + hash = CmdL.FileList[3]; + new pkgAcqFile(&Fetcher, download_uri, hash, 0, "desc", "short-desc", "dest-dir-ignored", targetfile); Fetcher.Run(); - if (!FileExists(targetfile)) - { - _error->Error(_("Download Failed")); - return false; - } - if(hash.empty() == false) - { - if(hash.VerifyFile(targetfile) == false) - { - _error->Error(_("HashSum Failed")); - Rename(targetfile, targetfile+".failed"); - return false; - } - } + bool Failed = false; + if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true || + FileExists(targetfile) == false) + return _error->Error(_("Download Failed")); return true; } -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, + ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) return true; - cout << + std::cout << _("Usage: apt-helper [options] command\n" " apt-helper [options] download-file uri target-path\n" "\n" diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index bf5b8c1fe..b85c07c33 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -20,7 +20,15 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/upgrade.h> - +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/cacheiterators.h> + +#include <string.h> +#include <iostream> +#include <list> +#include <string> #include <unistd.h> #include <cstdio> @@ -30,7 +38,7 @@ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) { +static bool ShowHelp(CommandLine &) { ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index d3a3a780b..ed348358a 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -11,20 +11,31 @@ #include <apt-pkg/cacheset.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> #include <apt-pkg/init.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/pkgsystem.h> -#include <apt-pkg/fileutl.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/cacheiterators.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/depcache.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/pkgcache.h> + +#include <apt-private/private-cmndline.h> -#include <algorithm> #include <errno.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/wait.h> #include <fcntl.h> - -#include <apt-private/private-cmndline.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <unistd.h> +#include <algorithm> +#include <fstream> +#include <iostream> +#include <string> +#include <vector> #include <apti18n.h> /*}}}*/ @@ -35,7 +46,7 @@ ostream c1out(0); ostream c2out(0); ofstream devnull("/dev/null"); /* DoAuto - mark packages as automatically/manually installed {{{*/ -bool DoAuto(CommandLine &CmdL) +static bool DoAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -82,7 +93,7 @@ bool DoAuto(CommandLine &CmdL) /* DoMarkAuto - mark packages as automatically/manually installed {{{*/ /* Does the same as DoAuto but tries to do it exactly the same why as the python implementation did it so it can be a drop-in replacement */ -bool DoMarkAuto(CommandLine &CmdL) +static bool DoMarkAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -119,7 +130,7 @@ bool DoMarkAuto(CommandLine &CmdL) } /*}}}*/ /* ShowAuto - show automatically installed packages (sorted) {{{*/ -bool ShowAuto(CommandLine &CmdL) +static bool ShowAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -159,7 +170,7 @@ bool ShowAuto(CommandLine &CmdL) } /*}}}*/ /* DoHold - mark packages as hold by dpkg {{{*/ -bool DoHold(CommandLine &CmdL) +static bool DoHold(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -335,7 +346,7 @@ bool DoHold(CommandLine &CmdL) } /*}}}*/ /* ShowHold - show packages set on hold in dpkg status {{{*/ -bool ShowHold(CommandLine &CmdL) +static bool ShowHold(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -372,7 +383,7 @@ bool ShowHold(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 46989044e..c2b11890a 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -25,9 +25,9 @@ #include <vector> #include <algorithm> - -#include <locale.h> -#include <unistd.h> +#include <stdio.h> +#include <iostream> +#include <string> #include <apti18n.h> /*}}}*/ @@ -62,7 +62,7 @@ struct PkgName /*{{{*/ // DoIt - Sort a single file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoIt(string InFile) +static bool DoIt(string InFile) { FileFd Fd(InFile,FileFd::ReadOnly); pkgTagFile Tags(&Fd); @@ -142,7 +142,7 @@ bool DoIt(string InFile) // ShowHelp - Show the help text /*{{{*/ // --------------------------------------------------------------------- /* */ -int ShowHelp() +static int ShowHelp() { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 7ef9060aa..5dbf868d7 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -11,39 +11,12 @@ // Include Files /*{{{*/ #include<config.h> -#include <cassert> -#include <locale.h> -#include <iostream> -#include <unistd.h> -#include <errno.h> -#include <regex.h> -#include <stdio.h> -#include <iomanip> -#include <algorithm> - - +#include <apt-pkg/cmndline.h> #include <apt-pkg/error.h> -#include <apt-pkg/cachefile.h> -#include <apt-pkg/cacheset.h> #include <apt-pkg/init.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/sourcelist.h> -#include <apt-pkg/cmndline.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/pkgrecords.h> -#include <apt-pkg/srcrecords.h> -#include <apt-pkg/version.h> -#include <apt-pkg/policy.h> -#include <apt-pkg/tagfile.h> -#include <apt-pkg/algorithms.h> -#include <apt-pkg/sptr.h> #include <apt-pkg/pkgsystem.h> -#include <apt-pkg/indexfile.h> -#include <apt-pkg/metaindex.h> -#include <apt-pkg/hashes.h> - -#include <apti18n.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/configuration.h> #include <apt-private/private-list.h> #include <apt-private/private-search.h> @@ -55,13 +28,16 @@ #include <apt-private/private-upgrade.h> #include <apt-private/private-show.h> #include <apt-private/private-main.h> -#include <apt-private/private-utils.h> #include <apt-private/private-sources.h> - /*}}}*/ +#include <unistd.h> +#include <iostream> +#include <vector> +#include <apti18n.h> + /*}}}*/ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/configure.ac b/configure.ac index 40556ee54..4f782f873 100644 --- a/configure.ac +++ b/configure.ac @@ -107,6 +107,13 @@ if test "x$HAVE_BZ2" = "xyes"; then AC_DEFINE(HAVE_BZ2) fi +HAVE_LZMA=no +AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], []) +AC_SUBST(HAVE_LZMA) +if test "x$HAVE_LZMA" = "xyes"; then + AC_DEFINE(HAVE_LZMA) +fi + dnl Converts the ARCH to be something singular for this general CPU family dnl This is often the dpkg architecture string. dnl First check against the full canonical canoncial-system-type in $target diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index d105f440a..0c5158658 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -1,5 +1,4 @@ #!/bin/sh - set -e # Author: Steve Langasek <steve.langasek@canonical.com> @@ -42,7 +41,7 @@ version_test_gt () return "$?" } -list=$(${DPKG} -l 'linux-image-[0-9]*'|awk '/^ii/ && $2 !~ /-dbg$/ { print $2 }' | sed -e's/linux-image-//') +list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]*/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')" latest_version="" previous_version="" @@ -64,30 +63,23 @@ then previous_version= fi -kernels=$(sort -u <<EOF -$latest_version +kernels="$(echo "$latest_version $installed_version $running_version -$previous_version -EOF -) +$previous_version" | sort -u | sed -e 's#\.#\\.#g' )" -cat > "$config_file".dpkg-new <<EOF -// File autogenerated by $0, do not edit -APT +generateconfig() { + cat <<EOF +// DO NOT EDIT! File autogenerated by $0 +APT::NeverAutoRemove { - NeverAutoRemove - { EOF -for kernel in $kernels; do - echo " \"^linux-image-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-image-extra-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-signed-image-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-backports-modules-.*-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-headers-${kernel}$\";" >> "$config_file".dpkg-new -done -cat >> "$config_file".dpkg-new <<EOF - }; -}; -EOF -mv "$config_file".dpkg-new "$config_file" + apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages' | while read package; do + for kernel in $kernels; do + echo " \"^${package}-${kernel}$\";" + done + done + echo '};' +} +generateconfig > "${config_file}.dpkg-new" +mv "${config_file}.dpkg-new" "$config_file" diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove index 9684c9c7d..cf69d56c3 100644 --- a/debian/apt.conf.autoremove +++ b/debian/apt.conf.autoremove @@ -4,9 +4,24 @@ APT { "^firmware-linux.*"; "^linux-firmware$"; - "^kfreebsd-image.*"; - "^gnumach$"; - "^gnumach-image.*"; + }; + + VersionedKernelPackages + { + # linux kernels + "linux-image"; + "linux-headers"; + "linux-image-extra"; + "linux-signed-image"; + # kfreebsd kernels + "kfreebsd-image"; + "kfreebsd-headers"; + # hurd kernels + "gnumach-image"; + # (out-of-tree) modules + ".*-modules"; + ".*-kernel"; + "linux-backports-modules-.*"; }; Never-MarkAuto-Sections diff --git a/debian/control b/debian/control index 2d58d0711..cb6f9b995 100644 --- a/debian/control +++ b/debian/control @@ -7,8 +7,9 @@ Uploaders: Michael Vogt <mvo@debian.org>, Christian Perrier <bubulle@debian.org> Standards-Version: 3.9.5 Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), - zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml, - po4a (>= 0.34-2), autotools-dev, autoconf, automake + zlib1g-dev, libbz2-dev, liblzma-dev, + xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), + autotools-dev, autoconf, automake Build-Depends-Indep: doxygen, debiandoc-sgml, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: git://anonscm.debian.org/apt/apt.git @@ -21,7 +22,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${apt:keyring}, gnupg Replaces: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~) Breaks: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~) Conflicts: python-apt (<< 0.7.93.2~) -Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, python-apt +Suggests: aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), apt-doc, python-apt Description: commandline package manager This package provides commandline tools for searching and managing as well as querying information about packages @@ -41,7 +42,7 @@ Package: libapt-pkg4.12 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} -Depends: ${shlibs:Depends}, ${misc:Depends}, xz-utils +Depends: ${shlibs:Depends}, ${misc:Depends} Breaks: apt (<< 0.9.4~), libapt-inst1.5 (<< 0.9.9~) Section: libs Description: package management runtime library @@ -107,7 +108,6 @@ Description: documentation for APT development Package: apt-utils Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Suggests: xz-utils Description: package management related utility programs This package contains some less used commandline utilities related to package management with APT. diff --git a/debian/libapt-pkg4.12.symbols b/debian/libapt-pkg4.12.symbols index 17b9f69fa..c1747bc9e 100644 --- a/debian/libapt-pkg4.12.symbols +++ b/debian/libapt-pkg4.12.symbols @@ -1197,7 +1197,6 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# (c++)"APT::Configuration::setDefaultConfigurationForCompressors()@Base" 0.8.12 (c++)"pkgAcqMetaClearSig::Custom600Headers()@Base" 0.8.13 (c++|optional=private)"debListParser::NewProvidesAllArch(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.13.2 - (c++|optional=private)"PrintMode(char)@Base" 0.8.13.2 (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2 (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1 (c++)"Configuration::CndSet(char const*, int)@Base" 0.8.15.3 diff --git a/debian/tests/run-tests b/debian/tests/run-tests index e03db9b0c..e6bc5e0d1 100644 --- a/debian/tests/run-tests +++ b/debian/tests/run-tests @@ -2,9 +2,6 @@ set -e -unset LANGUAGE -export LC_ALL=C - # we need the buildin webserver for the tests if [ ! -e environment.mak ]; then make startup @@ -16,4 +13,5 @@ APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \ APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \ APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \ APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \ +APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \ ./test/integration/run-tests diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 306bab1dc..ffd7c88b9 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -40,7 +40,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@ # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = "commandline package manager" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not @@ -197,7 +197,7 @@ TAB_SIZE = 8 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = "TODO=\todo" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding @@ -601,7 +601,7 @@ CITE_BIB_FILES = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank @@ -748,7 +748,7 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. -INPUT_FILTER = +INPUT_FILTER = "sed -e 's#//[ ]*FIXME:\?#/// \\todo#'" # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. @@ -1287,7 +1287,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml index 595ea875d..1ed08904e 100644 --- a/doc/apt-get.8.xml +++ b/doc/apt-get.8.xml @@ -371,7 +371,18 @@ by <command>apt-get source --compile</command> and how cross-builddependencies are satisfied. By default is it not set which means that the host architecture is the same as the build architecture (which is defined by <literal>APT::Architecture</literal>). - Configuration Item: <literal>APT::Get::Host-Architecture</literal> + Configuration Item: <literal>APT::Get::Host-Architecture</literal>. + </para></listitem> + </varlistentry> + + <varlistentry><term><option>-P</option></term> + <term><option>--build-profiles</option></term> + <listitem><para>This option controls the activated build profiles for which + a source package is built by <command>apt-get source --compile</command> and + how build dependencies are satisfied. By default no build profile is active. + More than one build profile can be activated at a time by concatenating them + with a comma. + Configuration Item: <literal>APT::Build-Profiles</literal>. </para></listitem> </varlistentry> diff --git a/doc/apt-verbatim.ent b/doc/apt-verbatim.ent index 6ff45e228..75aa02c8f 100644 --- a/doc/apt-verbatim.ent +++ b/doc/apt-verbatim.ent @@ -226,7 +226,6 @@ <!ENTITY stable-codename "wheezy"> <!ENTITY testing-codename "jessie"> <!ENTITY stable-version "7"> -<!ENTITY tanglu-codename "bartholomea"> <!ENTITY ubuntu-codename "trusty"> <!-- good and bad just refers to matching and not matching a pattern… diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index bfc43ba29..78f6a27a2 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -177,6 +177,15 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; </para></listitem> </varlistentry> + <varlistentry><term><option>Build-Profiles</option></term> + <listitem><para> + List of all build profiles enabled for build-dependency resolution, + without the "<literal>profile.</literal>" namespace prefix. + By default this list is empty. The <envar>DEB_BUILD_PROFILES</envar> + as used by &dpkg-buildpackage; overrides the list notation. + </para></listitem> + </varlistentry> + <varlistentry><term><option>Default-Release</option></term> <listitem><para>Default release to install packages from if more than one version is available. Contains release name, codename or release version. Examples: 'stable', 'testing', diff --git a/doc/po/pl.po b/doc/po/pl.po index a5e2a7fa8..981dc676c 100644 --- a/doc/po/pl.po +++ b/doc/po/pl.po @@ -1162,7 +1162,7 @@ msgid "" "Consider suggested packages as a dependency for installing. Configuration " "Item: <literal>APT::Install-Suggests</literal>." msgstr "" -"Nie bierze pod uwagÄ™ sugerowanych pakietów jako zależnoÅ›ci do instalacji. " +"Uznaje sugerowane pakiety za zależnoÅ›ci do instalacji. " "Pozycja w pliku konfiguracyjnym: <literal>APT::Install-Suggests</literal>." # diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 712f8469a..692f19e25 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -17,14 +17,23 @@ #include <apt-pkg/cmndline.h> #include <apt-pkg/strutl.h> #include <apt-pkg/init.h> -#include <algorithm> +#include <apt-pkg/fileutl.h> +#include <algorithm> #include <climits> #include <sys/time.h> -#include <regex.h> - +#include <locale.h> +#include <stdio.h> +#include <sys/stat.h> +#include <time.h> +#include <functional> +#include <iostream> +#include <string> +#include <vector> + +#include "cachedb.h" +#include "override.h" #include "apt-ftparchive.h" -#include "contents.h" #include "multicompress.h" #include "writer.h" @@ -438,7 +447,7 @@ bool PackageMap::GenContents(Configuration &Setup, // --------------------------------------------------------------------- /* This populates the PkgList with all the possible permutations of the section/arch lists. */ -void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) +static void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) { // Load the defaults string DDir = Setup.Find("TreeDefault::Directory", @@ -484,7 +493,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) struct SubstVar const Vars[] = {{"$(DIST)",&Dist}, {"$(SECTION)",&Section}, {"$(ARCH)",&Arch}, - {}}; + {NULL, NULL}}; mode_t const Perms = Block.FindI("FileMode", Permissions); bool const LongDesc = Block.FindB("LongDescription", LongDescription); TranslationWriter *TransWriter; @@ -550,7 +559,7 @@ void LoadTree(vector<PackageMap> &PkgList,Configuration &Setup) // LoadBinDir - Load a 'bindirectory' section from the Generate Config /*{{{*/ // --------------------------------------------------------------------- /* */ -void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup) +static void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup) { mode_t const Permissions = Setup.FindI("Default::FileMode",0644); @@ -586,7 +595,7 @@ void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup) // ShowHelp - Show the help text /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -639,7 +648,7 @@ bool ShowHelp(CommandLine &CmdL) // SimpleGenPackages - Generate a Packages file for a directory tree /*{{{*/ // --------------------------------------------------------------------- /* This emulates dpkg-scanpackages's command line interface. 'mostly' */ -bool SimpleGenPackages(CommandLine &CmdL) +static bool SimpleGenPackages(CommandLine &CmdL) { if (CmdL.FileSize() < 2) return ShowHelp(CmdL); @@ -667,7 +676,7 @@ bool SimpleGenPackages(CommandLine &CmdL) // SimpleGenContents - Generate a Contents listing /*{{{*/ // --------------------------------------------------------------------- /* */ -bool SimpleGenContents(CommandLine &CmdL) +static bool SimpleGenContents(CommandLine &CmdL) { if (CmdL.FileSize() < 2) return ShowHelp(CmdL); @@ -689,7 +698,7 @@ bool SimpleGenContents(CommandLine &CmdL) // SimpleGenSources - Generate a Sources file for a directory tree /*{{{*/ // --------------------------------------------------------------------- /* This emulates dpkg-scanpackages's command line interface. 'mostly' */ -bool SimpleGenSources(CommandLine &CmdL) +static bool SimpleGenSources(CommandLine &CmdL) { if (CmdL.FileSize() < 2) return ShowHelp(CmdL); @@ -722,7 +731,7 @@ bool SimpleGenSources(CommandLine &CmdL) /*}}}*/ // SimpleGenRelease - Generate a Release file for a directory tree /*{{{*/ // --------------------------------------------------------------------- -bool SimpleGenRelease(CommandLine &CmdL) +static bool SimpleGenRelease(CommandLine &CmdL) { if (CmdL.FileSize() < 2) return ShowHelp(CmdL); @@ -747,7 +756,7 @@ bool SimpleGenRelease(CommandLine &CmdL) // Generate - Full generate, using a config file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Generate(CommandLine &CmdL) +static bool Generate(CommandLine &CmdL) { struct CacheDB::Stats SrcStats; if (CmdL.FileSize() < 2) @@ -911,7 +920,7 @@ bool Generate(CommandLine &CmdL) // Clean - Clean out the databases /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Clean(CommandLine &CmdL) +static bool Clean(CommandLine &CmdL) { if (CmdL.FileSize() != 2) return ShowHelp(CmdL); diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index c2318bf53..523c6b5fa 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -19,8 +19,12 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/configuration.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/debfile.h> #include <netinet/in.h> // htonl, etc +#include <ctype.h> +#include <stddef.h> +#include <sys/stat.h> #include "cachedb.h" diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h index b9ced9418..49b9a0ef5 100644 --- a/ftparchive/cachedb.h +++ b/ftparchive/cachedb.h @@ -12,17 +12,19 @@ #ifndef CACHEDB_H #define CACHEDB_H - #include <apt-pkg/debfile.h> #include <db.h> -#include <inttypes.h> -#include <sys/stat.h> #include <errno.h> #include <string> +#include <string.h> +#include <stdint.h> +#include <stdio.h> #include "contents.h" +class FileFd; + class CacheDB { protected: diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc index 80fe6e17e..7a1fb779e 100644 --- a/ftparchive/contents.cc +++ b/ftparchive/contents.cc @@ -36,13 +36,12 @@ #include <config.h> #include <apt-pkg/debfile.h> -#include <apt-pkg/extracttar.h> +#include <apt-pkg/dirstream.h> #include <apt-pkg/error.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <malloc.h> #include "contents.h" @@ -316,7 +315,7 @@ bool ContentsExtract::Read(debDebFile &Deb) // ContentsExtract::DoItem - Extract an item /*{{{*/ // --------------------------------------------------------------------- /* This just tacks the name onto the end of our memory buffer */ -bool ContentsExtract::DoItem(Item &Itm,int &Fd) +bool ContentsExtract::DoItem(Item &Itm, int &/*Fd*/) { unsigned long Len = strlen(Itm.Name); diff --git a/ftparchive/contents.h b/ftparchive/contents.h index 4af9db574..dbbb83350 100644 --- a/ftparchive/contents.h +++ b/ftparchive/contents.h @@ -9,11 +9,13 @@ /*}}}*/ #ifndef CONTENTS_H #define CONTENTS_H - -#include <stdlib.h> -#include <stdio.h> + #include <apt-pkg/dirstream.h> +#include <stddef.h> +#include <stdio.h> +#include <string> + class debDebFile; class GenContents diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 1555d2f2d..f35d5304a 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -20,13 +20,15 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/error.h> #include <apt-pkg/md5.h> +#include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/hashsum_template.h> -#include <fcntl.h> +#include <ctype.h> +#include <vector> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> -#include <iostream> #include "multicompress.h" #include <apti18n.h> diff --git a/ftparchive/multicompress.h b/ftparchive/multicompress.h index 388fad22e..ddd1815a3 100644 --- a/ftparchive/multicompress.h +++ b/ftparchive/multicompress.h @@ -22,7 +22,8 @@ #include <string> #include <stdio.h> #include <sys/types.h> - +#include <time.h> + class MultiCompress { // An output file diff --git a/ftparchive/override.cc b/ftparchive/override.cc index d2130db8a..b4cd49b6c 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -16,6 +16,9 @@ #include <apt-pkg/error.h> #include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <utility> #include "override.h" @@ -129,7 +132,7 @@ bool Override::ReadOverride(string const &File,bool const &Source) // Override::ReadExtraOverride - Read the extra override file /*{{{*/ // --------------------------------------------------------------------- /* This parses the extra override file and reads it into the map */ -bool Override::ReadExtraOverride(string const &File,bool const &Source) +bool Override::ReadExtraOverride(string const &File,bool const &/*Source*/) { if (File.empty() == true) return true; @@ -201,7 +204,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) } /*}}}*/ -// Override::GetItem - Get a architecture specific item /*{{{*/ +// Override::GetItem - Get a architecture specific item /*{{{*/ // --------------------------------------------------------------------- /* Returns a override item for the given package and the given architecture. * Treats "all" special @@ -232,10 +235,10 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect { result->FieldOverride[foI->first] = foI->second; } - } - } + } + } return result; -}; +} // Override::Item::SwapMaint - Swap the maintainer field if necessary /*{{{*/ diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 7ecfe78ed..153c4fb42 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -13,28 +13,37 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/error.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/aptconfiguration.h> -#include <apt-pkg/md5.h> -#include <apt-pkg/hashes.h> #include <apt-pkg/deblistparser.h> +#include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/gpgv.h> +#include <apt-pkg/hashes.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/debfile.h> +#include <apt-pkg/pkgcache.h> +#include <apt-pkg/sha1.h> +#include <apt-pkg/sha2.h> +#include <apt-pkg/tagfile.h> +#include <ctype.h> +#include <fnmatch.h> +#include <ftw.h> +#include <locale.h> +#include <string.h> +#include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <ctime> -#include <ftw.h> -#include <fnmatch.h> #include <iostream> #include <sstream> #include <memory> +#include <utility> +#include "apt-ftparchive.h" #include "writer.h" #include "cachedb.h" -#include "apt-ftparchive.h" #include "multicompress.h" #include <apti18n.h> @@ -72,9 +81,9 @@ FTWScanner::FTWScanner(string const &Arch): Arch(Arch) /*}}}*/ // FTWScanner::Scanner - FTW Scanner /*{{{*/ // --------------------------------------------------------------------- -/* This is the FTW scanner, it processes each directory element in the +/* This is the FTW scanner, it processes each directory element in the directory tree. */ -int FTWScanner::ScannerFTW(const char *File,const struct stat *sb,int Flag) +int FTWScanner::ScannerFTW(const char *File,const struct stat * /*sb*/,int Flag) { if (Flag == FTW_DNR) { @@ -951,7 +960,7 @@ bool ContentsWriter::ReadFromPkgs(string const &PkgFile,string const &PkgCompres // ReleaseWriter::ReleaseWriter - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -ReleaseWriter::ReleaseWriter(string const &DB) +ReleaseWriter::ReleaseWriter(string const &/*DB*/) { if (_config->FindB("APT::FTPArchive::Release::Default-Patterns", true) == true) { diff --git a/ftparchive/writer.h b/ftparchive/writer.h index 4932b0cc8..86884dcfc 100644 --- a/ftparchive/writer.h +++ b/ftparchive/writer.h @@ -13,14 +13,16 @@ #ifndef WRITER_H #define WRITER_H - #include <string> #include <stdio.h> #include <iostream> #include <vector> #include <map> #include <set> +#include <stdlib.h> +#include <sys/types.h> +#include "contents.h" #include "cachedb.h" #include "override.h" #include "apt-ftparchive.h" diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 22d4b9164..74e2ecc6b 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -19,9 +19,9 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/hashes.h> +#include <string> +#include <vector> #include <sys/stat.h> -#include <unistd.h> -#include <dlfcn.h> #include <iostream> #include <apti18n.h> @@ -62,7 +62,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | MountedByApt(false) { UdevCdroms.Dlopen(); -}; +} /*}}}*/ // CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/connect.cc b/methods/connect.cc index d9c9a1dd4..e2cbf4f5c 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -23,7 +23,7 @@ #include <errno.h> #include <unistd.h> #include <sstream> - +#include <string.h> #include<set> #include<string> diff --git a/methods/copy.cc b/methods/copy.cc index f2a8f9ed8..d59f032ff 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -17,9 +17,10 @@ #include <apt-pkg/error.h> #include <apt-pkg/hashes.h> +#include <string> #include <sys/stat.h> #include <sys/time.h> -#include <unistd.h> + #include <apti18n.h> /*}}}*/ diff --git a/methods/file.cc b/methods/file.cc index 3d0687c5b..12db62203 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -21,8 +21,9 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/strutl.h> +#include <string> #include <sys/stat.h> -#include <unistd.h> + #include <apti18n.h> /*}}}*/ diff --git a/methods/ftp.cc b/methods/ftp.cc index 621f48476..66787a7be 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -23,7 +23,11 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/netrc.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/strutl.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> @@ -42,6 +46,7 @@ #include "rfc2553emu.h" #include "connect.h" #include "ftp.h" + #include <apti18n.h> /*}}}*/ @@ -56,9 +61,9 @@ struct AFMap }; #ifndef AF_INET6 -struct AFMap AFMap[] = {{AF_INET,1},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{0, 0}}; #else -struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{0, 0}}; #endif unsigned long TimeOut = 120; @@ -1098,7 +1103,7 @@ bool FtpMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc,const char *argv[]) +int main(int, const char *argv[]) { setlocale(LC_ALL, ""); diff --git a/methods/ftp.h b/methods/ftp.h index 8055c389f..dd92f0086 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -12,6 +12,8 @@ #include <apt-pkg/strutl.h> +#include <sys/types.h> +#include <time.h> #include <string> class FTPConn @@ -76,7 +78,7 @@ class FtpMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 25bf64ddd..ae521a2ed 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -1,19 +1,21 @@ #include <config.h> -#include <apt-pkg/error.h> #include <apt-pkg/acquire-method.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/indexcopy.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/error.h> #include <apt-pkg/gpgv.h> +#include <apt-pkg/strutl.h> -#include <stdio.h> -#include <fcntl.h> +#include <ctype.h> #include <errno.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/wait.h> +#include <unistd.h> #include <iostream> -#include <sstream> +#include <string> #include <vector> #include <apti18n.h> diff --git a/methods/gzip.cc b/methods/gzip.cc index a2844e969..df3f8828f 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -11,17 +11,20 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/error.h> +#include <apt-pkg/configuration.h> #include <apt-pkg/acquire-method.h> -#include <apt-pkg/strutl.h> +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> #include <apt-pkg/hashes.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/aptconfiguration.h> +#include <string.h> #include <sys/stat.h> #include <sys/time.h> -#include <unistd.h> -#include <stdio.h> -#include <errno.h> +#include <string> +#include <vector> + #include <apti18n.h> /*}}}*/ @@ -58,17 +61,25 @@ bool GzipMethod::Fetch(FetchItem *Itm) return _error->Error("Extraction of file %s requires unknown compressor %s", Path.c_str(), Prog); // Open the source and destination files - FileFd From; - From.Open(Path, FileFd::ReadOnly, *compressor); - - if(From.FileSize() == 0) - return _error->Error(_("Empty files can't be valid archives")); - - FileFd To(Itm->DestFile,FileFd::WriteAtomic); + FileFd From, To; + if (_config->FindB("Method::Compress", false) == false) + { + From.Open(Path, FileFd::ReadOnly, *compressor); + if(From.FileSize() == 0) + return _error->Error(_("Empty files can't be valid archives")); + To.Open(Itm->DestFile, FileFd::WriteAtomic); + } + else + { + From.Open(Path, FileFd::ReadOnly); + To.Open(Itm->DestFile, FileFd::WriteOnly | FileFd::Create | FileFd::Empty, *compressor); + } To.EraseOnFailure(); - if (_error->PendingError() == true) + + if (From.IsOpen() == false || From.Failed() == true || + To.IsOpen() == false || To.Failed() == true) return false; - + // Read data from source, generate checksums and write Hashes Hash; bool Failed = false; @@ -120,7 +131,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc, char *argv[]) +int main(int, char *argv[]) { setlocale(LC_ALL, ""); diff --git a/methods/http.cc b/methods/http.cc index 42b31beeb..ed6e3517d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -33,24 +33,21 @@ #include <apt-pkg/error.h> #include <apt-pkg/hashes.h> #include <apt-pkg/netrc.h> +#include <apt-pkg/strutl.h> +#include <stddef.h> +#include <stdlib.h> +#include <sys/select.h> +#include <cstring> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> -#include <signal.h> #include <stdio.h> #include <errno.h> -#include <string.h> -#include <climits> #include <iostream> -#include <map> - -// Internet stuff -#include <netdb.h> #include "config.h" #include "connect.h" -#include "rfc2553emu.h" #include "http.h" #include <apti18n.h> @@ -61,7 +58,7 @@ unsigned long long CircleBuf::BwReadLimit=0; unsigned long long CircleBuf::BwTickReadData=0; struct timeval CircleBuf::BwReadTick={0,0}; const unsigned int CircleBuf::BW_HZ=10; - + // CircleBuf::CircleBuf - Circular input buffer /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -87,8 +84,8 @@ void CircleBuf::Reset() { delete Hash; Hash = new Hashes; - } -}; + } +} /*}}}*/ // CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/ // --------------------------------------------------------------------- @@ -473,7 +470,7 @@ bool HttpServerState::WriteResponse(const std::string &Data) /*{{{*/ return Out.Read(Data); } /*}}}*/ -bool HttpServerState::IsOpen() /*{{{*/ +APT_PURE bool HttpServerState::IsOpen() /*{{{*/ { return (ServerFd != -1); } @@ -484,16 +481,11 @@ bool HttpServerState::InitHashes(FileFd &File) /*{{{*/ In.Hash = new Hashes; // Set the expected size and read file for the hashes - if (StartPos >= 0) - { - File.Truncate(StartPos); - - return In.Hash->AddFD(File, StartPos); - } - return true; + File.Truncate(StartPos); + return In.Hash->AddFD(File, StartPos); } /*}}}*/ -Hashes * HttpServerState::GetHashes() /*{{{*/ +APT_PURE Hashes * HttpServerState::GetHashes() /*{{{*/ { return In.Hash; } diff --git a/methods/http.h b/methods/http.h index 450a42eed..5406ce4a7 100644 --- a/methods/http.h +++ b/methods/http.h @@ -12,14 +12,18 @@ #define APT_HTTP_H #include <apt-pkg/strutl.h> +#include <apt-pkg/acquire-method.h> #include <string> +#include <sys/time.h> +#include <iostream> #include "server.h" using std::cout; using std::endl; +class FileFd; class HttpMethod; class Hashes; diff --git a/methods/http_main.cc b/methods/http_main.cc index 2ca91bfc9..3b346a514 100644 --- a/methods/http_main.cc +++ b/methods/http_main.cc @@ -1,14 +1,9 @@ #include <config.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/acquire-method.h> #include <signal.h> -#include "connect.h" -#include "rfc2553emu.h" #include "http.h" - int main() { setlocale(LC_ALL, ""); diff --git a/methods/https.cc b/methods/https.cc index febe6a0f0..c4aff8f38 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -18,19 +18,20 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/netrc.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/macros.h> +#include <apt-pkg/strutl.h> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> -#include <signal.h> #include <stdio.h> -#include <errno.h> -#include <string.h> #include <iostream> #include <sstream> +#include <ctype.h> +#include <stdlib.h> -#include "config.h" #include "https.h" + #include <apti18n.h> /*}}}*/ using namespace std; @@ -83,9 +84,9 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp) return size*nmemb; } -int -HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, - double ultotal, double ulnow) +int +HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/, + double /*ultotal*/, double /*ulnow*/) { HttpsMethod *me = (HttpsMethod *)clientp; if(dltotal > 0 && me->Res.Size == 0) { @@ -95,7 +96,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, } // HttpsServerState::HttpsServerState - Constructor /*{{{*/ -HttpsServerState::HttpsServerState(URI Srv,HttpsMethod *Owner) : ServerState(Srv, NULL) +HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * /*Owner*/) : ServerState(Srv, NULL) { TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut); Reset(); @@ -432,7 +433,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) delete File; return true; -}; +} int main() { diff --git a/methods/https.h b/methods/https.h index ab0dd3407..faac8a3cd 100644 --- a/methods/https.h +++ b/methods/https.h @@ -11,37 +11,42 @@ #ifndef APT_HTTPS_H #define APT_HTTPS_H -#include <iostream> +#include <apt-pkg/acquire-method.h> + #include <curl/curl.h> +#include <iostream> +#include <stddef.h> +#include <string> #include "server.h" using std::cout; using std::endl; +class Hashes; class HttpsMethod; class FileFd; class HttpsServerState : public ServerState { protected: - virtual bool ReadHeaderLines(std::string &Data) { return false; } - virtual bool LoadNextResponse(bool const ToFile, FileFd * const File) { return false; } + virtual bool ReadHeaderLines(std::string &/*Data*/) { return false; } + virtual bool LoadNextResponse(bool const /*ToFile*/, FileFd * const /*File*/) { return false; } public: - virtual bool WriteResponse(std::string const &Data) { return false; } + virtual bool WriteResponse(std::string const &/*Data*/) { return false; } /** \brief Transfer the data from the socket */ - virtual bool RunData(FileFd * const File) { return false; } + virtual bool RunData(FileFd * const /*File*/) { return false; } virtual bool Open() { return false; } virtual bool IsOpen() { return false; } virtual bool Close() { return false; } - virtual bool InitHashes(FileFd &File) { return false; } + virtual bool InitHashes(FileFd &/*File*/) { return false; } virtual Hashes * GetHashes() { return NULL; } - virtual bool Die(FileFd &File) { return false; } - virtual bool Flush(FileFd * const File) { return false; } - virtual bool Go(bool ToFile, FileFd * const File) { return false; } + virtual bool Die(FileFd &/*File*/) { return false; } + virtual bool Flush(FileFd * const /*File*/) { return false; } + virtual bool Go(bool /*ToFile*/, FileFd * const /*File*/) { return false; } HttpsServerState(URI Srv, HttpsMethod *Owner); virtual ~HttpsServerState() {Close();}; diff --git a/methods/mirror.cc b/methods/mirror.cc index 085f3717b..d3aef91bc 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -16,18 +16,18 @@ #include <apt-pkg/acquire-item.h> #include <apt-pkg/acquire.h> #include <apt-pkg/error.h> -#include <apt-pkg/hashes.h> #include <apt-pkg/sourcelist.h> #include <apt-pkg/configuration.h> #include <apt-pkg/metaindex.h> +#include <apt-pkg/strutl.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include <algorithm> -#include <fstream> #include <iostream> - -#include <stdarg.h> +#include <fstream> #include <sys/stat.h> -#include <sys/types.h> #include <sys/utsname.h> #include <dirent.h> @@ -60,7 +60,7 @@ using namespace std; MirrorMethod::MirrorMethod() : HttpMethod(), DownloadedMirrorFile(false), Debug(false) { -}; +} // HttpMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- @@ -90,17 +90,17 @@ bool MirrorMethod::Clean(string Dir) pkgSourceList list; list.ReadMainList(); - DIR *D = opendir(Dir.c_str()); + DIR *D = opendir(Dir.c_str()); if (D == 0) return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); - + string StartDir = SafeGetCWD(); if (chdir(Dir.c_str()) != 0) { closedir(D); return _error->Errno("chdir",_("Unable to change to %s"),Dir.c_str()); } - + for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D)) { // Skip some files.. @@ -123,23 +123,23 @@ bool MirrorMethod::Clean(string Dir) // nothing found, nuke it if (I == list.end()) unlink(Dir->d_name); - }; + } closedir(D); if (chdir(StartDir.c_str()) != 0) return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); - return true; + return true; } -bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) +bool MirrorMethod::DownloadMirrorFile(string /*mirror_uri_str*/) { - // not that great to use pkgAcquire here, but we do not have + // not that great to use pkgAcquire here, but we do not have // any other way right now string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); -#if 0 // no need for this, the getArchitectures() will also include the main +#if 0 // no need for this, the getArchitectures() will also include the main // arch // append main architecture fetch += "?arch=" + _config->Find("Apt::Architecture"); @@ -173,7 +173,7 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) if(Debug) clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl; - + return res; } @@ -187,13 +187,13 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) if (!FileExists(mirror_file)) return false; - // read + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { getline(in, line); content.push_back(line); } - + // we want the file to be random for each different machine, but also // "stable" on the same machine. this is to avoid running into out-of-sync // issues (i.e. Release/Release.gpg different on each mirror) @@ -422,10 +422,10 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Debug) clog << "Fetch: " << Itm->Uri << endl << endl; - + // now run the real fetcher return HttpMethod::Fetch(Itm); -}; +} void MirrorMethod::Fail(string Err,bool Transient) { @@ -437,7 +437,7 @@ void MirrorMethod::Fail(string Err,bool Transient) // try the next mirror on fail (if its not a expected failure, // e.g. translations are ok to ignore) - if (!Queue->FailIgnore && TryNextMirror()) + if (!Queue->FailIgnore && TryNextMirror()) return; // all mirrors failed, so bail out diff --git a/methods/mirror.h b/methods/mirror.h index 1dd9f2ec6..6c0ce370e 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -11,6 +11,8 @@ #ifndef APT_MIRROR_H #define APT_MIRROR_H +#include <apt-pkg/acquire-method.h> + #include <iostream> #include <string> #include <vector> diff --git a/methods/rred.cc b/methods/rred.cc index fe7ef7322..cabb3c456 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -8,19 +8,18 @@ #include <config.h> #include <apt-pkg/fileutl.h> -#include <apt-pkg/mmap.h> #include <apt-pkg/error.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/strutl.h> #include <apt-pkg/hashes.h> #include <apt-pkg/configuration.h> +#include <stddef.h> +#include <iostream> #include <string> #include <list> #include <vector> -#include <iterator> -#include <fcntl.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -469,7 +468,7 @@ class Patch { void write_diff(FILE *f) { - size_t line = 0; + unsigned long long line = 0; std::list<struct Change>::reverse_iterator ch; for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) { line += ch->offset + ch->del_cnt; @@ -482,11 +481,11 @@ class Patch { line -= ch->del_cnt; if (ch->add_cnt > 0) { if (ch->del_cnt == 0) { - fprintf(f, "%lua\n", line); + fprintf(f, "%llua\n", line); } else if (ch->del_cnt == 1) { - fprintf(f, "%luc\n", line+1); + fprintf(f, "%lluc\n", line+1); } else { - fprintf(f, "%lu,%luc\n", line+1, line+ch->del_cnt); + fprintf(f, "%llu,%lluc\n", line+1, line+ch->del_cnt); } mg_i = ch; @@ -496,9 +495,9 @@ class Patch { fprintf(f, ".\n"); } else if (ch->del_cnt == 1) { - fprintf(f, "%lud\n", line+1); + fprintf(f, "%llud\n", line+1); } else if (ch->del_cnt > 1) { - fprintf(f, "%lu,%lud\n", line+1, line+ch->del_cnt); + fprintf(f, "%llu,%llud\n", line+1, line+ch->del_cnt); } line -= ch->offset; } diff --git a/methods/rsh.cc b/methods/rsh.cc index 550f77eca..bd46d2515 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -17,7 +17,11 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/hashes.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/acquire-method.h> +#include <apt-pkg/strutl.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/time.h> #include <unistd.h> @@ -368,7 +372,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig) signal(SIGINT,SigTerm); Server = 0; FailFd = -1; -}; +} /*}}}*/ // RSHMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- @@ -390,7 +394,7 @@ bool RSHMethod::Configuration(std::string Message) // RSHMethod::SigTerm - Clean up and timestamp the files on exit /*{{{*/ // --------------------------------------------------------------------- /* */ -void RSHMethod::SigTerm(int sig) +void RSHMethod::SigTerm(int) { if (FailFd == -1) _exit(100); @@ -519,7 +523,7 @@ bool RSHMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc, const char *argv[]) +int main(int, const char *argv[]) { setlocale(LC_ALL, ""); diff --git a/methods/rsh.h b/methods/rsh.h index d7efa3f06..dd259e744 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -11,6 +11,8 @@ #define APT_RSH_H #include <string> +#include <time.h> + #include <apt-pkg/strutl.h> class Hashes; @@ -62,7 +64,7 @@ class RSHMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/server.cc b/methods/server.cc index ef90c809c..5a13f18a7 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -10,32 +10,27 @@ // Include Files /*{{{*/ #include <config.h> -#include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/configuration.h> #include <apt-pkg/error.h> -#include <apt-pkg/hashes.h> -#include <apt-pkg/netrc.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/strutl.h> -#include <fcntl.h> +#include <ctype.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> #include <sys/stat.h> #include <sys/time.h> +#include <time.h> #include <unistd.h> -#include <signal.h> -#include <stdio.h> -#include <errno.h> -#include <string.h> -#include <climits> #include <iostream> +#include <limits> #include <map> +#include <string> +#include <vector> -// Internet stuff -#include <netdb.h> - -#include "config.h" -#include "connect.h" -#include "rfc2553emu.h" -#include "http.h" +#include "server.h" #include <apti18n.h> /*}}}*/ @@ -119,10 +114,10 @@ bool ServerState::HeaderLine(string Line) string::size_type Pos2 = Pos; while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0) Pos2++; - + string Tag = string(Line,0,Pos); string Val = string(Line,Pos2); - + if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0) { // Evil servers return no version @@ -159,14 +154,14 @@ bool ServerState::HeaderLine(string Line) } return true; - } - + } + if (stringcasecmp(Tag,"Content-Length:") == 0) { if (Encoding == Closes) Encoding = Stream; HaveContent = true; - + // The length is already set from the Content-Range header if (StartPos != 0) return true; @@ -184,7 +179,7 @@ bool ServerState::HeaderLine(string Line) HaveContent = true; return true; } - + if (stringcasecmp(Tag,"Content-Range:") == 0) { HaveContent = true; @@ -201,12 +196,12 @@ bool ServerState::HeaderLine(string Line) return _error->Error(_("This HTTP server has broken range support")); return true; } - + if (stringcasecmp(Tag,"Transfer-Encoding:") == 0) { HaveContent = true; if (stringcasecmp(Val,"chunked") == 0) - Encoding = Chunked; + Encoding = Chunked; return true; } @@ -218,7 +213,7 @@ bool ServerState::HeaderLine(string Line) Persistent = true; return true; } - + if (stringcasecmp(Tag,"Last-Modified:") == 0) { if (RFC1123StrToTime(Val.c_str(), Date) == false) @@ -413,7 +408,7 @@ bool ServerMethod::Fetch(FetchItem *) } return true; -}; +} /*}}}*/ // ServerMethod::Loop - Main loop /*{{{*/ int ServerMethod::Loop() diff --git a/methods/server.h b/methods/server.h index 2b81e6173..0f45ab994 100644 --- a/methods/server.h +++ b/methods/server.h @@ -12,7 +12,10 @@ #define APT_SERVER_H #include <apt-pkg/strutl.h> +#include <apt-pkg/acquire-method.h> +#include <time.h> +#include <iostream> #include <string> using std::cout; @@ -32,7 +35,7 @@ struct ServerState // These are some statistics from the last parsed header lines unsigned long long Size; - signed long long StartPos; + unsigned long long StartPos; time_t Date; bool HaveContent; enum {Chunked,Stream,Closes} Encoding; @@ -62,7 +65,7 @@ struct ServerState /** \brief IO error while retrieving */ RUN_HEADERS_IO_ERROR, /** \brief Parse error after retrieving */ - RUN_HEADERS_PARSE_ERROR, + RUN_HEADERS_PARSE_ERROR }; /** \brief Get the headers before the data */ RunHeadersResult RunHeaders(FileFd * const File); @@ -126,7 +129,7 @@ class ServerMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); virtual bool Configuration(std::string Message); virtual bool Flush() { return Server->Flush(File); }; @@ -1020,8 +1020,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "خطأ داخلي، لم تنته عملية الترتيب" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "يا للغرابة.. لم تتطابق الأØجام، الرجاء مراسلة apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "يا للغرابة... لم تتطابق الأØجام، الرجاء مراسلة apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -2932,10 +2932,6 @@ msgstr "" msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "ÙÙƒ تركيب القرص المدمج\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "بانتظار القرص...\n" @@ -2945,7 +2941,7 @@ msgid "Mounting CD-ROM...\n" msgstr "تركيب القرص...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "جاري التعرÙ..." #: apt-pkg/cdrom.cc:643 @@ -2954,12 +2950,11 @@ msgid "Stored label: %s\n" msgstr "" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 -#, fuzzy msgid "Unmounting CD-ROM...\n" -msgstr "ÙÙƒ تركيب القرص المدمج..." +msgstr "ÙÙƒ تركيب القرص المدمج...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:717 @@ -1129,8 +1129,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "Error internu, ordenar nun finó" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "Que raro.. Los tamaños nun concasen, escribe a apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "Que raro... Los tamaños nun concasen, escribe a apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3161,10 +3161,6 @@ msgstr "El bloque de fornidor %s nun contién una buelga dixital" msgid "Using CD-ROM mount point %s\n" msgstr "Usando el puntu de montaxe de CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Desmontando'l CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Esperando'l discu...\n" @@ -3174,8 +3170,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Montando'l CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identificando.. " +msgid "Identifying... " +msgstr "Identificando... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3184,10 +3180,10 @@ msgstr "Etiqueta guardada: %s\n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 msgid "Unmounting CD-ROM...\n" -msgstr "Desmontando l CD-ROM...\n" +msgstr "Desmontando'l CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Buscando nel discu ficheros d'Ãndices...\n" #: apt-pkg/cdrom.cc:717 @@ -1161,9 +1161,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Вътрешна грешка, „Ordering“ не завърши" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Странно.. Размерите не Ñъвпадат, изпратете е-поща на apt@packages.debian.org" +"Странно... Размерите не Ñъвпадат, изпратете е-поща на apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3217,10 +3217,6 @@ msgstr "Блокът на Ð¿Ñ€Ð¾Ð¸Ð·Ð²Ð¾Ð´Ð¸Ñ‚ÐµÐ»Ñ %s не Ñъдържа от msgid "Using CD-ROM mount point %s\n" msgstr "Използване на точка за монтиране на CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Демонтиране на CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Чакане за диÑк...\n" @@ -3230,7 +3226,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Монтиране на CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Идентифициране..." #: apt-pkg/cdrom.cc:643 @@ -3243,7 +3239,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Демонтиране на CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Сканиране на диÑка за индекÑни файлове...\n" #: apt-pkg/cdrom.cc:717 @@ -1025,7 +1025,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" #. TRANSLATOR: The required space between number and unit is already included @@ -2924,10 +2924,6 @@ msgstr "" msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "" - #: apt-pkg/cdrom.cc:588 #, fuzzy msgid "Waiting for disc...\n" @@ -2938,7 +2934,7 @@ msgid "Mounting CD-ROM...\n" msgstr "" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "" #: apt-pkg/cdrom.cc:643 @@ -2952,7 +2948,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "PogreÅ¡an CD" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:717 @@ -1148,7 +1148,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "S'ha produït un error intern, l'ordenació no ha acabat" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Què estrany… les mides no coincideixen, informeu a apt@packages.debian.org" @@ -3201,10 +3201,6 @@ msgstr "El camp del proveïdor %s no té una empremta digital" msgid "Using CD-ROM mount point %s\n" msgstr "S'està utilitzant el punt de muntatge de CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "S'està desmuntant el CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "S'està esperant al disc…\n" @@ -3214,7 +3210,7 @@ msgid "Mounting CD-ROM...\n" msgstr "S'està muntant el CD-ROM…\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "S'està identificant…" #: apt-pkg/cdrom.cc:643 @@ -3224,10 +3220,10 @@ msgstr "S'ha emmagatzemat l'etiqueta: %s\n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 msgid "Unmounting CD-ROM...\n" -msgstr "S'esta desmuntant el CD-ROM…\n" +msgstr "S'està desmuntant el CD-ROM…\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "S'està analitzant el disc per a fitxers d'Ãndex…\n" #: apt-pkg/cdrom.cc:717 @@ -1137,7 +1137,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "VnitÅ™nà chyba, tÅ™ÃdÄ›nà nedobÄ›hlo do konce" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Jak podivné… velikosti nesouhlasÃ, ohlaste to na apt@packages.debian.org" @@ -3159,10 +3159,6 @@ msgstr "Blok výrobce %s neobsahuje otisk klÃÄe" msgid "Using CD-ROM mount point %s\n" msgstr "PoužÃvám pÅ™Ãpojný bod %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Odpojuji CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ÄŒekám na disk…\n" @@ -3172,7 +3168,7 @@ msgid "Mounting CD-ROM...\n" msgstr "PÅ™ipojuji CD-ROM…\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Rozpoznávám… " #: apt-pkg/cdrom.cc:643 @@ -3185,7 +3181,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Odpojuji CD-ROM…\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Hledám na disku indexové soubory…\n" #: apt-pkg/cdrom.cc:717 @@ -1157,7 +1157,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Gwall Mewnol wrth ychwanegu dargyfeiriad" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" #. TRANSLATOR: The required space between number and unit is already included @@ -3218,10 +3218,6 @@ msgstr "Nid yw'r bloc darparwr %s yn cynnwys ôl bys" msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "" - #: apt-pkg/cdrom.cc:588 #, fuzzy msgid "Waiting for disc...\n" @@ -3232,7 +3228,7 @@ msgid "Mounting CD-ROM...\n" msgstr "" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "" #: apt-pkg/cdrom.cc:643 @@ -3246,7 +3242,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD Anghywir" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:717 @@ -1171,8 +1171,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "Intern fejl. Sortering blev ikke fuldført" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "Mystisk.. Størrelserne passede ikke, skriv til apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "Mystisk... Størrelserne passede ikke, skriv til apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3192,11 +3192,7 @@ msgstr "Leverandørblok %s inderholder intet fingeraftryk" #: apt-pkg/cdrom.cc:575 #, c-format msgid "Using CD-ROM mount point %s\n" -msgstr "Bruger cdrom-monteringspunktet %s\n" - -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Afmonterer cdrom\n" +msgstr "Bruger CD-ROM-monteringspunktet %s\n" #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" @@ -3204,11 +3200,11 @@ msgstr "Venter pÃ¥ disken ...\n" #: apt-pkg/cdrom.cc:597 msgid "Mounting CD-ROM...\n" -msgstr "Monterer cdrom ...\n" +msgstr "Monterer CD-ROM ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identificerer .. " +msgid "Identifying... " +msgstr "Identificerer ... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3217,11 +3213,11 @@ msgstr "Gemt mærkat: %s \n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 msgid "Unmounting CD-ROM...\n" -msgstr "Afmonterer cdrom ...\n" +msgstr "Afmonterer CD-ROM ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Skanner disken for indeksfiler ..\n" +msgid "Scanning disc for index files...\n" +msgstr "Skanner disken for indeksfiler ...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1191,7 +1191,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Interner Fehler, Anordnung beendete nicht" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Wie merkwürdig ... die Größen haben nicht übereingestimmt; schreiben Sie " "eine E-Mail an apt@packages.debian.org (auf Englisch bitte)." @@ -3272,10 +3272,6 @@ msgstr "Herstellerblock %s enthält keinen Fingerabdruck." msgid "Using CD-ROM mount point %s\n" msgstr "Verwendeter CD-ROM-Einbindungspunkt: %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Lösen der CD-ROM-Einbindung\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Warten auf Medium ...\n" @@ -3285,7 +3281,7 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM wird eingebunden ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identifizieren ... " #: apt-pkg/cdrom.cc:643 @@ -3298,7 +3294,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Einbindung der CD-ROM wird gelöst ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Durchsuchen des Mediums nach Index-Dateien ...\n" #: apt-pkg/cdrom.cc:717 @@ -1126,7 +1126,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "ནང་འà½à½¼à½‘་འཛོལ་བ་ གོ་རིམ་བཟོ་ནི་ཚུ་མཇུག་མ་བསྡུ་བསà¼" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "ག་ཅི་གི་ཡ་མཚན་ཆེ་མི་ཆེ་ ཚད་འདི་གིས་ email apt@packages.debian.org་ལུ་མà½à½´à½“་སྒྲིག་མི་འབད་" "བསà¼" @@ -3143,10 +3143,6 @@ msgstr "%sསིལ་ཚོང་པ་སྡེབ་ཚན་གྱི་ནà msgid "Using CD-ROM mount point %s\n" msgstr " %s སི་ཌི-རོམ་སྦྱར་བརྩེགས་ཀྱི་ས་ཚིགས་ལག་ལེན་འà½à½–་དོà¼\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "སི་ཌི་-རོམ་བརྩེགས་བཤོལ་འབད་དོà¼\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ཌིསིཀ་གི་དོན་ལུ་བསྒུག་དོ...\n" @@ -3156,8 +3152,8 @@ msgid "Mounting CD-ROM...\n" msgstr "སི་ཌི་-རོམ་སྦྱར་བརྩེགས་འབད་དོ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "ངོས་འཛིན་འབད་དོ.." +msgid "Identifying... " +msgstr "ངོས་འཛིན་འབད་དོ..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3170,8 +3166,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "སི་ཌི་-རོམ་སྦྱར་བརྩེགས་མ་འབད་བར་བཞག་དོ..." #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "ཟུར་à½à½¼à¼‹à½¡à½²à½‚་སྣོད་ཚུ་གི་དོན་ལུ་ ཌིསིཀ་ཞིབ་ལྟ་འབད་དོ..\n" +msgid "Scanning disc for index files...\n" +msgstr "ཟུར་à½à½¼à¼‹à½¡à½²à½‚་སྣོད་ཚུ་གི་དོན་ལུ་ ཌིསིཀ་ཞིབ་ལྟ་འབད་དོ...\n" #: apt-pkg/cdrom.cc:717 #, fuzzy, c-format @@ -1141,7 +1141,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "ΕσωτεÏικό Σφάλμα, η Ταξινόμηση δεν ολοκληÏώθηκε" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Î Î¿Î»Ï Ï€ÎµÏίεÏγο! Τα μεγÎθη δεν ταιÏιάζουν, στείλτε μήνυμα στο apt@packages." "debian.org" @@ -3175,10 +3175,6 @@ msgstr "Η εγγÏαφή κατασκευαστή %s δεν πεÏιÎχει Ï„ msgid "Using CD-ROM mount point %s\n" msgstr "ΧÏησιμοποιείται το σημείο Ï€ÏοσάÏτησης %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "ΑποπÏοσάÏτηση του CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Αναμονή για δίσκο...\n" @@ -3188,7 +3184,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Î ÏοσάÏτηση του CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "ΑναγνώÏιση..." #: apt-pkg/cdrom.cc:643 @@ -3201,7 +3197,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "ΑποπÏοσάÏτηση του CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "ΣάÏωση του δίσκου για πεÏιεχόμενα...\n" #: apt-pkg/cdrom.cc:717 @@ -1197,9 +1197,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Error interno, no terminó la ordenación" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Qué raro.. Los tamaños no concuerdan, mande un correo a apt@packages.debian." +"Qué raro... Los tamaños no concuerdan, mande un correo a apt@packages.debian." "org" #. TRANSLATOR: The required space between number and unit is already included @@ -3260,10 +3260,6 @@ msgstr "Bloque de fabricante %s sin huella digital" msgid "Using CD-ROM mount point %s\n" msgstr "Usando el punto de montaje del CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Desmontando el CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Esperando el disco...\n" @@ -3273,8 +3269,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Montando el CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identificando.. " +msgid "Identifying... " +msgstr "Identificando... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3286,7 +3282,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Desmontando el CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Buscando en el disco archivos de Ãndices...\n" #: apt-pkg/cdrom.cc:717 @@ -1125,9 +1125,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Barne errorea, ez da ordenatzeaz amaitu" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Hau bitxia.. Tamainak ez dira berdina, idatzi apt@packages.debian.org-ra " +"Hau bitxia... Tamainak ez dira berdina, idatzi apt@packages.debian.org-ra " "berri emanez (ingelesez)" #. TRANSLATOR: The required space between number and unit is already included @@ -3142,10 +3142,6 @@ msgstr "%s saltzaile blokeak ez du egiaztapen markarik" msgid "Using CD-ROM mount point %s\n" msgstr "%s CD-ROM muntatze puntua erabiltzen\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM-a desmuntatzen\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Diska itxaroten...\n" @@ -3155,7 +3151,7 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM-a muntatzen...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Egiaztatzen... " #: apt-pkg/cdrom.cc:643 @@ -3168,7 +3164,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROM Desmuntatzen...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Indize fitxategien bila diska arakatzen...\n" #: apt-pkg/cdrom.cc:717 @@ -1117,7 +1117,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Tapahtui sisäinen virhe, järjestäminen keskeytyi" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "No jo on... Koot eivät täsmää, sähköpostita email apt@packages.debian.org" @@ -3133,10 +3133,6 @@ msgstr "Toimittajan lohkosta %s puuttuu sormenjälki" msgid "Using CD-ROM mount point %s\n" msgstr "Käytetään rompun liitoskohtaa %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Irrotetaan romppu\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Odotetaan levyä...\n" @@ -3146,7 +3142,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Liitetään romppu...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Tunnistetaan... " #: apt-pkg/cdrom.cc:643 @@ -3159,7 +3155,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Irrotetaan romppu...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Etsitään levyltä hakemistotiedostoja...\n" #: apt-pkg/cdrom.cc:717 @@ -1189,7 +1189,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Erreur interne. Le tri a été interrompu." #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Étrangement, les tailles ne correspondent pas. Veuillez le signaler par " "courriel à apt@packages.debian.org." @@ -3292,10 +3292,6 @@ msgstr "Le bloc de fournisseur %s ne comporte pas d'empreinte" msgid "Using CD-ROM mount point %s\n" msgstr "Utilisation du point de montage %s pour le cédérom\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Démontage du cédérom\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Attente du disque...\n" @@ -3305,7 +3301,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Montage du cédérom...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identification..." #: apt-pkg/cdrom.cc:643 @@ -3318,7 +3314,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Démontage du cédérom...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Examen du disque à la recherche de fichiers d'index...\n" #: apt-pkg/cdrom.cc:717 @@ -1146,7 +1146,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Produciuse un erro interno; non rematou a ordenación" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Que estraño... Os tamaños non coinciden; envÃe un correo-e a apt@packages." "debian.org" @@ -3201,10 +3201,6 @@ msgstr "O bloque de provedor %s non contén unha pegada dixital" msgid "Using CD-ROM mount point %s\n" msgstr "Empregando o punto de montaxe de CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Desmontando o CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Agardando polo disco...\n" @@ -3214,7 +3210,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Montando o CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identificando... " #: apt-pkg/cdrom.cc:643 @@ -3227,8 +3223,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Desmontando o CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Buscando os ficheiros de Ãndices no disco..\n" +msgid "Scanning disc for index files...\n" +msgstr "Buscando os ficheiros de Ãndices no disco...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -717,7 +717,7 @@ msgid "The list of sources could not be read." msgstr "רשימת המקורות ×œ× × ×™×ª× ×ª לקרי××”." #: cmdline/apt-get.cc:836 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" #: cmdline/apt-get.cc:841 @@ -2604,7 +2604,7 @@ msgid "" msgstr "" #: apt-pkg/cdrom.cc:534 apt-pkg/cdrom.cc:622 -msgid "Identifying.. " +msgid "Identifying... " msgstr "" #: apt-pkg/cdrom.cc:559 @@ -2621,10 +2621,6 @@ msgstr "" msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:603 -msgid "Unmounting CD-ROM\n" -msgstr "" - #: apt-pkg/cdrom.cc:607 msgid "Waiting for disc...\n" msgstr "" @@ -2635,7 +2631,7 @@ msgid "Mounting CD-ROM...\n" msgstr "" #: apt-pkg/cdrom.cc:633 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:673 @@ -1159,7 +1159,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "BelsÅ‘ hiba, a rendezés nem fejezÅ‘dött be" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "A méretek nem egyeznek, Ãrjon az apt@packages.debian.org cÃmre" #. TRANSLATOR: The required space between number and unit is already included @@ -3209,10 +3209,6 @@ msgstr "A(z) %s terjesztÅ‘blokk nem tartalmaz ujjlenyomatot" msgid "Using CD-ROM mount point %s\n" msgstr "%s CD-ROM csatolási pont használata\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM leválasztása\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Várakozás a lemezre...\n" @@ -3222,7 +3218,7 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM csatolása...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "AzonosÃtás... " #: apt-pkg/cdrom.cc:643 @@ -3235,7 +3231,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROM leválasztása...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Indexfájlok keresése a lemezen...\n" #: apt-pkg/cdrom.cc:717 @@ -1180,7 +1180,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Errore interno, l'ordinamento non è stato terminato" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Le dimensioni non corrispondono. Inviare un'email a: apt@packages.debian.org" @@ -3263,10 +3263,6 @@ msgstr "Il blocco vendor %s non contiene impronte" msgid "Using CD-ROM mount point %s\n" msgstr "Viene usato il punto di mount del CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Smontaggio CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "In attesa del disco...\n" @@ -3276,7 +3272,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Montaggio CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identificazione... " #: apt-pkg/cdrom.cc:643 @@ -3289,7 +3285,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Smontaggio CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Analisi del disco per file indice...\n" #: apt-pkg/cdrom.cc:717 @@ -1160,7 +1160,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "内部エラーã€èª¿æ•´ãŒçµ‚ã‚ã£ã¦ã„ã¾ã›ã‚“" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "ãŠã£ã¨ã€ã‚µã‚¤ã‚ºãŒãƒžãƒƒãƒã—ã¾ã›ã‚“。apt@packages.debian.org ã«ãƒ¡ãƒ¼ãƒ«ã—ã¦ãã ã•ã„" @@ -3197,10 +3197,6 @@ msgstr "ベンダブãƒãƒƒã‚¯ %s ã¯éµæŒ‡ç´‹ã‚’å«ã‚“ã§ã„ã¾ã›ã‚“" msgid "Using CD-ROM mount point %s\n" msgstr "CD-ROM マウントãƒã‚¤ãƒ³ãƒˆ %s を使用ã—ã¾ã™\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM をアンマウントã—ã¦ã„ã¾ã™\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ディスクを待ã£ã¦ã„ã¾ã™ ...\n" @@ -3210,8 +3206,8 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM をマウントã—ã¦ã„ã¾ã™ ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "確èªã—ã¦ã„ã¾ã™.. " +msgid "Identifying... " +msgstr "確èªã—ã¦ã„ã¾ã™... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3223,8 +3219,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROM をアンマウントã—ã¦ã„ã¾ã™ ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "ディスクã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ãƒ•ã‚¡ã‚¤ãƒ«ã‚’走査ã—ã¦ã„ã¾ã™ ..\n" +msgid "Scanning disc for index files...\n" +msgstr "ディスクã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ãƒ•ã‚¡ã‚¤ãƒ«ã‚’走査ã—ã¦ã„ã¾ã™ ...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1110,7 +1110,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "កំហុស​ážáž¶áž„ក្នុង​ ការ​រៀប​ážáž¶áž˜â€‹áž›áŸ†ážŠáž¶áž”់​មិន​បាន​បញ្ចប់ឡើយ" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "យី អី​កáŸâ€‹áž…ម្លែង​ម្លáŸáŸ‡.. ទំហំ​មិន​ដូច​គ្នា​ឡើយ ។ សូម​ផ្ញើ​អ៊ីមែល​ទៅ apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -3110,10 +3110,6 @@ msgstr "ប្លុក​ក្រុមហ៊ុន​លក់​ %s គ្ហmsgid "Using CD-ROM mount point %s\n" msgstr "ប្រើប្រាស់ចំណុចម៉ោន​ ស៊ីឌី​-រ៉ូម​ %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "ការមិនម៉ោន​ ស៊ីឌី-រ៉ូម​\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "កំពុង​រង់ចាំឌីស​...\n" @@ -3123,8 +3119,8 @@ msgid "Mounting CD-ROM...\n" msgstr "កំពុង​ម៉ោន​ ស៊ីឌី​-រ៉ូម​...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "កំពុង​ធ្វើអážáŸ’ážážŸáž‰áŸ’ញាណនា​.. " +msgid "Identifying... " +msgstr "កំពុង​ធ្វើអážáŸ’ážážŸáž‰áŸ’ញាណនា​... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3137,8 +3133,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "មិនកំពុងម៉ោន ស៊ីឌី​-រ៉ូម​ áž‘áŸ..." #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "កំពុង​ស្កáŸáž“​ឌីស​សម្រាប់​​ឯកសារ​លិបិក្រម​..\n" +msgid "Scanning disc for index files...\n" +msgstr "កំពុង​ស្កáŸáž“​ឌីស​សម្រាប់​​ឯកសារ​លិបិក្រម​...\n" #: apt-pkg/cdrom.cc:717 #, fuzzy, c-format @@ -1118,7 +1118,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "내부 오류. ìˆœì„œë³€ê²½ìž‘ì—…ì´ ë나지 않았습니다" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "ì´ìƒí•˜ê²Œë„ í¬ê¸°ê°€ 서로 다릅니다. apt@packages.debian.orgë¡œ ì´ë©”ì¼ì„ 보내주ì‹" "시오." @@ -3131,10 +3131,6 @@ msgstr "ë²¤ë” ë¸”ëŸ %sì˜ í•‘ê±°í”„ë¦°íŠ¸ê°€ 없습니다" msgid "Using CD-ROM mount point %s\n" msgstr "CD-ROM 마운트 위치 %s 사용\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM 마운트 í•´ì œí•˜ëŠ” 중입니다\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "디스í¬ë¥¼ 기다리는 중입니다...\n" @@ -3144,8 +3140,8 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM 마운트하는 중입니다...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "알아보는 중입니다.. " +msgid "Identifying... " +msgstr "알아보는 중입니다... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3157,7 +3153,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROMì„ ë§ˆìš´íŠ¸ í•´ì œí•˜ëŠ” 중입니다...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "디스í¬ì—ì„œ ìƒ‰ì¸ íŒŒì¼ì„ 찾는 중입니다...\n" #: apt-pkg/cdrom.cc:717 @@ -1031,7 +1031,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" #. TRANSLATOR: The required space between number and unit is already included @@ -2942,10 +2942,6 @@ msgstr "" msgid "Using CD-ROM mount point %s\n" msgstr "" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "" @@ -2955,7 +2951,7 @@ msgid "Mounting CD-ROM...\n" msgstr "" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "" #: apt-pkg/cdrom.cc:643 @@ -2968,7 +2964,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:717 @@ -1032,8 +1032,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "Keista.. Dydis neatitinka, ParaÅ¡ykite laiÅ¡kÄ… apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "Keista... Dydis neatitinka, ParaÅ¡ykite laiÅ¡kÄ… apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3035,10 +3035,6 @@ msgstr "" msgid "Using CD-ROM mount point %s\n" msgstr "Naudojama CD-ROM prijungimo vieta %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Atjungiamas CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Laukiama disko...\n" @@ -3048,8 +3044,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Prijungiamas CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identifikuojama.. " +msgid "Identifying... " +msgstr "Identifikuojama... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3061,7 +3057,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Atjungiamas CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "" #: apt-pkg/cdrom.cc:717 @@ -1108,7 +1108,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "अंतरà¥à¤—त तà¥à¤°à¥à¤Ÿà¥€,कà¥à¤°à¤® अजून संपला नाही" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "किती विचितà¥à¤°...आकार जà¥à¤³à¤¤ नाहीत, ईमेल apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -3120,10 +3120,6 @@ msgstr "विकà¥à¤°à¥‡à¤¤à¤¾ गट %s मधà¥à¤¯à¥‡ बोटाचे ठmsgid "Using CD-ROM mount point %s\n" msgstr "सिडी-रॉमचे माउंट सà¥à¤¥à¤¾à¤¨ %s वापरà¥à¤¨\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "सिडी-रॉम अनमाउंट करत आहे\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "डिसà¥à¤•/चकती करिता पà¥à¤°à¤¤à¤¿à¤•à¥à¤·à¤¾ करीत आहे...\n" @@ -3133,8 +3129,8 @@ msgid "Mounting CD-ROM...\n" msgstr "सिडी-रॉम माउंट होत आहे...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "ओळखत आहे.." +msgid "Identifying... " +msgstr "ओळखत आहे..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3146,8 +3142,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "सिडी-रॉम अनमाउंट होत आहे...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "संचिकाचà¥à¤¯à¤¾ यादी/सूचीसाठी डिसà¥à¤•/चकती बारकाईने तपासत आहे..\n" +msgid "Scanning disc for index files...\n" +msgstr "संचिकाचà¥à¤¯à¤¾ यादी/सूचीसाठी डिसà¥à¤•/चकती बारकाईने तपासत आहे...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1126,7 +1126,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Intern feil, sortering fullførte ikke" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "SÃ¥ rart ... Størrelsene stemmer ikke overens, send en e-post til " "apt@packages.debian.org" @@ -3150,10 +3150,6 @@ msgstr "Utgivers blokk %s inneholder ikke no fingeravtrykk" msgid "Using CD-ROM mount point %s\n" msgstr "Bruker CD-ROM monteringspunkt %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Avmonterer CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Venter pÃ¥ CD-en...\n" @@ -3163,8 +3159,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Monterer CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Indentifiserer.." +msgid "Identifying... " +msgstr "Indentifiserer..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3176,8 +3172,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Avmonterer CD-ROM ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Leter gjennom CD for indeksfiler..\n" +msgid "Scanning disc for index files...\n" +msgstr "Leter gjennom CD for indeksfiler...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1109,7 +1109,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "आनà¥à¤¤à¤°à¤¿à¤• तà¥à¤°à¥à¤Ÿà¤¿, आदेश समापà¥à¤¤ à¤à¤à¤•à¥‹ छैन" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "कसà¥à¤¤à¥‹ नमिलेको.. साइजहरू मेल खाà¤à¤¨, apt@packages.debian.org इमेल गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥" #. TRANSLATOR: The required space between number and unit is already included @@ -3112,10 +3112,6 @@ msgstr "बिकà¥à¤°à¤¤à¤¾ बà¥à¤²à¥à¤• %s ले कà¥à¤¨à¥ˆ औठाठmsgid "Using CD-ROM mount point %s\n" msgstr "सिडी रोम माउनà¥à¤Ÿ विनà¥à¤¦à¥ पà¥à¤°à¤¯à¥‹à¤— गरिदैछ %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "सिडी रोम अनमाउनà¥à¤Ÿ गरिदैछ\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "डिसà¥à¤•à¥‹ लागि परà¥à¤–िदै...\n" @@ -3125,8 +3121,8 @@ msgid "Mounting CD-ROM...\n" msgstr "सिडी रोम माउनà¥à¤Ÿ गरिदै...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "परिचय गराइदैछ.." +msgid "Identifying... " +msgstr "परिचय गराइदैछ..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3139,7 +3135,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "सिडी रोम अनमाउनà¥à¤Ÿ गरिदैछ..." #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "अनà¥à¤•à¥à¤°à¤®à¤£à¤¿à¤•à¤¾ फाइलहरà¥à¤•à¥‹ लागि डिसà¥à¤• सà¥à¤•à¥à¤¯à¤¾à¤¨ गरिदैछ...\n" #: apt-pkg/cdrom.cc:717 @@ -1145,7 +1145,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Interne fout, rangschikken is niet voltooid" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Merkwaardig... De groottes kwamen niet overeen, gelieve apt@packages.debian." "org te mailen" @@ -3202,10 +3202,6 @@ msgstr "Verkopersblok %s bevat geen vingerafdruk" msgid "Using CD-ROM mount point %s\n" msgstr "Er wordt gebruik gemaakt van CD-aankoppelpunt %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD wordt losgekoppeld\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Er wordt gewacht op de schijf...\n" @@ -3215,7 +3211,7 @@ msgid "Mounting CD-ROM...\n" msgstr "CD wordt aangekoppeld...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identificatie..." #: apt-pkg/cdrom.cc:643 @@ -3228,7 +3224,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD wordt afgekoppeld...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Er wordt gescand voor indexbestanden...\n" #: apt-pkg/cdrom.cc:717 @@ -1119,7 +1119,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Intern feil ved tilleggjing av avleiing" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" #. TRANSLATOR: The required space between number and unit is already included @@ -3125,10 +3125,6 @@ msgstr "Utgjevarblokka %s inneheld ingen fingeravtrykk" msgid "Using CD-ROM mount point %s\n" msgstr "Brukar monteringspunktet %s for CD-ROM\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Avmonterer CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Ventar på disk ...\n" @@ -3138,7 +3134,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Monterer CD-ROM ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identifiserer ... " #: apt-pkg/cdrom.cc:643 @@ -3147,12 +3143,11 @@ msgid "Stored label: %s\n" msgstr "Lagra etikett: %s \n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 -#, fuzzy msgid "Unmounting CD-ROM...\n" -msgstr "Avmonterer CD-ROM ..." +msgstr "Avmonterer CD-ROM ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Leitar etter indeksfiler på disken ...\n" #: apt-pkg/cdrom.cc:717 @@ -1170,7 +1170,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "BÅ‚Ä…d wewnÄ™trzny, sortowanie niezakoÅ„czone" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "WystÄ…piÅ‚ dziwny bÅ‚Ä…d - rozmiary siÄ™ nie zgadzajÄ…. ProszÄ™ to zgÅ‚osić pod " "apt@packages.debian.org" @@ -3231,10 +3231,6 @@ msgstr "Blok producenta %s nie zawiera odcisku" msgid "Using CD-ROM mount point %s\n" msgstr "Użycie %s jako punktu montowania CD-ROM-u\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Odmontowanie CD-ROM-u\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Oczekiwanie na pÅ‚ytÄ™...\n" @@ -3244,8 +3240,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Montowanie CD-ROM-u...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identyfikacja.. " +msgid "Identifying... " +msgstr "Identyfikacja... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3257,8 +3253,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Odmontowanie CD-ROM-u...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Skanowanie pÅ‚yty w poszukiwaniu plików indeksu..\n" +msgid "Scanning disc for index files...\n" +msgstr "Skanowanie pÅ‚yty w poszukiwaniu plików indeksu...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1160,9 +1160,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Erro Interno, Ordering não terminou" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Estranho.. Os tamanhos não coincidiram, escreva para apt@packages.debian.org" +"Estranho... Os tamanhos não coincidiram, escreva para apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3221,10 +3221,6 @@ msgstr "O bloco de fabricante %s não contém a impressão digital" msgid "Using CD-ROM mount point %s\n" msgstr "A utilizar o ponto de montagem do CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "A desmontar o CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "A aguardar pelo disco...\n" @@ -3234,8 +3230,8 @@ msgid "Mounting CD-ROM...\n" msgstr "A montar o CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "A identificar.. " +msgid "Identifying... " +msgstr "A identificar... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3247,8 +3243,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "A desmontar o CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "A pesquisar os ficheiros de Ãndice do disco..\n" +msgid "Scanning disc for index files...\n" +msgstr "A pesquisar os ficheiros de Ãndice do disco...\n" #: apt-pkg/cdrom.cc:717 #, c-format diff --git a/po/pt_BR.po b/po/pt_BR.po index a9cff2f35..5aab79c68 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -1132,9 +1132,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Erro interno, Ordenação não finalizou" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Que estranho.. Os tamanhos não batem, mande e-mail para apt@packages.debian." +"Que estranho... Os tamanhos não batem, mande e-mail para apt@packages.debian." "org" #. TRANSLATOR: The required space between number and unit is already included @@ -3174,10 +3174,6 @@ msgstr "Bloco fornecedor %s não contém impressão digital (\"fingerprint\")" msgid "Using CD-ROM mount point %s\n" msgstr "Usando ponto de montagem de CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Desmontando CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Aguardando por disco...\n" @@ -3187,8 +3183,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Montando CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identificando.. " +msgid "Identifying... " +msgstr "Identificando... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3200,8 +3196,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Desmontando CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Procurando por arquivos de Ãndice no disco..\n" +msgid "Scanning disc for index files...\n" +msgstr "Procurando por arquivos de Ãndice no disco...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1134,9 +1134,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Eroare internă, Ordering nu s-a terminat" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Ce ciudat.. Dimensiunile nu se potrivesc, scrieÈ›i la apt@packages.debian.org" +"Ce ciudat... Dimensiunile nu se potrivesc, scrieÈ›i la apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3180,10 +3180,6 @@ msgstr "Blocul vânzător %s nu conÈ›ine amprentă" msgid "Using CD-ROM mount point %s\n" msgstr "Utilizare punct de montare CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Demontare CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "AÈ™tept discul...\n" @@ -3193,8 +3189,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Montez CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identificare.. " +msgid "Identifying... " +msgstr "Identificare... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3206,8 +3202,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Se demontează CD-ul...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Scanez discul de fiÈ™ierele index..\n" +msgid "Scanning disc for index files...\n" +msgstr "Scanez discul de fiÈ™ierele index...\n" # DEVELOPERS: please consider using somehow plural forms #: apt-pkg/cdrom.cc:717 @@ -1170,7 +1170,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "ВнутреннÑÑ Ð¾ÑˆÐ¸Ð±ÐºÐ°, Ordering не завершилаÑÑŒ" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "Странно. ÐеÑовпадение размеров, напишите на apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -3236,10 +3236,6 @@ msgstr "Блок поÑтавщика %s не Ñодержит отпечаткРmsgid "Using CD-ROM mount point %s\n" msgstr "ИÑпользование %s в качеÑтве точки Ð¼Ð¾Ð½Ñ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ CD-ROM\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Размонтирование CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Ожидание операции работы Ñ Ð´Ð¸Ñком…\n" @@ -3249,8 +3245,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Монтирование CD-ROM…\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "ИдентификациÑ.. " +msgid "Identifying... " +msgstr "ИдентификациÑ... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3262,8 +3258,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Размонтирование CD-ROM…\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "ПоиÑк на диÑке индекÑных файлов..\n" +msgid "Scanning disc for index files...\n" +msgstr "ПоиÑк на диÑке индекÑных файлов...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1147,7 +1147,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Vnútorná chyba, Triedenie sa neukonÄilo" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "NezvyÄajná udalosÅ¥... Veľkosti nesúhlasia, poÅ¡lite e-mail na apt@packages." "debian.org" @@ -3180,10 +3180,6 @@ msgstr "Blok výrobcu %s neobsahuje otlaÄok (fingerprint)" msgid "Using CD-ROM mount point %s\n" msgstr "Použije sa prÃpojný bod CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM sa odpája\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ÄŒaká sa na disk...\n" @@ -3193,8 +3189,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Pripája sa CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identifikuje sa.." +msgid "Identifying... " +msgstr "Identifikuje sa..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3206,8 +3202,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROM sa odpája...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Na disku sa hľadajú indexové súbory..\n" +msgid "Scanning disc for index files...\n" +msgstr "Na disku sa hľadajú indexové súbory...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1143,9 +1143,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Notranja napaka, Urejanje se ni konÄalo" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Kako Äudno .. Velikosti se ne ujemata, poÅ¡ljite sporoÄilo na apt@packages." +"Kako Äudno ... Velikosti se ne ujemata, poÅ¡ljite sporoÄilo na apt@packages." "debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -3188,10 +3188,6 @@ msgstr "Ponudnikov blok %s ne vsebuje prstnega podpisa" msgid "Using CD-ROM mount point %s\n" msgstr "Uporabljanje CD-ROM-ove priklopne toÄke %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Odklapljanje CD-ROM-a\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ÄŒakanje na disk ...\n" @@ -3201,7 +3197,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Priklapljanje CD-ROM-a ...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Identificiranje ... " #: apt-pkg/cdrom.cc:643 @@ -3214,8 +3210,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "Odklapljanje CD-ROM-a ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Preiskovanje diska za datoteke kazala ..\n" +msgid "Scanning disc for index files...\n" +msgstr "Preiskovanje diska za datoteke kazala ...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1134,9 +1134,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Internt fel. Sorteringen färdigställdes inte" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Konstigt.. storlekarna stämde inte överens, skicka e-post till apt@packages." +"Konstigt... storlekarna stämde inte överens, skicka e-post till apt@packages." "debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -1536,7 +1536,7 @@ msgstr "Fel vid kompilering av reguljärt uttryck - %s" #: apt-private/private-cachefile.cc:87 msgid "Correcting dependencies..." -msgstr "Korrigerar beroenden...." +msgstr "Korrigerar beroenden..." #: apt-private/private-cachefile.cc:90 msgid " failed." @@ -3180,10 +3180,6 @@ msgstr "Leverantörsblocket %s saknar fingeravtryck" msgid "Using CD-ROM mount point %s\n" msgstr "Använder cd-rom-monteringspunkten %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Avmonterar cd-rom\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Väntar pÃ¥ skiva...\n" @@ -3193,8 +3189,8 @@ msgid "Mounting CD-ROM...\n" msgstr "Monterar cd-rom...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "Identifierar.. " +msgid "Identifying... " +msgstr "Identifierar... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3203,10 +3199,10 @@ msgstr "Lagrad etikett: %s \n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 msgid "Unmounting CD-ROM...\n" -msgstr "Avmonterar cd-rom...\n" +msgstr "Avmonterar CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Söker efter indexfiler pÃ¥ skivan...\n" #: apt-pkg/cdrom.cc:717 @@ -1124,8 +1124,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "ข้à¸à¸œà¸´à¸”พลาดภายใน: à¸à¸²à¸£à¹€à¸£à¸µà¸¢à¸‡à¸¥à¸³à¸”ับไม่เสร็จสิ้น" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "à¹à¸›à¸¥à¸à¸›à¸£à¸°à¸«à¸¥à¸²à¸”.. ขนาดไม่ตรงà¸à¸±à¸™ à¸à¸£à¸¸à¸“าà¸à¸µà¹€à¸¡à¸¥à¹à¸ˆà¹‰à¸‡ apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "à¹à¸›à¸¥à¸à¸›à¸£à¸°à¸«à¸¥à¸²à¸”... ขนาดไม่ตรงà¸à¸±à¸™ à¸à¸£à¸¸à¸“าà¸à¸µà¹€à¸¡à¸¥à¹à¸ˆà¹‰à¸‡ apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3116,10 +3116,6 @@ msgstr "บล็à¸à¸„ผู้ผลิต %s ไม่มีลายนิ๠msgid "Using CD-ROM mount point %s\n" msgstr "à¸à¸³à¸¥à¸±à¸‡à¹ƒà¸Šà¹‰à¸ˆà¸¸à¸”เมานท์ซีดีรà¸à¸¡ %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸¥à¸´à¸à¹€à¸¡à¸²à¸™à¸—์ซีดีรà¸à¸¡\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¸à¹à¸œà¹ˆà¸™...\n" @@ -3129,8 +3125,8 @@ msgid "Mounting CD-ROM...\n" msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸¡à¸²à¸™à¸—์ซีดีรà¸à¸¡...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "à¸à¸³à¸¥à¸±à¸‡à¸•à¸£à¸§à¸ˆà¸ªà¸à¸šà¸Šà¸·à¹ˆà¸à¹à¸œà¹ˆà¸™.. " +msgid "Identifying... " +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸•à¸£à¸§à¸ˆà¸ªà¸à¸šà¸Šà¸·à¹ˆà¸à¹à¸œà¹ˆà¸™... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3142,8 +3138,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸¥à¸´à¸à¹€à¸¡à¸²à¸™à¸—์ซีดีรà¸à¸¡...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸³à¸£à¸§à¸ˆà¸‚้à¸à¸¡à¸¹à¸¥à¹ƒà¸™à¹à¸œà¹ˆà¸™à¹€à¸žà¸·à¹ˆà¸à¸«à¸²à¹à¸Ÿà¹‰à¸¡à¸”ัชนี..\n" +msgid "Scanning disc for index files...\n" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸³à¸£à¸§à¸ˆà¸‚้à¸à¸¡à¸¹à¸¥à¹ƒà¸™à¹à¸œà¹ˆà¸™à¹€à¸žà¸·à¹ˆà¸à¸«à¸²à¹à¸Ÿà¹‰à¸¡à¸”ัชนี...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1129,9 +1129,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "Error na internal, hindi natapos ang pagsaayos na pagkasunud-sunod" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Nakapagtataka.. Hindi magkatugma ang laki, mag-email sa apt@packages.debian." +"Nakapagtataka... Hindi magkatugma ang laki, mag-email sa apt@packages.debian." "org" #. TRANSLATOR: The required space between number and unit is already included @@ -3161,10 +3161,6 @@ msgstr "Block ng nagbebenta %s ay walang fingerprint" msgid "Using CD-ROM mount point %s\n" msgstr "Ginagamit ang %s bilang mount point ng CD-ROM\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Ina-unmount ang CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Hinihintay ang disc...\n" @@ -3174,7 +3170,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Sinasalang ang CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Kinikilala..." #: apt-pkg/cdrom.cc:643 @@ -3183,12 +3179,11 @@ msgid "Stored label: %s\n" msgstr "Naka-imbak na Label: %s \n" #: apt-pkg/cdrom.cc:652 apt-pkg/cdrom.cc:888 -#, fuzzy msgid "Unmounting CD-ROM...\n" -msgstr "Ina-unmount ang CD-ROM..." +msgstr "Ina-unmount ang CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Sinisiyasat ang Disc para sa talaksang index...\n" #: apt-pkg/cdrom.cc:717 @@ -1149,9 +1149,9 @@ msgid "Internal error, Ordering didn't finish" msgstr "İç hata, Sıralama tamamlanamadı" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" -"Ne kadar ilginç.. Boyutlar eÅŸleÅŸmedi, apt@packages.debian.org adresine " +"Ne kadar ilginç... Boyutlar eÅŸleÅŸmedi, apt@packages.debian.org adresine " "eposta atın." #. TRANSLATOR: The required space between number and unit is already included @@ -3206,10 +3206,6 @@ msgstr "SaÄŸlayıcı bloÄŸu %s parmak izi içermiyor" msgid "Using CD-ROM mount point %s\n" msgstr "CD-ROM baÄŸlama noktası %s kullanılıyor\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "CD-ROM ayrılıyor\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Disk bekleniliyor...\n" @@ -3219,7 +3215,7 @@ msgid "Mounting CD-ROM...\n" msgstr "CD-ROM baÄŸlanıyor...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Tanımlanıyor... " #: apt-pkg/cdrom.cc:643 @@ -3232,8 +3228,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "CD-ROM ayrılıyor...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "Disk, indeks dosyaları için taranıyor..\n" +msgid "Scanning disc for index files...\n" +msgstr "Disk, indeks dosyaları için taranıyor...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1167,8 +1167,8 @@ msgid "Internal error, Ordering didn't finish" msgstr "Ð’Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½Ñ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ°, Ordering не завершилаÑÑ" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" -msgstr "Дивно.. РозбіжніÑÑ‚ÑŒ розмірів, напишіть на apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" +msgstr "Дивно... РозбіжніÑÑ‚ÑŒ розмірів, напишіть на apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included #. in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB @@ -3231,10 +3231,6 @@ msgstr "Блок поÑтачальника %s не міÑтить відбитРmsgid "Using CD-ROM mount point %s\n" msgstr "ВикориÑтовуєтьÑÑ Ñ‚Ð¾Ñ‡ÐºÐ° Ð¼Ð¾Ð½Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ CD-ROM: %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "ДемонтуєтьÑÑ CD-ROM\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Чекаю на диÑк...\n" @@ -3244,8 +3240,8 @@ msgid "Mounting CD-ROM...\n" msgstr "МонтуєтьÑÑ CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "ІдентифікаціÑ.. " +msgid "Identifying... " +msgstr "ІдентифікаціÑ... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3257,8 +3253,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "ДемонтуєтьÑÑ CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "СкануєтьÑÑ Ð´Ð¸Ñк на вміÑÑ‚ індекÑних файлів..\n" +msgid "Scanning disc for index files...\n" +msgstr "СкануєтьÑÑ Ð´Ð¸Ñк на вміÑÑ‚ індекÑних файлів...\n" #: apt-pkg/cdrom.cc:717 #, c-format @@ -1204,7 +1204,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "Gặp lá»—i ná»™i bá»™: Tiến trình Sắp xếp chÆ°a xong" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "" "Lạ nhỉ... KÃch cỡ không khá»›p nhau. Hãy gá»i thÆ° cho <apt@packages.debian.org>" @@ -3259,10 +3259,6 @@ msgstr "Khối nhà bán %s không chứa vân tay" msgid "Using CD-ROM mount point %s\n" msgstr "Äang dùng Ä‘iểm gắn Ä‘Ä©a CD-ROM %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "Äang bá» gắn CD-ROM...\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "Äang đợi Ä‘Ä©a...\n" @@ -3272,7 +3268,7 @@ msgid "Mounting CD-ROM...\n" msgstr "Äang gắn Ä‘Ä©a CD-ROM...\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " +msgid "Identifying... " msgstr "Äang nháºn diện... " #: apt-pkg/cdrom.cc:643 @@ -3285,7 +3281,7 @@ msgid "Unmounting CD-ROM...\n" msgstr "Äang bá» gắn CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" +msgid "Scanning disc for index files...\n" msgstr "Äang quét Ä‘Ä©a tìm táºp tin chỉ mục...\n" #: apt-pkg/cdrom.cc:717 diff --git a/po/zh_CN.po b/po/zh_CN.po index 31ae60ab0..970e35138 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -1112,7 +1112,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "内部错误,Ordering 未能完æˆ" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "怪了……文件大å°ä¸ç¬¦ï¼Œè¯·å‘ä¿¡ç»™ apt@packages.debian.org å§" #. TRANSLATOR: The required space between number and unit is already included @@ -3103,10 +3103,6 @@ msgstr "软件æ供者数æ®å—内 %s 没有包å«æŒ‡çº¹ä¿¡æ¯" msgid "Using CD-ROM mount point %s\n" msgstr "现把 %s 作为了 CD-ROM 的挂载点\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "æ£åœ¨å¸è½½ CD-ROM 文件系统\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "ç‰å¾…æ’入盘片……\n" @@ -3116,8 +3112,8 @@ msgid "Mounting CD-ROM...\n" msgstr "æ£åœ¨æŒ‚è½½ CD-ROM 文件系统……\n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "æ£åœ¨é‰´åˆ«.. " +msgid "Identifying... " +msgstr "æ£åœ¨é‰´åˆ«... " #: apt-pkg/cdrom.cc:643 #, c-format @@ -3129,8 +3125,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "æ£åœ¨å¸è½½ CD-ROM...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "æ£åœ¨ç›˜ç‰‡ä¸æŸ¥æ‰¾ç´¢å¼•æ–‡ä»¶..\n" +msgid "Scanning disc for index files...\n" +msgstr "æ£åœ¨ç›˜ç‰‡ä¸æŸ¥æ‰¾ç´¢å¼•æ–‡ä»¶...\n" #: apt-pkg/cdrom.cc:717 #, c-format diff --git a/po/zh_TW.po b/po/zh_TW.po index cdb02aa55..bbe96b72d 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -1105,7 +1105,7 @@ msgid "Internal error, Ordering didn't finish" msgstr "內部錯誤,排åºæœªèƒ½å®Œæˆ" #: apt-private/private-install.cc:159 -msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" +msgid "How odd... The sizes didn't match, email apt@packages.debian.org" msgstr "怪哉... 檔案大å°ä¸ç¬¦ï¼Œè«‹ç™¼ä¿¡çµ¦ apt@packages.debian.org" #. TRANSLATOR: The required space between number and unit is already included @@ -3097,10 +3097,6 @@ msgstr "æ供者å€å¡Š %s 沒有包å«æŒ‡ç´‹ç¢¼" msgid "Using CD-ROM mount point %s\n" msgstr "使用光碟機掛載點 %s\n" -#: apt-pkg/cdrom.cc:583 -msgid "Unmounting CD-ROM\n" -msgstr "æ£åœ¨å¸è¼‰å…‰ç¢Ÿæ©Ÿ\n" - #: apt-pkg/cdrom.cc:588 msgid "Waiting for disc...\n" msgstr "æ£åœ¨ç‰å¾…碟片...\n" @@ -3110,8 +3106,8 @@ msgid "Mounting CD-ROM...\n" msgstr "æ£åœ¨æŽ›è¼‰å…‰ç¢Ÿæ©Ÿ... \n" #: apt-pkg/cdrom.cc:605 -msgid "Identifying.. " -msgstr "æ£åœ¨è˜åˆ¥.." +msgid "Identifying... " +msgstr "æ£åœ¨è˜åˆ¥..." #: apt-pkg/cdrom.cc:643 #, c-format @@ -3123,8 +3119,8 @@ msgid "Unmounting CD-ROM...\n" msgstr "æ£åœ¨å¸è¼‰å…‰ç¢Ÿæ©Ÿ...\n" #: apt-pkg/cdrom.cc:667 -msgid "Scanning disc for index files..\n" -msgstr "æ£åœ¨æŽƒæ碟片ä¸çš„索引檔..\n" +msgid "Scanning disc for index files...\n" +msgstr "æ£åœ¨æŽƒæ碟片ä¸çš„索引檔...\n" #: apt-pkg/cdrom.cc:717 #, c-format diff --git a/prepare-release b/prepare-release index 6141ce6e4..7b7fd1224 100755 --- a/prepare-release +++ b/prepare-release @@ -1,6 +1,7 @@ #!/bin/sh set -e +cd "$(readlink -f $(dirname $0))" dpkg-checkbuilddeps -d 'libxml2-utils' if [ -n "${GBP_BUILD_DIR}" ]; then @@ -10,7 +11,7 @@ fi VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p') DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p') -LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')" +LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')" LIBAPTINSTVERSION="$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)" librarysymbolsfromfile() { diff --git a/test/integration/framework b/test/integration/framework index d9bacef83..8e401cb5f 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -101,7 +101,11 @@ runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " local CMD="$1" shift - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" + case $CMD in + sh|aptitude|*/*) ;; + *) CMD="${BUILDDIRECTORY}/$CMD";; + esac + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } @@ -111,24 +115,19 @@ aptftparchive() { runapt apt-ftparchive "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } apt() { runapt apt "$@"; } -apthelper() { - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@"; -} -aptwebserver() { - LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@"; -} +apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } +aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } +aptitude() { runapt aptitude "$@"; } + dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" } -aptitude() { - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" +dpkgcheckbuilddeps() { + command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" } gdb() { echo "gdb: run »$*«" - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@" -} -http() { - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@" } gpg() { # see apt-key for the whole trickery. Setup is done in setupenvironment @@ -173,6 +172,7 @@ setupenvironment() { # allow overriding the default BUILDDIR location BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} + LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} @@ -184,11 +184,12 @@ setupenvironment() { mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d - mkdir -p var/cache var/lib var/log tmp + mkdir -p var/cache var/lib/apt var/log tmp mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers touch var/lib/dpkg/available mkdir -p usr/lib/apt ln -s ${METHODSDIR} usr/lib/apt/methods + ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove cd .. local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then @@ -217,8 +218,6 @@ setupenvironment() { echo 'quiet::NoUpdate "true";' >> aptconfig.conf echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary - export LC_ALL=C.UTF-8 - export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" configcompression '.' 'gz' #'bz2' 'lzma' 'xz' # gpg needs a trustdb to function, but it can't be invalid (not even empty) @@ -234,6 +233,12 @@ setupenvironment() { # newer gpg versions are fine without it, but play it safe for now gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 + # cleanup the environment a bit + export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" + export LC_ALL=C.UTF-8 + unset LANGUAGE APT_CONFIG + unset GREP_OPTIONS DEB_BUILD_PROFILES + msgdone "info" } @@ -254,6 +259,10 @@ getarchitectures() { echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" } +getarchitecturesfromcommalist() { + echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" +} + configarchitecture() { { echo "APT::Architecture \"$(getarchitecture $1)\";" @@ -427,7 +436,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control # fi done - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do rm -rf ${BUILDDIR}/debian/tmp mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} @@ -582,7 +591,7 @@ insertpackage() { something went horribly wrong! They are autogenerated und used only by testcases and surf no other propose…"}" local ARCHS="" - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do if [ "$arch" = 'all' -o "$arch" = 'none' ]; then ARCHS="$(getarchitectures)" else @@ -644,7 +653,7 @@ insertinstalledpackage() { local FILE='rootdir/var/lib/dpkg/status' local INFO='rootdir/var/lib/dpkg/info' - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do echo "Package: $NAME Status: $STATUS Priority: $PRIORITY @@ -850,18 +859,16 @@ signreleasefiles() { webserverconfig() { msgtest "Set webserver config option '${1}' to" "$2" - downloadfile "http://localhost:8080/_config/set/${1}/${2}" '/dev/null' >/dev/null - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" - local STATUS="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.status" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = '200' ]; then + local DOWNLOG='rootdir/tmp/download-testfile.log' + local STATUS='rootdir/tmp/webserverconfig.status' + rm -f "$STATUS" "$DOWNLOG" + if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then msgpass else - cat >&2 "$DOWNLOG" - msgfail "Statuscode was $(cat "$STATUS")" + cat "$DOWNLOG" "$STATUS" + msgfail fi - rm "$STATUS" + testwebserverlaststatuscode '200' } rewritesourceslist() { @@ -919,23 +926,29 @@ connect = 8080 changetocdrom() { mkdir -p rootdir/media/cdrom/.disk local CD="$(readlink -f rootdir/media/cdrom)" - echo "acquire::cdrom::mount \"${CD}\";" > rootdir/etc/apt/apt.conf.d/00cdrom - echo 'acquire::cdrom::autodetect 0;' >> rootdir/etc/apt/apt.conf.d/00cdrom + echo "acquire::cdrom::mount \"${CD}\"; +acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\"; +acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\"; +acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom echo -n "$1" > ${CD}/.disk/info if [ ! -d aptarchive/dists ]; then msgdie 'Flat file archive cdroms can not be created currently' return 1 fi - mv aptarchive/dists $CD + mv aptarchive/dists "$CD" ln -s "$(readlink -f ./incoming)" $CD/pool find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete + # start with an unmounted disk + mv "${CD}" "${CD}-unmounted" + # we don't want the disk to be modifiable + addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" + chmod -R -w rootdir/media/cdrom-unmounted/dists } downloadfile() { - PROTO="$(echo "$1" | cut -d':' -f 1)" - apthelper -o Acquire::https::CaInfo=${TESTDIR}/apt.pem \ - -o Debug::Acquire::${PROTO}=1 \ - download-file "$1" "$2" 2>&1 + local PROTO="$(echo "$1" | cut -d':' -f 1 )" + apthelper -o Debug::Acquire::${PROTO}=1 \ + download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful if [ -e "$2" ]; then return 0 @@ -947,8 +960,8 @@ downloadfile() { checkdiff() { local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then - echo - echo "$DIFFTEXT" + echo >&2 + echo >&2 "$DIFFTEXT" return 1 else return 0 @@ -997,11 +1010,17 @@ testequalor2() { shift 2 msgtest "Test for equality OR of" "$*" $* >$COMPAREAGAINST 2>&1 || true - (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null || - checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass || - ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \ - "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" && - msgfail ) + if checkdiff $COMPAREFILE1 $COMPAREAGAINST >/dev/null 2>&1 || \ + checkdiff $COMPAREFILE2 $COMPAREAGAINST >/dev/null 2>&1 + then + msgpass + else + echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" + checkdiff $COMPAREFILE1 $COMPAREAGAINST || true + echo -n "${CINFO}Diff against OR 2${CNORMAL}" + checkdiff $COMPAREFILE2 $COMPAREAGAINST || true + msgfail + fi } testshowvirtual() { @@ -1027,24 +1046,24 @@ testnopackage() { msgtest "Test for non-existent packages" "apt-cache show $*" local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" if [ -n "$SHOWPKG" ]; then - echo - echo "$SHOWPKG" + echo >&2 + echo >&2 "$SHOWPKG" msgfail - return 1 + else + msgpass fi - msgpass } testdpkginstalled() { msgtest "Test for correctly installed package(s) with" "dpkg -l $*" local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" if [ "$PKGS" != $# ]; then - echo $PKGS - dpkg -l "$@" | grep '^[a-z]' + echo >&2 $PKGS + dpkg -l "$@" | grep '^[a-z]' >&2 msgfail - return 1 + else + msgpass fi - msgpass } testdpkgnotinstalled() { @@ -1052,11 +1071,11 @@ testdpkgnotinstalled() { local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" if [ "$PKGS" != 0 ]; then echo - dpkg -l "$@" | grep '^[a-z]' + dpkg -l "$@" | grep '^[a-z]' >&2 msgfail - return 1 + else + msgpass fi - msgpass } testmarkedauto() { @@ -1081,8 +1100,8 @@ testsuccess() { if $@ >${OUTPUT} 2>&1; then msgpass else - echo - cat $OUTPUT + echo >&2 + cat >&2 $OUTPUT msgfail fi } @@ -1095,14 +1114,35 @@ testfailure() { fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if $@ >${OUTPUT} 2>&1; then - echo - cat $OUTPUT + echo >&2 + cat >&2 $OUTPUT msgfail else msgpass fi } +testwebserverlaststatuscode() { + local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' + local STATUS='rootdir/tmp/webserverstatus-statusfile.log' + rm -f "$DOWNLOG" "$STATUS" + msgtest 'Test last status code from the webserver was' "$1" + downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" + if [ "$(cat "$STATUS")" = "$1" ]; then + msgpass + else + echo >&2 + if [ -n "$2" ]; then + shift + echo >&2 '#### Additionally provided output files contain:' + cat >&2 "$@" + fi + echo >&2 '#### Download log of the status code:' + cat >&2 "$DOWNLOG" + msgfail "Status was $(cat "$STATUS")" + fi +} + pause() { echo "STOPPED execution. Press enter to continue" local IGNORE diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types new file mode 100755 index 000000000..a5c98f3d6 --- /dev/null +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -0,0 +1,144 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unversioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev +Conflicts: libdb5.1-dev' +insertpackage 'unversioned' 'libdb5.1-dev' 'amd64' '5.1.29-7' +insertpackage 'unversioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev' + +insertpackage 'unversioned' 'foo' 'amd64' '1' +insertpackage 'unversioned' 'bar' 'amd64' '1' +insertpackage 'unversioned' 'foo' 'amd64' '2' 'Conflicts: bar' +insertpackage 'unversioned' 'bar' 'amd64' '2' 'Conflicts: foo' +insertpackage 'unversioned' 'baz' 'amd64' '2' 'Depends: bar | foo' + +insertpackage 'versioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev +Conflicts: libdb5.1-dev (<< 5.2)' +insertpackage 'versioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev (<< 5.2)' + +insertpackage 'versioned' 'foo' 'amd64' '2' 'Conflicts: bar (<= 2)' +insertpackage 'versioned' 'bar' 'amd64' '2' 'Conflicts: foo (<= 2)' +insertpackage 'versioned' 'baz' 'amd64' '2' 'Depends: bar (>= 2) | foo (>= 2)' + +insertpackage 'multipleno' 'foo' 'amd64' '2.1' 'Conflicts: bar (<= 3)' +insertpackage 'multipleno' 'bar' 'amd64' '2.1' 'Conflicts: foo (<= 3), foo (<= 1)' + +insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)' +# having foo multiple times as conflict is a non-advisable hack in general +insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)' + +cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup +setupaptarchive + +insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev' +insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7' +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libdb5.1-dev +The following NEW packages will be installed: + libdb5.3-dev +The following packages will be upgraded: + libdb-dev +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ] +Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) [] +Inst libdb5.3-dev (5.3.28-3 unversioned [amd64]) +Conf libdb5.3-dev (5.3.28-3 unversioned [amd64]) +Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libdb5.1-dev +The following NEW packages will be installed: + libdb5.3-dev +The following packages will be upgraded: + libdb-dev +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ] +Inst libdb-dev [5.1.7] (5.3.0 versioned [amd64]) [] +Inst libdb5.3-dev (5.3.28-3 versioned [amd64]) +Conf libdb5.3-dev (5.3.28-3 versioned [amd64]) +Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned + +cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +insertinstalledpackage 'foo' 'amd64' '1' +insertinstalledpackage 'bar' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo +The following packages will be upgraded: + bar +1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv foo [1] +Inst bar [1] (2.2 multipleyes [amd64]) +Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + baz +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst baz (2 unversioned [amd64]) +Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following packages will be REMOVED: + bar +The following NEW packages will be installed: + baz +The following packages will be upgraded: + foo +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv bar [1] +Inst foo [1] (2 versioned [amd64]) +Inst baz (2 versioned [amd64]) +Conf foo (2 versioned [amd64]) +Conf baz (2 versioned [amd64])' aptget install baz -st versioned + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + baz +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst baz (2 unversioned [amd64]) +Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following packages will be REMOVED: + bar +The following NEW packages will be installed: + baz +The following packages will be upgraded: + foo +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv bar [1] +Inst foo [1] (2 versioned [amd64]) +Inst baz (2 versioned [amd64]) +Conf foo (2 versioned [amd64]) +Conf baz (2 versioned [amd64])' aptget install baz -st versioned diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index cc3483f9b..8d8fdf167 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -12,31 +12,60 @@ setupaptarchive --no-update changetocdrom 'Debian APT Testdisk 0.8.15' # -de is not in the Release file, but picked up anyway for compatibility -cd rootdir/media/cdrom/dists/stable/main/i18n +cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n +chmod +w . sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable Diese Pakete sind nur für das testen von APT gedacht, sie erfüllen keinen Zweck auf einem normalen System… ' >> Translation-de compressfile Translation-de -rm Translation-en Translation-de +rm -f Translation-en Translation-de +chmod -R -w . cd - > /dev/null -addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" -chmod -R -w rootdir/media/cdrom/dists -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. -Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures -Found label 'Debian APT Testdisk 0.8.15' -This disc is called: +aptcdromlog() { + rm -f rootdir/tmp/apt-cdrom.log + test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" + test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" + aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null + sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log + test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" + test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" +} + +CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +Unmounting CD-ROM... +Waiting for disc... +Please insert a Disc in the drive and press enter +Mounting CD-ROM... +Scanning disc for index files..." +CDROM_POST="This disc is called: 'Debian APT Testdisk 0.8.15' Writing new source list Source list entries for this disc are: deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Unmounting CD-ROM... Repeat this process for the rest of the CDs in your set." +testequal "$CDROM_PRE +Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures +Found label 'Debian APT Testdisk 0.8.15' +$CDROM_POST" aptcdromlog add + +testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +Mounting CD-ROM... +Stored label: Debian APT Testdisk 0.8.15 +Unmounting CD-ROM..." aptcdromlog ident + +# apt-setup uses these commands (expect the tr in the id) to find id and label +ident="$(LC_ALL=C aptcdrom ident 2>&1 )" +CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" +CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" +testequal "CD::${CD_ID} \"${CD_LABEL}\"; +CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -54,49 +83,24 @@ Inst testing:i386 (0.8.15 stable [i386]) Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s # check Idempotence of apt-cdrom (and disabling of Translation dropping) -aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 # take Translations from previous runs as needed -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists/partial -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail - # check that we really can install from a 'cdrom' testdpkgnotinstalled testing testsuccess aptget install testing -y diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 37ed95181..6505b5956 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -33,5 +33,7 @@ if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2> else msgfail fi -testfileequal download.stderr 'E: HashSum Failed' -testfileequal foo5.failed 'foo' +testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch + +E: Download Failed' +testfileequal foo5.FAILED 'foo' diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index 99419d1cc..73352a28c 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -7,19 +7,24 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +insertpackage 'stable' 'apt' 'all' '1' setupaptarchive --no-update +echo 'alright' > aptarchive/working changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/' -DOWNLOG='download-testfile.log' -msgtest 'normal http download works' -downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 > "$DOWNLOG" && msgpass || msgfail +msgtest 'download of a file works via' 'http' +downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail +testfileequal httpfile 'alright' -msgtest 'normal https download works' -downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog > "$DOWNLOG" && msgpass || msgfail +msgtest 'download of a file works via' 'https' +downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail +testfileequal httpsfile 'alright' -msgtest 'redirecting https to http does not work' -downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass || msgfail +msgtest 'download of a file does not work if' 'https redirected to http' +downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass + +msgtest 'libcurl has forbidden access in last request to' 'http resource' +grep -q -- 'Protocol http not supported or disabled in libcurl' curloutput && msgpass || msgfail diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support new file mode 100755 index 000000000..ae1403f71 --- /dev/null +++ b/test/integration/test-bug-661537-build-profiles-support @@ -0,0 +1,147 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign' + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'bar' 'all' '1.0' + +insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] <!profile.stage1 !profile.cross>, bar' + +# table from https://wiki.debian.org/BuildProfileSpec +insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!profile.stage1>' +insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <profile.stage1>' +insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!profile.stage1 !profile.notest>' +insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <profile.stage1 profile.notest>' +insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!profile.stage1 profile.notest>' +insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <profile.stage1 !profile.notest>' +# multiple stanzas not supported: error out +insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <profile.stage1><!profile.notest>' +insertsource 'unstable' 'spec-8' 'any' '1' 'Build-Depends: foo <profile.stage1> <!profile.notest>' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Inst foo (1.0 unstable [all]) +Conf bar (1.0 unstable [all]) +Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1 + +KEEP='Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [all]) +Conf foo (1.0 unstable [all])' +DROP='Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' + +msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support' +if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.2'; then + msgpass + testwithdpkg() { + msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output" + if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then + if [ "$3" = "$DROP" ]; then + msgpass + else + cat $OUTPUT + msgfail + fi + else + if [ "$3" = "$KEEP" ]; then + msgpass + else + cat $OUTPUT + msgfail + fi + fi + } +else + msgskip + testwithdpkg() { + msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" + msgskip + } +fi + +testprofile() { + if [ -n "$3" ]; then + testequal "$4" aptget build-dep "$1" -s -P "$3" + export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')" + testequal "$4" aptget build-dep "$1" -s -o with::environment=1 + unset DEB_BUILD_PROFILES + else + testequal "$4" aptget build-dep "$1" -s + fi + testwithdpkg "$2" "$3" "$4" +} + +testprofile 'spec-1' 'foo <!profile.stage1>' '' "$KEEP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1' "$DROP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'notest' "$KEEP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1,notest' "$DROP" + +testprofile 'spec-2' 'foo <profile.stage1>' '' "$DROP" +testprofile 'spec-2' 'foo <profile.stage1>' 'stage1' "$KEEP" +testprofile 'spec-2' 'foo <profile.stage1>' 'notest' "$DROP" +testprofile 'spec-2' 'foo <profile.stage1>' 'stage1,notest' "$KEEP" + +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' '' "$KEEP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1' "$DROP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'notest' "$DROP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1,notest' "$DROP" + +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' '' "$DROP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1' "$KEEP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'notest' "$KEEP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1,notest' "$KEEP" + +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' '' "$KEEP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1' "$DROP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'notest' "$KEEP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1,notest' "$DROP" + +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' '' "$KEEP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1' "$KEEP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'notest' "$DROP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1,notest' "$KEEP" + +testfailure aptget build-dep spec-7 -s +testfailure aptget build-dep spec-8 -s diff --git a/test/integration/test-bug-740843-versioned-up-down-breaks b/test/integration/test-bug-740843-versioned-up-down-breaks new file mode 100755 index 000000000..cb035a71f --- /dev/null +++ b/test/integration/test-bug-740843-versioned-up-down-breaks @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'foo-driver' 'amd64' '1' 'Depends: libfoo (= 1) +Recommends: libgl1-foo-glx (= 1) +Breaks: libgl1-foo-glx (<< 1), libgl1-foo-glx (>> 1)' +insertinstalledpackage 'libgl1-foo-glx' 'amd64,i386' '1' 'Depends: libfoo (= 1) +Multi-Arch: same' +insertinstalledpackage 'libfoo' 'amd64,i386' '1' 'Multi-Arch: same' + +buildsimplenativepackage 'foo-driver' 'amd64' '2' 'stable' 'Depends: libfoo (= 2) +Recommends: libgl1-foo-glx (= 2) +Breaks: libgl1-foo-glx (<< 2), libgl1-foo-glx (>> 2)' +buildsimplenativepackage 'libgl1-foo-glx' 'amd64,i386' '2' 'stable' 'Depends: libfoo (= 2) +Multi-Arch: same' +buildsimplenativepackage 'libfoo' 'amd64,i386' '2' 'stable' 'Multi-Arch: same' + +setupaptarchive + +testequalor2 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:i386 foo-driver:amd64 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 libgl1-foo-glx:i386 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' aptget dist-upgrade -s + +testsuccess aptget dist-upgrade -y -o Debug::pkgPackageManager=1 -o Debug::pkgOrderList=1 diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade index dc3725df1..c29e1f903 100755 --- a/test/integration/test-bug-multiarch-upgrade +++ b/test/integration/test-bug-multiarch-upgrade @@ -25,5 +25,5 @@ The following packages will be upgraded: 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ] Inst libcups2:i386 [1] (2 unstable [i386]) -Conf libcups2 (2 unstable [amd64]) -Conf libcups2:i386 (2 unstable [i386])' aptget install -s libcups2:i386 +Conf libcups2:i386 (2 unstable [i386]) +Conf libcups2 (2 unstable [amd64])' aptget install -s libcups2:i386 diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index c6f5ab49e..67ca0ba27 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -5,6 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment +configcompression '.' 'gz' # only gz is supported for this, so ensure it is used configarchitecture "i386" buildsimplenativepackage "testpkg" "i386" "1.0" diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 4407fbd9d..4978fe1e8 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -6,11 +6,11 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre-headless (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' -insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre-lib' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-headless (<< 6b17~pre3-1)' -insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' setupaptarchive @@ -19,16 +19,10 @@ testequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib - openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386 - openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386 - openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Remv openjdk-6-jre [6b16-1.8-0ubuntu1] - openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386 Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) - openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 - openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks index f8b4544a0..745f7d206 100755 --- a/test/integration/test-ignore-provides-if-versioned-breaks +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts index 44eafcff1..a07252768 100755 --- a/test/integration/test-ignore-provides-if-versioned-conflicts +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 2b165d100..7713c0875 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -1,55 +1,100 @@ #!/bin/sh - set -e -# setup testdir TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +# the executed script would use the installed apt-config, +# which is outside of our control +msgtest 'Check that the installed apt-config supports' '--no-empty' +if apt-config dump --no-empty >/dev/null 2>&1; then + msgpass +else + msgskip + exit 0 +fi + +CURRENTKERNEL="linux-image-$(uname -r)" +insertinstalledpackage "$CURRENTKERNEL" 'amd64' '1' +insertinstalledpackage 'linux-image-1.0.0-2-generic' 'amd64' '1.0.0-2' +insertinstalledpackage 'linux-image-100.0.0-1-generic' 'amd64' '100.0.0-1' +# ensure that the '.' is really a dot and not a wildcard +insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1' -TMPDIR=$(mktemp -d) -cd $TMPDIR -addtrap "cd /; rm -rf $TMPDIR" +testsuccess aptmark auto "$CURRENTKERNEL" 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic' -# create mock environment -mkdir apt.conf.d -cat > aptconfig.conf <<EOF -Dir::Etc::parts "$TMPDIR/apt.conf.d"; -Dir::bin::dpkg "$TMPDIR/fake-dpkg"; +cat > ./fake-dpkg <<EOF +#!/bin/sh +exec $(aptconfig dump --no-empty --format='%v ' 'DPKG::options') "\$@" EOF -APT_CONFIG=aptconfig.conf -export APT_CONFIG +chmod +x ./fake-dpkg +echo 'Dir::Bin::dpkg "./fake-dpkg";' > rootdir/etc/apt/apt.conf.d/99fakedpkg # install fake-dpkg into it -install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg +catfail() { + echo >&2 + echo >&2 '### List of protected kernels:' + cat >&2 protected.list + msgfail +} -# run the helper -sh ${TESTDIR}/../../debian/apt.auto-removal.sh +testprotected() { + rm -f rootdir/etc/apt/apt.conf.d/01autoremove-kernels protected.list -msgtest 'Check that kernel autoremoval list is correctly created' -# and ensure its there, valid and version 10.0.0-1 is there too -test -e $TMPDIR/apt.conf.d/01autoremove-kernels && msgpass || msgfail + testsuccess runapt sh ${TESTDIR}/../../debian/apt.auto-removal.sh "$@" -msgtest 'Check that most recent kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" && msgpass || msgfail + msgtest 'Check kernel autoremoval protection list' 'is created' + test -e rootdir/etc/apt/apt.conf.d/01autoremove-kernels && msgpass || msgfail -# ... and also that the running kernel is excluded -msgtest 'Check that running kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" && msgpass || msgfail + msgtest 'Check kernel autoremoval protection list' 'can be dumped' + aptconfig dump --no-empty --format '%v%n' 'APT::NeverAutoRemove' >protected.list 2>&1 && msgpass || catfail -# and that the old kernel is *not* excluded from autoremoval -msgtest 'Check that older kernels are not excluded from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" && msgfail || msgpass + msgtest 'Check kernel autoremoval protection list' 'can be parsed' + grep -q '^[A-Z]: ' protected.list && catfail || msgpass -msgtest "Check that the older kernel is retained when it's being installed" -sh ${TESTDIR}/../../debian/apt.auto-removal.sh 1.0.01-2-generic -test -e $TMPDIR/apt.conf.d/01autoremove-kernels -if ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" -then - msgfail -else - msgpass -fi + msgtest 'Check kernel autoremoval protection list includes' 'most recent kernel' + grep -q '^\^linux-image-100\\\.0\\\.0-1-generic\$$' protected.list && msgpass || catfail + + msgtest 'Check kernel autoremoval protection list includes' 'running kernel' + grep -q "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list && msgpass || catfail +} + +testequal "Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic (100.0.0-1) + linux-image-1.0.0-2-generic (1.0.0-2) + linux-image-100.0.0-1-generic (100.0.0-1) + $CURRENTKERNEL (1) +0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1] +Remv linux-image-1.0.0-2-generic [1.0.0-2] +Remv linux-image-100.0.0-1-generic [100.0.0-1] +Remv $CURRENTKERNEL [1]" aptget autoremove -sV + +testprotected +msgtest 'Check kernel autoremoval protection list does not include' 'old kernel' +grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && catfail || msgpass + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic linux-image-1.0.0-2-generic +0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1] +Remv linux-image-1.0.0-2-generic [1.0.0-2]' aptget autoremove -s -# done +testprotected 1.0.0-2-generic +msgtest 'Check kernel autoremoval protection list includes' 'installed kernel' +grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && msgpass || catfail +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1]' aptget autoremove -s diff --git a/test/integration/test-kernel-helper-autoremove.fake-dpkg b/test/integration/test-kernel-helper-autoremove.fake-dpkg deleted file mode 100644 index a365c5370..000000000 --- a/test/integration/test-kernel-helper-autoremove.fake-dpkg +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = "-l" ]; then - echo "ii linux-image-1.0.0-2-generic 1.0.01-2 amd64" - echo "ii linux-image-$(uname -r) not-used amd64" - echo "ii linux-image-10.0.0-1-generic 10.0.0.1-1 amd64" -elif [ "$1" = "--compare-versions" ]; then - dpkg "$1" "$2" "$3" "$4" -else - dpkg $@ -fi - diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 382789e68..5ab326def 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -13,17 +13,18 @@ copysource() { touch -d "$(stat --format '%y' "${TESTFILE}")" "$3" } +DOWNLOADLOG='rootdir/tmp/testdownloadfile.log' + testdownloadfile() { - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" + rm -f "$DOWNLOADLOG" msgtest "Testing download of file $2 with" "$1" - if ! downloadfile "$2" "$3" > "$DOWNLOG"; then - cat >&2 "$DOWNLOG" + if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then + cat >&2 "$DOWNLOADLOG" msgfail else msgpass fi - cat "$DOWNLOG" | while read field hash; do + cat "$DOWNLOADLOG" | while read field hash; do local EXPECTED case "$field" in 'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";; @@ -40,28 +41,12 @@ testdownloadfile() { if [ "$EXPECTED" "$4" "$hash" ]; then msgpass else - cat >&2 "$DOWNLOG" + cat >&2 "$DOWNLOADLOG" msgfail "expected: $EXPECTED ; got: $hash" fi done } -testwebserverlaststatuscode() { - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" - local STATUS="$(mktemp)" - addtrap "rm $STATUS;" - msgtest 'Test last status code from the webserver was' "$1" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = "$1" ]; then - msgpass - else - cat >&2 "$DOWNLOG" - msgfail "Status was $(cat "$STATUS")" - fi -} - - TESTFILE='aptarchive/testfile' cp -a ${TESTDIR}/framework $TESTFILE @@ -70,34 +55,34 @@ testrun() { copysource $TESTFILE 0 ./testfile testdownloadfile 'no data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" copysource $TESTFILE 20 ./testfile testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '206' + testwebserverlaststatuscode '206' "$DOWNLOADLOG" copysource /dev/zero 20 ./testfile testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!=' - testwebserverlaststatuscode '206' + testwebserverlaststatuscode '206' "$DOWNLOADLOG" copysource $TESTFILE 1M ./testfile testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '416' + testwebserverlaststatuscode '416' "$DOWNLOADLOG" copysource /dev/zero 1M ./testfile testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" copysource /dev/zero 20 ./testfile touch ./testfile testdownloadfile 'old data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" webserverconfig 'aptwebserver::support::range' 'false' copysource $TESTFILE 20 ./testfile testdownloadfile 'no server support' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" } testrun 'http://localhost:8080' diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index fed12dad0..d647856cb 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -55,14 +55,14 @@ Remv out-of-sync-gone-foreign:i386 [1] Remv out-of-sync-gone-native [1] Inst fine [1] (2 unstable [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ] Inst fine:i386 [1] (2 unstable [i386]) -Conf fine (2 unstable [amd64]) -Conf fine:i386 (2 unstable [i386]) Inst fine-installed [1] (2 unstable [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ] Inst fine-installed:i386 [1] (2 unstable [i386]) -Conf fine-installed (2 unstable [amd64]) -Conf fine-installed:i386 (2 unstable [i386]) Inst out-of-sync-gone-foreign [1] (2 unstable [amd64]) Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386]) +Conf fine:i386 (2 unstable [i386]) +Conf fine (2 unstable [amd64]) +Conf fine-installed:i386 (2 unstable [i386]) +Conf fine-installed (2 unstable [amd64]) Conf out-of-sync-gone-foreign (2 unstable [amd64]) Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1 diff --git a/test/integration/test-bug-1078697-missing-source-hashes b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes index 6fcb856b5..6fcb856b5 100755 --- a/test/integration/test-bug-1078697-missing-source-hashes +++ b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages index 5856cd744..c1d454f88 100755 --- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -39,9 +39,9 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-core:amd64 on libreoffice Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -55,7 +55,7 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffi Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' aptget dist-upgrade -s diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 992f802a6..34476e1af 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -1,29 +1,31 @@ #include <config.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/error.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/configuration.h> -#include <apt-pkg/init.h> - -#include <vector> -#include <string> -#include <list> -#include <sstream> +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/strutl.h> +#include <dirent.h> +#include <errno.h> +#include <netinet/in.h> +#include <pthread.h> +#include <regex.h> +#include <signal.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> #include <sys/socket.h> -#include <sys/types.h> #include <sys/stat.h> -#include <netinet/in.h> -#include <unistd.h> -#include <errno.h> #include <time.h> -#include <stdlib.h> -#include <dirent.h> -#include <signal.h> +#include <unistd.h> +#include <iostream> +#include <sstream> +#include <list> +#include <string> +#include <vector> -char const * const httpcodeToStr(int const httpcode) /*{{{*/ +static char const * httpcodeToStr(int const httpcode) /*{{{*/ { switch (httpcode) { @@ -77,7 +79,7 @@ char const * const httpcodeToStr(int const httpcode) /*{{{*/ return NULL; } /*}}}*/ -void addFileHeaders(std::list<std::string> &headers, FileFd &data) /*{{{*/ +static void addFileHeaders(std::list<std::string> &headers, FileFd &data)/*{{{*/ { std::ostringstream contentlength; contentlength << "Content-Length: " << data.FileSize(); @@ -88,14 +90,14 @@ void addFileHeaders(std::list<std::string> &headers, FileFd &data) /*{{{*/ headers.push_back(lastmodified); } /*}}}*/ -void addDataHeaders(std::list<std::string> &headers, std::string &data) /*{{{*/ +static void addDataHeaders(std::list<std::string> &headers, std::string &data)/*{{{*/ { std::ostringstream contentlength; contentlength << "Content-Length: " << data.size(); headers.push_back(contentlength.str()); } /*}}}*/ -bool sendHead(int const client, int const httpcode, std::list<std::string> &headers)/*{{{*/ +static bool sendHead(int const client, int const httpcode, std::list<std::string> &headers)/*{{{*/ { std::string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); @@ -128,7 +130,7 @@ bool sendHead(int const client, int const httpcode, std::list<std::string> &head return Success; } /*}}}*/ -bool sendFile(int const client, FileFd &data) /*{{{*/ +static bool sendFile(int const client, FileFd &data) /*{{{*/ { bool Success = true; char buffer[500]; @@ -144,7 +146,7 @@ bool sendFile(int const client, FileFd &data) /*{{{*/ return Success; } /*}}}*/ -bool sendData(int const client, std::string const &data) /*{{{*/ +static bool sendData(int const client, std::string const &data) /*{{{*/ { if (FileFd::Write(client, data.c_str(), data.size()) == false) { @@ -154,7 +156,7 @@ bool sendData(int const client, std::string const &data) /*{{{*/ return true; } /*}}}*/ -void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ +static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ bool content, std::string const &error = "") { std::list<std::string> headers; @@ -179,13 +181,13 @@ void sendError(int const client, int const httpcode, std::string const &request, if (content == true) sendData(client, response); } -void sendSuccess(int const client, std::string const &request, +static void sendSuccess(int const client, std::string const &request, bool content, std::string const &error = "") { sendError(client, 200, request, content, error); } /*}}}*/ -void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ +static void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ std::string const &request, bool content) { std::list<std::string> headers; @@ -222,7 +224,7 @@ void sendRedirect(int const client, int const httpcode, std::string const &uri,/ sendData(client, response); } /*}}}*/ -int filter_hidden_files(const struct dirent *a) /*{{{*/ +static int filter_hidden_files(const struct dirent *a) /*{{{*/ { if (a->d_name[0] == '.') return 0; @@ -236,7 +238,7 @@ int filter_hidden_files(const struct dirent *a) /*{{{*/ #endif return 1; } -int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { +static int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { #ifdef _DIRENT_HAVE_D_TYPE if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_DIR); else if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_REG) @@ -260,7 +262,7 @@ int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { return strcasecmp((*a)->d_name, (*b)->d_name); } /*}}}*/ -void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ +static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*/ std::string const &request, bool content) { std::list<std::string> headers; @@ -312,7 +314,7 @@ void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ sendData(client, response); } /*}}}*/ -bool parseFirstLine(int const client, std::string const &request, /*{{{*/ +static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ std::string &filename, std::string ¶ms, bool &sendContent, bool &closeConnection) { @@ -432,7 +434,7 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/ return true; } /*}}}*/ -bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> const &parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> const &parts)/*{{{*/ { size_t const pcount = parts.size(); if (pcount == 4 && parts[1] == "set") @@ -475,7 +477,7 @@ bool handleOnTheFlyReconfiguration(int const client, std::string const &request, return false; } /*}}}*/ -void * handleClient(void * voidclient) /*{{{*/ +static void * handleClient(void * voidclient) /*{{{*/ { int client = *((int*)(voidclient)); std::clog << "ACCEPT client " << client << std::endl; diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc index 3f7feabcb..852ec4ee9 100644 --- a/test/interactive-helper/extract-control.cc +++ b/test/interactive-helper/extract-control.cc @@ -1,13 +1,16 @@ +#include <config.h> + #include <apt-pkg/debfile.h> #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> +#include <string> #include <iostream> #include <unistd.h> using namespace std; -bool ExtractMember(const char *File,const char *Member) +static bool ExtractMember(const char *File,const char *Member) { FileFd Fd(File,FileFd::ReadOnly); debDebFile Deb(Fd); diff --git a/test/interactive-helper/mthdcat.cc b/test/interactive-helper/mthdcat.cc index 25d09a3f5..2961b2080 100644 --- a/test/interactive-helper/mthdcat.cc +++ b/test/interactive-helper/mthdcat.cc @@ -2,6 +2,8 @@ All this does is cat a file into the method without closing the FD when the file ends */ +#include <config.h> + #include <unistd.h> int main() diff --git a/test/interactive-helper/rpmver.cc b/test/interactive-helper/rpmver.cc index 15c96cbbe..017c92fba 100644 --- a/test/interactive-helper/rpmver.cc +++ b/test/interactive-helper/rpmver.cc @@ -1,3 +1,5 @@ +#include <config.h> + #include <apt-pkg/debversion.h> #include <rpm/rpmio.h> #include <rpm/misc.h> diff --git a/test/interactive-helper/test_udevcdrom.cc b/test/interactive-helper/test_udevcdrom.cc index 88f5f0153..b87dcd935 100644 --- a/test/interactive-helper/test_udevcdrom.cc +++ b/test/interactive-helper/test_udevcdrom.cc @@ -1,7 +1,10 @@ +#include <config.h> + #include <apt-pkg/cdrom.h> -#include <stdio.h> -#include <assert.h> +#include <stddef.h> +#include <string> +#include <assert.h> #include <vector> #include <iostream> @@ -17,5 +20,4 @@ int main() std::cerr << l[i].DeviceName << " " << l[i].Mounted << " " << l[i].MountPath << std::endl; - } diff --git a/test/interactive-helper/testdeb.cc b/test/interactive-helper/testdeb.cc index d28f20114..6aae9f563 100644 --- a/test/interactive-helper/testdeb.cc +++ b/test/interactive-helper/testdeb.cc @@ -1,15 +1,22 @@ +#include <config.h> + #include <apt-pkg/dirstream.h> #include <apt-pkg/debfile.h> #include <apt-pkg/error.h> #include <apt-pkg/extracttar.h> +#include <apt-pkg/arfile.h> +#include <apt-pkg/fileutl.h> + +#include <iostream> +#include <string> class NullStream : public pkgDirStream { public: - virtual bool DoItem(Item &Itm,int &Fd) {return true;}; + virtual bool DoItem(Item &/*Itm*/, int &/*Fd*/) {return true;}; }; -bool Test(const char *File) +static bool Test(const char *File) { FileFd Fd(File,FileFd::ReadOnly); debDebFile Deb(Fd); @@ -33,6 +40,11 @@ bool Test(const char *File) int main(int argc, const char *argv[]) { + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + Test(argv[1]); _error->DumpErrors(); return 0; diff --git a/test/libapt/assert.h b/test/libapt/assert.h index 113c057ed..357801592 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,11 +1,18 @@ #include <iostream> #include <cstdlib> +#include <apt-pkg/macros.h> + +#if __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmissing-declarations" +#endif + #define equals(x,y) assertEquals(y, x, __LINE__) #define equalsNot(x,y) assertEqualsNot(y, x, __LINE__) template < typename X, typename Y > -void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { +APT_NORETURN void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl; std::exit(EXIT_FAILURE); } @@ -111,3 +118,7 @@ void dumpVector(X vec) { v != vec.end(); ++v) std::cout << *v << std::endl; } + +#if __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif diff --git a/test/libapt/cdromfindmountpointfordevice_test.cc b/test/libapt/cdromfindmountpointfordevice_test.cc new file mode 100644 index 000000000..26dcd1459 --- /dev/null +++ b/test/libapt/cdromfindmountpointfordevice_test.cc @@ -0,0 +1,26 @@ +#include <config.h> + +#include <apt-pkg/cdromutl.h> +#include <apt-pkg/configuration.h> + +#include <string> +#include <vector> + +#include "assert.h" + +int main(int argc, char const *argv[]) { + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + + _config->Set("Dir::state::Mountpoints", argv[1]); + equals("/", FindMountPointForDevice("rootfs")); + equals("/", FindMountPointForDevice("/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21")); + equals("/sys", FindMountPointForDevice("sysfs")); + equals("/sys0", FindMountPointForDevice("sysfs0")); + equals("/boot/efi", FindMountPointForDevice("/dev/sda1")); + equals("/tmp", FindMountPointForDevice("tmpfs")); + + return 0; +} diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc index e9f5a51b0..583de1423 100644 --- a/test/libapt/cdromfindpackages_test.cc +++ b/test/libapt/cdromfindpackages_test.cc @@ -1,9 +1,13 @@ +#include <config.h> + #include <apt-pkg/cdrom.h> #include <apt-pkg/error.h> #include <algorithm> #include <string> #include <vector> +#include <stddef.h> +#include <iostream> #include "assert.h" diff --git a/test/libapt/cdromreducesourcelist_test.cc b/test/libapt/cdromreducesourcelist_test.cc index 729da23a6..196d0136e 100644 --- a/test/libapt/cdromreducesourcelist_test.cc +++ b/test/libapt/cdromreducesourcelist_test.cc @@ -1,7 +1,7 @@ +#include <config.h> + #include <apt-pkg/cdrom.h> -#include <apt-pkg/error.h> -#include <algorithm> #include <string> #include <vector> @@ -15,7 +15,7 @@ public: } }; -int main(int argc, char const *argv[]) { +int main() { Cdrom cd; std::vector<std::string> List; std::string CD("/media/cdrom/"); diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index de8a30bd6..d8c5bc5bd 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -1,4 +1,7 @@ +#include <config.h> + #include <apt-pkg/cmndline.h> +#include <apt-pkg/configuration.h> #include "assert.h" diff --git a/test/libapt/commandlineasstring_test.cc b/test/libapt/commandlineasstring_test.cc index a38957d7e..5c005e956 100644 --- a/test/libapt/commandlineasstring_test.cc +++ b/test/libapt/commandlineasstring_test.cc @@ -1,3 +1,5 @@ +#include <config.h> + #include <apt-pkg/cmndline.h> #include <apt-pkg/configuration.h> diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc index fdb1d5674..43b98f240 100644 --- a/test/libapt/compareversion_test.cc +++ b/test/libapt/compareversion_test.cc @@ -16,22 +16,21 @@ ##################################################################### */ /*}}}*/ -#include <apt-pkg/macros.h> +#include <config.h> + #include <apt-pkg/error.h> -#include <apt-pkg/version.h> #include <apt-pkg/debversion.h> #include <apt-pkg/fileutl.h> -#include <iostream> -#include <fstream> +#include <fstream> +#include <string> #include <stdlib.h> #include <unistd.h> -#include <sys/types.h> #include <sys/wait.h> using namespace std; -bool callDPkg(const char *val, const char *ref, const char &op) { +static bool callDPkg(const char *val, const char *ref, const char &op) { pid_t Process = ExecFork(); if (Process == 0) { @@ -50,7 +49,7 @@ bool callDPkg(const char *val, const char *ref, const char &op) { return WIFEXITED(Ret) == true && WEXITSTATUS(Ret) == 0; } -void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) { +static void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) { int Res = debVS.CmpVersion(A.c_str(), B.c_str()); bool const dpkg = callDPkg(A.c_str(),B.c_str(), Expected); Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res); @@ -61,7 +60,7 @@ void assertVersion(int const &CurLine, string const &A, string const &B, int con _error->Error("DPkg differ with line: %u. '%s' '%s' '%s' == false",CurLine,A.c_str(),((Expected == 1) ? "<<" : ( (Expected == 0) ? "=" : ">>")),B.c_str()); } -bool RunTest(const char *File) +static bool RunTest(const char *File) { if (FileExists(File) == false) return _error->Error("Versiontestfile %s doesn't exist!", File); diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 2c974ee0a..c9235500c 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -1,3 +1,5 @@ +#include <config.h> + #include <apt-pkg/configuration.h> #include <string> @@ -5,7 +7,7 @@ #include "assert.h" -int main(int argc,const char *argv[]) { +int main() { Configuration Cnf; std::vector<std::string> fds; @@ -98,9 +100,37 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null"); equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null"); - Cnf.Set("Moo::Bar", "1"); - Cnf.Clear(); - equals(Cnf.Find("Moo::Bar"), ""); + Cnf.Set("Moo::Bar", "1"); + Cnf.Clear(); + equals(Cnf.Find("Moo::Bar"), ""); + + std::vector<std::string> vec = Cnf.FindVector("Test::Vector", ""); + equals(vec.size(), 0); + vec = Cnf.FindVector("Test::Vector", "foo"); + equals(vec.size(), 1); + equals(vec[0], "foo"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 2); + equals(vec[0], "foo"); + equals(vec[1], "bar"); + Cnf.Set("Test::Vector::", "baz"); + Cnf.Set("Test::Vector::", "bob"); + Cnf.Set("Test::Vector::", "dob"); + vec = Cnf.FindVector("Test::Vector"); + equals(vec.size(), 3); + equals(vec[0], "baz"); + equals(vec[1], "bob"); + equals(vec[2], "dob"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 3); + equals(vec[0], "baz"); + equals(vec[1], "bob"); + equals(vec[2], "dob"); + Cnf.Set("Test::Vector", "abel,bravo"); + vec = Cnf.FindVector("Test::Vector", "foo,bar"); + equals(vec.size(), 2); + equals(vec[0], "abel"); + equals(vec[1], "bravo"); //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 462bdefd9..8da832ba9 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -1,16 +1,15 @@ +#include <config.h> + #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> -#include "assert.h" #include <string> #include <vector> - -#include <stdio.h> -#include <iostream> #include <stdlib.h> +#include "assert.h" -int main(int argc,char *argv[]) +int main() { std::vector<std::string> files; diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc index 807469263..f4dfc6ae8 100644 --- a/test/libapt/getarchitectures_test.cc +++ b/test/libapt/getarchitectures_test.cc @@ -1,13 +1,14 @@ +#include <config.h> + #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/configuration.h> -#include "assert.h" #include <string> #include <vector> -#include <iostream> +#include "assert.h" -int main(int argc,char *argv[]) +int main() { std::vector<std::string> vec; diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index cef89bde6..15aa4e879 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -1,3 +1,5 @@ +#include <config.h> + #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/configuration.h> @@ -105,6 +107,14 @@ int main(int argc,char *argv[]) vec = APT::Configuration::getLanguages(false, false, env); equals(vec.size(), 1); equals(vec[0], "fr"); + + _config->Set("Acquire::Languages", "environment,en"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 3); + equals(vec[0], "de_DE"); + equals(vec[1], "de"); + equals(vec[2], "en"); _config->Set("Acquire::Languages", ""); _config->Set("Acquire::Languages::1", "environment"); diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc index b2c95e840..df125fc83 100644 --- a/test/libapt/getlistoffilesindir_test.cc +++ b/test/libapt/getlistoffilesindir_test.cc @@ -1,12 +1,13 @@ +#include <config.h> + #include <apt-pkg/fileutl.h> -#include "assert.h" #include <string> #include <vector> - -#include <stdio.h> #include <iostream> +#include "assert.h" + #define P(x) std::string(argv[1]).append("/").append(x) int main(int argc,char *argv[]) diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc index b6939231d..e913fdc12 100644 --- a/test/libapt/globalerror_test.cc +++ b/test/libapt/globalerror_test.cc @@ -1,11 +1,15 @@ +#include <config.h> + #include <apt-pkg/error.h> -#include "assert.h" +#include <stddef.h> #include <string> #include <errno.h> #include <string.h> -int main(int argc,char *argv[]) +#include "assert.h" + +int main() { std::string const textOfErrnoZero(strerror(0)); diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 3da89052b..d743faec6 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -1,12 +1,15 @@ +#include <config.h> + #include <apt-pkg/md5.h> #include <apt-pkg/sha1.h> #include <apt-pkg/sha2.h> #include <apt-pkg/strutl.h> #include <apt-pkg/hashes.h> #include <apt-pkg/fileutl.h> -#include <iostream> -#include <stdio.h> +#include <iostream> +#include <stdlib.h> +#include <string> #include "assert.h" @@ -43,24 +46,29 @@ template <class T> void TestMill(const char *Out) int main(int argc, char** argv) { + if (argc != 6) { + std::cout << "Five parameter expected - given " << argc << std::endl; + return 100; + } + // test HashSumValue which doesn't calculate but just stores sums { - string md5sum = argv[2]; + std::string md5sum = argv[2]; MD5SumValue md5(md5sum); equals(md5.Value(), md5sum); } { - string sha1sum = argv[3]; + std::string sha1sum = argv[3]; SHA1SumValue sha1(sha1sum); equals(sha1.Value(), sha1sum); } { - string sha2sum = argv[4]; + std::string sha2sum = argv[4]; SHA256SumValue sha2(sha2sum); equals(sha2.Value(), sha2sum); } { - string sha2sum = argv[5]; + std::string sha2sum = argv[5]; SHA512SumValue sha2(sha2sum); equals(sha2.Value(), sha2sum); } diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc index 69d8fae86..e04ab261b 100644 --- a/test/libapt/indexcopytosourcelist_test.cc +++ b/test/libapt/indexcopytosourcelist_test.cc @@ -1,8 +1,11 @@ +#include <config.h> + #include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/indexcopy.h> #include <string> +#include <stdio.h> #include "assert.h" @@ -12,14 +15,14 @@ public: IndexCopy::ConvertToSourceList(CD, Path); return Path; } - bool GetFile(std::string &Filename,unsigned long long &Size) { return false; } - bool RewriteEntry(FILE *Target,std::string File) { return false; } + bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; } + bool RewriteEntry(FILE * /*Target*/, std::string /*File*/) { return false; } const char *GetFileName() { return NULL; } const char *Type() { return NULL; } }; -int main(int argc, char const *argv[]) { +int main() { NoCopy ic; std::string const CD("/media/cdrom/"); diff --git a/test/libapt/makefile b/test/libapt/makefile index a8e053d6e..66d6ea783 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -94,6 +94,12 @@ SLIBS = -lapt-pkg SOURCE = cdromreducesourcelist_test.cc include $(PROGRAM_H) +# test cdroms FindMountPointForDevice for udev autodetection +PROGRAM = CdromFindMountPointForDevice${BASENAME} +SLIBS = -lapt-pkg +SOURCE = cdromfindmountpointfordevice_test.cc +include $(PROGRAM_H) + # test IndexCopy::ConvertToSourceList PROGRAM = IndexCopyToSourceList${BASENAME} SLIBS = -lapt-pkg diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index e95016240..5564e2bc0 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -1,16 +1,24 @@ +#include <config.h> + #include <apt-pkg/deblistparser.h> #include <apt-pkg/configuration.h> +#include <apt-pkg/pkgcache.h> + +#include <string.h> +#include <string> #include "assert.h" -int main(int argc,char *argv[]) { +int main() { std::string Package; std::string Version; unsigned int Op = 5; unsigned int Null = 0; bool StripMultiArch = true; bool ParseArchFlags = false; + bool ParseRestrictionsList = false; _config->Set("APT::Architecture","amd64"); + _config->Set("APT::Build-Profiles","stage1"); const char* Depends = "debhelper:any (>= 5.0), " @@ -27,6 +35,9 @@ int main(int argc,char *argv[]) { "os-for-me [ linux-any ], " "cpu-not-for-me [ any-armel ], " "os-not-for-me [ kfreebsd-any ], " + "not-in-stage1 <!profile.stage1>, " + "not-in-stage1-or-nodoc <!profile.nodoc !profile.stage1>, " + "only-in-stage1 <unknown.unknown profile.stage1>, " "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), " ; @@ -39,7 +50,7 @@ test: const char* Start = Depends; const char* End = Depends + strlen(Depends); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("debhelper", Package); else @@ -47,7 +58,7 @@ test: equals("5.0", Version); equals(Null | pkgCache::Dep::GreaterEq, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("libdb-dev", Package); else @@ -55,7 +66,7 @@ test: equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("gettext", Package); else @@ -63,7 +74,7 @@ test: equals("0.12", Version); equals(Null | pkgCache::Dep::LessEq, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("libcurl4-gnutls-dev", Package); else @@ -71,104 +82,131 @@ test: equals("", Version); equals(Null | pkgCache::Dep::Or, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("libcurl3-gnutls-dev", Package); equals("7.15.5", Version); equals(Null | pkgCache::Dep::Greater, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("debiandoc-sgml", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("apt", Package); equals("0.7.25", Version); equals(Null | pkgCache::Dep::GreaterEq, Op); if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("", Package); // not-for-me } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("only-for-me", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("any-for-me", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("not-for-darwin", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("cpu-for-me", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("os-for-me", Package); equals("", Version); equals(Null | pkgCache::Dep::NoOp, Op); } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("", Package); // cpu-not-for-me } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } if (ParseArchFlags == true) { - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); equals("", Package); // os-not-for-me } else { - equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch)); + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); + Start = strstr(Start, ","); + Start++; + } + + if (ParseRestrictionsList == true) { + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); + equals("", Package); // not-in-stage1 + } else { + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); + Start = strstr(Start, ","); + Start++; + } + + if (ParseRestrictionsList == true) { + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); + equals("", Package); // not-in-stage1-or-in-nodoc + } else { + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); + Start = strstr(Start, ","); + Start++; + } + + if (ParseRestrictionsList == true) { + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); + equals("only-in-stage1", Package); + } else { + equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList)); Start = strstr(Start, ","); Start++; } - Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("overlord-dev", Package); else @@ -176,7 +214,7 @@ test: equals("7.15.3~", Version); equals(Null | pkgCache::Dep::Equals | pkgCache::Dep::Or, Op); - debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch); + debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList); if (StripMultiArch == true) equals("overlord-dev", Package); else @@ -185,11 +223,13 @@ test: equals(Null | pkgCache::Dep::Greater, Op); if (StripMultiArch == false) - ParseArchFlags = true; + if (ParseArchFlags == false) + ParseRestrictionsList = !ParseRestrictionsList; + ParseArchFlags = !ParseArchFlags; StripMultiArch = !StripMultiArch; runner++; - if (runner < 4) + if (runner < 8) goto test; // this is the prove: tests are really evil ;) return 0; diff --git a/test/libapt/run-tests b/test/libapt/run-tests index a056f31f9..0baedcf9e 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -108,6 +108,14 @@ do "${tmppath}/dists/unstable/InRelease" \ "${tmppath}/dists/broken/Release.gpg" ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid" + elif [ $name = "CdromFindMountPointForDevice${EXT}" ]; then + tmppath=$(mktemp) + echo 'rootfs / rootfs rw 0 0 +sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 +sysfs0 /sys0 sysfs rw,nosuid,nodev,noexec,relatime 0 0 +/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 +/dev/sda1 /boot/efi vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro 0 0 +tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0' > $tmppath fi echo -n "Testing with ${NAME} " diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 0300ce929..71aa54f1e 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -1,15 +1,20 @@ +#include <config.h> + +#include <apt-pkg/configuration.h> #include <apt-pkg/sourcelist.h> -#include <apt-pkg/tagfile.h> +#include <apt-pkg/fileutl.h> -#include "assert.h" +#include <string> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "assert.h" + char *tempfile = NULL; int tempfile_fd = -1; -void remove_tmpfile(void) +static void remove_tmpfile(void) { if (tempfile_fd > 0) close(tempfile_fd); @@ -19,7 +24,7 @@ void remove_tmpfile(void) } } -int main(int argc, char *argv[]) +int main() { _config->Set("APT::Sources::Use-Deb822", true); diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 8215654d0..618f4daba 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -1,8 +1,13 @@ +#include <config.h> + #include <apt-pkg/strutl.h> +#include <string> +#include <vector> + #include "assert.h" -int main(int argc,char *argv[]) +int main() { std::string input, output, expected; @@ -44,7 +49,7 @@ int main(int argc,char *argv[]) // Split input = "status: libnet1:amd64: unpacked"; - vector<std::string> result = StringSplit(input, ": "); + std::vector<std::string> result = StringSplit(input, ": "); equals(result[0], "status"); equals(result[1], "libnet1:amd64"); equals(result[2], "unpacked"); diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index d12c74c95..aaf46e3e9 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -1,15 +1,19 @@ +#include <config.h> + #include <apt-pkg/fileutl.h> #include <apt-pkg/tagfile.h> -#include "assert.h" +#include <string> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "assert.h" + char *tempfile = NULL; int tempfile_fd = -1; -void remove_tmpfile(void) +static void remove_tmpfile(void) { if (tempfile_fd > 0) close(tempfile_fd); @@ -19,7 +23,7 @@ void remove_tmpfile(void) } } -int main(int argc, char *argv[]) +int main() { FileFd fd; const char contents[] = "FieldA-12345678: the value of the field"; diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc index 8216ade71..6559f1390 100644 --- a/test/libapt/uri_test.cc +++ b/test/libapt/uri_test.cc @@ -1,5 +1,9 @@ +#include <config.h> + #include <apt-pkg/strutl.h> +#include <string> + #include "assert.h" int main() { diff --git a/vendor/debian/makefile b/vendor/debian/makefile deleted file mode 100644 index 25bc0350c..000000000 --- a/vendor/debian/makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/debian - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - sed -e 's#&stable-codename;#$(shell ../getinfo debian-stable-codename)#g' $< > $@ - -clean: clean/sources.list - -clean/sources.list: - rm -f sources.list - diff --git a/vendor/debian/sources.list.in b/vendor/debian/sources.list.in index 745e32cbe..2e430296a 100644 --- a/vendor/debian/sources.list.in +++ b/vendor/debian/sources.list.in @@ -1,8 +1,8 @@ # See sources.list(5) manpage for more information # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. -deb http://ftp.us.debian.org/debian &stable-codename; main contrib non-free -deb http://security.debian.org &stable-codename;/updates main contrib non-free +deb http://ftp.us.debian.org/debian &debian-stable-codename; main contrib non-free +deb http://security.debian.org &debian-stable-codename;/updates main contrib non-free # Uncomment if you want the apt-get source function to work -#deb-src http://ftp.us.debian.org/debian &stable-codename; main contrib non-free -#deb-src http://security.debian.org &stable-codename;/updates main contrib non-free +#deb-src http://ftp.us.debian.org/debian &debian-stable-codename; main contrib non-free +#deb-src http://security.debian.org &debian-stable-codename;/updates main contrib non-free diff --git a/vendor/getinfo b/vendor/getinfo index 4422f5d78..d45c0fca2 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -3,6 +3,7 @@ BASEDIR="$(readlink -f "$(dirname $0)")" INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")" +VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.' @@ -20,17 +21,20 @@ getfield() { } case "$1" in -debian-stable-codename) - getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent" - ;; -tanglu-codename) - getrawfield 'tanglu-codename' "${BASEDIR}/../doc/apt-verbatim.ent" +debian-stable-codename|debian-oldstable-codename|debian-testing-codename) + getrawfield "${1#*-}" "$VERBATIM" ;; ubuntu-codename) - getrawfield 'ubuntu-codename' "${BASEDIR}/../doc/apt-verbatim.ent" + getrawfield "$1" "$VERBATIM" + ;; +keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) + exec $0 'vendor' "$@" + ;; +vendor) + getfield "$2" ;; -keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-distro-codename) - getfield "$1" +verbatim) + getfield "$2" "$VERBATIM" ;; *) echo >&2 "Unknown data field $1 requested" diff --git a/vendor/makefile b/vendor/makefile index 619c603fb..0701a03eb 100644 --- a/vendor/makefile +++ b/vendor/makefile @@ -14,11 +14,9 @@ veryclean: veryclean/subdirs dirs: dirs/subdirs manpages: manpages/subdirs -all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs: - $(MAKE) -C current $(patsubst %/subdirs,%,$@) - -clean/subdirs veryclean/subdirs: - test ! -e current || $(MAKE) -C current $(patsubst %/subdirs,%,$@) +all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs clean/subdirs veryclean/subdirs: + test ! -e current/makefile || $(MAKE) -C current $(patsubst %/subdirs,%,$@) + test ! -e current/makefile.auto || $(MAKE) -C current -f makefile.auto $(patsubst %/subdirs,%,$@) current: rm -f $@ @@ -29,17 +27,29 @@ current: break; \ fi; \ done - # if we haven't found a specific, look for a deriving in hardcoded order - test -e $@ || \ - (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \ - (dpkg-vendor --derives-from tanglu && cp ln -s tanglu $@ ) || \ - ln -s debian $@ + # if we haven't found a specific, look for a deriving + # we do ubuntu and debian last as those are the biggest families + # and would therefore potentially 'shadow' smaller families + # (especially debian as it sorts quiet early) + if ! test -e $@; then \ + find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ + if [ "$$DISTRO" = 'debian' -o "$$DISTRO" = 'ubuntu' ]; then continue; fi; \ + if dpkg-vendor --derives-from $$DISTRO; then \ + ln -s $$DISTRO $@; \ + break; \ + fi; \ + done; \ + test -e $@ || \ + (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \ + ln -s debian $@; \ + fi + if test ! -e current/makefile; then \ + sed "s#@@VENDOR@@#$(notdir $(shell readlink -f current))#" vendor.makefile > current/makefile.auto; \ + fi .PHONY: clean veryclean all binary vendor -.NOPARALLEL: clean: clean/current -clean/current: - test ! -e current || $(MAKE) -C current clean - rm -f current +clean/current: clean/subdirs + rm -f current/makefile.auto current diff --git a/vendor/raspbian/makefile b/vendor/raspbian/makefile deleted file mode 100644 index c4464900f..000000000 --- a/vendor/raspbian/makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/raspbian - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - sed -e 's#&stable-codename;#$(shell ../getinfo debian-stable-codename)#g' $< > $@ - -clean: clean/sources.list - -clean/sources.list: - rm -f sources.list diff --git a/vendor/steamos/apt-vendor.ent b/vendor/steamos/apt-vendor.ent index 69bb254ef..dc1b798e6 100644 --- a/vendor/steamos/apt-vendor.ent +++ b/vendor/steamos/apt-vendor.ent @@ -3,6 +3,6 @@ <!ENTITY keyring-package "<package>valve-archive-keyring</package>"> <!ENTITY keyring-filename "<filename>/usr/share/keyrings/valve-archive-keyring.gpg</filename>"> <!ENTITY keyring-removed-filename "<filename>/usr/share/keyrings/valve-archive-removed-keys.gpg</filename>"> -<!ENTITY current-distro-codename "alchemist"> <!ENTITY keyring-master-filename ""> <!ENTITY keyring-uri ""> +<!ENTITY current-codename "alchemist"> diff --git a/vendor/steamos/makefile b/vendor/steamos/makefile deleted file mode 100644 index 9ee0e65a2..000000000 --- a/vendor/steamos/makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/steamos - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - sed -e 's#&stable-codename;#$(shell ../getinfo debian-stable-codename)#g' $< | sed -e 's#&steamos-codename;#$(shell ../getinfo current-distro-codename)#g' > $@ - -clean: clean/sources.list - -clean/sources.list: - rm -f sources.list - diff --git a/vendor/steamos/sources.list.in b/vendor/steamos/sources.list.in index fed6c3818..69174d090 100644 --- a/vendor/steamos/sources.list.in +++ b/vendor/steamos/sources.list.in @@ -1,5 +1,5 @@ # See sources.list(5) manpage for more information # Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool. -deb http://repo.steampowered.com/steamos &steamos-codename; main contrib non-free -deb-src http://repo.steampowered.com/steamos &steamos-codename; main contrib non-free +deb http://repo.steampowered.com/steamos ¤t-codename; main contrib non-free +deb-src http://repo.steampowered.com/steamos ¤t-codename; main contrib non-free diff --git a/vendor/tanglu/apt-vendor.ent b/vendor/tanglu/apt-vendor.ent index 4b70a5f82..d2442209c 100644 --- a/vendor/tanglu/apt-vendor.ent +++ b/vendor/tanglu/apt-vendor.ent @@ -5,3 +5,4 @@ <!ENTITY keyring-removed-filename "<filename>/usr/share/keyrings/tanglu-archive-removed-keys.gpg</filename>"> <!ENTITY keyring-master-filename ""> <!ENTITY keyring-uri ""> +<!ENTITY current-codename "bartholomea"> diff --git a/vendor/tanglu/makefile b/vendor/tanglu/makefile deleted file mode 100644 index 9fe680bc6..000000000 --- a/vendor/tanglu/makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/tanglu - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - sed -e 's#&tanglu-codename;#$(shell ../getinfo tanglu-codename)#g' $< > $@ - -clean: clean/sources.list - -clean/sources.list: - rm -f sources.list diff --git a/vendor/tanglu/sources.list.in b/vendor/tanglu/sources.list.in index dfa219046..ce95e70c2 100644 --- a/vendor/tanglu/sources.list.in +++ b/vendor/tanglu/sources.list.in @@ -1,7 +1,7 @@ # See sources.list(5) manpage for more information -deb http://archive.tanglu.org/tanglu &tanglu-codename; main contrib non-free -#deb-src http://archive.tanglu.org/tanglu &tanglu-codename; main contrib non-free +deb http://archive.tanglu.org/tanglu ¤t-codename; main contrib non-free +#deb-src http://archive.tanglu.org/tanglu ¤t-codename; main contrib non-free -#deb http://archive.tanglu.org/tanglu &tanglu-codename;-updates main contrib non-free -#deb-src http://archive.tanglu.org/tanglu &tanglu-codename;-updates main contrib non-free +#deb http://archive.tanglu.org/tanglu ¤t-codename;-updates main contrib non-free +#deb-src http://archive.tanglu.org/tanglu ¤t-codename;-updates main contrib non-free diff --git a/vendor/ubuntu/makefile b/vendor/ubuntu/makefile deleted file mode 100644 index afcaaf718..000000000 --- a/vendor/ubuntu/makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/ubuntu - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - sed -e 's#&ubuntu-codename;#$(shell ../getinfo ubuntu-codename)#g' $< > $@ - -clean: clean/sources.list - -clean/sources.list: - rm -f sources.list diff --git a/vendor/vendor.makefile b/vendor/vendor.makefile new file mode 100644 index 000000000..40b35ea3d --- /dev/null +++ b/vendor/vendor.makefile @@ -0,0 +1,21 @@ +# -*- make -*- +BASE=../.. +SUBDIR=vendor/@@VENDOR@@ + +# Bring in the default rules +include ../../buildlib/defaults.mak + +doc binary manpages: sources.list + +sources.list: sources.list.in ../../doc/apt-verbatim.ent + sed -e 's#&debian-stable-codename;#$(shell ../getinfo debian-stable-codename)#g' \ + -e 's#&debian-oldstable-codename;#$(shell ../getinfo debian-oldstable-codename)#g' \ + -e 's#&debian-testing-codename;#$(shell ../getinfo debian-testing-codename)#g' \ + -e 's#&ubuntu-codename;#$(shell ../getinfo ubuntu-codename)#g' \ + -e 's#¤t-codename;#$(shell ../getinfo current-codename)#g' \ + $< > $@ + +clean: clean/sources.list + +clean/sources.list: + rm -f sources.list |