tools/mic.git
11 years agoMerge "partitionedfs: simplify the code a tiny bit" into devel
Gui Chen [Tue, 19 Feb 2013 05:36:33 +0000 (21:36 -0800)]
Merge "partitionedfs: simplify the code a tiny bit" into devel

11 years agoMerge "partitionedfs: improve debugging prints" into devel
Gui Chen [Tue, 19 Feb 2013 05:31:12 +0000 (21:31 -0800)]
Merge "partitionedfs: improve debugging prints" into devel

11 years agoMerge "partitionedfs: remove bogus alignment check" into devel
Gui Chen [Tue, 19 Feb 2013 05:28:29 +0000 (21:28 -0800)]
Merge "partitionedfs: remove bogus alignment check" into devel

11 years agoPass command line info to CreatorError in get_file_size()
Huang Hao [Mon, 18 Feb 2013 09:31:44 +0000 (17:31 +0800)]
Pass command line info to CreatorError in get_file_size()

Variable "du" does not exist, so pass the command line to error.

Change the local var name "file" to "filename" to avoid conflicting
with builtin function.

Also refactor last "if" statement to more readable max function.

Change-Id: I661e0a02db940d75a8180c3215f95d5ff1ae8802

11 years agopartitionedfs: simplify the code a tiny bit
Artem Bityutskiy [Fri, 15 Feb 2013 09:09:31 +0000 (11:09 +0200)]
partitionedfs: simplify the code a tiny bit

When we calculate the minimum disk size, we do not have to search for the last
parition, because we have d['offset'] which points to the first available
sector.

Change-Id: Ida5f92ec11939caa76ad1bf90aee137a2e918d2d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: improve debugging prints
Artem Bityutskiy [Thu, 14 Feb 2013 12:28:10 +0000 (14:28 +0200)]
partitionedfs: improve debugging prints

Print the starting and ending partition sector numbers as well as partition
size. This makes it easier to debug issues.

Change-Id: Ie96872f6902d2b7c12bb043879e06d5b839d986c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: remove bogus alignment check
Artem Bityutskiy [Thu, 14 Feb 2013 11:48:18 +0000 (13:48 +0200)]
partitionedfs: remove bogus alignment check

The following perfectly valid KS option makes MIC complain about alignment and
exit:

part /d1 --size 1 --fstype=ext4 --ondisk sdb --align 1024

This creates a 1MiB partition and aligned to 1MiB.

And it is even fine to ask for a 1MiB partition to be aligned to 4MiB. So the
alignment size check is totally incorrect - remove it.

Change-Id: If84be72f43c3be91ae5a7c3fa49b10ef1202cf50
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoAdd global declaration to var _LOOP_RULE_PTH
Huang Hao [Mon, 18 Feb 2013 09:19:32 +0000 (17:19 +0800)]
Add global declaration to var _LOOP_RULE_PTH

hide_loopdev_presentation() redefine a var with the same name
_LOOP_RULE_PTH by setting its value without global statement. and
its global counterpart can never be changed.

pylint message:
W0621:136,12:hide_loopdev_presentation: Redefining name '_LOOP_RULE_PTH' from outer scope (line 125)

Change-Id: I1cfafa46a933e22c732d4f4963c4a4f6d1ac4c1d

11 years agoMove function optparser_setup out of class MicCmd
Huang Hao [Mon, 18 Feb 2013 02:52:25 +0000 (10:52 +0800)]
Move function optparser_setup out of class MicCmd

Found this problem by pylint. Decorator optparser_setup is not a
instance/class/static method of MicCmd, so move it out.

Also fix wrong indent.

Change-Id: I0315951134360fa6081b904e6323e57c16b7ef9f

11 years agoMake sure that urlgrabber gets URLs as strings
Markus Lehtonen [Tue, 16 Oct 2012 12:40:50 +0000 (15:40 +0300)]
Make sure that urlgrabber gets URLs as strings

URLs of unicode type cause a crash in python-urlgrabber.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
11 years agoroll back to original naming for release
Gui Chen [Tue, 5 Feb 2013 11:10:37 +0000 (19:10 +0800)]
roll back to original naming for release

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoremove suffix when release specified
Gui Chen [Tue, 5 Feb 2013 08:14:50 +0000 (16:14 +0800)]
remove suffix when release specified

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix no key 'HOME' in environ variable failure
Gui Chen [Mon, 4 Feb 2013 02:51:35 +0000 (10:51 +0800)]
fix no key 'HOME' in environ variable failure

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoFixed dependency issue for squashfs on OpenSUSE
Ed Bartosh [Tue, 5 Feb 2013 15:31:24 +0000 (17:31 +0200)]
Fixed dependency issue for squashfs on OpenSUSE

