Commit bc238965 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Fix some minor bugs in "support/schema/gendummydata.py".



The dummy data generation script used to create wrong package IDs for
both "PackageVotes" and "PackageDepends" tables which led to errors when
reloading the test data (constraints failed). This is fixed by no longer
creating entries with zero ("0") package IDs.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent 85c0db0c
...@@ -261,7 +261,7 @@ for u in user_keys: ...@@ -261,7 +261,7 @@ for u in user_keys:
int(len(seen_pkgs)*VOTING[1])) int(len(seen_pkgs)*VOTING[1]))
pkgvote = {} pkgvote = {}
for v in range(num_votes): for v in range(num_votes):
pkg = random.randrange(0, len(seen_pkgs)) pkg = random.randrange(1, len(seen_pkgs) + 1)
if not pkgvote.has_key(pkg): if not pkgvote.has_key(pkg):
s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg) s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg)
pkgvote[pkg] = 1 pkgvote[pkg] = 1
...@@ -288,7 +288,7 @@ for p in seen_pkgs.keys(): ...@@ -288,7 +288,7 @@ for p in seen_pkgs.keys():
this_deps = {} this_deps = {}
i = 0 i = 0
while i != num_deps: while i != num_deps:
dep = random.randrange(0, len(seen_pkgs)) dep = random.randrange(1, len(seen_pkgs) + 1)
if not this_deps.has_key(dep): if not this_deps.has_key(dep):
s = "INSERT INTO PackageDepends VALUES (%d, %d, NULL);\n" % (seen_pkgs[p], dep) s = "INSERT INTO PackageDepends VALUES (%d, %d, NULL);\n" % (seen_pkgs[p], dep)
out.write(s) out.write(s)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment