From 59152cdb480c75773f17dd3f24922bcc9ce2213e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 15:12:04 +0200 Subject: remove Size >= 0 check as Itm.Size is an unsigned variable (clang warning) --- apt-inst/contrib/extracttar.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 1a358d57e..01b6b3836 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -336,7 +336,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) } // And finish up - if (Itm.Size >= 0 && BadRecord == false) + if (BadRecord == false) if (Stream.FinishedFile(Itm,Fd) == false) return false; -- cgit v1.2.3 From 69718cedd506a7af6055be4fe47e484494e6e0b2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 15:13:56 +0200 Subject: ServerState is a struct and not a class (clang mismatch type warning) --- methods/http.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/methods/http.h b/methods/http.h index 0bc019e77..aa96c6810 100644 --- a/methods/http.h +++ b/methods/http.h @@ -182,7 +182,7 @@ class HttpMethod : public pkgAcqMethod string AutoDetectProxyCmd; public: - friend class ServerState; + friend struct ServerState; FileFd *File; ServerState *Server; -- cgit v1.2.3 From 470a5c38519989313514ebaec6920aafee53d798 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 15:15:13 +0200 Subject: rename I to J to avoid redefining a variable (clang warning) --- apt-pkg/deb/deblistparser.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b59ae8896..4a9e94c85 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -284,18 +284,18 @@ unsigned short debListParser::VersionHash() /* Strip out any spaces from the text, this undoes dpkgs reformatting of certain fields. dpkg also has the rather interesting notion of reformatting depends operators < -> <= */ - char *I = S; + char *J = S; for (; Start != End; Start++) { if (isspace(*Start) == 0) - *I++ = tolower_ascii(*Start); + *J++ = tolower_ascii(*Start); if (*Start == '<' && Start[1] != '<' && Start[1] != '=') - *I++ = '='; + *J++ = '='; if (*Start == '>' && Start[1] != '>' && Start[1] != '=') - *I++ = '='; + *J++ = '='; } - Result = AddCRC16(Result,S,I - S); + Result = AddCRC16(Result,S,J - S); } return Result; -- cgit v1.2.3 From 388f2962666a265709ad7c6e18902d49726b1f2c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 19 May 2011 14:16:43 +0200 Subject: remove invalid pkgcache.bin and rebuild it if possible The next invocation of APT tried to load an outdated big (and possible io-cold) file just to end up rebuilding it (possibly only as non-root in memory again and again), so we remove it here and if we have a srcpkgcache we are going to rebuild, too. --- apt-pkg/deb/dpkgpm.cc | 19 ++++++++++++++++++- debian/changelog | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index b37980b7e..a9d23ea67 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #include #include @@ -1269,6 +1269,23 @@ bool pkgDPkgPM::Go(int OutStatusFd) if (RunScripts("DPkg::Post-Invoke") == false) return false; + if (_config->FindB("Debug::pkgDPkgPM",false) == false) + { + std::string const oldpkgcache = _config->FindFile("Dir::cache::pkgcache"); + if (oldpkgcache.empty() == false && RealFileExists(oldpkgcache) == true && + unlink(oldpkgcache.c_str()) == 0) + { + std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache"); + if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true) + { + _error->PushToStack(); + pkgCacheFile CacheFile; + CacheFile.BuildCaches(NULL, true); + _error->RevertToStack(); + } + } + } + Cache.writeStateFile(NULL); return true; } diff --git a/debian/changelog b/debian/changelog index b64594c2c..7f52d844e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low - let VisitRProvides report if the calls were successful * apt-pkg/deb/dpkgpm.cc: - replace obsolete usleep with nanosleep + - remove invalid pkgcache.bin and rebuild it if possible * debian/apt{,-utils}.symbols: - update both experimental symbol-files to reflect 0.8.14 state * debian/rules: -- cgit v1.2.3 From 97be52d4372d1ca6b8d276060b434348876ca322 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 23 May 2011 18:10:48 +0200 Subject: log reinstall commands in history.log --- apt-pkg/deb/dpkgpm.cc | 47 +++++++++++++++---------- apt-pkg/depcache.h | 2 ++ debian/changelog | 1 + test/integration/test-bug-611729-mark-as-manual | 6 ++++ 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a9d23ea67..5ddcd47e9 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -681,31 +681,42 @@ bool pkgDPkgPM::OpenLog() return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str()); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); - string remove, purge, install, upgrade, downgrade; + string remove, purge, install, reinstall, upgrade, downgrade; for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { - if (Cache[I].NewInstall()) - { - install += I.FullName(false) + string(" (") + Cache[I].CandVersion; - if (Cache[I].Flags & pkgCache::Flag::Auto) - install+= ", automatic"; - install += string("), "); - } - else if (Cache[I].Upgrade()) - upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); - else if (Cache[I].Downgrade()) - downgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); - else if (Cache[I].Delete()) - { - if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) - purge += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); - else - remove += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); + enum { CANDIDATE, CANDIDATE_AUTO, CURRENT_CANDIDATE, CURRENT } infostring; + string *line = NULL; + #define HISTORYINFO(X, Y) { line = &X; infostring = Y; } + if (Cache[I].NewInstall() == true) + HISTORYINFO(install, CANDIDATE_AUTO) + else if (Cache[I].ReInstall() == true) + HISTORYINFO(reinstall, CANDIDATE) + else if (Cache[I].Upgrade() == true) + HISTORYINFO(upgrade, CURRENT_CANDIDATE) + else if (Cache[I].Downgrade() == true) + HISTORYINFO(downgrade, CURRENT_CANDIDATE) + else if (Cache[I].Delete() == true) + HISTORYINFO((Cache[I].Purge() ? purge : remove), CURRENT) + else + continue; + #undef HISTORYINFO + line->append(I.FullName(false)).append(" ("); + switch (infostring) { + case CANDIDATE: line->append(Cache[I].CandVersion); break; + case CANDIDATE_AUTO: + line->append(Cache[I].CandVersion); + if ((Cache[I].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) + line->append(", automatic"); + break; + case CURRENT_CANDIDATE: line->append(Cache[I].CurVersion).append(", ").append(Cache[I].CandVersion); break; + case CURRENT: line->append(Cache[I].CurVersion); break; } + line->append("), "); } if (_config->Exists("Commandline::AsString") == true) WriteHistoryTag("Commandline", _config->Find("Commandline::AsString")); WriteHistoryTag("Install", install); + WriteHistoryTag("Reinstall", reinstall); WriteHistoryTag("Upgrade", upgrade); WriteHistoryTag("Downgrade",downgrade); WriteHistoryTag("Remove",remove); diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 750da3d6f..9efe110f5 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -231,6 +231,7 @@ class pkgDepCache : protected pkgCache::Namespace // Various test members for the current status of the package inline bool NewInstall() const {return Status == 2 && Mode == ModeInstall;}; inline bool Delete() const {return Mode == ModeDelete;}; + inline bool Purge() const {return Delete() == true && (iFlags & pkgDepCache::Purge) == pkgDepCache::Purge; }; inline bool Keep() const {return Mode == ModeKeep;}; inline bool Upgrade() const {return Status > 0 && Mode == ModeInstall;}; inline bool Upgradable() const {return Status >= 1;}; @@ -241,6 +242,7 @@ class pkgDepCache : protected pkgCache::Namespace inline bool InstBroken() const {return (DepState & DepInstMin) != DepInstMin;}; inline bool InstPolicyBroken() const {return (DepState & DepInstPolicy) != DepInstPolicy;}; inline bool Install() const {return Mode == ModeInstall;}; + inline bool ReInstall() const {return Delete() == false && (iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall;}; inline VerIterator InstVerIter(pkgCache &Cache) {return VerIterator(Cache,InstallVer);}; inline VerIterator CandidateVerIter(pkgCache &Cache) diff --git a/debian/changelog b/debian/changelog index 7f52d844e..fe562e363 100644 --- a/debian/changelog +++ b/debian/changelog @@ -31,6 +31,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low * apt-pkg/deb/dpkgpm.cc: - replace obsolete usleep with nanosleep - remove invalid pkgcache.bin and rebuild it if possible + - log reinstall commands in history.log * debian/apt{,-utils}.symbols: - update both experimental symbol-files to reflect 0.8.14 state * debian/rules: diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index 4e3e2fa0b..9cf01610c 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -48,11 +48,17 @@ b is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d testmarkedauto 'b' +rm rootdir/var/log/apt/history.log + aptget install b --reinstall -y -qq 2>&1 > /dev/null testdpkgnotinstalled a testdpkginstalled b c testmarkedauto 'b' +sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' +testfileequal 'rootdir/var/log/apt/history.log' ' +Reinstall: b:i386 (1.0)' + testequal 'Reading package lists... Building dependency tree... Reading state information... -- cgit v1.2.3 From da833832ee0748f72674677a0c28ad0762159438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sommer?= Date: Sat, 28 May 2011 10:14:43 +0200 Subject: use the correct option name in comment for Acquire::Languages --- apt-pkg/aptconfiguration.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index ca602d4bf..e8c8e73d0 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -224,7 +224,7 @@ std::vector const Configuration::getLanguages(bool const &All, environment.push_back("en"); } - // Support settings like Acquire::Translation=none on the command line to + // 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) { -- cgit v1.2.3 From a5ca55e452d48bb59b4a5151816042ed722c4983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sommer?= Date: Sat, 28 May 2011 10:54:10 +0200 Subject: =?UTF-8?q?*=20apt-pkg/init.cc:=20=20=20-=20don't=20set=20deprecat?= =?UTF-8?q?ed=20APT::Acquire::Translation,=20thanks=20J=C3=B6rg=20Sommer!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/init.cc | 3 --- debian/changelog | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index a30f27844..31b2d9ccd 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -85,9 +85,6 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.Set("Dir::Ignore-Files-Silently::", "\\.bak$"); Cnf.Set("Dir::Ignore-Files-Silently::", "\\.dpkg-[a-z]+$"); - // Translation - Cnf.Set("APT::Acquire::Translation", "environment"); - // Default cdrom mount point Cnf.Set("Acquire::cdrom::mount", "/media/cdrom/"); diff --git a/debian/changelog b/debian/changelog index fe562e363..a416af19e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -72,8 +72,10 @@ apt (0.8.14.2) UNRELEASED; urgency=low * apt-pkg/packagemanager.cc: - ensure for Multi-Arch:same packages that they are unpacked in lock step even in immediate configuration (Closes: #618288) + * apt-pkg/init.cc: + - don't set deprecated APT::Acquire::Translation, thanks Jörg Sommer! - -- Michael Vogt Mon, 16 May 2011 14:57:52 +0200 + -- David Kalnischkies Sat, 28 May 2011 10:52:08 +0200 apt (0.8.14.1) unstable; urgency=low -- cgit v1.2.3 From aa833344f36bb81fb79c9d1dbe8f9240a00fc645 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 28 May 2011 10:56:46 +0200 Subject: * cmdline/apt-config.cc: - show Acquire::Languages and APT::Architectures settings in 'dump' (Closes: 626739) --- cmdline/apt-config.cc | 13 +++++++++++++ debian/changelog | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 9919a9c94..589ee7ada 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include /*}}}*/ using namespace std; @@ -119,6 +122,16 @@ int main(int argc,const char *argv[]) /*{{{*/ CmdL.FileSize() == 0) return ShowHelp(); + std::vector const langs = APT::Configuration::getLanguages(true); + _config->Clear("Acquire::Languages"); + for (std::vector::const_iterator l = langs.begin(); l != langs.end(); ++l) + _config->Set("Acquire::Languages::", *l); + + std::vector const archs = APT::Configuration::getArchitectures(); + _config->Clear("APT::Architectures"); + for (std::vector::const_iterator a = archs.begin(); a != archs.end(); ++a) + _config->Set("APT::Architectures::", *a); + // Match the operation CmdL.DispatchArg(Cmds); diff --git a/debian/changelog b/debian/changelog index a416af19e..971cf53b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -74,8 +74,11 @@ apt (0.8.14.2) UNRELEASED; urgency=low lock step even in immediate configuration (Closes: #618288) * apt-pkg/init.cc: - don't set deprecated APT::Acquire::Translation, thanks Jörg Sommer! + * cmdline/apt-config.cc: + - show Acquire::Languages and APT::Architectures settings + in 'dump' (Closes: 626739) - -- David Kalnischkies Sat, 28 May 2011 10:52:08 +0200 + -- David Kalnischkies Sat, 28 May 2011 10:54:23 +0200 apt (0.8.14.1) unstable; urgency=low -- cgit v1.2.3