summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-09-13 00:32:35 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-09-13 00:32:35 +0200
commit3e9c4f702ed45f6201bae44b628c84db69436b05 (patch)
tree68a80e18a2a08d0cb9120f68da53a1fc5dfcd3ab /apt-pkg
parent887f5036c31d6bbbab8fa967d39592617244f3a0 (diff)
add and document experimental options to make aggressive
use of dpkg's trigger and configuration handling (Closes: #473461) Add NoTriggers option to add --no-triggers to all dpkg calls, NoConfiguration to prevent apt from trying to configure packages - dpkg should handle this in the last ConfigurePending call. This options are for now deactivated as they require more testing in real world situations, but the plan is to enable them in the near future if anything works well.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc39
-rw-r--r--apt-pkg/deb/dpkgpm.h2
2 files changed, 34 insertions, 7 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b4a2abcb5..04e257b1b 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -134,8 +134,11 @@ bool pkgDPkgPM::Configure(PkgIterator Pkg)
{
if (Pkg.end() == true)
return false;
-
- List.push_back(Item(Item::Configure,Pkg));
+
+ bool static const NoConfigure = _config->FindB("DPkg::NoConfigure",false);
+ if (NoConfigure == false)
+ List.push_back(Item(Item::Configure,Pkg));
+
return true;
}
/*}}}*/
@@ -190,6 +193,9 @@ bool pkgDPkgPM::SendV2Pkgs(FILE *F)
// Write out the package actions in order.
for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
{
+ if(I->Pkg.end() == true)
+ continue;
+
pkgDepCache::StateCache &S = Cache[I->Pkg];
fprintf(F,"%s ",I->Pkg.Name());
@@ -629,6 +635,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
if (RunScriptsWithPkgs("DPkg::Pre-Install-Pkgs") == false)
return false;
+ // support subpressing of triggers processing for special
+ // cases like d-i that runs the triggers handling manually
+ if(_config->FindB("DPkg::ConfigurePending",_config->FindB("DPkg::NoConfigure",false)) == true)
+ List.push_back(Item(Item::ConfigurePending,PkgIterator()));
+
// 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[][7] = {
@@ -666,6 +677,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
// and the PackageOpsTranslations (human readable strings)
for (vector<Item>::const_iterator I = List.begin(); I != List.end();I++)
{
+ if((*I).Pkg.end() == true)
+ continue;
+
string const name = (*I).Pkg.Name();
PackageOpsDone[name] = 0;
for(int i=0; (DpkgStatesOpMap[(*I).Op][i]).state != NULL; i++)
@@ -752,11 +766,16 @@ bool pkgDPkgPM::Go(int OutStatusFd)
case Item::Configure:
Args[n++] = "--configure";
- if (NoTriggers == true)
- Args[n++] = "--no-triggers";
Size += strlen(Args[n-1]);
break;
-
+
+ case Item::ConfigurePending:
+ Args[n++] = "--configure";
+ Size += strlen(Args[n-1]);
+ Args[n++] = "--pending";
+ Size += strlen(Args[n-1]);
+ break;
+
case Item::Install:
Args[n++] = "--unpack";
Size += strlen(Args[n-1]);
@@ -764,7 +783,13 @@ bool pkgDPkgPM::Go(int OutStatusFd)
Size += strlen(Args[n-1]);
break;
}
-
+
+ if (NoTriggers == true && I->Op != Item::ConfigurePending)
+ {
+ Args[n++] = "--no-triggers";
+ Size += strlen(Args[n-1]);
+ }
+
// Write in the file or package names
if (I->Op == Item::Install)
{
@@ -780,6 +805,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
{
for (;I != J && Size < MaxArgBytes; I++)
{
+ if((*I).Pkg.end() == true)
+ continue;
Args[n++] = I->Pkg.Name();
Size += strlen(Args[n-1]);
}
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index ebc7e32bf..0c266605a 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -53,7 +53,7 @@ class pkgDPkgPM : public pkgPackageManager
struct Item
{
- enum Ops {Install, Configure, Remove, Purge} Op;
+ enum Ops {Install, Configure, Remove, Purge, ConfigurePending} Op;
string File;
PkgIterator Pkg;
Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),