summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2008-09-12 18:13:47 -0400
committerDusty Phillips <buchuki@gmail.com>2008-09-12 18:13:47 -0400
commit003f7596dbb374ab86b725b4327fc6644677faae (patch)
treeeacebbf03ec313b4cc7db08449e180124ff50b4c /scripts
parent8d3490f7cf578b4bbc4440d2982045790e6c03a5 (diff)
add a threshold check to reporead to try to catch the orphaning packages error
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/reporead.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/reporead.py b/scripts/reporead.py
index 2f55f149..40f1e980 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")