Commit 3da8c337 authored by onny's avatar onny
Browse files

first commit

parents
import tarfile
import re
import os
from jinja2 import Environment, FileSystemLoader
import requests
import time
import progressbar
from pkg_resources import parse_version
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment(
autoescape=False,
loader=FileSystemLoader(os.path.join(PATH, 'templates')),
trim_blocks=False)
package_databases = ['/var/lib/pacman/sync/core.db',
'/var/lib/pacman/sync/community.db',
'/var/lib/pacman/sync/extra.db']
def get_local_packages(package_databases):
#os.makedirs("/tmp/archlinux-anitya")
os.chdir("/tmp/archlinux-anitya")
pkglist = []
for database in package_databases:
tar = tarfile.open(database, "r:gz")
tar.extractall()
for entry in tar.getmembers():
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)
pkgname = re.search(r'%NAME%\\n(.*?)\\n',content).group(1)
pkglist.append({ 'name' : pkgname, 'version' : pkgversion })
descfile.close()
tar.close()
return pkglist
def get_upstream_version(packagename):
response = requests.get('https://release-monitoring.org/api/projects/?pattern='+packagename)
for project in response.json()['projects']:
if project['name'] == packagename:
if project['version']:
return project['version'].replace('.src','')
else:
return "None"
print("Loading local package databases ...")
packages = get_local_packages(package_databases)
packages = packages[8740:]
print("Checking upstream versions ...")
packages_outdated = []
packages_uptodate = []
packages_notlisted = []
bar = progressbar.ProgressBar(max_value=len(packages))
for idx, package in enumerate(packages):
bar.update(idx)
upstreamversion = get_upstream_version(package['name'])
packages[idx]['upstreamversion'] = upstreamversion
if upstreamversion == None:
packages_notlisted.append(packages[idx])
else:
if parse_version(upstreamversion) > parse_version(package['version']):
packages_outdated.append(packages[idx])
else:
packages_uptodate.append(packages[idx])
print("Writing template ...")
context = { 'packages_outdated' : packages_outdated,
'packages_uptodate' : packages_uptodate,
'packages_notlisted' : packages_notlisted}
html =TEMPLATE_ENVIRONMENT.get_template('template.html').render(context)
os.chdir(PATH)
with open('upstream.html', 'w') as f:
f.write(html)
print("Done!")
<html><head>
<title>Upstream releases - Arch Linux Upstream Tracker</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="https://security.archlinux.org/static/favicon.ico">
<link href="upstream_files/css.css" rel="stylesheet">
<link rel="stylesheet" href="upstream_files/normalize.css" type="text/css" media="all">
<link rel="stylesheet" href="upstream_files/style.css" type="text/css" media="all">
<link href="https://security.archlinux.org/advisory/feed.atom" rel="alternate" title="Recent advisories" type="application/atom+xml">
<link rel="stylesheet" type="text/css" href="upstream_files/socialwidgets.css"></head>
<body>
<div id="archnavbar">
<div id="logo"><a href="https://archlinux.org/">overview</a></div>
<div id="archnavbarmenu">
<ul id="archnavbarlist">
<li id="anb-home"><a href="https://archlinux.org/" title="Arch news, packages, projects and more">Home</a></li>
<li id="anb-packages"><a href="https://archlinux.org/packages/" title="Arch Package Database">Packages</a></li>
<li id="anb-forums"><a href="https://bbs.archlinux.org/" title="Community forums">Forums</a></li>
<li id="anb-wiki"><a href="https://wiki.archlinux.org/" title="Community documentation">Wiki</a></li>
<li id="anb-bugs"><a href="https://bugs.archlinux.org/" title="Report and track bugs">Bugs</a></li>
<li id="anb-security"><a href="#" title="Arch Linux Security Tracker">Upstream</a></li>
<li id="anb-aur"><a href="https://aur.archlinux.org/" title="Arch Linux User Repository">AUR</a></li>
<li id="anb-download"><a href="https://archlinux.org/download/" title="Get Arch Linux">Download</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="navbar">
<ul>
<li><a href="https://security.archlinux.org/">issues</a></li>
<li><a href="https://security.archlinux.org/advisory">advisories</a></li>
<li><a href="https://security.archlinux.org/todo">todo</a></li>
<li><a href="https://security.archlinux.org/login">login</a></li>
</ul>
</div>
<hr>
<h1>Packages</h1>
<div class="navbar">
<ul>
<li><b>outdated</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
{% for package in packages_outdated %}
<tr>
<td>{{ package['name'] }}</td>
<td><span class="red">{{ package['version'] }}</span></td>
<td>{{ package['upstreamversion'] }}</td>
<td>Link</td>
{% endfor %}
</tbody>
</table>
</div>
<div class="navbar">
<ul>
<li><b>uptodate</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
{% for package in packages_uptodate %}
<tr>
<td>{{ package['name'] }}</td>
<td><span class="green">{{ package['version'] }}</span></td>
<td>{{ package['upstreamversion'] }}</td>
<td>Link</td>
{% endfor %}
</tbody>
</table>
</div>
<div class="navbar">
<ul>
<li><b>notlisted</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
{% for package in packages_notlisted %}
<tr>
<td>{{ package['name'] }}</td>
<td>{{ package['version'] }}</td>
<td>{{ package['upstreamversion'] }}</td>
<td>Link</td>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body></html>
<html><head>
<title>Upstream releases - Arch Linux Upstream Tracker</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="https://security.archlinux.org/static/favicon.ico">
<link href="upstream_files/css.css" rel="stylesheet">
<link rel="stylesheet" href="upstream_files/normalize.css" type="text/css" media="all">
<link rel="stylesheet" href="upstream_files/style.css" type="text/css" media="all">
<link href="https://security.archlinux.org/advisory/feed.atom" rel="alternate" title="Recent advisories" type="application/atom+xml">
<link rel="stylesheet" type="text/css" href="upstream_files/socialwidgets.css"></head>
<body>
<div id="archnavbar">
<div id="logo"><a href="https://archlinux.org/">overview</a></div>
<div id="archnavbarmenu">
<ul id="archnavbarlist">
<li id="anb-home"><a href="https://archlinux.org/" title="Arch news, packages, projects and more">Home</a></li>
<li id="anb-packages"><a href="https://archlinux.org/packages/" title="Arch Package Database">Packages</a></li>
<li id="anb-forums"><a href="https://bbs.archlinux.org/" title="Community forums">Forums</a></li>
<li id="anb-wiki"><a href="https://wiki.archlinux.org/" title="Community documentation">Wiki</a></li>
<li id="anb-bugs"><a href="https://bugs.archlinux.org/" title="Report and track bugs">Bugs</a></li>
<li id="anb-security"><a href="#" title="Arch Linux Security Tracker">Upstream</a></li>
<li id="anb-aur"><a href="https://aur.archlinux.org/" title="Arch Linux User Repository">AUR</a></li>
<li id="anb-download"><a href="https://archlinux.org/download/" title="Get Arch Linux">Download</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="navbar">
<ul>
<li><a href="https://security.archlinux.org/">issues</a></li>
<li><a href="https://security.archlinux.org/advisory">advisories</a></li>
<li><a href="https://security.archlinux.org/todo">todo</a></li>
<li><a href="https://security.archlinux.org/login">login</a></li>
</ul>
</div>
<hr>
<h1>Packages</h1>
<div class="navbar">
<ul>
<li><b>outdated</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="navbar">
<ul>
<li><b>uptodate</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
<tr>
<td>cksfv</td>
<td><span class="green">1.3.14</span></td>
<td>1.3.14</td>
<td>Link</td>
<tr>
<td>clalsadrv</td>
<td><span class="green">2.0.0</span></td>
<td>2.0.0</td>
<td>Link</td>
<tr>
<td>clamtk</td>
<td><span class="green">5.24</span></td>
<td>None</td>
<td>Link</td>
<tr>
<td>clamz</td>
<td><span class="green">0.5</span></td>
<td>None</td>
<td>Link</td>
</tbody>
</table>
</div>
<div class="navbar">
<ul>
<li><b>notlisted</b></li>
<li><a href="https://security.archlinux.org/issues/all">all</a></li>
</ul>
</div>
<div class="scroll-x">
<table class="styled-table full size">
<thead>
<tr>
<th>Package</th>
<th>Version</th>
<th>Upstream Version</th>
<th>Ticket</th>
</tr>
</thead>
<tbody>
<tr>
<td>clanlib</td>
<td>4.0.0</td>
<td>None</td>
<td>Link</td>
<tr>
<td>clasp</td>
<td>3.2.1</td>
<td>None</td>
<td>Link</td>
<tr>
<td>classpath</td>
<td>0.99</td>
<td>None</td>
<td>Link</td>
<tr>
<td>clearsilver</td>
<td>0.10.5</td>
<td>None</td>
<td>Link</td>
<tr>
<td>clementine</td>
<td>1.3.1</td>
<td>None</td>
<td>Link</td>
<tr>
<td>clewn</td>
<td>1.15</td>
<td>None</td>
<td>Link</td>
</tbody>
</table>
</div>
</div>
</body></html>
\ No newline at end of file
/* cyrillic-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/K88pR3goAWT7BTt32Z01mxJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
}
/* cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/RjgO7rYTmqiVp7vzi-Q5URJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/LWCjsQkB6EMdfHrEVqA1KRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/xozscpT2726on7jbcb_pAhJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/59ZRklaO5bWGqF5A9baEERJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/u-WUoqrET9fUeobQW7jkRRJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url(https://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3VtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/* Document
========================================================================== */
html {
font-family: sans-serif; /* 1 */
line-height: 1.15; /* 2 */
-ms-text-size-adjust: 100%; /* 3 */
-webkit-text-size-adjust: 100%; /* 3 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
}
/**
* Add the correct display in IE 9-.
*/
article,
aside,
footer,
header,
nav,
section {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in IE.
*/
figcaption,
figure,
main { /* 1 */
display: block;
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/