mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Added ModifiedTS to Packages database
Implemented ModifiedTS such that: -ModifiedTS changed ONLY when package updated -SubmittedTS changed ONLY when new package Also made DummyPkg fixups in tupkgupdate
This commit is contained in:
parent
f40e1fb77d
commit
f7a0009ed7
3 changed files with 36 additions and 10 deletions
|
@ -118,6 +118,7 @@ CREATE TABLE Packages (
|
||||||
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
|
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
|
||||||
OutOfDate TINYINT UNSIGNED DEFAULT 0,
|
OutOfDate TINYINT UNSIGNED DEFAULT 0,
|
||||||
SubmittedTS BIGINT UNSIGNED NOT NULL,
|
SubmittedTS BIGINT UNSIGNED NOT NULL,
|
||||||
|
ModifiedTS BIGINT UNSIGNED NOT NULL,
|
||||||
SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who submitted it?
|
SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who submitted it?
|
||||||
MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- User
|
MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- User
|
||||||
AURMaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- TU/Dev
|
AURMaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- TU/Dev
|
||||||
|
|
|
@ -66,13 +66,14 @@ class PackageDatabase:
|
||||||
global repo_dir
|
global repo_dir
|
||||||
q = self.cursor()
|
q = self.cursor()
|
||||||
q.execute("INSERT INTO Packages " +
|
q.execute("INSERT INTO Packages " +
|
||||||
"(Name, CategoryID, Version, FSPath, LocationID, Description, URL) VALUES ('" +
|
"(Name, CategoryID, Version, FSPath, LocationID, SubmittedTS, Description, URL) VALUES ('" +
|
||||||
MySQLdb.escape_string(package.name) + "', " +
|
MySQLdb.escape_string(package.name) + "', " +
|
||||||
str(self.getCategoryID(package)) + ", '" +
|
str(self.getCategoryID(package)) + ", '" +
|
||||||
MySQLdb.escape_string(package.new.version) + "', '" +
|
MySQLdb.escape_string(package.new.version) + "', '" +
|
||||||
MySQLdb.escape_string(
|
MySQLdb.escape_string(
|
||||||
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
|
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
|
||||||
str(locationId) + ", '" +
|
str(locationId) + ", " +
|
||||||
|
"UNIX_TIMESTAMP(), '" +
|
||||||
MySQLdb.escape_string(str(package.desc)) + "', '" +
|
MySQLdb.escape_string(str(package.desc)) + "', '" +
|
||||||
MySQLdb.escape_string(str(package.url)) + "')")
|
MySQLdb.escape_string(str(package.url)) + "')")
|
||||||
id = self.lookup(package.name)
|
id = self.lookup(package.name)
|
||||||
|
@ -81,14 +82,27 @@ class PackageDatabase:
|
||||||
warning("DB: Updating package: " + package.name + " with id " + str(id))
|
warning("DB: Updating package: " + package.name + " with id " + str(id))
|
||||||
global repo_dir
|
global repo_dir
|
||||||
q = self.cursor()
|
q = self.cursor()
|
||||||
q.execute("UPDATE Packages SET " +
|
if (self.isdummy(package.name)):
|
||||||
"Version = '" + MySQLdb.escape_string(package.new.version) + "', " +
|
q.execute("UPDATE Packages SET " +
|
||||||
"CategoryID = " + str(self.getCategoryID(package)) + ", " +
|
"Version = '" + MySQLdb.escape_string(package.new.version) + "', " +
|
||||||
"FSPath = '" + MySQLdb.escape_string(
|
"CategoryID = " + str(self.getCategoryID(package)) + ", " +
|
||||||
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
|
"FSPath = '" + MySQLdb.escape_string(
|
||||||
"Description = '" + MySQLdb.escape_string(str(package.desc)) + "', " +
|
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
|
||||||
"URL = '" + MySQLdb.escape_string(str(package.url)) + "' " +
|
"Description = '" + MySQLdb.escape_string(str(package.desc)) + "', " +
|
||||||
"WHERE ID = " + str(id))
|
"DummyPkg = 0, " +
|
||||||
|
"SubmittedTS = UNIX_TIMESTAMP(), " +
|
||||||
|
"URL = '" + MySQLdb.escape_string(str(package.url)) + "' " +
|
||||||
|
"WHERE ID = " + str(id))
|
||||||
|
else:
|
||||||
|
q.execute("UPDATE Packages SET " +
|
||||||
|
"Version = '" + MySQLdb.escape_string(package.new.version) + "', " +
|
||||||
|
"CategoryID = " + str(self.getCategoryID(package)) + ", " +
|
||||||
|
"FSPath = '" + MySQLdb.escape_string(
|
||||||
|
os.path.join(repo_dir, os.path.basename(package.new.file))) + "', " +
|
||||||
|
"Description = '" + MySQLdb.escape_string(str(package.desc)) + "', " +
|
||||||
|
"ModifiedTS = UNIX_TIMESTAMP(), " +
|
||||||
|
"URL = '" + MySQLdb.escape_string(str(package.url)) + "' " +
|
||||||
|
"WHERE ID = " + str(id))
|
||||||
self.insertNewInfo(package, id, locationId)
|
self.insertNewInfo(package, id, locationId)
|
||||||
# we must lastly check to see if this is a move of a package from
|
# we must lastly check to see if this is a move of a package from
|
||||||
# unsupported to community, because we'd have to reset maintainer and location
|
# unsupported to community, because we'd have to reset maintainer and location
|
||||||
|
@ -150,6 +164,14 @@ class PackageDatabase:
|
||||||
depid = self.lookupOrDummy(dep)
|
depid = self.lookupOrDummy(dep)
|
||||||
q.execute("INSERT INTO PackageDepends (PackageID, DepPkgID) " +
|
q.execute("INSERT INTO PackageDepends (PackageID, DepPkgID) " +
|
||||||
"VALUES (" + str(id) + ", " + str(depid) + ")")
|
"VALUES (" + str(id) + ", " + str(depid) + ")")
|
||||||
|
def isdummy(self, packagename):
|
||||||
|
warning("DB: Looking up package: " + packagename)
|
||||||
|
q = self.cursor()
|
||||||
|
q.execute("SELECT * FROM Packages WHERE Name = '" +
|
||||||
|
MySQLdb.escape_string(packagename) + "' AND DummyPkg = 1")
|
||||||
|
if (q.rowcount != 0):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# Functions for walking the file trees
|
# Functions for walking the file trees
|
||||||
|
|
|
@ -344,6 +344,9 @@ if ($_COOKIE["AURSID"]) {
|
||||||
$q.= "DummyPkg = 0, ";
|
$q.= "DummyPkg = 0, ";
|
||||||
$q.= "SubmitterUID = ".uid_from_sid($_COOKIE["AURSID"]).", ";
|
$q.= "SubmitterUID = ".uid_from_sid($_COOKIE["AURSID"]).", ";
|
||||||
$q.= "MaintainerUID = ".uid_from_sid($_COOKIE["AURSID"]).", ";
|
$q.= "MaintainerUID = ".uid_from_sid($_COOKIE["AURSID"]).", ";
|
||||||
|
$q.= "SubmittedTS = UNIX_TIMESTAMP(), ";
|
||||||
|
} else {
|
||||||
|
$q.="ModifiedTS = UNIX_TIMESTAMP(), ";
|
||||||
}
|
}
|
||||||
$q.="Name='".mysql_escape_string($new_pkgbuild['pkgname'])."', ";
|
$q.="Name='".mysql_escape_string($new_pkgbuild['pkgname'])."', ";
|
||||||
$q.="Version='".mysql_escape_string($new_pkgbuild['pkgver'])."-".
|
$q.="Version='".mysql_escape_string($new_pkgbuild['pkgver'])."-".
|
||||||
|
|
Loading…
Add table
Reference in a new issue