]> git.saurik.com Git - apt.git/commitdiff
merged from donkult
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 28 Jun 2011 14:49:45 +0000 (15:49 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 28 Jun 2011 14:49:45 +0000 (15:49 +0100)
apt-inst/contrib/extracttar.cc
apt-pkg/aptconfiguration.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/dpkgpm.cc
apt-pkg/depcache.h
apt-pkg/init.cc
cmdline/apt-config.cc
debian/changelog
methods/http.h
test/integration/test-bug-611729-mark-as-manual

index 1a358d57e6fb34280edef6136d74d1738a088ccd..01b6b38360bd61dd1dcfe505aed9a9312b0dc47f 100644 (file)
@@ -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;
       
index ca602d4bfd1df5fa17938e32c0aee7b1eb28332f..e8c8e73d0b042919e408beb77f9f91d355323daf 100644 (file)
@@ -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) {
index b59ae8896ac6a23d41e340edd083a8838d4ddfd5..4a9e94c855a2d8a24303f50e0f4005eabc2e1eb7 100644 (file)
@@ -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;
index b37980b7ecbbdae96d210bb6ffca6a700c94d23b..5ddcd47e99d908f0a8374e17f6e49124d9fecba6 100644 (file)
@@ -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;
 }
index 750da3d6f1cb9db717a57882881626fc495d6a01..9efe110f530f33231c4d12204ed6dd8129e84fdc 100644 (file)
@@ -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)
index a30f278441ff4ff9b5840a4719ac529ab757acb2..31b2d9ccd163f7606797da2bf8669049fa440ed8 100644 (file)
@@ -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/");
 
index 9919a9c949be91f64eb584ad76844dbb93cc3b52..589ee7ada62a5d68cc3b47676d2f5ae7e9110a63 100644 (file)
@@ -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);
    
index 8c1688bd08a5c54abe98fde581dda5176eb1b074..c8a4f44770788a8b65fe773a92cce76bcf0aefdc 100644 (file)
@@ -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
 
index 0bc019e771af46fd9997f52582692ab26d6c5b72..aa96c6810d9824c36893a59cd9fda7d910e56f29 100644 (file)
@@ -182,7 +182,7 @@ class HttpMethod : public pkgAcqMethod
    string AutoDetectProxyCmd;
 
    public:
-   friend class ServerState;
+   friend struct ServerState;
 
    FileFd *File;
    ServerState *Server;
index 4e3e2fa0b237ba9952b0fa6e62323ae153b4eb31..9cf01610cf645e2f7929865d7177505f63128ede 100755 (executable)
@@ -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...