summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-30 17:34:48 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-30 17:34:48 +0200
commit55fb35e87a1ff550cbb3010c5a03064f0a2b10be (patch)
tree6ecb92eb145eefbb0c4a6dc6a869d9e21ba10b55 /apt-pkg/deb
parentadbce12126ccc58016af69d541bafad5c8bde631 (diff)
parentd5752e18bed18c706c93f5c43c61016c72132ede (diff)
merged from debian
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc4
-rw-r--r--apt-pkg/deb/debmetaindex.cc7
-rw-r--r--apt-pkg/deb/debmetaindex.h1
-rw-r--r--apt-pkg/deb/debsrcrecords.cc8
-rw-r--r--apt-pkg/deb/debsrcrecords.h1
-rw-r--r--apt-pkg/deb/dpkgpm.cc67
-rw-r--r--apt-pkg/deb/dpkgpm.h5
7 files changed, 78 insertions, 15 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 55ba1f8c4..517b771a5 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -109,6 +109,8 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
return false;
if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
return false;
+ if (ParseDepends(Ver,"Enhances",pkgCache::Dep::Enhances) == false)
+ return false;
// Obsolete.
if (ParseDepends(Ver,"Optional",pkgCache::Dep::Suggests) == false)
@@ -637,6 +639,8 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
FileI->Version = WriteUniqString(Start,Stop - Start);
if (Section.Find("Origin",Start,Stop) == true)
FileI->Origin = WriteUniqString(Start,Stop - Start);
+ if (Section.Find("Codename",Start,Stop) == true)
+ FileI->Codename = WriteUniqString(Start,Stop - Start);
if (Section.Find("Label",Start,Stop) == true)
FileI->Label = WriteUniqString(Start,Stop - Start);
if (Section.Find("Architecture",Start,Stop) == true)
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index ee035191f..f3ab6960c 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -115,6 +115,13 @@ debReleaseIndex::debReleaseIndex(string URI,string Dist)
this->Type = "deb";
}
+debReleaseIndex::~debReleaseIndex()
+{
+ for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin();
+ I != SectionEntries.end(); I++)
+ delete *I;
+}
+
vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const
{
vector <struct IndexTarget *>* IndexTargets = new vector <IndexTarget *>;
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h
index c021a1b5a..8e6a1463b 100644
--- a/apt-pkg/deb/debmetaindex.h
+++ b/apt-pkg/deb/debmetaindex.h
@@ -22,6 +22,7 @@ class debReleaseIndex : public metaIndex {
public:
debReleaseIndex(string URI, string Dist);
+ ~debReleaseIndex();
virtual string ArchiveURI(string File) const {return URI + File;};
virtual bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const;
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index ace4e00b5..2f87c767b 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -152,3 +152,11 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
return true;
}
/*}}}*/
+// SrcRecordParser::~SrcRecordParser - Destructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+debSrcRecordParser::~debSrcRecordParser()
+{
+ delete[] Buffer;
+}
+ /*}}}*/
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h
index 8b1237ccd..a3b5a8286 100644
--- a/apt-pkg/deb/debsrcrecords.h
+++ b/apt-pkg/deb/debsrcrecords.h
@@ -50,6 +50,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
debSrcRecordParser(string File,pkgIndexFile const *Index)
: Parser(Index), Fd(File,FileFd::ReadOnly), Tags(&Fd,102400),
Buffer(0), BufSize(0) {}
+ ~debSrcRecordParser();
};
#endif
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b41b38bd5..4403eaefe 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -76,6 +76,31 @@ namespace
};
}
+/* helper function to ionice the given PID
+
+ there is no C header for ionice yet - just the syscall interface
+ so we use the binary from util-linux
+*/
+static bool
+ionice(int PID)
+{
+ if (!FileExists("/usr/bin/ionice"))
+ return false;
+ pid_t Process = ExecFork();
+ if (Process == 0)
+ {
+ char buf[32];
+ snprintf(buf, sizeof(buf), "-p%d", PID);
+ const char *Args[4];
+ Args[0] = "/usr/bin/ionice";
+ Args[1] = "-c3";
+ Args[2] = buf;
+ Args[3] = 0;
+ execv(Args[0], (char **)Args);
+ }
+ return ExecWait(Process, "ionice");
+}
+
// DPkgPM::pkgDPkgPM - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -626,20 +651,12 @@ 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}
@@ -676,10 +693,19 @@ bool pkgDPkgPM::Go(int OutStatusFd)
for (vector<Item>::iterator I = List.begin(); I != List.end();)
{
vector<Item>::iterator J = I;
- for (; J != List.end() && J->Op == I->Op; J++);
+ for (; J != List.end() && J->Op == I->Op; J++)
+ /* nothing */;
// Generate the argument list
const char *Args[MaxArgs + 50];
+
+ // Now check if we are within the MaxArgs limit
+ //
+ // this code below is problematic, because it may happen that
+ // the argument list is split in a way that A depends on B
+ // and they are in the same "--configure A B" run
+ // - with the split they may now be configured in different
+ // runs
if (J - I > (signed)MaxArgs)
J = I + MaxArgs;
@@ -825,6 +851,15 @@ bool pkgDPkgPM::Go(int OutStatusFd)
// Fork dpkg
pid_t Child;
_config->Set("APT::Keep-Fds::",fd[1]);
+ // send status information that we are about to fork dpkg
+ if(OutStatusFd > 0) {
+ ostringstream status;
+ status << "pmstatus:dpkg-exec:"
+ << (PackagesDone/float(PackagesTotal)*100.0)
+ << ":" << _("Running dpkg")
+ << endl;
+ write(OutStatusFd, status.str().c_str(), status.str().size());
+ }
Child = ExecFork();
// This is the child
@@ -842,6 +877,15 @@ bool pkgDPkgPM::Go(int OutStatusFd)
}
close(fd[0]); // close the read end of the pipe
+ if (_config->FindDir("DPkg::Chroot-Directory","/") != "/")
+ {
+ std::cerr << "Chrooting into "
+ << _config->FindDir("DPkg::Chroot-Directory")
+ << std::endl;
+ if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0)
+ _exit(100);
+ }
+
if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0)
_exit(100);
@@ -861,7 +905,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
_exit(100);
}
-
/* No Job Control Stop Env is a magic dpkg var that prevents it
from using sigstop */
putenv((char *)"DPKG_NO_TSTP=yes");
@@ -870,6 +913,10 @@ bool pkgDPkgPM::Go(int OutStatusFd)
_exit(100);
}
+ // apply ionice
+ if (_config->FindB("DPkg::UseIoNice", false) == true)
+ ionice(Child);
+
// clear the Keep-Fd again
_config->Clear("APT::Keep-Fds",fd[1]);
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 62d3d893d..1675e9e74 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -49,11 +49,6 @@ class pkgDPkgPM : public pkgPackageManager
// going to be install is already in state "half-installed")
map<string,unsigned int> PackageOpsDone;
-
-#if 1 // FIXME: BINARY COMPATIBILITY ONLY, remove on next ABI break
- map<string,string> PackageProcessingOps;
-#endif
-
// progress reporting
unsigned int PackagesDone;
unsigned int PackagesTotal;