mrmp/__init__.py

58 lines
1.2 KiB
Python
Raw Normal View History

2021-10-09 10:29:37 +00:00
#! /usr/bin/env python3
2021-10-08 21:31:53 +00:00
2021-10-10 20:35:13 +00:00
import hashlib
import os
2021-10-09 12:01:50 +00:00
import sys
2021-10-08 21:31:53 +00:00
import arguments
2021-10-10 12:44:22 +00:00
import local
2021-10-09 17:46:11 +00:00
import synchronization
2021-10-09 10:25:45 +00:00
2021-10-10 17:02:34 +00:00
def build():
2021-10-09 10:25:45 +00:00
# TODO identify
print('TODO identify')
# TODO extract
print('TODO extract')
# TODO apply
print('TODO apply')
# TODO archive
print('TODO archive')
2021-10-10 17:02:34 +00:00
def check():
2021-10-10 20:35:13 +00:00
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))
2021-10-09 10:25:45 +00:00
2021-10-10 17:02:34 +00:00
def info():
print(local.Local())
2021-10-09 10:25:45 +00:00
2021-10-10 17:02:34 +00:00
def sync():
sync = synchronization.Synchronization()
2021-10-09 17:46:11 +00:00
print(sync)
2021-10-10 11:45:02 +00:00
sync.run()
2021-10-08 21:31:53 +00:00
def main():
2021-10-10 17:02:34 +00:00
getattr(sys.modules[__name__], arguments.action)()
2021-10-08 21:31:53 +00:00
if __name__ == '__main__':
main()