Commit 103acd65 authored by onny's avatar onny
Browse files

enhanced version regex

parent 2653cce1
......@@ -31,7 +31,7 @@ def load_database(package_database):
if entry.isfile() and "desc" in entry.name:
descfile = tar.extractfile(entry)
content = str(descfile.read())
pkgversion = re.search(r'%VERSION%\\n(.*?)-',content).group(1)
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 })
descfile.close()
......@@ -53,10 +53,16 @@ def get_upstream_version(packagename):
def get_repo_status(packagename):
response = requests.get('https://www.archlinux.org/packages/search/json/?name='+packagename)
try:
if response.json()['results'][0]['flag_date'] == None:
return "Unknown"
else:
return "Flagged"
for package in response.json()['results']:
if package['pkgname'] == packagename:
if "testing" in package['repo']:
return "Testing"
for package in response.json()['results']:
if package['pkgname'] == packagename:
if package['flag_date'] == None:
return "Unknown"
else:
return "Flagged"
except:
return "Unknown"
......@@ -69,6 +75,9 @@ for idx, database in enumerate(package_databases):
bar.update(idx+1)
print("")
for package in packages:
print(package)
packages_outdated = []
packages_uptodate = []
packages_notlisted = []
......@@ -88,14 +97,15 @@ for idx, package in enumerate(packages):
bar.update(idx+1)
print("")
widgets = ['Checking repository status : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
bar = ProgressBar(widgets=widgets, max_value=len(packages_outdated))
for idx, package in enumerate(packages_outdated):
bar.update(idx)
status = get_repo_status(package['name'])
packages_outdated[idx]['status'] = status
bar.update(idx+1)
print("")
if len(packages_outdated) != 0:
widgets = ['Checking repository status : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
bar = ProgressBar(widgets=widgets, max_value=len(packages_outdated))
for idx, package in enumerate(packages_outdated):
bar.update(idx)
status = get_repo_status(package['name'])
packages_outdated[idx]['status'] = status
bar.update(idx+1)
print("")
widgets = ['Writing template : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
bar = ProgressBar(widgets=widgets, max_value=2)
......
......@@ -55,57 +55,47 @@
<tbody>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=systemd>systemd</a></td>
<td><span class="red">232</span></td>
<td>v233</td>
<td><a target=new href=https://www.archlinux.org/packages/?name=btrfs-progs>btrfs-progs</a></td>
<td><span class="red">4.9.1</span></td>
<td>4.10</td>
<td><span class="red">Unknown</span></td>
</tr>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=thin-provisioning-tools>thin-provisioning-tools</a></td>
<td><span class="red">0.6.3</span></td>
<td>v0.7.0-rc2</td>
<td><span class="light_orange">Testing</span></td>
<td><span class="red">Unknown</span></td>
</tr>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=wpa_supplicant>wpa_supplicant</a></td>
<td><span class="red">1:2.6</span></td>
<td>2.6</td>
<td><a target=new href=https://www.archlinux.org/packages/?name=ca-certificates>ca-certificates</a></td>
<td><span class="red">20160507</span></td>
<td>20161130</td>
<td><span class="red">Unknown</span></td>
</tr>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=xfsprogs>xfsprogs</a></td>
<td><span class="red">4.9.0</span></td>
<td>4.10.0</td>
<td><span class="light_orange">Testing</span></td>
<td><span class="red">Unknown</span></td>
</tr>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=zlib>zlib</a></td>
<td><span class="red">1:1.2.11</span></td>
<td>1.2.11</td>
<td><a target=new href=https://www.archlinux.org/packages/?name=coreutils>coreutils</a></td>
<td><span class="red">8.26</span></td>
<td>8.27</td>
<td><span class="red">Unknown</span></td>
<td><span class="orange">Flagged</span></td>
</tr>
<tr>
<td><a target=new href=https://www.archlinux.org/packages/?name=0ad>0ad</a></td>
<td><span class="red">a21</span></td>
<td>0.0.21</td>
<td><a target=new href=https://www.archlinux.org/packages/?name=cracklib>cracklib</a></td>
<td><span class="red">2.9.6</span></td>
<td>3.0pre2</td>
<td><span class="red">Unknown</span></td>
</tr>
</tbody>
......
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