mrmp/__init__.py
Marc Beninca a7fcaa975c check
2023-01-28 21:19:16 +01:00

57 lines
1.2 KiB
Python
Executable file

#! /usr/bin/env python3
import hashlib
import os
import sys
import arguments
import local
import synchronization
def build():
# TODO identify
print('TODO identify')
# TODO extract
print('TODO extract')
# TODO apply
print('TODO apply')
# TODO archive
print('TODO archive')
def check():
packages = []
broken = []
lo = local.Local()
for architecture in lo.architectures:
for subsystem in architecture.subsystems.values():
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():
print(local.Local())
def sync():
sync = synchronization.Synchronization()
print(sync)
sync.run()
def main():
getattr(sys.modules[__name__], arguments.action)()
if __name__ == '__main__':
main()