summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoui Chang <louipc.ist@gmail.com>2008-02-28 17:51:15 +0100
committerSimo Leone <simo@archlinux.org>2008-03-23 09:04:17 +0100
commite64307d8d278ca5514b6f23aa97d51d3fe655736 (patch)
tree35db722400443f747f967fe8d266a04415488a03
parent3577326b2b32bad2765cdacd2959dd4fea48c2f8 (diff)
downloadaur-e64307d8d278ca5514b6f23aa97d51d3fe655736.tar.gz
aur-e64307d8d278ca5514b6f23aa97d51d3fe655736.tar.xz
Generate valid dummy data entries
Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Simo Leone <simo@archlinux.org>
-rwxr-xr-xsupport/schema/gendummydata.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py
index 9915f586..94f037c3 100755
--- a/support/schema/gendummydata.py
+++ b/support/schema/gendummydata.py
@@ -18,10 +18,10 @@ DB_USER = "aur"
DB_PASS = "aur"
USER_ID = 5 # Users.ID of first bogus user
PKG_ID = 1 # Packages.ID of first package
-MAX_USERS = 500 # how many users to 'register'
+MAX_USERS = 300 # how many users to 'register'
MAX_DEVS = .1 # what percentage of MAX_USERS are Developers
MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users
-MAX_PKGS = 2500 # how many packages to load
+MAX_PKGS = 900 # how many packages to load
PKG_FILES = (8, 30) # min/max number of files in a package
PKG_DEPS = (1, 5) # min/max depends a package has
PKG_SRC = (1, 3) # min/max sources a package has
@@ -36,14 +36,7 @@ RANDOM_PATHS = ( # random path locations for package files
RANDOM_TLDS = ("edu", "com", "org", "net", "tw", "ru", "pl", "de", "es")
RANDOM_URL = ("http://www.", "ftp://ftp.", "http://", "ftp://")
RANDOM_LOCS = ("pub", "release", "files", "downloads", "src")
-FORTUNE_FILES = ("computers", "fortunes", "literature", "science",
- "songs-poems", "startrek", "wisdom", "work", "buffy", "calvin",
- "futurama", "jargon", "matrix", "starwars", "tao", "chalkboard",
- "dune", "dune-messiah", "children-of-dune", "god-emperor", "definitions",
- "drugs", "education", "food", "humorists", "kids", "law", "news",
- "people", "pets", "politics", "platitudes", "zippy", "riddles"
-)
-FORTUNE_CMD = "/usr/bin/fortune -l " + " ".join(FORTUNE_FILES)
+FORTUNE_CMD = "/usr/bin/fortune -l"
import random
@@ -257,7 +250,7 @@ for p in seen_pkgs.keys():
uuid = genUID() # the submitter/user
s = "INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID, SubmittedTS, SubmitterUID, MaintainerUID, AURMaintainerUID) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d, %d);\n" % (seen_pkgs[p], p, genVersion(location_id),
- genCategory(), location_id, NOW, uuid, uuid, muid)
+ genCategory(), location_id, NOW, uuid, muid, muid)
out.write(s)
if count % 100 == 0:
if DBUG: print ".",
@@ -376,7 +369,7 @@ for p in seen_pkgs.keys():
while i != num_deps:
dep = random.randrange(0, len(seen_pkgs))
if not this_deps.has_key(dep):
- s = "INSERT INTO PackageDepends VALUES (%d, %d);\n" % (seen_pkgs[p], dep)
+ s = "INSERT INTO PackageDepends VALUES (%d, %d, NULL);\n" % (seen_pkgs[p], dep)
out.write(s)
i += 1