summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimo <simo>2005-05-08 04:01:15 +0200
committersimo <simo>2005-05-08 04:01:15 +0200
commitf7a0009ed7ad537606e6ed1b1e4404f1134d8565 (patch)
treee22c3abae489669126a1f7075d7d3817063deb63
parentf40e1fb77ddb36fd7d35b2ffedd4275db5068748 (diff)
downloadaur-f7a0009ed7ad537606e6ed1b1e4404f1134d8565.tar.gz
aur-f7a0009ed7ad537606e6ed1b1e4404f1134d8565.tar.xz
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
-rw-r--r--support/schema/aur-schema.sql1
-rwxr-xr-xtupkg/update/tupkgupdate42
-rw-r--r--web/html/pkgsubmit.php3
3 files changed, 36 insertions, 10 deletions
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index d269d4bb..0b6d5e5f 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -118,6 +118,7 @@ CREATE TABLE Packages (
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
OutOfDate TINYINT UNSIGNED DEFAULT 0,
SubmittedTS BIGINT UNSIGNED NOT NULL,
+ ModifiedTS BIGINT UNSIGNED NOT NULL,
SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who submitted it?
MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- User
AURMaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- TU/Dev
diff --git a/tupkg/update/tupkgupdate b/tupkg/update/tupkgupdate
index 514a6970..c8298cdc 100755
--- a/tupkg/update/tupkgupdate
+++ b/tupkg/update/tupkgupdate
@@ -66,13 +66,14 @@ class PackageDatabase:
global repo_dir
q = self.cursor()
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) + "', " +
str(self.getCategoryID(package)) + ", '" +
MySQLdb.escape_string(package.new.version) + "', '" +
MySQLdb.escape_string(
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.url)) + "')")
id = self.lookup(package.name)
@@ -81,14 +82,27 @@ class PackageDatabase:
warning("DB: Updating package: " + package.name + " with id " + str(id))
global repo_dir
q = self.cursor()
- 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)) + "', " +
- "URL = '" + MySQLdb.escape_string(str(package.url)) + "' " +
- "WHERE ID = " + str(id))
+ if (self.isdummy(package.name)):
+ 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)) + "', " +
+ "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)
# 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
@@ -150,6 +164,14 @@ class PackageDatabase:
depid = self.lookupOrDummy(dep)
q.execute("INSERT INTO PackageDepends (PackageID, DepPkgID) " +
"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
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 6accce6a..070de6ea 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -344,6 +344,9 @@ if ($_COOKIE["AURSID"]) {
$q.= "DummyPkg = 0, ";
$q.= "SubmitterUID = ".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.="Version='".mysql_escape_string($new_pkgbuild['pkgver'])."-".