diff --git a/build/usr/bin/lxcbuild b/build/usr/bin/lxcbuild index 9d47df9..e15b61b 100755 --- a/build/usr/bin/lxcbuild +++ b/build/usr/bin/lxcbuild @@ -20,7 +20,7 @@ if len(sys.argv) < 2: sys.exit(1) args = parser.parse_args() -def build_and_pack_image(args, path): +def build_and_pack_image(path, args): image = Image() image.force_build = args.force or args.scratch image.scratch_build = args.scratch @@ -44,7 +44,7 @@ else: if os.path.isfile(buildpath): basename = os.path.basename(buildpath) if basename == 'lxcfile' or basename.endswith('.lxcfile'): - build_and_pack_image(args, buildpath) + build_and_pack_image(buildpath, args) # Compose files needs to be ignored when performing scratch builds elif not args.scratch and basename == 'meta': pack_app(buildpath) @@ -54,16 +54,21 @@ else: # If the buildpath is a directory, build as much as possible, unless scratch build was requested, in which case don't build anything else: if args.scratch: - print('Please specify an lxcfile for scratch build') - sys.exit(1) - valid_dir = False - for entry in os.scandir(buildpath): - if entry.is_file() and (entry.name == 'lxcfile' or entry.name.endswith('.lxcfile')): + lxcfile = os.path.join(buildpath, 'lxcfile') + if os.path.exists(lxcfile): + build_and_pack_image(lxcfile, args) + else: + print('Please specify an lxcfile for scratch build') + sys.exit(1) + else: + valid_dir = False + for entry in os.scandir(buildpath): + if entry.is_file() and (entry.name == 'lxcfile' or entry.name.endswith('.lxcfile')): + valid_dir = True + build_and_pack_image(entry.path, args) + meta = os.path.join(buildpath, 'meta') + if os.path.exists(meta): valid_dir = True - build_and_pack_image(args, entry.path) - meta = os.path.join(buildpath, 'meta') - if os.path.exists(meta): - valid_dir = True - pack_app(meta) - if not valid_dir: - print('Directory {} doesn\'t contain anything to build, skipping'.format(buildpath)) + pack_app(meta) + if not valid_dir: + print('Directory {} doesn\'t contain anything to build, skipping'.format(buildpath)) diff --git a/build/usr/lib/python3.6/lxcbuild/apppacker.py b/build/usr/lib/python3.6/lxcbuild/apppacker.py index 29412de..24da80a 100644 --- a/build/usr/lib/python3.6/lxcbuild/apppacker.py +++ b/build/usr/lib/python3.6/lxcbuild/apppacker.py @@ -47,7 +47,7 @@ class AppPacker(Packer): def register(self): # Register package in global repository metadata file - print('Registering package', self.app.name) + print('Registering application package', self.app.name) self.packages['apps'][self.app.name] = self.app.conf.copy() self.packages['apps'][self.app.name]['size'] = self.tar_size self.packages['apps'][self.app.name]['pkgsize'] = self.xz_size diff --git a/build/usr/lib/python3.6/lxcbuild/imagepacker.py b/build/usr/lib/python3.6/lxcbuild/imagepacker.py index aad02d0..4ce7fd9 100644 --- a/build/usr/lib/python3.6/lxcbuild/imagepacker.py +++ b/build/usr/lib/python3.6/lxcbuild/imagepacker.py @@ -40,13 +40,13 @@ class ImagePacker(Packer): def create_archive(self): # Create archive - print('Archiving', self.image.name) + print('Archiving image', self.image.name) subprocess.run(['tar', '--xattrs', '-cpf', self.tar_path, self.image.name], cwd=LXC_STORAGE_DIR) self.compress_archive() def register(self): # Register image in global repository metadata file - print('Registering package', self.image.name) + print('Registering image package', self.image.name) self.packages['images'][self.image.name] = self.image.conf.copy() self.packages['images'][self.image.name]['size'] = self.tar_size self.packages['images'][self.image.name]['pkgsize'] = self.xz_size