import mic.utils.errors as errors
from mic import msger
+chroot_lockfd = -1
+chroot_lock = ""
BIND_MOUNTS = (
"/proc",
"/proc/sys/fs/binfmt_misc",
"tmpdir": DEFAULT_TMPDIR,
"cachedir": DEFAULT_CACHEDIR,
"outdir": DEFAULT_OUTDIR,
- "arch": "i586",
+ "arch": None,
"pkgmgr": "zypp",
"name": "output",
"ksfile": None,
self.cachedir = createopts['cachedir']
self.destdir = createopts['outdir']
+ # target arch for non-x86 image
+ self.target_arch = createopts['arch']
else:
self.ks = None
self.repometadata = None
self.tmpdir = "/var/tmp"
self.cachedir = "/var/cache"
self.destdir = "."
+ self.target_arch = None
self.__builddir = None
self.__bindmounts = []
self._local_pkgs_path = None
# available size in root fs, init to 0
self._root_fs_avail = 0
- # target arch for non-x86 image
- self.target_arch = None
# Name of the disk image file that is created. """
self._img_name = None
# Image format """
RPM's n-v-r in the case of e.g. xen)
"""
- def get_kernel_versions(self, instroot):
+ def get_kernel_versions(instroot):
ret = {}
versions = set()
files = glob.glob(instroot + "/boot/vmlinuz-*")
"""Return a menu options string for syslinux configuration.
"""
if self.ks is None:
- return "bootinstall autoinst"
+ return "liveinst autoinst"
r = kickstart.get_menu_args(self.ks)
return r
raise MountError("Bind-mounting '%s' to '%s' failed" %
(self.src, self.dest))
if self.option:
- rc = subprocess.call([self.mountcmd, "-o", "remount,%s" % self.option, self.dest])
+ rc = subprocess.call([self.mountcmd, "--bind", "-o", "remount,%s" % self.option, self.dest])
if rc != 0:
raise MountError("Bind-remounting '%s' failed" % self.dest)
self.mounted = True
from errors import *
from fs_related import *
-chroot_lockfd = -1
-chroot_lock = ""
-
def setlocale():
import locale
import codecs
self.creator = creator
if self.creator.target_arch:
- if rpmUtils.arch.arches.has_key(self.creator.target_arch):
- self.arch.setup_arch(self.creator.target_arch)
- else:
- raise CreatorError("Invalid target arch: %s" % self.creator.target_arch)
+ if not rpmUtils.arch.arches.has_key(self.creator.target_arch):
+ rpmUtils.arch.arches["armv7hl"] = "noarch"
+ rpmUtils.arch.arches["armv7tnhl"] = "armv7nhl"
+ rpmUtils.arch.arches["armv7tnhl"] = "armv7thl"
+ rpmUtils.arch.arches["armv7thl"] = "armv7hl"
+ rpmUtils.arch.arches["armv7nhl"] = "armv7hl"
+ self.arch.setup_arch(self.creator.target_arch)
self.__recording_pkgs = recording_pkgs
self.__pkgs_content = {}
""" Set system architecture """
if self.creator.target_arch and self.creator.target_arch.startswith("arm"):
- arches = ["armv7l", "armv7nhl", "armv7hl"]
+ arches = ["armv7l", "armv7nhl", "armv7hl", "armv5tel"]
if self.creator.target_arch not in arches:
raise CreatorError("Invalid architecture: %s" % self.creator.target_arch)
arch_map = {}
arch_map["armv7nhl"] = zypp.Arch_armv7nhl()
elif self.creator.target_arch == "armv7hl":
arch_map["armv7hl"] = zypp.Arch_armv7hl()
+ elif self.creator.target_arch == "armv5tel":
+ arch_map["armv5tel"] = zypp.Arch_armv5tel()
zconfig.setSystemArchitecture(arch_map[self.creator.target_arch])
print "zypp architecture: %s" % zconfig.systemArchitecture()
try:
chroot.chroot(extmnt, None, "/bin/env HOME=/root /bin/bash")
except:
- raise CreatorError("Failed to chroot to %s." %img)
+ raise CreatorError("Failed to chroot to %s." %target)
finally:
chroot.cleanup_after_chroot("img", extloop, os_image_dir, extmnt)
try:
chroot.chroot(extmnt, None, "/bin/env HOME=/root /bin/bash")
except:
- raise CreatorError("Failed to chroot to %s." %img)
+ raise CreatorError("Failed to chroot to %s." %target)
finally:
chroot.cleanup_after_chroot("img", extloop, os_image_dir, extmnt)
if rc != 0:
raise CreatorError("Failed to dd")
srcloop.cleanup()
+ shutil.rmtree(srcmnt, ignore_errors = True)
return image
mic_plugin = ["raw", RawPlugin]