diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-09-13 00:13:47 +0200 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-09-13 00:13:47 +0200 |
commit | 003f7596dbb374ab86b725b4327fc6644677faae (patch) | |
tree | eacebbf03ec313b4cc7db08449e180124ff50b4c /scripts | |
parent | 8d3490f7cf578b4bbc4440d2982045790e6c03a5 (diff) | |
download | archweb-003f7596dbb374ab86b725b4327fc6644677faae.tar.gz archweb-003f7596dbb374ab86b725b4327fc6644677faae.tar.xz |
add a threshold check to reporead to try to catch the orphaning packages error
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/reporead.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/reporead.py b/scripts/reporead.py index 2f55f14..40f1e98 100755 --- a/scripts/reporead.py +++ b/scripts/reporead.py @@ -50,6 +50,11 @@ from cStringIO import StringIO from logging import CRITICAL,ERROR,WARNING,INFO,DEBUG from main.models import Arch, Package, PackageFile, PackageDepend, Repo +class SomethingFishyException(Exception): + '''Raised when the database looks like its going to wipe out a bunch of + packages.''' + pass + ### ### Initialization ### @@ -165,6 +170,16 @@ def db_update(archname, pkgs): logger.debug("Creating sets") dbset = set([pkg.pkgname for pkg in dbpkgs]) syncset = set([pkg.name for pkg in pkgs]) + + # Try to catch those random orphaning issues that make Eric so unhappy. + if len(syncset) < len(dbset) * .5: + logger.error(".db.tar.gz has less than 50% the number of packages in the web database") + raise SomethingFishyException( + 'it looks like the syncdb is twice as big as the new' + 'packages. WTF?') + + if len(syncset) < len(dbset) * .75: + logger.warning(".db.tar.gz has 75% the number of packages in the web database.") # packages in syncdb and not in database (add to database) logger.debug("Set theory: Packages in syncdb not in database") |