[maemo-commits] [maemo-commits] r11240 - projects/haf/trunk/apt

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Apr 24 16:06:31 EEST 2007
Author: marivoll
Date: 2007-04-24 16:06:30 +0300 (Tue, 24 Apr 2007)
New Revision: 11240

Added:
   projects/haf/trunk/apt/trusthook.patch
Log:
New.


Added: projects/haf/trunk/apt/trusthook.patch
===================================================================
--- projects/haf/trunk/apt/trusthook.patch	2007-04-24 12:11:16 UTC (rev 11239)
+++ projects/haf/trunk/apt/trusthook.patch	2007-04-24 13:06:30 UTC (rev 11240)
@@ -0,0 +1,59 @@
+Index: apt-pkg/acquire-item.cc
+===================================================================
+--- apt-pkg/acquire-item.cc	(revision 11194)
++++ apt-pkg/acquire-item.cc	(working copy)
+@@ -1251,7 +1251,26 @@
+ }
+ 
+ 									/*}}}*/
++static bool
++default_index_is_trusted_for_package (pkgIndexFile *Index,
++				      const pkgCache::VerIterator &Ver)
++{
++  return Index->IsTrusted ();
++}
+ 
++static bool (*index_is_trusted_for_package) (pkgIndexFile *Index,
++					     const pkgCache::VerIterator &Ver)
++  = default_index_is_trusted_for_package;
++
++void
++apt_set_index_is_trusted_for_package_hook (bool (*hook)
++					   (pkgIndexFile *Index,
++					    const pkgCache::VerIterator &Ver))
++{
++  index_is_trusted_for_package = hook;
++}
++
++
+ // AcqArchive::AcqArchive - Constructor					/*{{{*/
+ // ---------------------------------------------------------------------
+ /* This just sets up the initial fetch environment and queues the first
+@@ -1312,7 +1331,7 @@
+          std::cerr << "Checking index: " << Index->Describe()
+                    << "(Trusted=" << Index->IsTrusted() << ")\n";
+       }
+-      if (Index->IsTrusted()) {
++      if (index_is_trusted_for_package (Index, Version)) {
+          Trusted = true;
+ 	 break;
+       }
+Index: apt-pkg/acquire-item.h
+===================================================================
+--- apt-pkg/acquire-item.h	(revision 11192)
++++ apt-pkg/acquire-item.h	(working copy)
+@@ -303,4 +303,14 @@
+ 	      const string &DestDir="", const string &DestFilename="");
+ };
+ 
++/* For influencing the IsTrusted decision when acquiring a new version
++   of a package.  The default behavior is to trust any signed (and
++   verified) MetaIndex for any package.
++*/
++
++void
++apt_set_index_is_trusted_for_package_hook (bool (*hook)
++					   (pkgIndexFile *Index,
++					    const pkgCache::VerIterator &Ver));
++
+ #endif


More information about the maemo-commits mailing list