Move BuildType to imagebuilder to prevent dependency conflicts
This commit is contained in:
parent
e794ced82a
commit
c22d2c7393
@ -5,7 +5,8 @@ import argparse
|
||||
import os
|
||||
import sys
|
||||
from lxcbuild.app import App
|
||||
from lxcbuild.image import BuildType, Image
|
||||
from lxcbuild.image import Image
|
||||
from lxcbuild.imagebuilder import BuildType
|
||||
|
||||
parser = argparse.ArgumentParser(description='VM application builder and packager')
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
|
@ -3,19 +3,12 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from enum import Enum
|
||||
from lxcmgr import lxcmgr
|
||||
|
||||
from .imagebuilder import ImageBuilder, ImageExistsError, ImageNotFoundError
|
||||
from .imagebuilder import BuildType, ImageBuilder, ImageExistsError, ImageNotFoundError
|
||||
from .imagepacker import ImagePacker
|
||||
from .packer import PackageExistsError
|
||||
|
||||
class BuildType(Enum):
|
||||
NORMAL = 1
|
||||
FORCE = 2
|
||||
SCRATCH = 3
|
||||
METADATA = 4
|
||||
|
||||
class Image:
|
||||
def __init__(self):
|
||||
self.name = None
|
||||
|
@ -5,18 +5,23 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from enum import Enum
|
||||
from lxcmgr import lxcmgr
|
||||
from lxcmgr.paths import LXC_STORAGE_DIR
|
||||
from lxcmgr.pkgmgr import PkgMgr
|
||||
|
||||
from .image import BuildType
|
||||
|
||||
class ImageExistsError(Exception):
|
||||
pass
|
||||
|
||||
class ImageNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
class BuildType(Enum):
|
||||
NORMAL = 1
|
||||
FORCE = 2
|
||||
SCRATCH = 3
|
||||
METADATA = 4
|
||||
|
||||
class ImageBuilder:
|
||||
def __init__(self, image):
|
||||
self.image = image
|
||||
@ -86,6 +91,9 @@ class ImageBuilder:
|
||||
# Set name and first (topmost) layer of the image
|
||||
self.image.name = name
|
||||
self.image.conf['layers'] = [name]
|
||||
if self.image.build_type == BuildType.METADATA:
|
||||
# Don't check or create any directories if we're building just metadata
|
||||
return
|
||||
image_path = self.get_layer_path(name)
|
||||
if os.path.exists(image_path):
|
||||
if self.image.build_type in (BuildType.FORCE, BuildType.SCRATCH):
|
||||
|
Loading…
Reference in New Issue
Block a user