Commit 5b3fb81d authored by onny's avatar onny
Browse files

fix aur packages seperate list and correct package count

parent b2532357
......@@ -30,7 +30,7 @@ class AUR:
self.get_page_count()
widgets[0] = 'Scraping AUR packages : '
widgets[0] = 'Scraping AUR packages : '
bar = ProgressBar(widgets=widgets, max_value=self.page_total)
for self.page in range(0, int(self.page_total)+1):
......
......@@ -20,9 +20,13 @@ class Template:
def write(self):
widgets[0] = 'Writing template : '
bar = ProgressBar(widgets=widgets, max_value=2)
bar = ProgressBar(widgets=widgets, max_value=4)
bar.update(0)
context = { 'packages' : self.packages,
'count_outdated' : len([y for y in self.packages if y['state'] == 'outdated' and y['repository'] != 'AUR']),
'count_notlisted' : len([y for y in self.packages if y['state'] == 'notlisted' and y['repository'] != 'AUR']),
'count_aur_outdated' : len([y for y in self.packages if y['state'] == 'outdated' and y['repository'] == 'AUR']),
'count_aur_notlisted' : len([y for y in self.packages if y['state'] == 'notlisted' and y['repository'] == 'AUR']),
'date' : self.datenow}
html = self.template_environement.get_template('upstream.html').render(context)
os.chdir(self.PATH)
......@@ -33,3 +37,11 @@ class Template:
with open('notlisted.html', 'w') as f:
f.write(html)
bar.update(2)
html = self.template_environement.get_template('upstream_aur.html').render(context)
with open('upstream_aur.html', 'w') as f:
f.write(html)
bar.update(3)
html = self.template_environement.get_template('notlisted_aur.html').render(context)
with open('notlisted_aur.html', 'w') as f:
f.write(html)
bar.update(4)
......@@ -37,7 +37,7 @@ class Versioncheck:
bar = ProgressBar(widgets=widgets, max_value=len(packages))
for idx, package in enumerate(packages):
bar.update(idx)
if "AUR" not in package['repository'] and package['state'] == "Outdated":
if "AUR" not in package['repository'] and package['state'] == "outdated":
status = self.check_repository_status(package['name'])
packages[idx]['status'] = status
bar.update(idx+1)
......@@ -74,15 +74,15 @@ class Versioncheck:
upstreamversion = self.get_upstream_version(package['name'])
self.packages[idx]['upstreamversion'] = upstreamversion
if upstreamversion == 'None':
self.packages[idx]['state'] = 'Not listed'
self.packages[idx]['state'] = 'notlisted'
else:
if parse_version(upstreamversion) > parse_version(package['version']):
self.packages[idx]['state'] = 'Outdated'
self.packages[idx]['state'] = 'outdated'
else:
self.packages[idx]['state'] = 'Up to date'
self.packages[idx]['state'] = 'uptodate'
bar.update(idx+1)
print("")
self.sqlite_conn.close()
#self.sqlite_conn.close()
return self.packages
......@@ -30,13 +30,12 @@ if __name__ == '__main__':
packages = Database(package_database, config).load_database()
sqlite_conn = Database(package_database, config).convert_upstream_database()
#aur_packages = AUR().scrape_packages()
#packages = packages + aur_packages
aur_packages = AUR().scrape_packages()
packages = packages + aur_packages
packages = sorted(packages, key=lambda k: k['name'])
packages = Versioncheck(packages, sqlite_conn).compare_upstream()
packages = Versioncheck(packages, sqlite_conn).get_repository_status(packages)
Template(PATH, packages).write()
......@@ -29,6 +29,8 @@
<ul>
<li><a href="upstream.html">outdated</a></li>
<li><b>notlisted</b></li>
<li><a href="upstream_aur.html">outdated (AUR)</a></li>
<li><a href="notlisted_aur.html">notlisted (AUR)</a></li>
</ul>
</div>
<div class="scroll-x">
......@@ -43,7 +45,7 @@
</thead>
<tbody>
{% for package in packages %}
{% if package['state'] == "Not listed" %}
{% if package['state'] == "notlisted" and package['repository'] != 'AUR' %}
<tr>
{% if package['repository'] == "AUR" %}
<td><a target=new href=https://aur.archlinux.org/packages/{{ package['name'] }}>{{ package['name'] }}</a></td>
......@@ -60,7 +62,7 @@
</table>
</div>
<i>{{ packages|count }} packages not listed. Page last updated: {{ date }} UTC</i>
<i>{{ count_notlisted }} packages not listed. Page last updated: {{ date }} UTC</i>
<br><br>
</div>
......
......@@ -29,6 +29,8 @@
<ul>
<li><b>outdated</b></li>
<li><a href="notlisted.html">notlisted</a></li>
<li><a href="upstream_aur.html">outdated (AUR)</a></li>
<li><a href="notlisted_aur.html">notlisted (AUR)</a></li>
</ul>
</div>
<div class="scroll-x">
......@@ -43,7 +45,7 @@
</thead>
<tbody>
{% for package in packages %}
{% if package['state'] == "Outdated" %}
{% if package['state'] == "outdated" and package['repository'] != 'AUR' %}
<tr>
{% if package['repository'] == "AUR" %}
<td><a target=new href=https://aur.archlinux.org/packages/{{ package['name'] }}>{{ package['name'] }}</a></td>
......@@ -68,7 +70,7 @@
</table>
</div>
<i>{{ packages|count }} packages outdated. Page last updated: {{ date }} UTC</i>
<i>{{ count_outdated }} packages outdated. Page last updated: {{ date }} UTC</i>
<br><br>
</div>
......
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