Name of the package with mksquashfs and unsquashfs utilities is squashfs
on OpenSUSE and squashfs-tools on Fedora. This change adds Requires:
squashfs to the spec for OpenSUSE and squashfs-tools for the rest of
distros.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agobump up to release 0.16 0.16
Gui Chen [Tue, 29 Jan 2013 08:22:38 +0000 (16:22 +0800)]
bump up to release 0.16

Change-Id: I4b62e11db18c027d6cd6afe63932fc4d8eaecf7a
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoupdate RELEASE_NOTES
Gui Chen [Tue, 29 Jan 2013 08:09:33 +0000 (16:09 +0800)]
update RELEASE_NOTES

Change-Id: Ide5b483fc7bdc2c36590ea6d1d2fdbc1f970414b
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to 0.16-rc4
Gui Chen [Tue, 29 Jan 2013 05:53:35 +0000 (13:53 +0800)]
bump up to 0.16-rc4

Change-Id: I01121a1ffff0e17d199e1b69dee69c62e8bab28e
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agopartitionedfs: do not use blkid for PARTUUID
Artem Bityutskiy [Tue, 29 Jan 2013 12:19:32 +0000 (14:19 +0200)]
partitionedfs: do not use blkid for PARTUUID

Now, as we have our own GPT partition table parser, lets use it. This patch
teaches partitionedfs.py to add the 'partuuid' key to partitions dictionary.
This value is later used in 'raw.py' when generating the extlinux.conf file.

Change-Id: I1af9e59742171797842f3fafd5c74be78e1414bc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Conflicts:
mic/imager/raw.py

11 years agoAdd a simple GPT partitions parser
Artem Bityutskiy [Tue, 29 Jan 2013 12:19:11 +0000 (14:19 +0200)]
Add a simple GPT partitions parser

The 'PARTUUID' blkid feature exists only in relatively new versions of blkid,
which causes troubles in some distributions. Therefore, lets implement our own
simple GPT parser instead.

Change-Id: Ie07efc5040770c002ef4be60431c8756fa690d63
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: remove unused variable
Artem Bityutskiy [Tue, 29 Jan 2013 11:24:44 +0000 (13:24 +0200)]
raw.py: remove unused variable

The rootdev variable is unused - remove it.

Change-Id: I7355a006557dced7ad95dbecb053243acf86829f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobump up to 0.16-rc3
Gui Chen [Sun, 27 Jan 2013 03:47:45 +0000 (11:47 +0800)]
bump up to 0.16-rc3

Change-Id: I007b70a1091a89a47e81dcc58653d5835f8859f0
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoupdate REALSE_NOTES
Gui Chen [Sun, 27 Jan 2013 03:46:09 +0000 (11:46 +0800)]
update REALSE_NOTES

Change-Id: I748b53f7397009136b0a42c98d45abd5a928b9fe
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix .vcs file not included in output showing
Gui Chen [Sun, 27 Jan 2013 03:45:26 +0000 (11:45 +0800)]
fix .vcs file not included in output showing

Change-Id: I2feeb6de21e6f69bda05ce25ffe6b9eb06537238
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agosome minor fixes
Gui Chen [Sun, 27 Jan 2013 03:37:24 +0000 (11:37 +0800)]
some minor fixes

fix --record-pkgs missing 'vcs' in help text
fix debugsource invalid in --install-pkgs

Change-Id: Ib61c3ec587b7173cc22284779fac05daf910f684
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd option '--fstab-entry' to set the entry in /etc/fstab
Gui Chen [Sun, 27 Jan 2013 03:25:27 +0000 (11:25 +0800)]
add option '--fstab-entry' to set the entry in /etc/fstab

valid values: name, uuid. 'name' means using device names, 'uuid' means using filesystem uuid

Change-Id: I6ea340bc66955cc33ebbe478cbf1425e060f313c
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agogive hints when overwriting loop images
Gui Chen [Sun, 27 Jan 2013 02:55:12 +0000 (10:55 +0800)]
give hints when overwriting loop images

Change-Id: Ia5f3fc69571a34445d8e879227953d3aa5a112af
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to 0.16-rc2
Gui Chen [Wed, 23 Jan 2013 03:53:49 +0000 (11:53 +0800)]
bump up to 0.16-rc2

Change-Id: Idc3d8d191b4d7adb77c7ddad86c2a0211e591909
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoRevert "raw.py: switch to the BmapCreate module"
Gui Chen [Wed, 23 Jan 2013 03:52:04 +0000 (11:52 +0800)]
Revert "raw.py: switch to the BmapCreate module"

This reverts commit 567fc7ad08ebbce84e1cb6894d35749b17637fa3.

11 years agoput the recording stuff before pkg_manager.close
Gui Chen [Wed, 23 Jan 2013 01:41:21 +0000 (09:41 +0800)]
put the recording stuff before pkg_manager.close

