file
This commit is contained in:
parent
e90a4396fa
commit
ec6a6e07e1
2 changed files with 30 additions and 1 deletions
20
file.py
Normal file
20
file.py
Normal file
|
@ -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)
|
|
@ -2,6 +2,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import arguments
|
import arguments
|
||||||
|
import file
|
||||||
import msys
|
import msys
|
||||||
import remote
|
import remote
|
||||||
import repository
|
import repository
|
||||||
|
@ -19,9 +20,17 @@ class Synchronization:
|
||||||
for subsystem in msys.get_subsystems(architecture,
|
for subsystem in msys.get_subsystems(architecture,
|
||||||
self.remote.subsystems):
|
self.remote.subsystems):
|
||||||
catalog = self.remote.catalogs[architecture][subsystem]
|
catalog = self.remote.catalogs[architecture][subsystem]
|
||||||
|
path = msys.get_subsystem(architecture, subsystem)
|
||||||
for _, package in sorted(catalog.packages.items()):
|
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()
|
||||||
print(package)
|
print(f)
|
||||||
tmp = os.path.join(self.repository.directory,
|
tmp = os.path.join(self.repository.directory,
|
||||||
self.repository.get_temporary())
|
self.repository.get_temporary())
|
||||||
os.makedirs(tmp)
|
os.makedirs(tmp)
|
||||||
|
|
Loading…
Reference in a new issue