add recursive package search

This commit is contained in:
2023-09-07 06:00:06 +08:00
parent 60e73aa922
commit 707cf492d0

View File

@@ -28,7 +28,7 @@ logger = logging.getLogger('jpacrepo.uploader')
package_file_pattern = re.compile('.*\.pkg\.tar\.(xz|zst|gz)$')
_size_uoms = ('B', 'KiB', 'MiB', 'GiB', 'KiB')
_supported_compression_formats = ('xz', 'zst', 'gz')
def format_filesize(size: int) -> str:
counter = 0
@@ -195,8 +195,8 @@ class JpacrepoClient:
raise RuntimeError(f'Received HTTP error code: {response.code}')
def packages_to_upload(self) -> tuple[Path, ...]:
package_files: dict[str, Path] = {file.name: file for package_cache in self.config.repo_folders
for file in package_cache.iterdir()
package_files: dict[str, Path] = {file.name: file for ext in _supported_compression_formats for package_cache in self.config.repo_folders
for file in package_cache.glob(f'**/*.pkg.tar.{ext}')
if file.is_file() and package_file_pattern.match(file.name)}
headers = {
'Accept': 'application/json',