init→main
This commit is contained in:
parent
a7fcaa975c
commit
4abb2c073b
1 changed files with 0 additions and 0 deletions
57
__main__.py
Executable file
57
__main__.py
Executable file
|
@ -0,0 +1,57 @@
|
|||
#! /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()
|
Loading…
Add table
Add a link
Reference in a new issue