Increase the size of the tables used for storing package information

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>

If the internal tables used in the C module are not large enough to store
the list of discovered packages then checking installability becomes very
slow.
This commit is contained in:
Adam D. Barratt 2010-06-23 19:03:40 +00:00
parent 7b5f161f93
commit bd048814b2
2 changed files with 10 additions and 2 deletions

View File

@ -245,6 +245,8 @@ class Britney:
self.systems = {} self.systems = {}
# if requested, build the non-installable status and save it # if requested, build the non-installable status and save it
# if this or the population of self.binaries below takes a very
# long time, try increasing SIZEOFHASHMAP in lib/dpkg.c and rebuilding
if not self.options.nuninst_cache: if not self.options.nuninst_cache:
self.__log("Building the list of not installable packages for the full archive", type="I") self.__log("Building the list of not installable packages for the full archive", type="I")
self.sources = {'testing': self.read_sources(self.options.testing)} self.sources = {'testing': self.read_sources(self.options.testing)}
@ -270,6 +272,8 @@ class Britney:
return return
# read the source and binary packages for the involved distributions # read the source and binary packages for the involved distributions
# if this takes a very long time, try increasing SIZEOFHASHMAP in
# lib/dpkg.c and rebuilding
self.sources = {'testing': self.read_sources(self.options.testing), self.sources = {'testing': self.read_sources(self.options.testing),
'unstable': self.read_sources(self.options.unstable), 'unstable': self.read_sources(self.options.unstable),
'tpu': self.read_sources(self.options.tpu),} 'tpu': self.read_sources(self.options.tpu),}

View File

@ -7,6 +7,10 @@
#include "dpkg.h" #include "dpkg.h"
#include "memory.h" #include "memory.h"
// enlarge this if britney has issues parsing packages
// (e.g. very slow installability checks)
#define SIZEOFHASHMAP 16
/* #define DIAGNOSE 1 */ /* #define DIAGNOSE 1 */
#define insert_packagenamelist(x,y) insert_l_packagenamelist(x,y,__LINE__) #define insert_packagenamelist(x,y) insert_l_packagenamelist(x,y,__LINE__)
@ -562,9 +566,9 @@ void free_packages(dpkg_packages *pkgs) {
} }
HASH_IMPL(packagetbl, char *, dpkg_collected_package *, 15, strhash, strcmp, HASH_IMPL(packagetbl, char *, dpkg_collected_package *, SIZEOFHASHMAP, strhash, strcmp,
KEEP(char*),free_collected_package); KEEP(char*),free_collected_package);
HASH_IMPL(virtualpkgtbl, char *, virtualpkg *, 15, strhash, strcmp, HASH_IMPL(virtualpkgtbl, char *, virtualpkg *, SIZEOFHASHMAP, strhash, strcmp,
KEEP(char*), free_virtualpkg); KEEP(char*), free_virtualpkg);
/* dpkg_provision refers to memory allocated elsewhere */ /* dpkg_provision refers to memory allocated elsewhere */