summaryrefslogtreecommitdiffstats
path: root/schema/gendummydata.py
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-17 19:49:26 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-17 21:09:16 +0200
commit73936002f7d5685a9063683f68d4e8c2e01be0ac (patch)
treec1f152f76be0399222a47cab2060998e41ce5688 /schema/gendummydata.py
parent32b5d466439b5c291472c68f6a732c5be4ca60cf (diff)
downloadaur-73936002f7d5685a9063683f68d4e8c2e01be0ac.tar.gz
aur-73936002f7d5685a9063683f68d4e8c2e01be0ac.tar.xz
Store {make,check,opt}depends in the database
In addition to parsing and storing dependencies of packages, store makedepends, checkdepends and optdepends. Every dependency (of any type) is displayed on the package details page. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'schema/gendummydata.py')
-rwxr-xr-xschema/gendummydata.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/schema/gendummydata.py b/schema/gendummydata.py
index bc0ede8a..18852a22 100755
--- a/schema/gendummydata.py
+++ b/schema/gendummydata.py
@@ -28,7 +28,7 @@ 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 = 900 # how many packages to load
-PKG_DEPS = (1, 5) # min/max depends a package has
+PKG_DEPS = (1, 15) # min/max depends a package has
PKG_SRC = (1, 3) # min/max sources a package has
PKG_CMNTS = (1, 5) # min/max number of comments a package has
CATEGORIES_COUNT = 17 # the number of categories from aur-schema
@@ -258,8 +258,11 @@ for p in list(seen_pkgs.keys()):
while i != num_deps:
dep = random.choice([k for k in seen_pkgs])
if dep not in this_deps:
- s = "INSERT INTO PackageDepends VALUES (%d, '%s', NULL);\n"
- s = s % (seen_pkgs[p], dep)
+ deptype = random.randrange(1, 5)
+ if deptype == 4:
+ dep += ": for " + random.choice([k for k in seen_pkgs])
+ s = "INSERT INTO PackageDepends VALUES (%d, %d, '%s', NULL);\n"
+ s = s % (seen_pkgs[p], deptype, dep)
out.write(s)
i += 1