Added handling of pkg groups and fixed whitespace
This commit is contained in:
parent
71ce299d94
commit
967e113caf
4 changed files with 158 additions and 148 deletions
|
@ -22,13 +22,15 @@ class Package(object):
|
|||
self.path = os.path.join(self.buildPath, name)
|
||||
self.repo = False
|
||||
self.aur = False
|
||||
self.isgroup = False
|
||||
self.upToDate = False
|
||||
self.aurdeps = []
|
||||
self.pkg = ""
|
||||
self.pkgs = ""
|
||||
self.inrepo()
|
||||
if not self.repo:
|
||||
self.inaur()
|
||||
if self.aur:
|
||||
self.isgroup()
|
||||
if not os.path.exists(self.path):
|
||||
self.clone()
|
||||
else:
|
||||
|
@ -54,6 +56,11 @@ class Package(object):
|
|||
if response.status_code < 400:
|
||||
self.aur = True
|
||||
|
||||
def isgroup(self):
|
||||
response = requests.get("https://aur.archlinux.org/pkgbase/%s" % (self.name))
|
||||
if response.status_code < 400:
|
||||
self.isgroup = True
|
||||
|
||||
def clone(self):
|
||||
git.clone("https://aur.archlinux.org/%s.git" % (self.name), self.path)
|
||||
|
||||
|
@ -132,14 +139,17 @@ class Package(object):
|
|||
raise BuildError
|
||||
for line in open("/var/log/aur_repo/%s.log" % self.name).read().split("\n"):
|
||||
if "Finished making" in line:
|
||||
tmp = line[line.find(":") + 1:].split()[1]
|
||||
self.pkg = sh.glob("%s/*%s*" % (self.path,tmp))[0]
|
||||
if(self.isgroup):
|
||||
self.pkgs = sh.glob("%s/*.pkg.*" % (self.path))
|
||||
else:
|
||||
self.pkgs = sh.glob("%s/%s*.pkg.*" % (self.path,self.name))[0]
|
||||
self.add()
|
||||
|
||||
def add(self):
|
||||
if self.pkg:
|
||||
if self.pkgs:
|
||||
for pkg in self.pkgs:
|
||||
dbPath = os.path.join(self.repoPath, "%s.db.tar.gz" % (self.repoName))
|
||||
pkgPath = os.path.join(self.repoPath, os.path.basename(self.pkg))
|
||||
shutil.copy(self.pkg, pkgPath)
|
||||
pkgPath = os.path.join(self.repoPath, os.path.basename(pkg))
|
||||
shutil.copy(pkg, pkgPath)
|
||||
repoAdd = sh.Command("repo-add")
|
||||
repoAdd(dbPath, pkgPath)
|
||||
|
|
Loading…
Add table
Reference in a new issue