baseimager: remove INSTALLERFW_DISTRO_NAME

Stop exporting the INSTALLERFW_DISTRO_NAME because it is harful if installer
framework plugins start using it instead of taking the data from
/etc/os-release.

Change-Id: Ibcedbe4c35416087a0edf64b128fef9942524a67
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Support encode form of baseurl for repo directive.

If user has special characters like '@' in his/her password, it
can be write as encode form embeded into url. By using zypp.Url
class which is already support encoded password, it by default
hide password part, so we also gain the feature that password
won't be printed to console.

Fix: 1499

Change-Id: I4243f36df491cb6eb80f04334962a2ed6030acbe
Add --user/--passwd to repo command in KS.

If there are special characters like '@' in repo url, it can be
set by --passwd option in plain text format.

Also refactor MicRepo_data and MicRepo classes to extend from
F14_Repo, so we don't have to add --proxy ourself.

Fix: 1542

Change-Id: Ic9078a7313e14bd0959fd1676994cf5761e04c44
Rewrite SafeURL class without using zypp.Url

Since SafeURL implementation depends on lib zypp which provided
by python-zypp package. This package will not be installed when
only install "mic" package instead of "mic-native". Then import
zypp will raise exception of "No module named _zypp".

Change-Id: If8232b0ee77166eadc04f016cd2cda722c7ff23e
Fixed: 1568
baseimager: do not add noatime mount option

Stop adding "noatime" to the INSTALLERFW_PARTx_FSOPTS installer framework
variable, because it is up to the plugin to decide which mount options to add.
MIC should not try to add own.

Change-Id: I4b9e8f0f61b2777e0ee6bdcd96728b21913eaf0c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Fix --pkgmgr=yum does not use cached download packages

Change-Id: I81fba9c393a7fd13b0ce22c5c9e8027fa14bf315
Fixes: #1547
fix single ip ignored in no proxy setting

Fixes: #1569

Change-Id: Ic40c32ceaed78e59947af7f185e00e84ccbb30b8
Signed-off-by: Gui Chen <gui.chen@intel.com>
kickstart: remove old installerfw keywords

The story: the installer framework keyword in KS files originally was
"installerfw", and the keyword for the first plugin was "extlinux". However,
we realized that this is bad naming, and commit changed the names in commit
'0bafaa1b31a0 kickstart: add an alias for installerfw'. That commit preserved
the old name as aliases for compatibility reasons. And added scary warnings
which are printed when the old names are used.

The only user user of the old names was Tizen IVI, and it stopped using them
very long time ago. Now it uses the new 'installerfw_plugins' and 'bootloader'
keywords instead.

So it is time to kill the old keywords completely and clean the code up. And
this is exactly what this patch does.

Change-Id: I23ef6c5850744734816974233229cf99fca05f38
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Fix a bug that raise AttributeError.

When download attachment packages by using yum pkgmgr, the url
variable below is a unicode instead of SafeURL object.

Traceback (most recent call last):
......
  File "/home/huanghao/workspace/mic/plugins/imager/loop_plugin.py", line 127, in do_create
    creator.install()
  File "/usr/local/lib/python2.7/dist-packages/mic/imager/baseimager.py", line 1051, in install
    self.__attachment_packages(pkg_manager)
  File "/usr/local/lib/python2.7/dist-packages/mic/imager/baseimager.py", line 966, in __attachment_packages
    fpath = grabber.myurlgrab(url.full, fpath, proxies, None)
AttributeError: 'unicode' object has no attribute 'full'

Change-Id: Ib5c03ef053b8cf22f1b8ef1868ad244427df7cc6
Fix chroot failure caused by out-of-disk-space error.

If there is no space left on loop device, creation of mount points
will fail. In this case, mic will catch and ignore this failure.
Mic make its best effort to chroot.

Fix: #701

