-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathppa-check
executable file
·44 lines (32 loc) · 1.08 KB
/
ppa-check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
import os
from collections import defaultdict
import requests
from aptsources import sourceslist
IGNORE_DISABLED = True
SHOW_SUPPORTED = True
TARGET_DIST = 'artful'
def get_sources():
sources = defaultdict(list)
for source in sourceslist.SourcesList():
sources[source.file].append(source)
return sources
def get_distro(distro_info):
if '-' not in distro_info:
return (distro_info, '')
return distro_info.split('-', 1)
for path, sources in get_sources().items():
for src in sources:
if src.invalid or src.type == 'deb-src':
continue
if IGNORE_DISABLED and src.disabled:
continue
if any(domain in src.uri for domain in ['ubuntu.com', 'canonical.com']):
continue
repo_url = os.path.join(src.uri, 'dists', TARGET_DIST)
response = requests.get(repo_url)
if response.status_code == 200:
if SHOW_SUPPORTED:
print(repo_url, response.status_code)
elif not SHOW_SUPPORTED:
print(repo_url, response.status_code)