Change-Id: I680e2761743a2068919b18221a004152e40068f3
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to version 0.16-0.rc1
Gui Chen [Tue, 22 Jan 2013 09:47:58 +0000 (17:47 +0800)]
bump up to version 0.16-0.rc1

Change-Id: I8d861ae9ee3b35db789347bed2b66a27e81c75d0
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoupdate release notes
Gui Chen [Tue, 22 Jan 2013 09:42:30 +0000 (17:42 +0800)]
update release notes

Change-Id: I44f98af914e3b82117ed227ab2fc46fe07cf9894
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agodon't throw exception if get_partuuid failed
Gui Chen [Tue, 22 Jan 2013 08:11:49 +0000 (16:11 +0800)]
don't throw exception if get_partuuid failed

this try except is not tricky, just make things
going on, if 'gpt' required, root_partuuid valued
None would throw an exception instead

Change-Id: I44a6ae70893eacef52f3cf1673b7c2e5bb21f141
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoupdate debian packaging files
Gui Chen [Tue, 22 Jan 2013 07:53:16 +0000 (15:53 +0800)]
update debian packaging files

Change-Id: Ia857444bb840fa6fa41e633917ac14d3813f8348
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd lost interface getVcsInfo in yum backend
Gui Chen [Tue, 22 Jan 2013 07:39:13 +0000 (15:39 +0800)]
add lost interface getVcsInfo in yum backend

Change-Id: Icda3b0579d87ae4af3dc0fa566fb59be77732fe7
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocorrect empty prefix string produce '-'
Gui Chen [Tue, 22 Jan 2013 07:33:02 +0000 (15:33 +0800)]
correct empty prefix string produce '-'

Change-Id: I722a1268220848fe76bba7a9f0eee9fa4c689cc9
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to version 0.16-rc0
Gui Chen [Tue, 22 Jan 2013 07:27:19 +0000 (15:27 +0800)]
bump up to version 0.16-rc0

Change-Id: I7ff7eb8c019afb04598b49c81537e9c103d91c74
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocompatible with old style in name prefix
Gui Chen [Mon, 21 Jan 2013 17:39:32 +0000 (01:39 +0800)]
compatible with old style in name prefix

Change-Id: I6c223bdaf8c74fd36093da6690d8ba5c7379b57c
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agomake clear message info
Gui Chen [Mon, 21 Jan 2013 16:55:36 +0000 (00:55 +0800)]
make clear message info

Change-Id: I5717d5d92b604b544ad3ddec7a3eb2eebb9d461b
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoclean up the loop devices not released
Gui Chen [Mon, 21 Jan 2013 16:36:18 +0000 (00:36 +0800)]
clean up the loop devices not released

the pidfiles record last running info of device and
process pid, and now mic can clean these up if they
are not released for some unknown reason

Change-Id: I3b0bbd31fbcfaf7fe4c751feab6f7f9b528d64f6
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd pidfile for each used loop device
Gui Chen [Mon, 21 Jan 2013 15:48:53 +0000 (23:48 +0800)]
add pidfile for each used loop device

sometimes mic can't know if the device can be released,
and it will bump up to maxinum used number, now record
an pid file for each used device so that they can be
released when needed

Change-Id: I24308eebd8b2c10a46f2bf20cfdb70bf7f1b04a2
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocleanup also when sys loop device used
Gui Chen [Mon, 21 Jan 2013 15:25:14 +0000 (23:25 +0800)]
cleanup also when sys loop device used

some interfaces are added to make LoopDevice as
loop device manager:
register: if loop device existed, register it in
          LoopDevice, and benefit the cleanup
reg_atexit: not all loop device need this atexit,
            make it optional
now, such as 'loop0' will benefit the cleanup of
LoopDevice 'cause above interface

Change-Id: I110a1aaf0179d04a31f31f7ed54b2b75cdb6bc01
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix the failure if ks under / dir in easy way
Gui Chen [Tue, 15 Jan 2013 13:31:49 +0000 (21:31 +0800)]
fix the failure if ks under / dir in easy way

this patch is to fix the failure if ks file under / dir,
in final, mic should sync the ks file to bootstrap,
the location should be kept inside bootstrap

Change-Id: Ia93013622ffda0fa91c81aeb8f6e0e7c1d6b70cf
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoclean up the mess message of directory not empty
Gui Chen [Tue, 15 Jan 2013 13:15:11 +0000 (21:15 +0800)]
clean up the mess message of directory not empty

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agodon't setup emulator for arm image twice
Gui Chen [Sun, 13 Jan 2013 08:49:27 +0000 (16:49 +0800)]
don't setup emulator for arm image twice

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoregister arm binfmt in every time
Gui Chen [Sun, 13 Jan 2013 08:45:19 +0000 (16:45 +0800)]
register arm binfmt in every time

