summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc4
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/cdrom.cc4
-rw-r--r--apt-pkg/contrib/error.cc4
-rw-r--r--apt-pkg/contrib/fileutl.cc2
-rw-r--r--apt-pkg/contrib/hashes.h1
-rw-r--r--apt-pkg/contrib/md5.cc1
-rw-r--r--apt-pkg/contrib/md5.h1
-rw-r--r--apt-pkg/contrib/mmap.cc6
-rw-r--r--apt-pkg/contrib/progress.cc1
-rw-r--r--apt-pkg/contrib/sha1.h1
-rw-r--r--apt-pkg/contrib/sha256.h1
-rw-r--r--apt-pkg/deb/deblistparser.cc2
-rw-r--r--apt-pkg/deb/debmetaindex.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc23
-rw-r--r--apt-pkg/indexfile.cc5
-rw-r--r--apt-pkg/packagemanager.cc22
-rw-r--r--apt-pkg/packagemanager.h13
-rw-r--r--apt-pkg/pkgcache.cc6
-rw-r--r--apt-pkg/pkgcache.h3
-rw-r--r--apt-pkg/pkgsystem.cc1
21 files changed, 71 insertions, 34 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 32798335c..9c51184e6 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -345,7 +345,7 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,
*/
pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc,
- HashString ExpectedMD5,
+ HashString ExpectedHash,
vector<DiffInfo> diffs)
: Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash),
available_patches(diffs)
@@ -704,7 +704,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
Local = true;
string compExt = Desc.URI.substr(Desc.URI.size()-3);
- char *decompProg;
+ const char *decompProg;
if(compExt == "bz2")
decompProg = "bzip2";
else if(compExt == ".gz")
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index b21fcbb2f..62727a852 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -257,6 +257,8 @@ bool pkgApplyStatus(pkgDepCache &Cache)
re-unpacked (probably) */
case pkgCache::State::UnPacked:
case pkgCache::State::HalfConfigured:
+ case pkgCache::State::TriggersAwaited:
+ case pkgCache::State::TriggersPending:
if ((I->CurrentVer != 0 && I.CurrentVer().Downloadable() == true) ||
I.State() != pkgCache::PkgIterator::NeedsUnpack)
Cache.MarkKeep(I, false, false);
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 96106c7a9..b8f94e5b0 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -668,8 +668,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
DropRepeats(TransList,"");
if(log) {
msg.str("");
- ioprintf(msg, _("Found %lu package indexes, %lu source indexes, "
- "%lu translation indexes and %lu signatures\n"),
+ ioprintf(msg, _("Found %u package indexes, %u source indexes, "
+ "%u translation indexes and %u signatures\n"),
List.size(), SourceList.size(), TransList.size(),
SigList.size());
log->Update(msg.str(), STEP_SCAN);
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index 8c2d6cb19..db8c53c36 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -19,10 +19,12 @@
#include <iostream>
#include <errno.h>
#include <stdio.h>
-#include <string>
#include <stdarg.h>
#include <unistd.h>
+#include <string>
+#include <cstring>
+
#include "config.h"
/*}}}*/
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index d19a92e62..9e13b4f60 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -22,6 +22,8 @@
#include <apti18n.h>
#include <cstdlib>
+#include <cstring>
+
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index 93e7b25d9..264f7fe90 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -20,6 +20,7 @@
#include <algorithm>
#include <vector>
+#include <cstring>
using std::min;
using std::vector;
diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc
index 44242371a..a095f8f0f 100644
--- a/apt-pkg/contrib/md5.cc
+++ b/apt-pkg/contrib/md5.cc
@@ -44,6 +44,7 @@
#include <inttypes.h>
#include <config.h>
#include <system.h>
+
/*}}}*/
// byteSwap - Swap bytes in a buffer /*{{{*/
diff --git a/apt-pkg/contrib/md5.h b/apt-pkg/contrib/md5.h
index 247b3fab9..96c8975b4 100644
--- a/apt-pkg/contrib/md5.h
+++ b/apt-pkg/contrib/md5.h
@@ -25,6 +25,7 @@
#include <string>
+#include <cstring>
#include <algorithm>
#include <stdint.h>
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 88e71e8e3..abcae46fe 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -31,6 +31,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+
+#include <cstring>
/*}}}*/
// MMap::MMap - Constructor /*{{{*/
@@ -115,7 +117,7 @@ bool MMap::Sync()
#ifdef _POSIX_SYNCHRONIZED_IO
if ((Flags & ReadOnly) != ReadOnly)
- if (msync((char *)Base,iSize,MS_SYNC) != 0)
+ if (msync((char *)Base,iSize,MS_SYNC) < 0)
return _error->Errno("msync","Unable to write mmap");
#endif
return true;
@@ -132,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
#ifdef _POSIX_SYNCHRONIZED_IO
unsigned long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
- if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
+ if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
return _error->Errno("msync","Unable to write mmap");
#endif
return true;
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 6ce6e950a..cffdddc4f 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -16,6 +16,7 @@
#include <iostream>
#include <stdio.h>
+#include <cstring>
/*}}}*/
using namespace std;
diff --git a/apt-pkg/contrib/sha1.h b/apt-pkg/contrib/sha1.h
index 010ef802e..8ddd889f1 100644
--- a/apt-pkg/contrib/sha1.h
+++ b/apt-pkg/contrib/sha1.h
@@ -15,6 +15,7 @@
#define APTPKG_SHA1_H
#include <string>
+#include <cstring>
#include <algorithm>
using std::string;
diff --git a/apt-pkg/contrib/sha256.h b/apt-pkg/contrib/sha256.h
index c490bfa4d..1951f053b 100644
--- a/apt-pkg/contrib/sha256.h
+++ b/apt-pkg/contrib/sha256.h
@@ -15,6 +15,7 @@
#define APTPKG_SHA256_H
#include <string>
+#include <cstring>
#include <algorithm>
using std::string;
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 074abea6d..896d4d6d8 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -293,6 +293,8 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg,
{"installed",pkgCache::State::Installed},
{"half-installed",pkgCache::State::HalfInstalled},
{"config-files",pkgCache::State::ConfigFiles},
+ {"triggers-awaited",pkgCache::State::TriggersAwaited},
+ {"triggers-pending",pkgCache::State::TriggersPending},
{"post-inst-failed",pkgCache::State::HalfConfigured},
{"removal-failed",pkgCache::State::HalfInstalled},
{}};
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 94995798f..9ac659f78 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -224,7 +224,7 @@ class debSLTypeDebian : public pkgSourceList::Type
// This check insures that there will be only one Release file
// queued for all the Packages files and Sources files it
// corresponds to.
- if ((*I)->GetType() == "deb")
+ if (strcmp((*I)->GetType(), "deb") == 0)
{
debReleaseIndex *Deb = (debReleaseIndex *) (*I);
// This check insures that there will be only one Release file
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index f83214344..4323b5fd2 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -44,8 +44,8 @@ using namespace std;
// ---------------------------------------------------------------------
/* */
pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
- : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesDone(0),
- PackagesTotal(0), term_out(NULL)
+ : pkgPackageManager(Cache), dpkgbuf_pos(0),
+ term_out(NULL), PackagesDone(0), PackagesTotal(0)
{
}
/*}}}*/
@@ -392,14 +392,14 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
// statusfd or by rewriting the code here to deal with
// it. for now we just ignore it and not crash
TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
- char *pkg = list[1];
- char *action = _strstrip(list[2]);
- if( pkg == NULL || action == NULL)
+ if( list[0] == NULL || list[1] == NULL || list[2] == NULL)
{
if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
std::clog << "ignoring line: not enough ':'" << std::endl;
return;
}
+ char *pkg = list[1];
+ char *action = _strstrip(list[2]);
if(strncmp(action,"error",strlen("error")) == 0)
{
@@ -558,7 +558,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
// map the dpkg states to the operations that are performed
// (this is sorted in the same way as Item::Ops)
- static const struct DpkgState DpkgStatesOpMap[][5] = {
+ static const struct DpkgState DpkgStatesOpMap[][7] = {
// Install operation
{
{"half-installed", N_("Preparing %s")},
@@ -569,12 +569,20 @@ bool pkgDPkgPM::Go(int OutStatusFd)
{
{"unpacked",N_("Preparing to configure %s") },
{"half-configured", N_("Configuring %s") },
+#if 0
+ {"triggers-awaited", N_("Processing triggers for %s") },
+ {"triggers-pending", N_("Processing triggers for %s") },
+#endif
{ "installed", N_("Installed %s")},
{NULL, NULL}
},
// Remove operation
{
{"half-configured", N_("Preparing for removal of %s")},
+#if 0
+ {"triggers-awaited", N_("Preparing for removal of %s")},
+ {"triggers-pending", N_("Preparing for removal of %s")},
+#endif
{"half-installed", N_("Removing %s")},
{"config-files", N_("Removed %s")},
{NULL, NULL}
@@ -785,7 +793,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
/* No Job Control Stop Env is a magic dpkg var that prevents it
from using sigstop */
- putenv("DPKG_NO_TSTP=yes");
+ putenv((char *)"DPKG_NO_TSTP=yes");
execvp(Args[0],(char **)Args);
cerr << "Could not exec dpkg!" << endl;
_exit(100);
@@ -843,7 +851,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
continue;
}
-
if(master >= 0 && FD_ISSET(master, &rfds))
DoTerminalPty(master);
if(master >= 0 && FD_ISSET(0, &rfds))
diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc
index ca11fc111..b38596143 100644
--- a/apt-pkg/indexfile.cc
+++ b/apt-pkg/indexfile.cc
@@ -13,6 +13,7 @@
#include <apt-pkg/error.h>
#include <clocale>
+#include <cstring>
/*}}}*/
// Global list of Item supported
@@ -112,8 +113,8 @@ string pkgIndexFile::LanguageCode()
// we have a mapping of the language codes that contains all the language
// codes that need the country code as well
// (like pt_BR, pt_PT, sv_SE, zh_*, en_*)
- char *need_full_langcode[] = { "pt","sv","zh","en", NULL };
- for(char **s = need_full_langcode;*s != NULL; s++)
+ const char *need_full_langcode[] = { "pt","sv","zh","en", NULL };
+ for(const char **s = need_full_langcode;*s != NULL; s++)
if(lang.find(*s) == 0)
return lang.substr(0,5);
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 10e2858ed..d6172c6c4 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -25,7 +25,7 @@
#include <apti18n.h>
#include <iostream>
- /*}}}*/
+#include <fcntl.h>
using namespace std;
@@ -624,6 +624,26 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
return Completed;
}
/*}}}*/
+// PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
+// ---------------------------------------------------------------------
+pkgPackageManager::OrderResult
+pkgPackageManager::DoInstallPostFork(int statusFd)
+{
+ if(statusFd > 0)
+ // FIXME: use SetCloseExec here once it taught about throwing
+ // exceptions instead of doing _exit(100) on failure
+ fcntl(statusFd,F_SETFD,FD_CLOEXEC);
+ bool goResult = Go(statusFd);
+ if(goResult == false)
+ return Failed;
+
+ // if all was fine update the state file
+ if(Res == Completed) {
+ Cache.writeStateFile(NULL);
+ }
+ return Res;
+};
+
// PM::DoInstall - Does the installation /*{{{*/
// ---------------------------------------------------------------------
/* This uses the filenames in FileNames and the information in the
diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h
index 53600fb61..53cd4c96f 100644
--- a/apt-pkg/packagemanager.h
+++ b/apt-pkg/packagemanager.h
@@ -90,18 +90,7 @@ class pkgPackageManager : protected pkgCache::Namespace
};
// stuff that needs to be done after the fork
- OrderResult DoInstallPostFork(int statusFd=-1) {
- bool goResult = Go(statusFd);
- if(goResult == false)
- return Failed;
-
- // if all was fine update the state file
- if(Res == Completed) {
- Cache.writeStateFile(NULL);
- }
- return Res;
- };
-
+ OrderResult DoInstallPostFork(int statusFd=-1);
bool FixMissing();
pkgPackageManager(pkgDepCache *Cache);
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 7e3b9d78c..133899a27 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -49,7 +49,7 @@ pkgCache::Header::Header()
/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
- MajorVersion = 6;
+ MajorVersion = 7;
MinorVersion = 0;
Dirty = false;
@@ -274,7 +274,9 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
return NeedsUnpack;
if (Pkg->CurrentState == pkgCache::State::UnPacked ||
- Pkg->CurrentState == pkgCache::State::HalfConfigured)
+ Pkg->CurrentState == pkgCache::State::HalfConfigured ||
+ Pkg->CurrentState == pkgCache::State::TriggersPending ||
+ Pkg->CurrentState == pkgCache::State::TriggersAwaited)
return NeedsConfigure;
if (Pkg->CurrentState == pkgCache::State::HalfInstalled ||
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 83b7548a3..59d5003bb 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -81,7 +81,8 @@ class pkgCache
enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4};
enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
- HalfInstalled=4,ConfigFiles=5,Installed=6};
+ HalfInstalled=4,ConfigFiles=5,Installed=6,
+ TriggersAwaited=7,TriggersPending=8};
};
struct Flag
diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc
index eee19e35c..6dd2d3ee4 100644
--- a/apt-pkg/pkgsystem.cc
+++ b/apt-pkg/pkgsystem.cc
@@ -13,6 +13,7 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/policy.h>
#include <cassert>
+#include <cstring>
/*}}}*/
pkgSystem *_system = 0;