From ec6a6e07e1beb4f9961b578065039b9cd906ace9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 14:07:15 +0200 Subject: [PATCH] file --- file.py | 20 ++++++++++++++++++++ synchronization.py | 11 ++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 file.py diff --git a/file.py b/file.py new file mode 100644 index 0000000..8100b1e --- /dev/null +++ b/file.py @@ -0,0 +1,20 @@ +import os + + +class File: + def __init__(self, remote, name, size, local, hash): + self.remote = remote + self.name = name + self.size = size + self.local = local + self.hash = hash + + def __str__(self): + lines = [ + f'Remote: {self.remote}', + f' Name: {self.name}', + f' Size: {self.size}', + f' Local: {self.local}', + f' Hash: {self.hash}', + ] + return os.linesep.join(lines) diff --git a/synchronization.py b/synchronization.py index f824470..2b55874 100644 --- a/synchronization.py +++ b/synchronization.py @@ -2,6 +2,7 @@ import os import shutil import arguments +import file import msys import remote import repository @@ -19,9 +20,17 @@ class Synchronization: for subsystem in msys.get_subsystems(architecture, self.remote.subsystems): catalog = self.remote.catalogs[architecture][subsystem] + path = msys.get_subsystem(architecture, subsystem) for _, package in sorted(catalog.packages.items()): + f = file.File( + os.path.join(self.remote.location, path), + package.name, + package.csize, + os.path.join(self.repository.directory, path), + package.sha256sum, + ) print() - print(package) + print(f) tmp = os.path.join(self.repository.directory, self.repository.get_temporary()) os.makedirs(tmp)