in bootstrap, there is only 'qemu-arm-static', so should unregister arm binfmt,
and register it for arm image in every time to avoid conflict register

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agosync /etc/passwd to save user info to bootstrap
Gui Chen [Mon, 7 Jan 2013 07:38:27 +0000 (15:38 +0800)]
sync /etc/passwd to save user info to bootstrap

for some reason, mic bootstrap would not has correct /etc/passwd,
using local /etc/passwd also works

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoverify if logfile is a file
Gui Chen [Mon, 7 Jan 2013 07:34:00 +0000 (15:34 +0800)]
verify if logfile is a file

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocorrect rpm path in local repo for zypp backend
Gui Chen [Mon, 7 Jan 2013 07:29:24 +0000 (15:29 +0800)]
correct rpm path in local repo for zypp backend

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd debuginfo rpm install option
Gui Chen [Mon, 21 Jan 2013 13:52:51 +0000 (21:52 +0800)]
add debuginfo rpm install option

make this option flexible to include 'debuginfo',
and enable '--install-pkgs=debuginfo' to work well.
later mic should add 'source' and 'debugsource' to
this option

Change-Id: I12765aeeeb5d41f9de351b617377ebe654436dac
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoinstall the according debuginfo rpms in zypp
Gui Chen [Mon, 21 Jan 2013 12:00:44 +0000 (20:00 +0800)]
install the according debuginfo rpms in zypp

normally every binary package would have one
corresponding debuginfo package, and now mic
can install those debuginfo rpm in the meantime
in zypp backend if needed

Change-Id: Id3d4dd678257d21a737632a395031b0776c3d2bc
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agorefactor try except statement in baseimager
Gui Chen [Mon, 21 Jan 2013 08:46:28 +0000 (16:46 +0800)]
refactor try except statement in baseimager

it's risky to handle the assignment in finally loop,
actually it will only cleanup pkg_manager, try to
refactor it here

Change-Id: Icae4108ce4df353389f4a92f7f2be603434a00ed
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocleanup zypp credential file to fix conflicts during installing
Gui Chen [Mon, 21 Jan 2013 07:50:39 +0000 (15:50 +0800)]
cleanup zypp credential file to fix conflicts during installing

