=== modified file 'apt-pkg/acquire-item.h' --- apt-pkg/acquire-item.h 2010-05-04 15:05:23 +0000 +++ apt-pkg/acquire-item.h 2010-06-03 07:22:00 +0000 @@ -112,10 +112,10 @@ string ErrorText; /** \brief The size of the object to fetch. */ - unsigned long FileSize; + unsigned long long FileSize; /** \brief How much of the object was already fetched. */ - unsigned long PartialSize; + unsigned long long PartialSize; /** \brief If not \b NULL, contains the name of a subprocess that * is operating on this object (for instance, "gzip" or "gpgv"). === modified file 'apt-pkg/acquire.cc' --- apt-pkg/acquire.cc 2010-04-13 08:18:19 +0000 +++ apt-pkg/acquire.cc 2010-06-03 08:45:58 +0000 @@ -506,9 +506,9 @@ // Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/ // --------------------------------------------------------------------- /* This is the total number of bytes needed */ -double pkgAcquire::TotalNeeded() +unsigned long long pkgAcquire::TotalNeeded() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) Total += (*I)->FileSize; return Total; @@ -517,9 +517,9 @@ // Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -double pkgAcquire::FetchNeeded() +unsigned long long pkgAcquire::FetchNeeded() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) if ((*I)->Local == false) Total += (*I)->FileSize; @@ -529,9 +529,9 @@ // Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -double pkgAcquire::PartialPresent() +unsigned long long pkgAcquire::PartialPresent() { - double Total = 0; + unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++) if ((*I)->Local == false) Total += (*I)->PartialSize; === modified file 'apt-pkg/acquire.h' --- apt-pkg/acquire.h 2010-05-04 15:05:23 +0000 +++ apt-pkg/acquire.h 2010-06-03 08:45:58 +0000 @@ -323,17 +323,17 @@ /** \return the total size in bytes of all the items included in * this download. */ - double TotalNeeded(); + unsigned long long TotalNeeded(); /** \return the size in bytes of all non-local items included in * this download. */ - double FetchNeeded(); + unsigned long long FetchNeeded(); /** \return the amount of data to be fetched that is already * present on the filesystem. */ - double PartialPresent(); + unsigned long long PartialPresent(); /** \brief Delayed constructor * === modified file 'apt-pkg/deb/deblistparser.cc' --- apt-pkg/deb/deblistparser.cc 2010-03-30 12:45:38 +0000 +++ apt-pkg/deb/deblistparser.cc 2010-06-03 07:22:00 +0000 @@ -133,10 +133,9 @@ } // Archive Size - Ver->Size = (unsigned)Section.FindI("Size"); - + Ver->Size = Section.FindULL("Size"); // Unpacked Size (in K) - Ver->InstalledSize = (unsigned)Section.FindI("Installed-Size"); + Ver->InstalledSize = Section.FindULL("Installed-Size"); Ver->InstalledSize *= 1024; // Priority === modified file 'apt-pkg/depcache.cc' --- apt-pkg/depcache.cc 2010-05-29 17:02:32 +0000 +++ apt-pkg/depcache.cc 2010-06-09 08:50:32 +0000 @@ -407,49 +407,118 @@ /*}}}*/ // DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/ // --------------------------------------------------------------------- -/* Call with Mult = -1 to preform the inverse opration */ -void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult) -{ - StateCache &P = PkgState[Pkg->ID]; - - if (Pkg->VersionList == 0) - return; - - if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && - P.Keep() == true) - return; - - // Compute the size data - if (P.NewInstall() == true) - { - iUsrSize += (signed)(Mult*P.InstVerIter(*this)->InstalledSize); - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); - return; - } - - // Upgrading - if (Pkg->CurrentVer != 0 && - (P.InstallVer != (Version *)Pkg.CurrentVer() || - (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0) - { - iUsrSize += (signed)(Mult*((signed)P.InstVerIter(*this)->InstalledSize - - (signed)Pkg.CurrentVer()->InstalledSize)); - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); - return; - } - - // Reinstall - if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack && - P.Delete() == false) - { - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); - return; - } - - // Removing - if (Pkg->CurrentVer != 0 && P.InstallVer == 0) - { - iUsrSize -= (signed)(Mult*Pkg.CurrentVer()->InstalledSize); +/* Call with Mult = -1 to preform the inverse opration + The Mult increases the complexity of the calulations here and is unused - + or do we really have a usecase for removing the size of a package two + times? So let us replace it with a simple bool and be done with it… */ +__deprecated void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult) +{ + StateCache &P = PkgState[Pkg->ID]; + + if (Pkg->VersionList == 0) + return; + + if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && + P.Keep() == true) + return; + + // Compute the size data + if (P.NewInstall() == true) + { + iUsrSize += (signed long long)(Mult*P.InstVerIter(*this)->InstalledSize); + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); + return; + } + + // Upgrading + if (Pkg->CurrentVer != 0 && + (P.InstallVer != (Version *)Pkg.CurrentVer() || + (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0) + { + iUsrSize += (signed long long)(Mult*((signed long long)P.InstVerIter(*this)->InstalledSize - + (signed long long)Pkg.CurrentVer()->InstalledSize)); + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); + return; + } + + // Reinstall + if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack && + P.Delete() == false) + { + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); + return; + } + + // Removing + if (Pkg->CurrentVer != 0 && P.InstallVer == 0) + { + iUsrSize -= (signed long long)(Mult*Pkg.CurrentVer()->InstalledSize); + return; + } +} + /*}}}*/ +// DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/ +// --------------------------------------------------------------------- +/* Call with Inverse = true to preform the inverse opration */ +void pkgDepCache::AddSizes(const PkgIterator &Pkg, bool const &Inverse) +{ + StateCache &P = PkgState[Pkg->ID]; + + if (Pkg->VersionList == 0) + return; + + if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && + P.Keep() == true) + return; + + // Compute the size data + if (P.NewInstall() == true) + { + if (Inverse == false) { + iUsrSize += P.InstVerIter(*this)->InstalledSize; + iDownloadSize += P.InstVerIter(*this)->Size; + } else { + iUsrSize -= P.InstVerIter(*this)->InstalledSize; + iDownloadSize -= P.InstVerIter(*this)->Size; + } + return; + } + + // Upgrading + if (Pkg->CurrentVer != 0 && + (P.InstallVer != (Version *)Pkg.CurrentVer() || + (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0) + { + if (Inverse == false) { + iUsrSize -= Pkg.CurrentVer()->InstalledSize; + iUsrSize += P.InstVerIter(*this)->InstalledSize; + iDownloadSize += P.InstVerIter(*this)->Size; + } else { + iUsrSize -= P.InstVerIter(*this)->InstalledSize; + iUsrSize += Pkg.CurrentVer()->InstalledSize; + iDownloadSize -= P.InstVerIter(*this)->Size; + } + return; + } + + // Reinstall + if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack && + P.Delete() == false) + { + if (Inverse == false) + iDownloadSize += P.InstVerIter(*this)->Size; + else + iDownloadSize -= P.InstVerIter(*this)->Size; + return; + } + + // Removing + if (Pkg->CurrentVer != 0 && P.InstallVer == 0) + { + if (Inverse == false) + iUsrSize -= Pkg.CurrentVer()->InstalledSize; + else + iUsrSize += Pkg.CurrentVer()->InstalledSize; return; } } === modified file 'apt-pkg/depcache.h' --- apt-pkg/depcache.h 2010-04-28 14:25:05 +0000 +++ apt-pkg/depcache.h 2010-06-03 08:45:58 +0000 @@ -286,9 +286,11 @@ pkgCache *Cache; StateCache *PkgState; unsigned char *DepState; - - double iUsrSize; - double iDownloadSize; + + /** Stores the space changes after installation */ + signed long long iUsrSize; + /** Stores how much we need to download to get the packages */ + unsigned long long iDownloadSize; unsigned long iInstCount; unsigned long iDelCount; unsigned long iKeepCount; @@ -321,8 +323,9 @@ void Update(PkgIterator const &P); // Count manipulators - void AddSizes(const PkgIterator &Pkg,signed long Mult = 1); - inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg,-1);}; + void AddSizes(const PkgIterator &Pkg, bool const &Invert = false); + inline void RemoveSizes(const PkgIterator &Pkg) {AddSizes(Pkg, true);}; + void AddSizes(const PkgIterator &Pkg,signed long Mult) __deprecated; void AddStates(const PkgIterator &Pkg,int Add = 1); inline void RemoveStates(const PkgIterator &Pkg) {AddStates(Pkg,-1);}; @@ -451,8 +454,8 @@ bool writeStateFile(OpProgress *prog, bool InstalledOnly=true); // Size queries - inline double UsrSize() {return iUsrSize;}; - inline double DebSize() {return iDownloadSize;}; + inline signed long long UsrSize() {return iUsrSize;}; + inline unsigned long long DebSize() {return iDownloadSize;}; inline unsigned long DelCount() {return iDelCount;}; inline unsigned long KeepCount() {return iKeepCount;}; inline unsigned long InstCount() {return iInstCount;}; === modified file 'apt-pkg/pkgcache.h' --- apt-pkg/pkgcache.h 2010-05-04 10:43:08 +0000 +++ apt-pkg/pkgcache.h 2010-06-03 07:22:00 +0000 @@ -532,9 +532,9 @@ /** \brief archive size for this version For Debian this is the size of the .deb file. */ - map_ptrloc Size; // These are the .deb size + unsigned long long Size; // These are the .deb size /** \brief uncompressed size for this version */ - map_ptrloc InstalledSize; + unsigned long long InstalledSize; /** \brief characteristic value representing this version No two packages in existence should have the same VerStr === modified file 'apt-pkg/tagfile.cc' --- apt-pkg/tagfile.cc 2010-03-14 20:48:14 +0000 +++ apt-pkg/tagfile.cc 2010-06-03 07:22:00 +0000 @@ -365,6 +365,30 @@ return Result; } /*}}}*/ +// TagSection::FindULL - Find an unsigned long long integer /*{{{*/ +// --------------------------------------------------------------------- +/* */ +unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const +{ + const char *Start; + const char *Stop; + if (Find(Tag,Start,Stop) == false) + return Default; + + // Copy it into a temp buffer so we can use strtoull + char S[100]; + if ((unsigned)(Stop - Start) >= sizeof(S)) + return Default; + strncpy(S,Start,Stop-Start); + S[Stop - Start] = 0; + + char *End; + unsigned long long Result = strtoull(S,&End,10); + if (S == End) + return Default; + return Result; +} + /*}}}*/ // TagSection::FindFlag - Locate a yes/no type flag /*{{{*/ // --------------------------------------------------------------------- /* The bits marked in Flag are masked on/off in Flags */ === modified file 'apt-pkg/tagfile.h' --- apt-pkg/tagfile.h 2010-03-14 20:48:14 +0000 +++ apt-pkg/tagfile.h 2010-06-03 07:22:00 +0000 @@ -57,6 +57,7 @@ bool Find(const char *Tag,unsigned &Pos) const; string FindS(const char *Tag) const; signed int FindI(const char *Tag,signed long Default = 0) const ; + 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 Scan(const char *Start,unsigned long MaxLength); === modified file 'cmdline/apt-get.cc' --- cmdline/apt-get.cc 2010-06-04 12:51:21 +0000 +++ cmdline/apt-get.cc 2010-06-09 08:50:32 +0000 @@ -838,9 +838,9 @@ return false; // Display statistics - double FetchBytes = Fetcher.FetchNeeded(); - double FetchPBytes = Fetcher.PartialPresent(); - double DebBytes = Fetcher.TotalNeeded(); + unsigned long long FetchBytes = Fetcher.FetchNeeded(); + unsigned long long FetchPBytes = Fetcher.PartialPresent(); + unsigned long long DebBytes = Fetcher.TotalNeeded(); if (DebBytes != Cache->DebSize()) { c0out << DebBytes << ',' << Cache->DebSize() << endl; @@ -2336,9 +2336,9 @@ } // Display statistics - double FetchBytes = Fetcher.FetchNeeded(); - double FetchPBytes = Fetcher.PartialPresent(); - double DebBytes = Fetcher.TotalNeeded(); + unsigned long long FetchBytes = Fetcher.FetchNeeded(); + unsigned long long FetchPBytes = Fetcher.PartialPresent(); + unsigned long long DebBytes = Fetcher.TotalNeeded(); // Check for enough free space struct statvfs Buf; === modified file 'debian/changelog' --- debian/changelog 2010-06-05 16:00:00 +0000 +++ debian/changelog 2010-06-09 08:50:32 +0000 @@ -6,11 +6,17 @@ - forward manual-installed bit on package disappearance * apt-pkg/deb/debsystem.cc: - add better config item for extended_states file + * apt-pkg/pkgcache.h: + - switch {,Install-}Size to unsigned long long * apt-pkg/depcache.cc: - do the autoremove mark process also for required packages to handle these illegally depending on lower priority packages (Closes: #583517) - try harder to find the other pseudo versions for autoremove multiarch - correct "Dangerous iterator usage" pointed out by cppcheck + - deal with long long, not with int to remove 2GB Limit (LP: #250909) + - deprecate AddSize with Multiplier as it is unused and switch to + boolean instead to handle the sizes more gracefully. + - switch i{Download,Usr}Size from double to (un)signed long long * apt-pkg/aptconfiguration.cc: - remove duplicate architectures in getArchitectures() * apt-pkg/indexrecords.{cc,h}: @@ -36,12 +42,14 @@ - add --target-release option (Closes: #115520) - accept pkg/release and pkg=version in show and co. (Closes: #236270) - accept package versions in the unmet command + * cmdline/apt-get.cc: + - use unsigned long long instead of double to store values it gets * apt-pkg/cachefile.{cc,h}: - split Open() into submethods to be able to build only parts - make the OpProgress optional in the Cache buildprocess - store also the SourceList we use internally for export - -- David Kalnischkies Sat, 05 Jun 2010 14:39:58 +0200 + -- David Kalnischkies Wed, 09 Jun 2010 10:50:12 +0200 apt (0.7.26~exp5) experimental; urgency=low