This commit is contained in:
Marc Beninca 2021-10-10 22:35:13 +02:00 committed by Marc Beninca
parent 0aec6573f8
commit a7fcaa975c
2 changed files with 22 additions and 9 deletions

View file

@ -1,5 +1,7 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
import hashlib
import os
import sys import sys
import arguments import arguments
@ -19,12 +21,22 @@ def build():
def check(): def check():
# TODO prepare threads packages = []
print('TODO prepare threads') broken = []
# TODO run threads lo = local.Local()
print('TODO run threads') for architecture in lo.architectures:
# TODO watch threads for subsystem in architecture.subsystems.values():
print('TODO watch threads') for package in subsystem.catalog.packages.values():
packages.append((subsystem, package))
for index, items in enumerate(packages):
print(index, '/', len(packages))
subsystem, package = items
path = os.path.join(subsystem.path, package.filename)
with open(path, 'br') as f:
hash = hashlib.sha256(f.read()).hexdigest()
if hash != package.sha256sum:
broken.append(package)
print(len(broken), '/', len(packages))
def info(): def info():

View file

@ -20,8 +20,9 @@ class Package:
def __str__(self): def __str__(self):
lines = [ lines = [
f'Name: {self.name}', f' Name: {self.name}',
f'Size: {self.csize}', f'FileName: {self.filename}',
f'Hash: {self.sha256sum}', f' Size: {self.csize}',
f' Hash: {self.sha256sum}',
] ]
return os.linesep.join(lines) return os.linesep.join(lines)