mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
added capability to get category from the directory in CVS
fixed bogus reference to subzero in the user docs
This commit is contained in:
parent
2f27045c0f
commit
da80234d77
2 changed files with 27 additions and 5 deletions
|
@ -29,6 +29,7 @@ class Version:
|
||||||
class Package:
|
class Package:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.name = None
|
self.name = None
|
||||||
|
self.category = None
|
||||||
self.old = None
|
self.old = None
|
||||||
self.new = None
|
self.new = None
|
||||||
self.desc = None
|
self.desc = None
|
||||||
|
@ -56,11 +57,15 @@ class PackageDatabase:
|
||||||
return None
|
return None
|
||||||
def insert(self, package, locationId):
|
def insert(self, package, locationId):
|
||||||
warning("DB: Inserting package: " + package.name)
|
warning("DB: Inserting package: " + package.name)
|
||||||
|
category_id = lookupCategory(package.category)
|
||||||
|
if (category_id == None):
|
||||||
|
category_id = 1
|
||||||
global repo_dir
|
global repo_dir
|
||||||
q = self.cursor()
|
q = self.cursor()
|
||||||
q.execute("INSERT INTO Packages " +
|
q.execute("INSERT INTO Packages " +
|
||||||
"(Name, Version, FSPath, LocationID, Description, URL) VALUES ('" +
|
"(Name, CategoryID, Version, FSPath, LocationID, Description, URL) VALUES ('" +
|
||||||
MySQLdb.escape_string(package.name) + "', '" +
|
MySQLdb.escape_string(package.name) + "', " +
|
||||||
|
str(category_id) + ", '" +
|
||||||
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))) + "', " +
|
||||||
|
@ -98,6 +103,14 @@ class PackageDatabase:
|
||||||
if (retval != None):
|
if (retval != None):
|
||||||
return retval
|
return retval
|
||||||
return self.createDummy(packagename)
|
return self.createDummy(packagename)
|
||||||
|
def lookupCategory(self, categoryname):
|
||||||
|
warning("DB: Looking up category: " + categoryname)
|
||||||
|
q = self.cursor()
|
||||||
|
q.execute("SELECT ID from PackageCategories WHERE Category = '" + MySQLdb.escape_string(categoryname) + "'")
|
||||||
|
if (q.rowcount != 0):
|
||||||
|
row = q.fetchone()
|
||||||
|
return row[0]
|
||||||
|
return None
|
||||||
def createDummy(self, packagename):
|
def createDummy(self, packagename):
|
||||||
warning("DB: Creating dummy package for: " + packagename)
|
warning("DB: Creating dummy package for: " + packagename)
|
||||||
q = self.cursor()
|
q = self.cursor()
|
||||||
|
@ -165,6 +178,14 @@ def infoFromPackageFile(filename):
|
||||||
return pkg.name, pkg.version + "-" + pkg.release
|
return pkg.name, pkg.version + "-" + pkg.release
|
||||||
|
|
||||||
def infoFromPkgbuildFile(filename):
|
def infoFromPkgbuildFile(filename):
|
||||||
|
# first grab the category based on the file path
|
||||||
|
directory = os.path.dirname(os.path.abspath(filename))
|
||||||
|
m = re.match(r".*/([^/]+)$", directory)
|
||||||
|
if (m):
|
||||||
|
category = m.group(1)
|
||||||
|
else:
|
||||||
|
category = "none"
|
||||||
|
|
||||||
# open and source the file
|
# open and source the file
|
||||||
pf_stdin, pf_stdout = os.popen2("/bin/bash", 't', 0)
|
pf_stdin, pf_stdout = os.popen2("/bin/bash", 't', 0)
|
||||||
print >>pf_stdin, ". " + filename
|
print >>pf_stdin, ". " + filename
|
||||||
|
@ -207,7 +228,7 @@ def infoFromPkgbuildFile(filename):
|
||||||
pf_stdin.close()
|
pf_stdin.close()
|
||||||
pf_stdout.close()
|
pf_stdout.close()
|
||||||
|
|
||||||
return pkgname, pkgver + "-" + pkgrel, pkgdesc, url, depends, source
|
return pkgname, pkgver + "-" + pkgrel, pkgdesc, url, depends, source, category
|
||||||
|
|
||||||
def infoFromPkgbuildFileWorse(filename):
|
def infoFromPkgbuildFileWorse(filename):
|
||||||
# load the file with pacman library
|
# load the file with pacman library
|
||||||
|
@ -296,7 +317,7 @@ dbmodify = list()
|
||||||
|
|
||||||
a_files = pkgbuildsInTree(pkgbuild_dir)
|
a_files = pkgbuildsInTree(pkgbuild_dir)
|
||||||
for a_file in a_files:
|
for a_file in a_files:
|
||||||
pkgname, ver, desc, url, depends, sources = infoFromPkgbuildFile(a_file)
|
pkgname, ver, desc, url, depends, sources, category = infoFromPkgbuildFile(a_file)
|
||||||
|
|
||||||
# Error (and skip) if we encounter any invalid PKGBUILD files
|
# Error (and skip) if we encounter any invalid PKGBUILD files
|
||||||
if (pkgname == None or ver == None):
|
if (pkgname == None or ver == None):
|
||||||
|
@ -315,6 +336,7 @@ for a_file in a_files:
|
||||||
|
|
||||||
package = Package()
|
package = Package()
|
||||||
package.name = pkgname
|
package.name = pkgname
|
||||||
|
package.category = category
|
||||||
package.desc = desc
|
package.desc = desc
|
||||||
package.url = url
|
package.url = url
|
||||||
package.depends = depends
|
package.depends = depends
|
||||||
|
|
|
@ -139,7 +139,7 @@ cvs commit</code><br>
|
||||||
</span><code><br>
|
</span><code><br>
|
||||||
tupkg
|
tupkg
|
||||||
--host
|
--host
|
||||||
subzero.elys.com --user <userid> --password <password>
|
aur.archlinux.org --user <userid> --password <password>
|
||||||
<packagefile.pkg.tar.gz></code><br>
|
<packagefile.pkg.tar.gz></code><br>
|
||||||
<br>
|
<br>
|
||||||
Note that this is your <span style="font-weight: bold;">AUR login
|
Note that this is your <span style="font-weight: bold;">AUR login
|
||||||
|
|
Loading…
Add table
Reference in a new issue