mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
32b5d46643
commit
73936002f7
5 changed files with 90 additions and 24 deletions
|
@ -133,15 +133,30 @@ CREATE TABLE Packages (
|
|||
) ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- Define the package dependency types
|
||||
--
|
||||
CREATE TABLE DependencyTypes (
|
||||
ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
Name VARCHAR(32) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (ID)
|
||||
) ENGINE = InnoDB;
|
||||
INSERT INTO DependencyTypes VALUES (1, 'depends');
|
||||
INSERT INTO DependencyTypes VALUES (2, 'makedepends');
|
||||
INSERT INTO DependencyTypes VALUES (3, 'checkdepends');
|
||||
INSERT INTO DependencyTypes VALUES (4, 'optdepends');
|
||||
|
||||
|
||||
-- Track which dependencies a package has
|
||||
--
|
||||
CREATE TABLE PackageDepends (
|
||||
PackageID INTEGER UNSIGNED NOT NULL,
|
||||
DepTypeID TINYINT UNSIGNED NOT NULL,
|
||||
DepName VARCHAR(64) NOT NULL,
|
||||
DepCondition VARCHAR(20),
|
||||
INDEX (PackageID),
|
||||
INDEX (DepName),
|
||||
FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE
|
||||
FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (DepTypeID) REFERENCES DependencyTypes(ID) ON DELETE NO ACTION
|
||||
) ENGINE = InnoDB;
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue