From cbe2050420a65349a5fcf1f4cce6e7c76490f881 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 12 Jul 2004 22:12:42 +0000 Subject: started on the package submit script --- support/schema/dummy-data.sql.bz2 | Bin 782756 -> 784649 bytes support/schema/gendummydata.py | 14 ++++++++++---- support/schema/reloadtestdb.sh | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 support/schema/reloadtestdb.sh (limited to 'support/schema') diff --git a/support/schema/dummy-data.sql.bz2 b/support/schema/dummy-data.sql.bz2 index 7f34228f..a97c77d8 100644 Binary files a/support/schema/dummy-data.sql.bz2 and b/support/schema/dummy-data.sql.bz2 differ diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py index 32e202db..738b99d9 100755 --- a/support/schema/gendummydata.py +++ b/support/schema/gendummydata.py @@ -13,7 +13,7 @@ DB_HOST = "localhost" DB_NAME = "AUR" DB_USER = "aur" DB_PASS = "aur" -USER_ID = 5 # Users.ID of first user +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_DEVS = .1 # what percentage of MAX_USERS are Developers @@ -123,8 +123,9 @@ if DBUG: print "Generating random user names..." user_id = USER_ID while len(seen_users) < MAX_USERS: user = random.randrange(0, len(contents)) - word = contents[user].strip().replace("'", "").replace(" ", "_") - if not seen_users.has_key(user): + word = contents[user].replace("'", "").replace(".","").replace(" ", "_") + word = word.strip().lower() + if not seen_users.has_key(word): seen_users[word] = user_id user_id += 1 user_keys = seen_users.keys() @@ -135,7 +136,8 @@ if DBUG: print "Generating random package names..." num_pkgs = PKG_ID while len(seen_pkgs) < MAX_PKGS: pkg = random.randrange(0, len(contents)) - word = contents[pkg].strip().replace("'", "").replace(" ", "_") + word = contents[pkg].replace("'", "").replace(".","").replace(" ", "_") + word = word.strip().lower() if not need_dupes: if not seen_pkgs.has_key(word) and not seen_users.has_key(word): seen_pkgs[word] = num_pkgs @@ -145,6 +147,10 @@ while len(seen_pkgs) < MAX_PKGS: seen_pkgs[word] = num_pkgs num_pkgs += 1 +# free up contents memory +# +contents = None + # Load package categories from database # if DBUG: print "Loading package categories/locations..." diff --git a/support/schema/reloadtestdb.sh b/support/schema/reloadtestdb.sh new file mode 100755 index 00000000..53ddf867 --- /dev/null +++ b/support/schema/reloadtestdb.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +mydir=`pwd` +if [ `basename $mydir` != "schema" ]; then + echo "you must be in the aur/support/schema directory to run this script" + exit +fi + +echo "dropping old database..." +yes | mysqladmin -uaur -paur drop AUR + +echo "recreating database..." +mysqladmin -uaur -paur create AUR + +echo "recreating tables..." +mysql -uaur -paur AUR < ./aur-schema.sql + +echo "loading dummy-data..." +bzcat ./dummy-data.sql.bz2 | mysql -uaur -paur AUR + +echo "done." +exit + -- cgit v1.2.3-24-g4f1b