summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-inst/contrib/extracttar.cc2
-rw-r--r--apt-pkg/aptconfiguration.cc2
-rw-r--r--apt-pkg/deb/deblistparser.cc10
-rw-r--r--apt-pkg/deb/dpkgpm.cc66
-rw-r--r--apt-pkg/depcache.h2
-rw-r--r--apt-pkg/init.cc3
-rw-r--r--cmdline/apt-config.cc13
-rw-r--r--debian/changelog9
-rw-r--r--methods/http.h2
-rwxr-xr-xtest/integration/test-bug-611729-mark-as-manual6
10 files changed, 84 insertions, 31 deletions
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;
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<std::string> 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) {
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;
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b37980b7e..5ddcd47e9 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -14,8 +14,8 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/strutl.h>
-#include <apti18n.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/cachefile.h>
#include <unistd.h>
#include <stdlib.h>
@@ -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);
@@ -1269,6 +1280,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/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/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/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 <apt-pkg/error.h>
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/aptconfiguration.h>
#include <config.h>
#include <apti18n.h>
@@ -27,6 +29,7 @@
#include <locale.h>
#include <iostream>
#include <string>
+#include <vector>
/*}}}*/
using namespace std;
@@ -119,6 +122,16 @@ int main(int argc,const char *argv[]) /*{{{*/
CmdL.FileSize() == 0)
return ShowHelp();
+ std::vector<std::string> const langs = APT::Configuration::getLanguages(true);
+ _config->Clear("Acquire::Languages");
+ for (std::vector<std::string>::const_iterator l = langs.begin(); l != langs.end(); ++l)
+ _config->Set("Acquire::Languages::", *l);
+
+ std::vector<std::string> const archs = APT::Configuration::getArchitectures();
+ _config->Clear("APT::Architectures");
+ for (std::vector<std::string>::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 8c1688bd0..c8a4f4477 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,8 @@ 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
+ - log reinstall commands in history.log
* debian/apt{,-utils}.symbols:
- update both experimental symbol-files to reflect 0.8.14 state
* debian/rules:
@@ -75,11 +77,16 @@ 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!
+ * cmdline/apt-config.cc:
+ - show Acquire::Languages and APT::Architectures settings
+ in 'dump' (Closes: 626739)
* apt-pkg/orderlist.cc:
- ensure that an old version of a package with a provides can
never satisfy a dependency of a newer version of this package
- -- Michael Vogt <mvo@debian.org> Mon, 16 May 2011 14:57:52 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Sat, 28 May 2011 10:54:23 +0200
apt (0.8.14.1) unstable; urgency=low
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;
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...