Change-Id: Ifb7666ec27f8bdb560983a9966ef171cb2a8a14b
Signed-off-by: Xiaoning Zhu <xiaoning.zhu@intel.com>
Bmap: sync with the latest bmap-tools

This patch syncs MIC's copy of BmapCreate with the latest contents of the
bmap-tools project. The reason for syncing is to fix DEVT-139. The bugreport
tells that MIC cannot generate the bmap file when the image resides on tmpfs.
And now this is fixed.

We also re-named the Fiemap module to Filemap, because now this module supports
both FIEMAP ioctl and the SEEK_HOLE method. Here is some more description from
the bmap-tools release notes.

"
Make 'bmaptool create' (and hence, the BmapCreate module) work with the
"tmpfs" file-system. This file-system does not, unfortunately, support the
"FIEMAP" ioctl, but it supports the "SEEK_HOLE" option of the "lseek" system
call, which can also be used to find where the holes are. In this release we
have implemented support for "SEEK_HOLE" to cover tmpfs. Generally, FIEMAP
is faster than "SEEK_HOLE" for large files, so we always try to start with
using FIEMAP, and if it is not supported, we fall-back to using "SEEK_HOLE".
Therefore, the "Fiemap" module was re-named to "Filemap", since it is now
supports more than just the FIEMAP ioctl.

Unfortunately, the SEEK_HOLE method requires the directory where the image
resides to be accessible for writing, because in current implementation we
need to create a temporary file there for a short time. The temporary file
is used to detect whether SEEK_HOLE is really implemented, or the system
just fakes it by always returning EOF.
"

Change-Id: I75522cab3c32c9b0879967f8fa2587c71bae0395
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Show hostname in log

Show hostname before distro info in log.

Fixes: #1644

Change-Id: Ibb9bdfa8bd1920084fbcdcec7a233102aeda0762
Fix duplicate log shows when run mic with 'yum'

Fixes: #1585

Change-Id: Ie5b39b055198b3f023819993b56a4dfc6c92e8dc
use nametuple to represent repo info

Change-Id: I9e3268ce91bd60739172520756790712085e0e04
Signed-off-by: Gui Chen <gui.chen@intel.com>
packaging: use gbp packaging service

Change version in debian/changelog to Debian source package format "1.0
native".

Change-Id: I6a4017a814cb04a808389e9b11851ce49e8765e0
Signed-off-by: Gui Chen <gui.chen@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Fix zypp fail to download packages

If we changed all configuration in '/etc/mic/mic.conf' to other dirs
like '/home/build/xx' instead of '/var/tmp/xx', mic wouldn't mount
or create '/var/tmp' any more, then it would result in zypp can't download
packages, becuase zypp will use '/var/tmp' to build cache as default

Fixes: #1623

Change-Id: I6f69c4a6f9655f70d3cbfa6670756255bca171a4
sleep earlier to prepare loop device creation

Fixes: #1646

Change-Id: If8e4fbe27e9320abf203eca82de6666271b00f86
Signed-off-by: Gui Chen <gui.chen@intel.com>
add two new options '--repo' and '--ignore-ksrepo'

option '--repo' is to append a new repo to repo pool
option '--ignore-ksrepo' is to ignore repos in ks file

Change-Id: I10280f0c3f40b2f68186240f3694d2eb14104e10
Signed-off-by: Gui Chen <gui.chen@intel.com>
implement '--repo' option and '--ignore-ksrepo'

option '--repo' is to append a new repo to repo pool, like
  --repo "name=main;baseurl=http://repo"
option '--ignoe-ksrepo' is to ignore repos in ks file, only valid when '--repo' used

Change-Id: I38586f2e587904e0f4fe2d901597f7231a248b97
Signed-off-by: Gui Chen <gui.chen@intel.com>
change tizen-python-zypp to python-zypp-tizen

Change-Id: I78c8c9f3bdadd4cb49b4dd6cecf8ccfb8e34a36c
Signed-off-by: Gui Chen <gui.chen@intel.com>