the issue is zypp will create credential file $instroot/$home/.zypp/*.cat,
and this file only influence rpm downloading, but it cause some conflicts
issue during rpm installing for it is not owned by any package.
in this patch, it will locate the credential file to $instroot/.zypp,
then clean it up before rpm installing.

Change-Id: Ib1409b5aa57547ec8ff96ca39be07bf53894b1bf
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd vcs value for --record-pkgs to record vcs info
Gui Chen [Mon, 21 Jan 2013 02:15:48 +0000 (10:15 +0800)]
add vcs value for --record-pkgs to record vcs info

vcs info includes git tree and tag info

Change-Id: Ibe9263de569c888709e46767d08f919046324754
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agorecalculate package content recording
Gui Chen [Mon, 21 Jan 2013 02:08:01 +0000 (10:08 +0800)]
recalculate package content recording

Change-Id: I1c0e9bbf2e1c6c05d552e89f764e1082f91415f0
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix the issue that outdir/cachedir is not dir
Gui Chen [Sun, 20 Jan 2013 14:01:34 +0000 (22:01 +0800)]
fix the issue that outdir/cachedir is not dir

Change-Id: I321066964626404ca84d2d650fc7801ddf54e025
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoreformat rpm name string to be more flexible
Gui Chen [Sun, 20 Jan 2013 11:54:31 +0000 (19:54 +0800)]
reformat rpm name string to be more flexible

Change-Id: I5f735ad31ef7dd3a8c2a23eb31b6bca22aaa4f0f
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agorevert back to use device name
Gui Chen [Sun, 20 Jan 2013 07:02:02 +0000 (15:02 +0800)]
revert back to use device name

to fix some specific image can't boot by uuid,
mic revert it back, but mic will change this
configurable, then put it to some config file

Change-Id: I73a07d54ef467bf2148d4833a4372e70f68bbbc7
Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoadd a new opiton --nocache for repo command
Gui Chen [Tue, 15 Jan 2013 08:29:44 +0000 (16:29 +0800)]
add a new opiton --nocache for repo command

this option '--nocache' in repo command is used
to disable using cached rpm in this repo

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agosplit out the download stuff as one python module
Gui Chen [Tue, 15 Jan 2013 08:05:06 +0000 (16:05 +0800)]
split out the download stuff as one python module

mix the download code into rpmmisc is mess,
try to make it stand alone, now the download
stuff like myurlgrabb, TextProcess can be
treated in one owned module

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoremove moblin stuff from mic code
Gui Chen [Tue, 15 Jan 2013 07:27:24 +0000 (15:27 +0800)]
remove moblin stuff from mic code

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agocompatible with old style if 'release' specified
Gui Chen [Tue, 15 Jan 2013 06:41:33 +0000 (14:41 +0800)]
compatible with old style if 'release' specified

when '--release=tizen-2013' is specified, mic shouldn't
append the original suffix, to be compatible with old
style, build_name will replace suffix with release

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agouse build_name to genarate image name
Gui Chen [Tue, 15 Jan 2013 06:33:13 +0000 (14:33 +0800)]
use build_name to genarate image name

consider prefix and suffix, mic should use build_name
to genarate the name of image

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoraw.py: implement booting by partition UUID
Artem Bityutskiy [Tue, 8 Jan 2013 13:53:24 +0000 (15:53 +0200)]
raw.py: implement booting by partition UUID

If the partition typ is "gpt", specify the rootfs by partition UUID instead of
the device node. This will allow to be device-node-independent.

Change-Id: I534036d2a38a072a73ac2994f5753425d60ab8a1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: implement 'get_partuuid()' method
Artem Bityutskiy [Tue, 8 Jan 2013 13:49:56 +0000 (15:49 +0200)]
partitionedfs: implement 'get_partuuid()' method

Implement a method for getting the partition UUID for a mapped partition.
We will use it for mounting by partition UUID a bit later.

Change-Id: Iaf497c34eaf84e8e25dd5019a99d76f3674744cd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: kill rootdev and prefix
Artem Bityutskiy [Tue, 8 Jan 2013 13:11:30 +0000 (15:11 +0200)]
raw.py: kill rootdev and prefix

Similarly, kill the 'rootdev' and 'prefix' values returned by
'_get_syslinux_boot_config()' - they are not used. This cleans up things a bit
further.

Change-Id: I164c46d5a17ebdd2404f5da1ff883ec9d79cfffc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: kill bootdevnum
Artem Bityutskiy [Tue, 8 Jan 2013 13:07:47 +0000 (15:07 +0200)]
raw.py: kill bootdevnum

The _get_syslinux_boot_config() function returns bootdevnum which is not really
needed, because it is not used. There is only one usage - an exception error
string, but this usage is incorrect anywere, because it prints incorrect
loopback name anyway.

So kill it, and make the code a little bit cleaner. We have enough mess there.

Change-Id: Ia6fff77205389e77ce1dac55ab044f7410bcf347
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: detect the boot partition properly
Artem Bityutskiy [Tue, 8 Jan 2013 12:43:21 +0000 (14:43 +0200)]
raw.py: detect the boot partition properly

Remove a hack of detecting the boot partition by mount point. We have a special
key for marking the boot partition.

Change-Id: I05f62cc33a72cc87ad95f45cdb79a8a611cf53de

11 years agoraw.py: fix strange "bug"
Artem Bityutskiy [Tue, 8 Jan 2013 12:50:43 +0000 (14:50 +0200)]
raw.py: fix strange "bug"

The entire file kind of assumes that there may be several disks. And this is
why we have a lot of complexity in raw.py and partitionedfs.py.

But if we look at _install_syslinux(), we have a nonesense loop at the
beginning. Obviously, the entire function has to be in this loop, otherwise it
makes zero sense, right?

Change-Id: I2e6825ca475b4e1c34128361b9c4cc97159379da
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: enable GPT support
Artem Bityutskiy [Mon, 7 Jan 2013 10:12:41 +0000 (12:12 +0200)]
partitionedfs: enable GPT support

This adds finally GPT support. It works, and Tizen IVI images with GPT
partition table boot fine.

We now need is to use 'root=PARTUUID=<uuid>' in syslinux.conf to boot by
UUID - will be added later as well.

Change-Id: Icfe938e72b96c4092131039a120d6095b3acbbd4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agokickstart: add --ptable option
Artem Bityutskiy [Thu, 10 Jan 2013 11:41:41 +0000 (13:41 +0200)]
kickstart: add --ptable option

This patch adds a --ptable option to the 'bootloader' command of the KS file,
as suggested by Guy Chen. The default partition table format is "msdos". We are
going to support the "gpt" format soon. Usage:

bootloader --timeout=blah --append=blah --ptable=blah

Change-Id: I02772df92a8e883ac3450b5b947789bca19be037
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: remove redundant code
Artem Bityutskiy [Mon, 7 Jan 2013 11:16:59 +0000 (13:16 +0200)]
raw.py: remove redundant code

Remove code from raw.py which sets the 'bootable' flag to the boot partition,
because it is redundant.

partitionedfs.py it the file where everything concerning partitions has to be
done. And there is code which sets the 'boot' flag to the boot partition. We
just need to use the '--active' option for that partition in the ks file.

Change-Id: I17fd4e6e8785b8c6b1a48a7af1a2335a056b4d98
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: a preparation and nicification
Artem Bityutskiy [Fri, 4 Jan 2013 14:25:15 +0000 (16:25 +0200)]
partitionedfs: a preparation and nicification

Prepare for further changes and refactor the code a bit: separate the parted
running functionality to the '__run_parted()' function.

Do some nicifications in '__create_partition()' to improve readability.

Move the '__create_partition()' and '__run_parted()' functions down so that
they go just before 'format_disk()', which is more logical.

Remove a lot of redundant code by moving the error checking to
'__run_parted()'.

Change-Id: If9697cd2ede6f8b3f07289aa8e8ac391ea882cf2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: rename self.__create_part_to_image
Artem Bityutskiy [Fri, 4 Jan 2013 14:17:21 +0000 (16:17 +0200)]
partitionedfs: rename self.__create_part_to_image

The 'self.__create_part_to_image()' is too long and not too descriptive either.
Let's name it '__create_partition()' instead.

Change-Id: I556c8dd872b1fd79d8c44fac0ca5130ae1521bc8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: add partial GPT support
Artem Bityutskiy [Fri, 4 Jan 2013 13:53:10 +0000 (15:53 +0200)]
partitionedfs: add partial GPT support

This commit partially adds GPT partitions support. Further patches will add
full support. I split them to make the patches more reviewable.

This patch basically implements most of the things except of actually asking
parted to use GPT partitioning.

This patch introduces another 'layout_partitions()' parameter which defines the
partition table format. It now may be 'msdos' or 'gpt'.

Change-Id: I210bacc629b938d307a1e4d209c90d4400a42daa
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: make the interface a bit saner
Artem Bityutskiy [Fri, 4 Jan 2013 13:41:08 +0000 (15:41 +0200)]
partitionedfs: make the interface a bit saner

We have 'add_partition()' call to add one partion, but we have 'add_disks()'
method to add all disks at once. This is inconsistent and makes the code more
difficult to understand. Fix this by changind 'add_disks()' into 'add_disk()'
which adds a single disk. This makes things look a lot nicer.

Change-Id: I8a4f4249b1f8fa02486d4cbb3fbc4226ca2e65b8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs.py: improve readability some more
Artem Bityutskiy [Fri, 4 Jan 2013 13:32:46 +0000 (15:32 +0200)]
partitionedfs.py: improve readability some more

Add a comment to 'add_partition()'. Also convert all the non-docstring comments
to the normal '#' style to make the code consistent.

Change-Id: I772d08f20d434b7bb4f4725410622da5ac9d2fb6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: rename MBR_SECTOR_LEN
Artem Bityutskiy [Fri, 4 Jan 2013 13:10:49 +0000 (15:10 +0200)]
partitionedfs: rename MBR_SECTOR_LEN

The 'MBR_SECTOR_LEN' name becomes not very appropriate when we add GPT
partitions, which have a lot larger overhead comparing to MBR partitions. We'll
need to introduce another constant. Let's use the 'MBR_OVERHEAD' instead, and
later we'll introduce a 'GPT_OVERHEAD' variable.

Change-Id: Iedf9338b58eed3b4b4b149ba9f30acf5369500c7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoparitionedfs: improve readability
Artem Bityutskiy [Fri, 4 Jan 2013 13:01:52 +0000 (15:01 +0200)]
paritionedfs: improve readability

Rename the 'disk' key in parition and subvolume dictionaries into 'disk_name',
because it is really a disk name string. Old name is very confusing because
the disks dictionary also has a 'disk' key which points to a real disk object.
I was many times confused by this when I was trying to understand the code, and
now it is time to clean the mess up a bit.

Change-Id: I58526ce719f831051924498550df5de9b3ebd737
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: fix the mbr_sector_skipped hack
Artem Bityutskiy [Fri, 4 Jan 2013 12:35:25 +0000 (14:35 +0200)]
partitionedfs: fix the mbr_sector_skipped hack

The entire PartitionedMount class assumes there may be more than one disk. And
the 'mbr_sector_skipped' hack is wrong because it assumes there is only one
disk and we need to skip only once, which is incorrect.

This patch fixes the issue. And it actually makes things nicer as well.

Change-Id: Icb399cfa488786ce6668ffaa21146f01a3e15a08
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: clean-up some mess
Artem Bityutskiy [Fri, 4 Jan 2013 12:26:18 +0000 (14:26 +0200)]
partitionedfs: clean-up some mess

This is a clean-up patch. It cleans up the code around alignment and makes it
both shorter and more readable. No functinal changes, just using better
constructs and removing useless operations.

Change-Id: I9655239168101ca491ac60b3a16798dedef12841
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw.py: kill get_diskinfo()
Artem Bityutskiy [Fri, 4 Jan 2013 12:04:20 +0000 (14:04 +0200)]
raw.py: kill get_diskinfo()

We do not need this function anymore. The only thing we need is to get disk
names. So instead, introduce a 'get_disk_names()' method which simply returns a
list of disk names.

This is a clean-up.

Change-Id: I5145ab0fe3f36c9ac5fef6bb82b53a29f51eb5b0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoraw: fix image size with --align
Artem Bityutskiy [Fri, 4 Jan 2013 11:41:15 +0000 (13:41 +0200)]
raw: fix image size with --align

Finally, with the preparation patches we did, we can fix the --align problem
and fix bug #624.

The issue is: with --align the image size becomes too large and there are
unused blocks at the end.

Now we can use correct image size calculated by partitionedfs.py.

Change-Id: I59e19281934b9557cdb960a7228d81f463f37786
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: calculate minimum disk sizes
Artem Bityutskiy [Fri, 4 Jan 2013 10:54:36 +0000 (12:54 +0200)]
partitionedfs: calculate minimum disk sizes

Now we can calculate minimum disk sizes in layout_partitions(). Introduce
'min_size' key to the disks dictionary for this.

Change-Id: I23161ff2461111f323dcd30ef6d1cb744098a6a7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: separate out partitions placing
Artem Bityutskiy [Fri, 4 Jan 2013 10:29:16 +0000 (12:29 +0200)]
partitionedfs: separate out partitions placing

Create a new method which lays out (or places) partitions to the disks. It will
make it possible to find out disk size before creating a disk. Indeed, this
function places all partitions, so the end of the last partition is the size of
the disk. So the user will have to be able to do this:

1. Add all partitions
2. Layout partitions
3. Get the disk size
4. Create the disk
5. Add the disk and format/mount it

And no more buggy heuristics for disk size are needed.

Change-Id: Ib6edf5e57d3d03f4a84d3f46eefad7d25bc793ec
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: add disks while adding partitions
Artem Bityutskiy [Fri, 4 Jan 2013 09:02:16 +0000 (11:02 +0200)]
partitionedfs: add disks while adding partitions

The PartitionedMount class used to work as follows:

1. The user adds all partitions using 'add_partition()'. We create an internal
   list of partitions.
2. User adds all disks using 'add_disks()'. We create an internal list of
   disks. Additionally, 'add_disks()' provides the real disk object.

The problem with this is that in order to create the real disk object, we need
to know its size. But it is difficult to calculate it when complex options like
--align are used.

The real calculations happen in the '__format_disks()' method of
PartitionedMount.

What I want to do is to make things work this way:

1. The user adds all the partitions.
2. The user asks what disk size is required.
3. The user creates disk objects of the right size and adds them.

In order to achieve it, I need to separate out the partitions positioning from
the '_format_disks()' function, and do this before the user adds the disks.

However, the positioning code assumes we already have the internal disks
dictionaries (self.disks). But current code creates those dictionaries only in
'add_disks()', which is too late for our purposes.

This patch basically makes the inderal disks dictionaries while adding the
partitions, because the partition already contains the disk name (internal
target physical name). So we can create the disk dictionaries right away.

The only missing thing will be the host disk objects, which are added by
'add_disks()' later on.

Change-Id: Ie8245c8b61c941165aea3a583826a2896f4c85d9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitionedfs: introduce add_disks() method
Artem Bityutskiy [Thu, 3 Jan 2013 11:15:22 +0000 (13:15 +0200)]
partitionedfs: introduce add_disks() method

The 'PartitionedMount()' class has an 'add_partition()' method for adding a
partition. Introduce a simialr 'add_disks()' method of adding disks.

Currently the disks are added by the constructor and this is very inflexible.
Indeed, to add a disk, wee need know first create it. To create it - we need to
know its size. To find out its size, we need to sum up all the partition sizes,
take into account the alignment, the MBR size and so on. IOW, do complex
calculations.

This is a preparation for further changes where the disk size calculation will
be done by 'PartitionedMount()' instead. It will tell us the disk size, and
we'll add the disk after adding partitions.

The final goal is to fix the --align bug - when --align is used, the generated
raw disk size is larger than needed - it has unused space at the end.

In this patch we also amend all the users of PartitionedMount to comply to
the new interface.

Change-Id: I0cacfb64410c7b2da634642fbf57d5b4be28acad
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoMerge "baseimager.py: rename MANIFEST to MD5SUMS" into devel
Gui Chen [Thu, 10 Jan 2013 11:12:13 +0000 (03:12 -0800)]
Merge "baseimager.py: rename MANIFEST to MD5SUMS" into devel

11 years agoraw.py: switch to the BmapCreate module
Artem Bityutskiy [Thu, 22 Nov 2012 15:41:39 +0000 (17:41 +0200)]
raw.py: switch to the BmapCreate module

The bmaptools project now has a nice 'BmapCreate' API module, which contains
all the bmap creation functionality, gets improved and bug-fixed, as well as
tested.

Already now it is better then the old mic implementation because it uses the
FIEMAP ioctl instead of FIBMAP, and FIEMAP does not require root.

In order to get all the goodies of the library and avoid code duplication
and double maintanace efforts - switch to the BmapCreate library and kill
own bmap implementation.

Change-Id: Ie5b591fd1125dcff3fb82118a6e3604961e9c301
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agomake syslinux sel menu color usable
Anas Nashif [Fri, 21 Dec 2012 05:53:57 +0000 (21:53 -0800)]
make syslinux sel menu color usable

The selection color is the same as the background, which makes it
invisible, this sets the color to the inverse

11 years agobaseimager.py: rename MANIFEST to MD5SUMS
Artem Bityutskiy [Fri, 28 Dec 2012 08:28:22 +0000 (10:28 +0200)]
baseimager.py: rename MANIFEST to MD5SUMS

The name "MANIFEST" is not very good for multiple reasons:

1. It is not user-friendly - mere users do cannot tell what this file is from
   its name.
2. Tizen is currently the most important user of MIC, and in Tizen we use word
   "manifest" for a different thing - every package has a security manifest
   file which declares the needs of the package.
3. MIC stores checksums in the MANIFEST, and this file is compatible with the
   'md5sum' tool. If we decide to provide sha1 checksums in the future, we'll
   have to add another file with a different name. What will that name be?

Anyway, it is nicer and cleaner to use the same naming scheme as OpenSuse and
Ubuntu use. They have MD5SUMS and SHA1SUMS files.

Let's make things more aligned and cleaner and rename MANIFEST into MD5SUMS.

This may break some scripts some people use. But I think it is anyway a low
risk thing, and it is better to rename now, when Tizen has few users. It may be
more difficult to do later.

Change-Id: I79f968066aa27bd211622f477b27a1973b3775ad
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoupdate dist files and tests to enable unittest
Gui Chen [Sun, 6 Jan 2013 02:36:53 +0000 (10:36 +0800)]
update dist files and tests to enable unittest

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agokeep only unittest
Gui Chen [Thu, 20 Dec 2012 07:25:04 +0000 (15:25 +0800)]
keep only unittest

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agoupdate documentation
Gui Chen [Thu, 20 Dec 2012 06:00:43 +0000 (14:00 +0800)]
update documentation

12 years agoput arch compatible into pkg comparison
Gui Chen [Tue, 18 Dec 2012 06:55:18 +0000 (14:55 +0800)]
put arch compatible into pkg comparison

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agoMerge branch 'release-0.15' into devel
Gui Chen [Wed, 19 Dec 2012 06:42:48 +0000 (14:42 +0800)]
Merge branch 'release-0.15' into devel

Conflicts:
etc/bootstrap.conf
mic/bootstrap.py
mic/creator.py
mic/imager/raw.py
mic/msger.py
mic/utils/misc.py
setup.py

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agofix type error when calling mknod
lihuanhuan [Mon, 17 Dec 2012 20:34:28 +0000 (15:34 -0500)]
fix type error when calling mknod

subprocess requires string only for command args

Change-Id: I32442ea6a0d28a40fea55a2ffcf9d43579d1c6da

12 years agobump up to release 0.15 0.15
Gui Chen [Wed, 12 Dec 2012 08:08:19 +0000 (16:08 +0800)]
bump up to release 0.15

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agoSparseLoopbackDisk: fix sparse file creation
Artem Bityutskiy [Wed, 14 Nov 2012 12:46:30 +0000 (14:46 +0200)]
SparseLoopbackDisk: fix sparse file creation

The SparseLoopbackDisk class created sparse file a bit incorrecly.

First of all, it created a sparse file of wrong size - one byte more than
asked.  Indeed, look at Tizen images, they are of size '2717908993', which is
2.5GiB + 1 byte.

Second of all, the file was not as sparse as it could be - because of the write
to the end, the last block was mapped.

Change this to just use 'ftruncate()' to the right size, which does the trick.

Change-Id: If76d27515d5483e29a76a15f128ff8737872d57b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
12 years agoremove rpmdb files before install packages
Gui Chen [Tue, 11 Dec 2012 07:50:32 +0000 (15:50 +0800)]
remove rpmdb files before install packages

this rpmdb files will avoid the installing

Signed-off-by: Gui Chen <gui.chen@intel.com>
12 years agobump up to 0.15-rc5
Gui Chen [Sun, 9 Dec 2012 07:36:49 +0000 (15:36 +0800)]
bump up to 0.15-rc5

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