diff options
author | eric <eric> | 2004-07-01 22:20:09 +0000 |
---|---|---|
committer | eric <eric> | 2004-07-01 22:20:09 +0000 |
commit | 993fcb7811d763368a6940730d3870b0013623c0 (patch) | |
tree | 4665a7a5abc964b4877ffebed626835a83789773 /support | |
parent | ab6afc990ccfca02e3c027be2b97ded6c9f51ad6 (diff) | |
download | aurweb-993fcb7811d763368a6940730d3870b0013623c0.tar.xz |
still working on pkgsearch.php::do_Details
Diffstat (limited to 'support')
-rw-r--r-- | support/schema/aur-schema.sql | 19 | ||||
-rw-r--r-- | support/schema/dummy-data.sql.bz2 | bin | 687908 -> 782756 bytes | |||
-rwxr-xr-x | support/schema/gendummydata.py | 38 |
3 files changed, 56 insertions, 1 deletions
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql index dd02310..fde8b95 100644 --- a/support/schema/aur-schema.sql +++ b/support/schema/aur-schema.sql @@ -108,7 +108,6 @@ CREATE TABLE Packages ( CategoryID TINYINT UNSIGNED NOT NULL, Description CHAR(128) NOT NULL DEFAULT "An Arch Package", URL CHAR(255) NOT NULL DEFAULT "http://www.archlinux.org", - Source CHAR(255) NOT NULL DEFAULT "/dev/null", LocationID TINYINT UNSIGNED NOT NULL, NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0, OutOfDate TINYINT UNSIGNED DEFAULT 0, @@ -133,6 +132,24 @@ CREATE TABLE Packages ( ); +-- Track which dependencies a package has +-- +CREATE TABLE PackageDepends ( + PackageID INTEGER UNSIGNED NOT NULL, + DepPkgID INTEGER UNSIGNED NOT NULL, + INDEX (PackageID) +); + + +-- Track which sources a package has +-- +CREATE TABLE PackageSources ( + PackageID INTEGER UNSIGNED NOT NULL, + Source CHAR(255) NOT NULL DEFAULT "/dev/null", + INDEX (PackageID) +); + + -- Track votes for packages -- CREATE TABLE PackageVotes ( diff --git a/support/schema/dummy-data.sql.bz2 b/support/schema/dummy-data.sql.bz2 Binary files differindex 6a502a0..7f34228 100644 --- a/support/schema/dummy-data.sql.bz2 +++ b/support/schema/dummy-data.sql.bz2 diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py index 917b569..32e202d 100755 --- a/support/schema/gendummydata.py +++ b/support/schema/gendummydata.py @@ -20,6 +20,8 @@ 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 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 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", @@ -27,6 +29,10 @@ RANDOM_PATHS = [ # random path locations for package files "/usr/X11R6/lib", "/usr/libexec", "/usr/man/man1", "/usr/man/man3", "/usr/man/man5", "/usr/X11R6/man/man1", "/etc/profile.d" ] +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"] + import random import time @@ -327,6 +333,38 @@ for p in track_votes.keys(): s = "UPDATE Packages SET NumVotes = %d WHERE ID = %d;\n" % (track_votes[p], p) out.write(s) +# Create package dependencies and sources +# +if DBUG: print "."; print "Creating statements for package depends/sources.", +count = 0 +for p in seen_pkgs.keys(): + num_deps = random.randrange(PKG_DEPS[0], PKG_DEPS[1]) + this_deps = {} + i = 0 + 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) + out.write(s) + i += 1 + + num_sources = random.randrange(PKG_SRC[0], PKG_SRC[1]) + for i in range(num_sources): + src_file = user_keys[random.randrange(0, len(user_keys))] + src = "%s%s.%s/%s/%s-%s.tar.gz" % ( + RANDOM_URL[random.randrange(0,len(RANDOM_URL))], + p, RANDOM_TLDS[random.randrange(0,len(RANDOM_TLDS))], + RANDOM_LOCS[random.randrange(0,len(RANDOM_LOCS))], + src_file, genVersion()) + s = "INSERT INTO PackageSources VALUES (%d, '%s');\n" % ( + seen_pkgs[p], src) + out.write(s) + + if count % 100 == 0: + if DBUG: print ".", + count += 1 + + # close output file # out.write("\n") |