From 7f0d9572e30db523cc95144fcee7f4d8d4dcb5b1 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 24 Sep 2019 10:04:13 +0200 Subject: [PATCH] Add unpacked sizes --- apk/vmmgr | 2 +- build/usr/lib/python3.6/lxcbuild/packer.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apk/vmmgr b/apk/vmmgr index 7b045cf..d14fba7 160000 --- a/apk/vmmgr +++ b/apk/vmmgr @@ -1 +1 @@ -Subproject commit 7b045cf9c3e7f0de494a75e99a9f2a9d34d4772d +Subproject commit d14fba7ec1759bb9a9a45369d155a9937dbdbecd diff --git a/build/usr/lib/python3.6/lxcbuild/packer.py b/build/usr/lib/python3.6/lxcbuild/packer.py index ffbeb53..11aab79 100644 --- a/build/usr/lib/python3.6/lxcbuild/packer.py +++ b/build/usr/lib/python3.6/lxcbuild/packer.py @@ -20,7 +20,9 @@ class Packer: self.app = None self.image = None self.tar_path = None + self.tar_size = 0 self.xz_path = None + self.xz_size = 0 if os.path.exists(REPO_META_FILE): with open(REPO_META_FILE, 'r') as f: self.packages = json.load(f) @@ -56,15 +58,18 @@ class Packer: def compress_archive(self): # Compress the tarball with xz (LZMA2) - print('Compressing', self.tar_path, '({:.2f} MB)'.format(os.path.getsize(self.tar_path)/1048576)) + self.tar_size = os.path.getsize(self.tar_path) + print('Compressing', self.tar_path, '({:.2f} MB)'.format(self.tar_size/1048576)) subprocess.run(['xz', '-9', self.tar_path]) - print('Compressed ', self.xz_path, '({:.2f} MB)'.format(os.path.getsize(self.xz_path)/1048576)) + self.xz_size = os.path.getsize(self.xz_path) + print('Compressed ', self.xz_path, '({:.2f} MB)'.format(self.xz_size/1048576)) def register_image(self): # Register image in global repository metadata file print('Registering package {}'.format(self.image.name)) self.packages['images'][self.image.name] = self.image.conf.copy() - self.packages['images'][self.image.name]['size'] = os.path.getsize(self.xz_path) + self.packages['images'][self.image.name]['size'] = self.tar_size + self.packages['images'][self.image.name]['pkgsize'] = self.xz_size self.packages['images'][self.image.name]['sha512'] = crypto.hash_file(self.xz_path) self.save_repo_meta() # Register the image also to locally installed images for package manager @@ -112,6 +117,7 @@ class Packer: # Register package in global repository metadata file print('Registering package {}'.format(self.app.name)) self.packages['apps'][self.app.name] = self.app.conf.copy() - self.packages['apps'][self.app.name]['size'] = os.path.getsize(self.xz_path) + self.packages['apps'][self.app.name]['size'] = self.tar_size + self.packages['apps'][self.app.name]['pkgsize'] = self.xz_size self.packages['apps'][self.app.name]['sha512'] = crypto.hash_file(self.xz_path) self.save_repo_meta()