This repository has been archived by the owner on Apr 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
/
check-built-packages.py
executable file
·51 lines (46 loc) · 1.96 KB
/
check-built-packages.py
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
45
46
47
48
49
50
51
#!/usr/bin/env python3
##
## Script for comparing local and remote package versions.
##
## Copyright 2019 Fredrik Fornwall <[email protected]>
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
import urllib.request
from subprocess import Popen, PIPE
version_map = {}
any_error = False
pipe = Popen('./scripts/list-versions.sh', stdout=PIPE)
for line in pipe.stdout:
(name, version) = line.decode().strip().split('=')
version_map[name] = version
def check_manifest(arch, manifest):
current_package = {}
for line in manifest:
if line.isspace():
package_name = current_package['Package']
package_version = current_package['Version']
if not package_name in version_map:
# Skip sub-package
continue
latest_version = version_map[package_name]
if package_version != latest_version:
print(f'{package_name}@{arch}: Expected {latest_version}, but was {package_version}')
current_package.clear()
elif not line.decode().startswith(' '):
parts = line.decode().split(':', 1)
current_package[parts[0].strip()] = parts[1].strip()
for arch in ['aarch64', 'arm', 'i686', 'x86_64']:
manifest_url = f'https://ipfs.io/ipns/k51qzi5uqu5dgu3homski160l4t4bmp52vb6dbgxb5bda90rewnwg64wnkwxj4/dists/x11/main/binary-{arch}/Packages'
with urllib.request.urlopen(manifest_url) as manifest:
check_manifest(arch, manifest)