supported tizen bootstrap included mic
authorGui Chen <gui.chen@intel.com>
Wed, 11 Jul 2012 07:59:27 +0000 (15:59 +0800)
committerGui Chen <gui.chen@intel.com>
Wed, 11 Jul 2012 10:01:47 +0000 (18:01 +0800)
this function is not for normal user, but for special usage

Signed-off-by: Gui Chen <gui.chen@intel.com>
distfiles/mic.conf.in
mic/bootstrap.py
mic/creator.py
mic/rt_util.py

index 2504590..a1d0d70 100644 (file)
@@ -30,18 +30,7 @@ pkgmgr = zypp
 ; settings for chroot subcommand
 
 [bootstrap1]
-; This bootstrap can be used to create image with rpm 4.8.x
-name=meego-1.2.0
-1.2.0-oss=http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/
-1.2.0-tools=http://download.meego.com/live/devel:/tools:/building/MeeGo_1.2.0/
-; 1.2.0-oss_proxy=http://proxy.yourcompany.com:port
-; 1.2.0-tools_proxy=http://proxy.yourcompany.com:port
-
-[bootstrap2]
-; This bootstrap can be used to create image with rpm 4.9.x
-name=meego-trunk
-trunk-oss=http://repo.meego.com/MeeGo/builds/trunk/latest/repos/oss/ia32/packages/
-trunk-tools=http://download.meego.com/live/devel:/tools:/building/Trunk/
-; trunk-oss_proxy=http://proxy.yourcompany.com:port
-; trunk-tools_proxy=http://proxy.yourcompany.com:port
+name=micbootstrap
+bootstrap=http://download.tizen.org/tools/micbootstrap/
+; bootstrap_proxy=http://proxy.yourcompany.com:port
 
index 0b28599..9d223d0 100644 (file)
@@ -29,16 +29,10 @@ from mic.utils import proxy
 from mic.utils import misc
 from mic.utils import errors
 
-minibase_pkgs = [ "kernel", "rpm", "setup", "filesystem", "basesystem",
-                  "tzdata", "libgcc", "ncurses-base", "ncurses", "glibc",
-                  "glibc-common", "ncurses-libs", "nss-softokn-freebl",
-                  "bash", "zlib", "info", "cpio", "coreutils", "zypper" ]
-
-required_pkgs = [ "pam", "passwd", "meego-release", "nss", "genisoimage",
-                  "bzip2", "gzip", "perl", "make", "file", "psmisc", "wget",
-                  "syslinux-extlinux", "btrfs-progs", "satsolver-tools",
-                  "isomd5sum", "mtd-utils", "mtd-utils-ubi", "libzypp",
-                  "python-zypp", "grep", "sed", "qemu-arm-static", "mic" ]
+minibase_grps = [ "tizen-bootstrap" ]
+minibase_pkgs = [ ]
+required_pkgs = [ "syslinux", "syslinux-extlinux", "satsolver-tools",
+                  "libzypp", "python-zypp", "qemu-arm-static", "mic" ]
 
 
 def query_package_rpmdb(root='/', tag='name', pattern=None):
@@ -204,6 +198,8 @@ class Bootstrap(object):
         rpm.addMacro("_dbpath", "/var/lib/rpm")
         rpm.addMacro("__file_context_path", "%{nil}")
 
+        for grp in minibase_grps:
+            pkg_manager.selectGroup(grp)
         for pkg in minibase_pkgs:
             pkg_manager.selectPackage(pkg)
         for pkg in required_pkgs:
@@ -228,6 +224,9 @@ class Bootstrap(object):
         destdir= "%s/etc/zypp/repos.d/" % os.path.abspath(self.rootdir)
         shutil.rmtree(destdir, ignore_errors = True)
         shutil.copytree(srcdir, destdir)
+        # create '/tmp' in chroot
+        if not os.path.exists(os.path.join(os.path.abspath(self.rootdir), "tmp")):
+            os.makedirs(os.path.join(os.path.abspath(self.rootdir), "tmp"))
 
         msger.info("Bootstrap created.")
 
index 4c980e6..9dabaf3 100644 (file)
@@ -91,7 +91,8 @@ class Creator(cmdln.Cmdln):
                              help='Path for local pkgs(rpms) to be installed')
         optparser.add_option('', '--runtime', type='string',
                              dest='runtime', default=None,
-                             help='Specify  runtime mode, avaiable: bootstrap')
+                             #help='Specify  runtime mode, avaiable: bootstrap')
+                             help=SUPPRESS_HELP)
         # --taring-to is alias to --pack-to
         optparser.add_option('', '--taring-to', type='string',
                              dest='pack_to', default=None,
@@ -200,6 +201,9 @@ class Creator(cmdln.Cmdln):
         if self.options.pkgmgr is not None:
             configmgr.create['pkgmgr'] = self.options.pkgmgr
 
+        if self.options.runtime:
+            configmgr.create['runtime'] = self.options.runtime
+
         if self.options.pack_to is not None:
             configmgr.create['pack_to'] = self.options.pack_to
 
index bde3594..deb6b9f 100644 (file)
@@ -25,9 +25,13 @@ from mic import msger
 from mic.conf import configmgr
 from mic.utils import errors
 import mic.utils.misc as misc
+from mic.utils.proxy import get_proxy_for
+
+BOOTSTRAP_URL="http://download.tizen.org/tools/micbootstrap"
 
 def runmic_in_runtime(runmode, opts, ksfile, argv=None):
-    if not runmode or "MeeGo" == linux_distribution()[0]:
+    dist = misc.get_distro()[0]
+    if not runmode or not dist or "MeeGo" == dist:
         return
 
     if not argv:
@@ -37,7 +41,15 @@ def runmic_in_runtime(runmode, opts, ksfile, argv=None):
 
     if runmode == 'bootstrap':
         msger.info("Use bootstrap runtime environment")
-        (name, repostrs) = select_bootstrap(opts['repomd'], opts['cachedir'], opts['bootstrapdir'])
+        name = "micbootstrap"
+        try:
+            repostrs = configmgr.bootstraps[name]
+        except:
+            repostrs = "name:%s,baseurl:%s," (name, BOOTSTRAP_URL)
+            proxy = get_proxy_for(BOOTSTRAP_URL)
+            if proxy:
+                repostrs += "proxy:%s" % proxy
+
         repolist = []
         if not name:
             # use ks repo to create bootstrap
@@ -176,7 +188,7 @@ def get_mic_libpath():
 
 # the hard code path is prepared for bootstrap
 def copy_mic(bootstrap_pth, bin_pth = '/usr/bin', lib_pth='/usr/lib', \
-             pylib_pth = '/usr/lib/python2.6/site-packages'):
+             pylib_pth = '/usr/lib/python2.7/site-packages'):
     # copy python lib files
     mic_pylib = get_mic_modpath()
     bs_mic_pylib = bootstrap_pth + os.path.join(pylib_pth, 'mic')
@@ -208,6 +220,13 @@ def copy_mic(bootstrap_pth, bin_pth = '/usr/bin', lib_pth='/usr/lib', \
         os.makedirs(os.path.dirname(bs_mic_cfgpth))
     shutil.copy2(mic_cfgpth, bs_mic_cfgpth)
 
+    # remove yum backend
+    try:
+        yumpth = "/usr/lib/mic/plugins/backend/yumpkgmgr.py"
+        os.unlink(bootstrap_pth + yumpth)
+    except:
+        pass
+
 def clean_files(pattern, dir):
     if not os.path.exists(dir):
         return