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>
fix no key 'HOME' in environ variable failure

Signed-off-by: Gui Chen <gui.chen@intel.com>
remove suffix when release specified

Signed-off-by: Gui Chen <gui.chen@intel.com>
roll back to original naming for release

Signed-off-by: Gui Chen <gui.chen@intel.com>
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>
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
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
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>
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>
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>
paritionedfs: remove the 'extended' key from disk dictionary

The 'extended' key holds the size of the extended partition, and it is only
used once when we create the extended partition. However, we do not really need
this becase we can easily calculate the extended partition size, because we
know the start of the first logical partition and the disk size. Having this
'extended' key only complicates the code unnecessarily.

Change-Id: I58e61e219890339fae63eeb5bdf9f2002401cb72
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
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
Merge "partitionedfs: remove bogus alignment check" into devel
Merge "partitionedfs: improve debugging prints" into devel
Merge "partitionedfs: simplify the code a tiny bit" into devel
Merge "paritionedfs: remove the 'extended' key from disk dictionary" into devel
Fix bad indents

Change-Id: I4bd330957aeaeaae8367aafdeffd2f511d479077
paritionedfs: partially fix extended paritions support

Currently MIC is unable to create more than 3 partitions, because the
logical/extended paritions support is broken. This is because the EBR is not
taken into account, so parted fails to create logical partitions. EBR stands
for "Extended Boot Record" and this ia basically a single sector which prepends
every logical parition.

This patch fixes the issue. We take one sector from each partition starting
from the 3rd one (the last primary parition), and this sector will be used by
parted for the EBR. This works nicely and partitions stay aligned correctly for
the best performance.

Change-Id: I678c52f24750388ffdc09c32939541ba3f3e8b8f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
paritionedfs: do not create extended parition in case of GPT

Change-Id: Ibd2ae31c7e0ed630dd7e392995a21ff90442cc6a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
partitionedfs: fix extended partitions support

When we use th elegacy MBR paritions and have more than 3 paritions, MIC
creates and extended parition and which allows us to create 4 more logical
paritions. However, this functionality was broken. It was partially fixed in
the previous commit, and this is the final fix.

The problem is that kpartx maps the extended partirion (sometimes, depending on
the version), and MIC tries to use it and fails. Instead, MIC should just skip
the extended parition. This patch adds the corresponding check.

With this fix we can create images with many paritions, and both MBR and GPT
paritions work.

Change-Id: Iabf17c6407942eec7a7051bff52ebf427aa4f3a1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>