[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#438547: apt patch for supporting dpkg triggers



Package: apt
Version: 0.7.6

This patch makes apt know what to do about the new package states
which can appear when dpkg supports triggers.

This change can and should be made to Debian's apt immediately; it
doesn't depend in any way on the dpkg changes.

Regards,
Ian.

=== modified file 'apt-pkg/algorithms.cc'
--- apt-pkg/algorithms.cc	2007-06-14 09:59:13 +0000
+++ apt-pkg/algorithms.cc	2007-08-15 19:41:19 +0000
@@ -257,6 +257,8 @@
 	    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);

=== modified file 'apt-pkg/deb/deblistparser.cc'
--- apt-pkg/deb/deblistparser.cc	2006-12-14 11:39:29 +0000
+++ apt-pkg/deb/deblistparser.cc	2007-08-15 19:40:21 +0000
@@ -293,6 +293,8 @@
                             {"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},
                             {}};

=== modified file 'apt-pkg/deb/dpkgpm.cc'
--- apt-pkg/deb/dpkgpm.cc	2007-08-06 14:48:55 +0000
+++ apt-pkg/deb/dpkgpm.cc	2007-08-15 19:56:55 +0000
@@ -521,7 +521,7 @@
    
    // 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")}, 
@@ -532,12 +532,17 @@
       { 
 	 {"unpacked",N_("Preparing to configure %s") },
 	 {"half-configured", N_("Configuring %s") },
+	 {"triggers-awaited", N_("Processing triggers for %s") },
+	 {"triggers-pending", N_("Processing triggers for %s") },
+	 {"half-configured", N_("Configuring %s") },
 	 { "installed", N_("Installed %s")},
 	 {NULL, NULL}
       },
       // Remove operation
       { 
 	 {"half-configured", N_("Preparing for removal of %s")},
+	 {"triggers-awaited", N_("Preparing for removal of %s")},
+	 {"triggers-pending", N_("Preparing for removal of %s")},
 	 {"half-installed", N_("Removing %s")},
 	 {"config-files",  N_("Removed %s")},
 	 {NULL, NULL}

=== modified file 'apt-pkg/pkgcache.cc'
--- apt-pkg/pkgcache.cc	2007-06-14 09:59:13 +0000
+++ apt-pkg/pkgcache.cc	2007-08-15 19:39:12 +0000
@@ -49,7 +49,7 @@
    
    /* 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 @@
       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 ||

=== modified file 'apt-pkg/pkgcache.h'
--- apt-pkg/pkgcache.h	2007-06-14 09:59:13 +0000
+++ apt-pkg/pkgcache.h	2007-08-15 19:40:13 +0000
@@ -81,7 +81,8 @@
       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

=== modified file 'debian/changelog'
--- debian/changelog	2007-08-09 10:34:46 +0000
+++ debian/changelog	2007-08-15 19:44:42 +0000
@@ -1,3 +1,9 @@
+apt (0.7.6ubuntu6) gutsy; urgency=low
+
+  * dpkg-triggers: Deal properly with new package states.
+
+ -- Ian Jackson <iwj@ubuntu.com>  Wed, 15 Aug 2007 20:44:37 +0100
+
 apt (0.7.6ubuntu5) UNRELEASED; urgency=low
 
   * apt-pkg/acquire-item.cc:

=== modified file 'doc/cache.sgml'
--- doc/cache.sgml	2006-08-25 14:39:15 +0000
+++ doc/cache.sgml	2007-08-15 19:40:13 +0000
@@ -721,6 +721,8 @@
 #define pkgSTATE_HalfInstalled 4
 #define pkgSTATE_ConfigFiles 5
 #define pkgSTATE_Installed 6
+#define pkgSTATE_TriggersAwaited 7
+#define pkgSTATE_TriggersPending 8
 </example>
 </sect1>
 


Reply to: