Commit e4cb77de authored by onny's avatar onny
Browse files

fixed AUR package support

parent fc6e04cd
......@@ -24,7 +24,7 @@ class AUR:
response = requests.get(webpath)
self.page_total = re.search(r'(\d+) packages found',response.text).group(1)
page_total_decimal = decimal.Decimal(int(self.page_total) / 250)
self.page_total = round(page_total_decimal,0)
self.page_total = round(page_total_decimal,0)+1
def scrape_packages(self):
......@@ -33,7 +33,7 @@ class AUR:
widgets[0] = 'Scraping AUR packages : '
bar = ProgressBar(widgets=widgets, max_value=self.page_total)
for self.page in range(0, int(self.page_total)):
for self.page in range(0, int(self.page_total)+1):
webpath="https://aur.archlinux.org/packages/?O=" + str(self.start) + "&C=0&SeB=nd&SB=n&SO=a&PP=" + self.perpage + "&do_Search=Go"
response = requests.get(webpath)
......@@ -48,11 +48,16 @@ class AUR:
package['name'] = response_row.findAll("td")[0].text
package['version'] = response_row.findAll("td")[1].text
package['version'] = package['version'].split('-')[0]
if "flagged" in response_row.findAll("td")[1]:
package['status'] = "Flagged"
else:
package['status'] = "Unknown"
package['repository'] = "AUR"
#if "-git" not in package['name']:
self.aur_packages.append(package)
self.start += 250
bar.update(self.page)
bar.update(self.page_total)
print("")
return self.aur_packages
......@@ -26,7 +26,7 @@ class Database:
content = str(descfile.read())
pkgversion = re.search(r'%VERSION%\\n(?:\d+\:)?(.*?)-',content).group(1)
pkgname = re.search(r'%NAME%\\n(.*?)\\n',content).group(1)
pkglist.append({ 'name' : pkgname, 'version' : pkgversion })
pkglist.append({ 'name' : pkgname, 'version' : pkgversion, 'repository' : '' })
descfile.close()
tar.close()
return pkglist
......@@ -40,6 +40,4 @@ class Database:
bar.update(idx+1)
print("")
self.packages = sorted(self.packages, key=lambda k: k['name'])
return self.packages
......@@ -38,7 +38,8 @@ class Versioncheck:
bar = ProgressBar(widgets=widgets, max_value=len(packages_outdated))
for idx, package in enumerate(packages_outdated):
bar.update(idx)
status = self.check_repository_status(package['name'])
if "AUR" not in package['repository']:
status = self.check_repository_status(package['name'])
packages_outdated[idx]['status'] = status
bar.update(idx+1)
print("")
......
......@@ -20,14 +20,18 @@ def load_config(config):
if __name__ == '__main__':
# Loading configuration file
config = load_config('config/config.json')
# Downloading package database
package_database = Download(config).get_databases()
packages = Database(package_database, config).load_database()
aur_packages = AUR().scrape_packages()
packages = packages + aur_packages
packages = sorted(packages, key=lambda k: k['name'])
packages_notlisted, packages_outdated, packages_uptodate = Versioncheck(packages).compare_upstream()
packages_outdated = Versioncheck(packages).get_repository_status(packages_outdated)
......
......@@ -55,7 +55,11 @@
<tbody>
{% for package in packages_notlisted %}
<tr>
{% if package['repository'] == "AUR" %}
<td><a target=new href=https://aur.archlinux.org/packages/{{ package['name'] }}>{{ package['name'] }}</a></td>
{% else %}
<td><a target=new href=https://www.archlinux.org/packages/?name={{ package['name'] }}>{{ package['name'] }}</a></td>
{% endif %}
<td>{{ package['version'] }}</td>
<td>{{ package['upstreamversion'] }}</td>
<td>Unknown</td>
......
......@@ -55,7 +55,11 @@
<tbody>
{% for package in packages_outdated %}
<tr>
{% if package['repository'] == "AUR" %}
<td><a target=new href=https://aur.archlinux.org/packages/{{ package['name'] }}>{{ package['name'] }}</a></td>
{% else %}
<td><a target=new href=https://www.archlinux.org/packages/?name={{ package['name'] }}>{{ package['name'] }}</a></td>
{% endif %}
<td><span class="red">{{ package['version'] }}</span></td>
<td>{{ package['upstreamversion'] }}</td>
{% if package['status'] == "Unknown" %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment