summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/schema/aur-schema.sql6
-rwxr-xr-xsupport/schema/gendummydata.py57
2 files changed, 42 insertions, 21 deletions
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index 88d074e..726fd2f 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -31,7 +31,9 @@ CREATE TABLE Users (
RealName VARCHAR(64) NOT NULL DEFAULT '',
LangPreference VARCHAR(5) NOT NULL DEFAULT 'en',
IRCNick VARCHAR(32) NOT NULL DEFAULT '',
+ PGPKey VARCHAR(40) NULL DEFAULT NULL,
LastVoted BIGINT UNSIGNED NOT NULL DEFAULT 0,
+ LastLogin BIGINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (ID),
UNIQUE (Username),
UNIQUE (Email),
@@ -190,8 +192,8 @@ CREATE TABLE PackageBlacklist (
--
CREATE TABLE IF NOT EXISTS TU_VoteInfo (
ID int(10) unsigned NOT NULL auto_increment,
- Agenda text COLLATE utf8_general_ci NOT NULL,
- User VARCHAR(32) COLLATE utf8_general_ci NOT NULL,
+ Agenda text NOT NULL,
+ User VARCHAR(32) NOT NULL,
Submitted bigint(20) unsigned NOT NULL,
End bigint(20) unsigned NOT NULL,
SubmitterID int(10) unsigned NOT NULL,
diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py
index d0b8b71..160dde5 100755
--- a/support/schema/gendummydata.py
+++ b/support/schema/gendummydata.py
@@ -29,22 +29,17 @@ 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_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
PKG_CMNTS = (1, 5) # min/max number of comments a package has
CATEGORIES_COUNT = 17 # the number of categories from aur-schema
VOTING = (0, .30) # percentage range for package voting
-RANDOM_PATHS = ( # random path locations for package files
- "/usr/bin", "/usr/lib", "/etc", "/etc/rc.d", "/usr/share", "/lib",
- "/var/spool", "/var/log", "/usr/sbin", "/opt", "/usr/X11R6/bin",
- "/usr/X11R6/lib", "/usr/libexec", "/usr/man/man1", "/usr/man/man3",
- "/usr/man/man5", "/usr/X11R6/man/man1", "/etc/profile.d"
-)
+OPEN_PROPOSALS = 5 # number of open trusted user proposals
+CLOSE_PROPOSALS = 15 # number of closed trusted user proposals
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_CMD = "/usr/bin/fortune -l"
+FORTUNE_CMD = "/usr/bin/fortune"
# setup logging
logformat = "%(levelname)s: %(message)s"
@@ -61,6 +56,12 @@ if not os.path.exists(SEED_FILE):
log.error("Please install the 'words' Arch package")
raise SystemExit
+# make sure comments can be created
+#
+if not os.path.exists(FORTUNE_CMD):
+ log.error("Please install the 'fortune-mod' Arch package")
+ raise SystemExit
+
# track what users/package names have been used
#
seen_users = {}
@@ -188,20 +189,14 @@ for p in list(seen_pkgs.keys()):
else:
muid = trustedusers[random.randrange(0,len(trustedusers))]
if count % 20 == 0: # every so often, there are orphans...
- muid = 0
+ muid = "NULL"
uuid = genUID() # the submitter/user
- if muid == 0:
- s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
- " SubmittedTS, SubmitterUID, MaintainerUID) VALUES"
- " (%d, '%s', '%s', %d, %d, %d, NULL);\n")
- s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid)
- else:
- s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
- " SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
- " (%d, '%s', '%s', %d, %d, %d, %d);\n")
- s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
+ s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
+ " SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
+ " (%d, '%s', '%s', %d, %d, %d, %s);\n")
+ s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
out.write(s)
count += 1
@@ -271,6 +266,30 @@ for p in list(seen_pkgs.keys()):
s = s % (seen_pkgs[p], src)
out.write(s)
+# Create trusted user proposals
+#
+log.debug("Creating SQL statements for trusted user proposals.")
+count=0
+for t in range(0, OPEN_PROPOSALS+CLOSE_PROPOSALS):
+ fortune = subprocess.getoutput(FORTUNE_CMD).replace("'","")
+ now = int(time.time())
+ if count < CLOSE_PROPOSALS:
+ start = now - random.randrange(3600*24*7, 3600*24*21)
+ end = now - random.randrange(0, 3600*24*7)
+ else:
+ start = now
+ end = now + random.randrange(3600*24, 3600*24*7)
+ if count % 5 == 0: # Don't make the vote about anyone once in a while
+ user = ""
+ else:
+ user = user_keys[random.randrange(0,len(user_keys))]
+ suid = trustedusers[random.randrange(0,len(trustedusers))]
+ s = ("INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End,"
+ " SubmitterID) VALUES ('%s', '%s', %d, %d, %d);\n")
+ s = s % (fortune, user, start, end, suid)
+ out.write(s)
+ count += 1
+
# close output file
#
out.write("COMMIT;\n")