import os, sys
import ConfigParser
-import mic.utils as utils
-import mic.utils.errors as errors
+
+from mic.utils import misc
+from mic.utils import errors
from mic import kickstart
from mic import msger
DEFAULT_GSITECONF='/etc/mic/mic.conf'
DEFAULT_OUTDIR='.'
-DEFAULT_TMPDIR='/var/tmp'
-DEFAULT_CACHEDIR='/var/cache'
+DEFAULT_TMPDIR='/var/tmp/mic'
+DEFAULT_CACHEDIR='/var/tmp/mic/cache'
DEFAULT_CREATE = {
"tmpdir": DEFAULT_TMPDIR,
try:
ks = kickstart.read_kickstart(ksconf)
- ksrepos = utils.misc.get_repostrs_from_ks(ks)
+ ksrepos = misc.get_repostrs_from_ks(ks)
msger.info("Retrieving repo metadata:")
- repometadata = utils.misc.get_metadata_from_repos(ksrepos, self.create['cachedir'])
+ repometadata = misc.get_metadata_from_repos(ksrepos, self.create['cachedir'])
msger.raw(" DONE")
self.create['ks'] = ks
self.ks = None
self.repometadata = None
self.name = "target"
- self.tmpdir = "/var/tmp"
- self.cachedir = "/var/cache"
+ self.tmpdir = "/var/tmp/mic"
+ self.cachedir = "/var/tmp/mic/cache"
self.destdir = "."
self.target_arch = None
self._local_pkgs_path = None
self._dep_checks = ["ls", "bash", "cp", "echo", "modprobe", "passwd"]
- ### to be obsolete
+ #FIXME to be obsolete
self.distro_name = "MeeGo"
+
# Output image file names"""
self.outimage = []
+
# A flag to generate checksum"""
self._genchecksum = False
+
self._alt_initrd_name = None
+
# the disk image after creation, e.g., bz2.
# This value is set with compression_method function. """
self.__img_compression_method = None
- # dependent commands to check
+
self._recording_pkgs = None
self._include_src = None
+
# available size in root fs, init to 0
self._root_fs_avail = 0
+
# Name of the disk image file that is created. """
self._img_name = None
- # Image format """
+
self.image_format = None
+
# Save qemu emulator file name in order to clean up it finally """
self.qemu_emulator = None
+
# No ks provided when called by convertor, so skip the dependency check """
if self.ks:
# If we have btrfs partition we need to check that we have toosl for those """
self._dep_checks.append("mkfs.btrfs")
break
+ # make sure the specified tmpdir and cachedir exist
+ if not os.path.exists(self.tmpdir):
+ makedirs(self.tmpdir)
+ if not os.path.exists(self.cachedir):
+ makedirs(self.cachedir)
+
def set_target_arch(self, arch):
if arch not in rpmmisc.arches:
return False