tools/bmap-tools.git
10 years agoTODO: remove an irrelevant item
Artem Bityutskiy [Fri, 31 Jan 2014 10:44:37 +0000 (12:44 +0200)]
TODO: remove an irrelevant item

We re-wrote the decompressing code and this item became irrelevant.

Change-Id: I29dffc3c3c545f4727c0fa29f2c38ae7435a0a70
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoman: write about new supported compressors
Artem Bityutskiy [Thu, 30 Jan 2014 08:23:38 +0000 (10:23 +0200)]
man: write about new supported compressors

And re-structure the text a bit to make it more readable.

Change-Id: I487de9c9e651b6bd4c4010c73271fd561458b288
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRELEASE_NOTES: write 3.2 release notes some more
Artem Bityutskiy [Thu, 30 Jan 2014 07:42:23 +0000 (09:42 +0200)]
RELEASE_NOTES: write 3.2 release notes some more

Tell about new compressors support, re-structure, make the text nicer.

Change-Id: I363b8205d3dbfefd514a9e9b8d5e1e5e2cb408d1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: cosmetic imports re-arranging
Artem Bityutskiy [Thu, 30 Jan 2014 07:05:37 +0000 (09:05 +0200)]
tests: cosmetic imports re-arranging

Just arrange the imports at the beginning of the files so that they would look
the same in all the tests. Just for consistency.

Change-Id: I6d8044f01a100075271bef3e737bb67daf90340f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use external programs for compression
Artem Bityutskiy [Wed, 29 Jan 2014 17:05:06 +0000 (19:05 +0200)]
test_api_base: use external programs for compression

Stop using internal python modules for compressing test files, and just like we
did in the previous commit, use external programs for this.

Change-Id: I75dd6461d598d1d4b0b4096b65d74f08c44adc75
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: re-write decompress logic
Artem Bityutskiy [Wed, 29 Jan 2014 11:39:02 +0000 (13:39 +0200)]
TransRead: re-write decompress logic

This is a relatively big change which completerly re-writes the decompression
logic of this module. I did not split this change on many smaller changes,
since this is difficult to do, and I am trying to optimize my time usage. Yes,
bad explanation, but honest :-) But the diff is not that big anyway!

At the moment, TransRead tries to use various python tools for decompressing:
the 'bz2', 'tarfile', and 'zlib' modules. For 'xz', we are using the 'lzma'
module from backports, which is not present everywhere, e.g., OpenSuse does not
have it.

This worked relatively well, until I got these bug-reports and requrests:
Out-of-memory failure: https://bugs.tizen.org/jira/browse/TIVI-2388
pbzip2 support request: https://bugs.tizen.org/jira/browse/DEVT-141
lzo support request: https://bugs.tizen.org/jira/browse/DEVT-140

The first is very difficult to fix. We already pass only 128 bytes of data to
the bz2 decompressor. Makin it smaller would probably help, but would probably
fail on a system with even less memory. I tried to handle the MemoryError
exceptions, but the bz2 decompressor objects becomes unusable after the
MemoryError exception.

Then pbzip2 - the standard python 2.x 'bz2' library just does not support
multiple streams. I tried to use the 'bz2file' backport from python 3.x, but it
is really not very user-friendly, since users need to install it from PyPI.

Then 'lzo' support is absent in python 2.x. There is the 'python-lzo' package
in some distros providing the lzo functionality, but it is again, not available
in OpenSuse.

So I figured that this is too much of the trubles and tried to dump all the
decompression cruft and just use the standard Linux tools for that: bzip2,
gzip, xz, lzop, and tar. Just piple the data from the input file to the
decompressor program's stdin, and read the uncompressed data from its stdout.
And this worked perfectly. And became faster. And the out-of-memory problems
seemed to go away. And both pbzip2 and lzo became supported. And the amount of
code became less.

So I've just decided to go this way and this patch does exactly that.

This patch also adds several standard, but rarely used extensions: .tbz2, .tbz,
.tb2, and .txz, as aliases for 'tar.bz2' and 'tar.xz'.

Change-Id: I1bd1ae8a853744c3098189c08a9802e118a50580
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: add compressors dependencies
Artem Bityutskiy [Thu, 30 Jan 2014 07:58:10 +0000 (09:58 +0200)]
packaging: add compressors dependencies

Add a bunch of dependencies: bzip2, gzip, tar, lzo, xz, pbzip2, pigz. This is a
preparation to the next change where we'll re-write the TransRead module and
start using external tools for decompression.

Change-Id: I8815942ff44fd6ed9c8d60bc62b1cdfd1e1988c7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: use a 1M buffer size for the ssh pipe
Artem Bityutskiy [Wed, 29 Jan 2014 15:59:42 +0000 (17:59 +0200)]
TransRead: use a 1M buffer size for the ssh pipe

Set buffer size for the SSH pipe to be 1M. Frankly, I am not 100% sure if this
matters, it looks like it makes reading the file over ssh a bit faster.

Change-Id: If91f6589db2e80af4bd6afc994ad1553a1109b3e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapHelpers: add program_is_available
Artem Bityutskiy [Wed, 29 Jan 2014 08:51:20 +0000 (10:51 +0200)]
BmapHelpers: add program_is_available

This patch adds the 'program_is_available()' helper function which checks if an
external program is available in the PATH. Also make TransRead use this helper.

Change-Id: Ied8c8b39e7c382bc57fd47b2120e47c7022b6e23
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: do not seek TransRead objects back
Artem Bityutskiy [Wed, 29 Jan 2014 15:22:03 +0000 (17:22 +0200)]
test_api_base: do not seek TransRead objects back

The TransRead objects are not suppoesed to be seek'ed back. This happen to work
for non-compressed files, but would fail for compressed files.

Change-Id: Ife9a04e5467cec63c311b67c3b41d98d22a7529b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: remove unused import
Artem Bityutskiy [Tue, 28 Jan 2014 16:23:27 +0000 (18:23 +0200)]
test_api_base: remove unused import

Pylint noticed this:
W: 33, 0: Unused import random (unused-import)

Change-Id: Id7d8c5f64d2454a7c3ce077413e426f179b09ef3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: rename a couple of test classes
Artem Bityutskiy [Tue, 28 Jan 2014 15:54:59 +0000 (17:54 +0200)]
tests: rename a couple of test classes

This is a cosmetic change.

Most of the tests were started by copying the 'test_api_base', and the main
class was not re-named from 'TestCreateCopy' to something else. Let's do this
now.

Change-Id: Iba87c5094cbb8d217682e5c89df1f2441d2b70bc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoman page: mention SEEK_HOLE
Artem Bityutskiy [Tue, 28 Jan 2014 12:38:45 +0000 (14:38 +0200)]
man page: mention SEEK_HOLE

Mention that we fall-back to SEEK_HOLE when FIEMAP is not supported.

Change-Id: I3aec79f214982e6f4aec0f9900f26231a26c665f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRELEASE_NOTES: write about pbzip2 support
Artem Bityutskiy [Tue, 28 Jan 2014 12:36:07 +0000 (14:36 +0200)]
RELEASE_NOTES: write about pbzip2 support

Change-Id: I4ff61ce88356e2e1d83da2834a9e8b175a4d7774
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: handle TransRead errors
Artem Bityutskiy [Tue, 28 Jan 2014 12:10:14 +0000 (14:10 +0200)]
bmaptool: handle TransRead errors

Catch both BmapCopy and TransRead module errors since they all contain
a user-friendly error message.

Change-Id: If8acb95abba1f3edd178674da152d09b63ed6819
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: provide user-friendly error message for pbzip2
Artem Bityutskiy [Tue, 28 Jan 2014 12:05:40 +0000 (14:05 +0200)]
TransRead: provide user-friendly error message for pbzip2

If the bz2 file is a multi-stream archive and the 'bz2file' library was not
found, we cannot read the file and just fail with a scary traceback. This patch
adds a nice user-friendly message which suggests what to do in this case.

Change-Id: I41971a58fbe9712162b3ffb294c6f5e0272f34b9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: add pbzip2 support
Artem Bityutskiy [Tue, 28 Jan 2014 11:17:34 +0000 (13:17 +0200)]
TransRead: add pbzip2 support

This patch adds support for multi-stream bz2 files (creted with pbzip2).
Unfortunately, the standard python 2.7 'bz2' module does not support it, so we
use the 'bz2file' module from PyPI.

'bz2file' may not be present in the system, in which case we fall-back to the
standard python 2.7 'bz2' module. As a bonus, 'bz2file' is a little bit faster
than 'bz2' even for single-stream archives.

Change-Id: I7b473987a3bda0241f49da5bbdf1a8a2b3841400
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: remove useless check
Artem Bityutskiy [Tue, 28 Jan 2014 11:15:09 +0000 (13:15 +0200)]
TransRead: remove useless check

The _CompressedFile class is designed to work with compressed files, and it
makes no sense to use it for uncompress files. So let's assume that the
decompression function is always present and remove the useless
"if self._decompress_func" check.

Change-Id: Ie427f1507801525f29efd103dfd4cfdf76291b7e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: remove code duplication
Artem Bityutskiy [Tue, 28 Jan 2014 11:05:09 +0000 (13:05 +0200)]
TransRead: remove code duplication

We had some amount of duplicated code related to opening a tar file - introduce
a '_open_tarfile()' helper function for this instead.

On top of this, stop using 'tarfile' modules for opening 'tar.gz' and 'tar.bz2'
files since for some reasons this is a lot slower than using the
'_CompressedFile' module, like we do for 'tar.xz' files.

Change-Id: I1c35cff9056c555df7e7391da0b0213a016a9e45
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: assume that bmap and asc files are not compressed
Artem Bityutskiy [Mon, 27 Jan 2014 15:20:57 +0000 (17:20 +0200)]
bmaptool: assume that bmap and asc files are not compressed

Remove useless 'is_compressed' check for bmap and asc files which are never
compressed, since compression is currently detected by file extention, so .bmap
and .asc extentions always correspond to an uncompressed file.

Change-Id: I93e743bc760f0f37d6fcee8bc079eade532708f1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: store compression type name
Artem Bityutskiy [Mon, 27 Jan 2014 15:02:51 +0000 (17:02 +0200)]
TransRead: store compression type name

Introduce an 'compression_type' attribute and store the compression format
there. This will be needed in the next patches, where we will add 'pbzip2'
support. Also, remove the 'is_compressed' attribute sinc this is the same as
'compression_type == "none"'.

Change-Id: I02dfd8efb14e5868d9b413c08b14ca8f513773f8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: catch exception from the Filemap module
Artem Bityutskiy [Wed, 22 Jan 2014 10:12:15 +0000 (12:12 +0200)]
BmapCreate: catch exception from the Filemap module

The 'Filemap' module can raise exceptions in case of errors. Let's catch them
and re-raise as 'BmapCreate.Error' exceptions. This will make 'bmaptool' catch
them too and print a nice error message.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
10 years agoRELEASE_NOTES: start release notes for v3.2
Artem Bityutskiy [Wed, 22 Jan 2014 07:35:19 +0000 (09:35 +0200)]
RELEASE_NOTES: start release notes for v3.2

Starte preparing bmapt-tools-3.2 release notes and describe the tmpfs and
SEEK_HOLE support there.

Change-Id: Iba0b8c3d784c55dc566985983a5c44ebd9fc7f64
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: move _lseek out of the class
Artem Bityutskiy [Wed, 22 Jan 2014 07:24:44 +0000 (09:24 +0200)]
Filemap: move _lseek out of the class

Pylint suggested that the 'FilemapSeek._lseek()' would better be an independent
function. Let's do this and move it out of the FilemapSeek class.

Change-Id: Ifeb582a0e1f4c719d29f8a27794649fbc61678c9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: fix and tidy-up bmap file formatting
Artem Bityutskiy [Tue, 21 Jan 2014 15:02:44 +0000 (17:02 +0200)]
BmapCreate: fix and tidy-up bmap file formatting

We generated bogus commentary for files with zero mapped block:

<!-- Count of mapped blocks: 0 bytes or 0.0%0.0    -->
        <MappedBlocksCount> 0   </MappedBlocksCount>

and this patch fixes it. On top of this, we put too many white-spaces
in the <MappedBlocksCount> because we used wrong variable to calculate
the maximum amount of spaces. Fix this as well.

Change-Id: Icf80b1b8cdba7785755890f066824bb3abb42e0a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: add debugging facility
Artem Bityutskiy [Tue, 21 Jan 2014 12:25:08 +0000 (14:25 +0200)]
Filemap: add debugging facility

Add the 'log' parameter to the Filemap* classes to allow passing the logger
object where the debugging prints will go. This is similar to what we have in
the BmapCopy module. Also add the same parameter to 'BmapCreate' and make sure
that 'bmaptool' passes its logger to 'BmapCreate', which then passes it to
'Filemap*' objects, where we use it for debugging.

This makes sure that '--debug' triggers debugging messages from 'Filemap*'
ojects.

Change-Id: Idc9686edc4809856720481f79e37887d29a8b0df
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoMake all classes to be of new style
Artem Bityutskiy [Mon, 20 Jan 2014 07:37:30 +0000 (09:37 +0200)]
Make all classes to be of new style

Pylint nowadays prints something like this when it sees old-style classes:

C: 41, 0: Old-style class defined. (old-style-class)

Let's fix it globally by making all our classes to be of new style.

Change-Id: If9cd20bc85247a50aac140575b3e7b6d51a9a564
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: remove the SEEK_HOLE entry
Artem Bityutskiy [Sun, 19 Jan 2014 14:59:10 +0000 (16:59 +0200)]
TODO: remove the SEEK_HOLE entry

because it is done.

Change-Id: I0baec33c52a6e1494280e9fabcddaf660a86f3e4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: amend commentaries
Artem Bityutskiy [Sun, 19 Jan 2014 14:57:02 +0000 (16:57 +0200)]
tests: amend commentaries

Now we do support tmpfs, since we have the FiemapSeek class which works on
tmpfs, so correct commentaries.

Change-Id: I29f348a2f93746120112a80878379a62a13f634d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_filemap: improve the test
Artem Bityutskiy [Sun, 19 Jan 2014 14:51:34 +0000 (16:51 +0200)]
test_filemap: improve the test

The test did not cover the 'block_is_mapped()' and 'block_is_unmapped()'
methods of the Filemap module - improve this. Also, test both 'FilemapFiemap'
and 'FilemapSeek' classes.

On top of this, do not fail if the kernel of the file-system does not support
FIEMAP or SEEK_HOLE.

Change-Id: Iaa81f60e93084b5ada489b9fbbcf65568563335e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: implement ugly heuristics for SEEK_HOLE
Artem Bityutskiy [Mon, 20 Jan 2014 14:55:49 +0000 (16:55 +0200)]
Filemap: implement ugly heuristics for SEEK_HOLE

Old kernels do not have real SEEK_HOLE support, but instead, provide a stub
implementation which just returns EOF. And there seem to be no easy way to find
out whether the implementation is real or fake. But we need to know this,
because it is crucial for use since we won't get the block map with fake
SEEK_HOLE implementation.

This patch implements an ugly test which appends a hole to the image file,
tests whether SEEK_HOLE is fake or not, and then truncats the image file back
to the original size.

Change-Id: Ib5744d5247aa0cda02517afe7189059cc5efeb9b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: distinguish the "not supported" error
Artem Bityutskiy [Mon, 20 Jan 2014 13:47:41 +0000 (15:47 +0200)]
Filemap: distinguish the "not supported" error

Introduce a new exception type (ErrorNotSupp) in order to distinguish the
situation when FIEMAP or SEEK_HOLE is not supported by the system.

Change-Id: I61a8ec24a1f88d5adccbc449eb3ac2d2fd80163b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: implement the FilemapSeek class
Artem Bityutskiy [Sat, 18 Jan 2014 13:46:03 +0000 (15:46 +0200)]
Filemap: implement the FilemapSeek class

Change-Id: Idf8bf086ead16affede86a1839f29536b8e90bbd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: introduce a FilemapSeek class
Artem Bityutskiy [Sat, 18 Jan 2014 12:30:26 +0000 (14:30 +0200)]
Filemap: introduce a FilemapSeek class

This patch introduce a so far dummy FilemapSeek class which sill be an
alternative to FilemapFiemap. It also introduces the 'Filemap' function which
automatically selects which class will be used for getting block map. The
FIEMAP method is preferred as it is supposedly faster (at least for large
enough files).

This patch also converts all places where we creant an instance of 'Fiemap'
class to use the 'Filemap' function.

Change-Id: Ic0fcb060b5262e0314582ef3b6dc5f464e4c39a5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: introduce base class
Artem Bityutskiy [Thu, 16 Jan 2014 16:17:05 +0000 (18:17 +0200)]
Filemap: introduce base class

We are going to introduce another class which uses the 'SEEK_HOLE' mechanism
for getting file block map, and some of the 'class Fiemap' functionality is
going to be the same in both. Let's separate that common functionality into a
separate '_FilemapBase' class which other classes will inherit.

The '_FilemapBase' class also defines the methods child classes have to
implement and documents them.

Change-Id: Ie1e05f96c1d8d9c77913b613940dc7e2e7971359
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: simplify the FIEMAP failure error path
Artem Bityutskiy [Thu, 16 Jan 2014 11:45:35 +0000 (13:45 +0200)]
Filemap: simplify the FIEMAP failure error path

Simplify the FIEMAP ioctl error handling by removing the 'looks like your
kernel does not support FIEMAP' note. I've recently got a bug report from the
field where people hit this error, and that line not was not actually appended
to the error message because the error code was something like ENOTSUPP. And
the error was anyway very clear and readable.

So let's just remove that part and simplify the code.

Change-Id: Ib098c814d70980bdcb60402eafd213c08f8c9dbd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFilemap: remove useless constants and a parameter
Artem Bityutskiy [Thu, 16 Jan 2014 11:22:07 +0000 (13:22 +0200)]
Filemap: remove useless constants and a parameter

This patch simplifies the Fiemap class API and removes the 'buf_size'
constructor parameter because it is useless. The default 256K value is good
enough. Remove a couple of related constants along with this for the same
reason.

Change-Id: I6d9bbca7f54ae409ad6e83b21b35a5e84504f847
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRename Fiemap.py to Filemap.py
Artem Bityutskiy [Thu, 16 Jan 2014 10:56:20 +0000 (12:56 +0200)]
Rename Fiemap.py to Filemap.py

The FIEMAP ioctl is not supported by tmpfs, so currently bmaptool fails to
create the bmap file when the file resides on tmpfs. This is unfortunate.

However, tmpfs supports 'SEEK_HOLE' which we can use instead of FIEMAP.

This patch is a preparation for adding 'SEEK_HOLE' support. Namely, we re-name
the Fiemap.py module to Filemap.py, where we'll support both FIEMAP and
SEEK_HOLE. Variables which contain 'fiemap' are also re-named so that they now
contain 'filemap' instead.

Change-Id: I20eac7adbdc3ad6d39c8ce5b67a5cbdbdf2987be
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoUpdate TODO list
Artem Bityutskiy [Wed, 15 Jan 2014 10:04:15 +0000 (12:04 +0200)]
Update TODO list

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
10 years agomake_a_release: remove TODOs
Artem Bityutskiy [Fri, 8 Nov 2013 09:17:41 +0000 (11:17 +0200)]
make_a_release: remove TODOs

One is done, the other one is not needed so far, so let's kill that. Also, we
have a separate TODO file which should be used instead.

Change-Id: Ia2b07f2fd00a40ba4e3964113c8cca3b4b48937c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release: do not forget to push the devel branch out
Artem Bityutskiy [Thu, 7 Nov 2013 15:33:18 +0000 (17:33 +0200)]
make_a_release: do not forget to push the devel branch out

The script assumes that the devel branch is pushed out, but this is not
necessarily the case. Teach 'make_a_release' script reminding about pushing the
devel branch too.

Change-Id: I6a0118ff886800f59700b18d13cda3a47d4cf8ad
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRelease version 3.1 v3.1
Artem Bityutskiy [Thu, 7 Nov 2013 15:26:57 +0000 (17:26 +0200)]
Release version 3.1

Change-Id: I0987e7a7ebf9cd82b883766c95e3132438d5757e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agodocs: update the README file
Artem Bityutskiy [Thu, 7 Nov 2013 15:23:55 +0000 (17:23 +0200)]
docs: update the README file

Change-Id: I1ddec192e3bd2c1de88665991af920cb2294cfa7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agodocs: add v3.1 release notes
Artem Bityutskiy [Thu, 7 Nov 2013 15:18:20 +0000 (17:18 +0200)]
docs: add v3.1 release notes
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Change-Id: I7b1e57731f91ca4ebb6e16dace1559dde1461726

10 years agoTODO: add another entry
Artem Bityutskiy [Tue, 5 Nov 2013 15:39:19 +0000 (17:39 +0200)]
TODO: add another entry

Change-Id: I7adff60bc9828110a82531c00969dc38c52cb42c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoSilence all uninteresting pylint recommendations
Artem Bityutskiy [Tue, 5 Nov 2013 08:40:19 +0000 (10:40 +0200)]
Silence all uninteresting pylint recommendations

Pylint produces many recommendations, but sometimes they are not very
interesting and I am not planning to change the code to fulfill them. For all
such cases, let's silence them. There are also a couple of false-positive
warnings like 'unable to import backports', silence them too.

Change-Id: Iac0a778877a6a71b9f28465d10c77b902a6b474e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests/oldcodebase: disable all pylint warnings
Artem Bityutskiy [Tue, 5 Nov 2013 08:13:31 +0000 (10:13 +0200)]
tests/oldcodebase: disable all pylint warnings

This is old code, and we are not goint to fix any warnings there, and we are
not going to modify these files, so let's just silence pylint for these old
files.

Change-Id: Ic9b1fd648751115400c477a883eebd58425c4658
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release: remind about updating the compat test
Artem Bityutskiy [Mon, 4 Nov 2013 15:11:44 +0000 (17:11 +0200)]
make_a_release: remind about updating the compat test

Change-Id: I06d0bdea86c391ffc5cba8ff862a791b8d3f678d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: remove the complete items
Artem Bityutskiy [Mon, 4 Nov 2013 15:03:55 +0000 (17:03 +0200)]
TODO: remove the complete items

Change-Id: I56e94874e871ece9454359be15bb91c7ec203a02
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_compat: improve backward compatibility test
Artem Bityutskiy [Mon, 4 Nov 2013 09:45:34 +0000 (11:45 +0200)]
test_compat: improve backward compatibility test

Currently 'test_compat' verifies that BmapCopy handles all the older bmap file
formats. This patch adds a check that older BmapCopy implementations are able
to handle all the compatible bmap file formats.

The reason for this test is that I once screwed it up with version 1.4: it had
incompatible changes, and older versions of BmapCopy crash with 1.4. If I had
this test-suite, I would add the new bmap format file to 'tests/test-data', and
the mistake would be caought right away.

Change-Id: I62ac407fb9cfe3b7158853ce09d5402cf85785de
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: add old code-base
Artem Bityutskiy [Mon, 4 Nov 2013 08:24:55 +0000 (10:24 +0200)]
tests: add old code-base

I am going to add a test which verifies that older BmapCopy work fine with
newer compatible bmap formats, as well as newer BmapCopy works fine with all
the older bmap formats.

This patch simply add a copy of various BmapCopy versions.

Change-Id: I37941f343b56511a85a47cda239dd702b7d2afc0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: update the todo list
Artem Bityutskiy [Fri, 1 Nov 2013 16:08:44 +0000 (18:08 +0200)]
TODO: update the todo list

Change-Id: Iae87d0a54aab6425dc35e30f18a01ffa1e7ca59c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_compat: new test for checking backward-compatibility
Artem Bityutskiy [Fri, 1 Nov 2013 12:21:57 +0000 (14:21 +0200)]
test_compat: new test for checking backward-compatibility

This test makes sure that BmapCopy works fine with all the previous bmap file
formats.

Change-Id: Ia3da88a99b32497f8ca782630d698ca54cfafc09
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: add test data
Artem Bityutskiy [Fri, 1 Nov 2013 12:09:03 +0000 (14:09 +0200)]
tests: add test data

Add a randomly-generated test image and bmap files of different formats. The
intention is to add a test case which verifies backward-compatibility.

Change-Id: I4cfbb5b16b252bbde3292aabcc7b432c3ee23e9e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: move a couple of functions to helpers.py
Artem Bityutskiy [Fri, 1 Nov 2013 15:35:04 +0000 (17:35 +0200)]
test_api_base: move a couple of functions to helpers.py

Move '_copy_and_verify_image()' and  '_calculate_chksum()' to the helpers.py
file since I am going to use them in the new unit test which I am about to add.
Remove the leading underscore since these functions become usable from outside.
Move some necessary module imports to helpers.py too.

Change-Id: Ifca399497f2d7b7bf046f916c1e744a4422cc7cc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: rename _copy_image
Artem Bityutskiy [Fri, 1 Nov 2013 15:15:36 +0000 (17:15 +0200)]
test_api_base: rename _copy_image

This function copies and verifies, so let's call it '_copy_and_verify_image()'.

Change-Id: Ifd67af5a3eee73dc755097462410bcc1835a145c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use file name in _copy_image (3)
Artem Bityutskiy [Fri, 1 Nov 2013 15:05:13 +0000 (17:05 +0200)]
test_api_base: use file name in _copy_image (3)

This is a minor clean-up which changes the '_copy_image()' so that it expects
the bmap file to be a path and does not allow for file-like objects. This is
cleaner than seeking the file-like object in this function, which changes the
object state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: I9929a4bbbc496156db9e0fb821f998bcf7279904
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use file name in _copy_image (2)
Artem Bityutskiy [Fri, 1 Nov 2013 14:51:05 +0000 (16:51 +0200)]
test_api_base: use file name in _copy_image (2)

This is a minor clean-up which changes the '_copy_image()' so that it expects
the image to be a path and does not allow for file-like objects. This is
cleaner than seeking the file-like object in this function, which changes the
object state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: I4a74431d10e2c174c4e21dd11a8adc69603a717f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use file name in _do_test
Artem Bityutskiy [Fri, 1 Nov 2013 13:35:22 +0000 (15:35 +0200)]
test_api_base: use file name in _do_test

This is a minor clean-up which changes the '_do_test()' so that it expects the
image to be a path and does not allow for file-like objects. This is cleaner
than seeking the file-like object in this function, which changes the object
state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: I884b54db2875bfbe68b15172ccc26767c40ff971
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use file name in _generate_compressed_files
Artem Bityutskiy [Fri, 1 Nov 2013 13:23:11 +0000 (15:23 +0200)]
test_api_base: use file name in _generate_compressed_files

This is a minor clean-up which changes the '_generate_compressed_files()' so
that it expects the image to be a path and does not allow for file-like
objects. This is cleaner than seeking the file-like object in this function,
which changes the object state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: I2c9004fa66b50a73d310f5ab649e3c1b1a3835c1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use file name in _calculate_chksum
Artem Bityutskiy [Fri, 1 Nov 2013 13:17:57 +0000 (15:17 +0200)]
test_api_base: use file name in _calculate_chksum

This is a minor clean-up which changes the '_calculate_chksum()' so that it
expects the image to be a path and does not allow for file-like objects. This
is cleaner than seeking the file-like object in this function, which changes
the object state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: Iec472bd5f02eb9c2a1162f43fb41defe87ff3ed6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use image name in _copy_image
Artem Bityutskiy [Fri, 1 Nov 2013 13:11:02 +0000 (15:11 +0200)]
test_api_base: use image name in _copy_image

This is a minor clean-up which changes the '_copy_image()' so that it expects
the image to be a path and does not allow for file-like objects. This is
cleaner than seeking the file-like object in this function, which changes the
object state.

This change is rather mechanical, and this is actually a preparation for the
upcoming changes, where I am going to make '_copy_image()' and some other
function generic, and then use them in a new test which I am going to add.

Change-Id: I81e7e2d15676794f9d5e0e93ce62e0945b95a6d0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: add proper license header to all tests
Artem Bityutskiy [Fri, 1 Nov 2013 12:14:40 +0000 (14:14 +0200)]
tests: add proper license header to all tests

Change-Id: I95195b227301119486c967cea2a338391ff26123
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: handle bmap format version 2.0
Artem Bityutskiy [Fri, 1 Nov 2013 10:57:31 +0000 (12:57 +0200)]
BmapCopy: handle bmap format version 2.0

This patch makes BmapCopy handle bmap format version 2.0, which is identical to
format 1.4. Format 1.4 was released by a mistake. Format 1.4 makes bmaptool
v2.x crash because it has incompatible changes. This is unfurtunate, sorry for
this.

Change-Id: Id26fd9fc807474004dddef0eee0b2028f75c3c41
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: fix bmap file format version
Artem Bityutskiy [Fri, 1 Nov 2013 10:49:21 +0000 (12:49 +0200)]
BmapCreate: fix bmap file format version

By a mistake, I've made bmap file format version to be 1.4, while is should
really have been 2.0, because there were incompatible changes. Fix this.

Change-Id: If2618db2c12b82f64e1f813e72a2786efdf4d3d5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: verify versions in a single function
Artem Bityutskiy [Fri, 1 Nov 2013 10:38:58 +0000 (12:38 +0200)]
BmapCopy: verify versions in a single function

This patch is a minor clean-up and a preparation to the upcoming changes. It
makes sure that all the differences between various bmap format version are
handled in the '_parse_bmap()' method, and we do not have to worry about the
format differences later on.

Change-Id: I00b0cc7b5f9c3372f85fb7519c3ce768f5db3bf4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: add some more entries
Artem Bityutskiy [Fri, 1 Nov 2013 11:06:24 +0000 (13:06 +0200)]
TODO: add some more entries

Change-Id: Ief83f6e42a306946826f89794c64981f0450baf3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRelease version 3.0 v3.0
Artem Bityutskiy [Wed, 2 Oct 2013 06:30:22 +0000 (09:30 +0300)]
Release version 3.0

Change-Id: I7dbcefaf07eff13f1aca05a3fa30a135989acae9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: warn if destination file is suspecious
Artem Bityutskiy [Mon, 30 Sep 2013 11:25:00 +0000 (14:25 +0300)]
bmaptool: warn if destination file is suspecious

Warn a user if he/she writes to a file under /dev, but it is not a special
device file, but just a regular file. This should improve user-friendliness.

Change-Id: I70e49d1c34ade667008dc606eb555e924b864ade
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: make sha256 to be the default
Artem Bityutskiy [Mon, 30 Sep 2013 07:04:48 +0000 (10:04 +0300)]
BmapCreate: make sha256 to be the default

Change-Id: I9d788371cfcc8a6c45ac7c443421c757058a12c6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: add a couple of debug messages
Artem Bityutskiy [Tue, 24 Sep 2013 10:17:30 +0000 (13:17 +0300)]
BmapCopy: add a couple of debug messages

Add a couple of useful debug messages to BmapCopy.

Also, do not print the progress indicator when debugging is on.

Change-Id: I38aca82e3f7f9704f827f72e6d702b0c65d26b24
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: rename _logger to _log
Artem Bityutskiy [Tue, 24 Sep 2013 10:00:12 +0000 (13:00 +0300)]
BmapCopy: rename _logger to _log

This patch renames the _logger class attribute to "_log". The reason is to make
logging statements shorter. Besides, we use "log" in bmaptool, so this also
brings a bit more consistency.

Do the same change also in TransRead.

Change-Id: I72ce6070bb792b99349ea3bd9a229cb5f7b1ca49
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: prefix debug messages with time-stamp
Artem Bityutskiy [Tue, 24 Sep 2013 08:40:12 +0000 (11:40 +0300)]
bmaptool: prefix debug messages with time-stamp

This patch makes the debug messages to be prefixed with time-stamp, as well as
the module name and line number. The time-stamp is highlighted with green
color.

This patch introduces a custom formatter class in order to be able to format
debug and other loglevls differently.

Change-Id: I8ed40957ced9cdcd20ee7e94a6c92ce62671a5cc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: increase the batch queue length
Artem Bityutskiy [Tue, 24 Sep 2013 07:37:09 +0000 (10:37 +0300)]
BmapCopy: increase the batch queue length

BmapCopy reads and writes from different threads to exploit parallelizm. There
is a "batch queue" where the reader supply 1MiB buffers and the writer consumes
them. The length of the queue is 6 for block devices and 2 for files. This
patch makes it to be 6 everywhere since 2 is rather short.

Change-Id: Ia4c6293ad2433fd7b466733ff9fbe5a0bd288d13
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: introduce --debug option
Artem Bityutskiy [Tue, 24 Sep 2013 07:30:10 +0000 (10:30 +0300)]
bmaptool: introduce --debug option

We often need to print debugging information, let's add a --debug option for
this.

Change-Id: I038e2163d2d5929b4bd07416547936fc34bf09c2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: fix --nobmap case
Artem Bityutskiy [Tue, 24 Sep 2013 09:55:07 +0000 (12:55 +0300)]
bmaptool: fix --nobmap case

One of the previous commits introduced the NamedFile class and broke the
--nobmap case, because we created a NamedFile object even when f_bmap was None.
This patch fixes the problem.

Change-Id: I4592e06b1385dcf5d34b42717b0374c68d0c223f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: print warning messages even with --quiet
Artem Bityutskiy [Tue, 24 Sep 2013 07:25:49 +0000 (10:25 +0300)]
bmaptool: print warning messages even with --quiet

When the --quiet option is used, we print only error messages, and warnings
are suppressed. However, it is a good idea to print warnings even with --quiet,
since they usually tell about problems users should better know about.

Change-Id: Id0f708723cc13d57191fd540e684ca0cf20a45f7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: remove junk argument
Artem Bityutskiy [Tue, 24 Sep 2013 07:07:04 +0000 (10:07 +0300)]
bmaptool: remove junk argument

This patch remove unneeded junk argument from the BmapBdevCopy constructor
invocation and fixes this issue:

Traceback (most recent call last):
  File "./bmaptool", line 684, in <module>
    sys.exit(main())
  File "./bmaptool", line 668, in main
    args.func(args, log)
  File "./bmaptool", line 434, in copy_command
    image_size, logger=log)
TypeError: __init__() got multiple values for keyword argument 'logger'

Change-Id: Ic77418ec81f6c085118807eb4a675034979a8f72
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: correct bad English one of the messages
Artem Bityutskiy [Tue, 24 Sep 2013 06:46:55 +0000 (09:46 +0300)]
TransRead: correct bad English one of the messages

Change-Id: Ib309a0dceac128410a6cb4e565c3cd556ed61b9b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release.sh: misc little changes
Artem Bityutskiy [Mon, 23 Sep 2013 07:00:04 +0000 (10:00 +0300)]
make_a_release.sh: misc little changes

Require that the release is made in the devel branch. Amend the instructions
that we print. Remove trailing white-spaces from the changelog.

Change-Id: Ic955edafcd78b5e54d82d39f29fa00aad2c6aac6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRELEASE_NOTES: add 3.0 release notes
Artem Bityutskiy [Fri, 20 Sep 2013 14:01:18 +0000 (17:01 +0300)]
RELEASE_NOTES: add 3.0 release notes

Change-Id: Ib2141049e4684c907a70e650672aac6625942c27
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: support .gizp extension
Artem Bityutskiy [Fri, 20 Sep 2013 14:10:23 +0000 (17:10 +0300)]
TransRead: support .gizp extension

We support GnuZip files, but only look at the .gz extension, and forget about
.gzip extension. This patch fixes the situation.

Change-Id: Id5775a84fe1d0dfba87333e9f430c4931324c7e9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: do not mark the entry point as static
Artem Bityutskiy [Fri, 20 Sep 2013 11:48:28 +0000 (14:48 +0300)]
tests: do not mark the entry point as static

Remove the @staticmethod decorator, because old unittest module on Centos6 does
not recognize static entry points and does not execute tests.

Change-Id: I6d490396fb79a9b43bc7d39328b1e5eacff0446b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: add a Centos 6 work-around
Artem Bityutskiy [Fri, 20 Sep 2013 10:30:59 +0000 (13:30 +0300)]
tests: add a Centos 6 work-around

Centos 6 is very old, and it has old unittest library, and the newer one which
we need is called 'unittest2' there. This patch adds the corresponding
work-around to make our tests pass in Centos 6.

Change-Id: Ibf9d9185f23a79aeb2f0ecf67f8f22e1840f1a82
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: add missing dependencies
Artem Bityutskiy [Thu, 19 Sep 2013 13:40:04 +0000 (16:40 +0300)]
packaging: add missing dependencies

Change-Id: Ib8b000434b5670d418ab58b18bfff82581e4e892
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: don't parse URL twice in case of ssh proto
Andy Shevchenko [Thu, 19 Sep 2013 10:41:02 +0000 (13:41 +0300)]
TransRead: don't parse URL twice in case of ssh proto

_open_url() method already parses the URL. Let's use it instead of doing
parsing second time.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release.sh: various improvements
Artem Bityutskiy [Wed, 18 Sep 2013 12:29:11 +0000 (15:29 +0300)]
make_a_release.sh: various improvements

This patch makes several improvements in the make_a_release.sh.

* Ask the maintainer tough questions about whether the docs were updated
* Automatically update the RPM and Debian changelog files
* Automatically increase version number in various places

Change-Id: I17a20132c79ac0d07cdb5addddb2e9da071bb281
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: remove a dot in bmap file comment
Artem Bityutskiy [Wed, 18 Sep 2013 10:15:46 +0000 (13:15 +0300)]
BmapCreate: remove a dot in bmap file comment

To be consistent with other commentaries, lets not put the dot at the end of
the one-line comment.

Change-Id: I86297b87752cf38056fc37ac5dfa893e73d97051
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: update the file to reflect the current state
Artem Bityutskiy [Wed, 18 Sep 2013 07:44:09 +0000 (10:44 +0300)]
TODO: update the file to reflect the current state

Change-Id: I6310ea6436d010a29ef514e276a3c56e56412993
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: improve XML parsing error message
Artem Bityutskiy [Wed, 18 Sep 2013 07:21:37 +0000 (10:21 +0300)]
BmapCopy: improve XML parsing error message

When BmapCopy fails to parse the XML file, it prints something like this:

bmaptool: ERROR: cannot parse the bmap file '/home/dedekind/tmp/Fedora-19-i386-CHECKSUM' which should be a proper XML file: not well-formed (invalid token): line 1, column 1

(yes, I deliberately fed bmaptool a bogus file)

The problem is that sometimes we actually modify the bmap file a bit before
parsing. For example, we do this when the bmap file is signed with a clearsign
OpenPGP signature.

This means that the line number does not match the file name we print. This
patch improves the situation by providing the bogus line number and a bit of
the context in the exception error message.

Change-Id: I62b8aefde4a3ea524f528b83c4b6e70fa469e387
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: override bmap path
Artem Bityutskiy [Wed, 18 Sep 2013 06:59:23 +0000 (09:59 +0300)]
bmaptool: override bmap path

Sometimes we create temporary files for the bmap file object, and the 'name'
attribute of the object contains the temporary file path in these cases. Then
we pass the bmap file object to, say, BmapCreate module, which uses the 'name'
attribute in various error messages. This, for example, leads to the following
confusing error message:

bmaptool: ERROR: cannot parse the bmap file '/tmp/tmpUkoTxA' which should be a proper XML file

It is a lot nicer to print the original path instead of the temporary path.
Let's do this with help of the 'NamedFile' class that we have. It helps
substituting the 'name' attribute with something we want the user to see.

Change-Id: I0503a1014d159b3bc6da8e00b16a4d194c2f68f3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agodocs: update bmaptool's man pages
Artem Bityutskiy [Tue, 17 Sep 2013 15:32:14 +0000 (18:32 +0300)]
docs: update bmaptool's man pages

Add information about new options, and more.

Change-Id: Id1c9ffe97bbb22ebd2ee4dd645142a8bc7b6a476
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agosetup.py: automatically detect version number
Artem Bityutskiy [Tue, 17 Sep 2013 14:02:39 +0000 (17:02 +0300)]
setup.py: automatically detect version number

We currently duplicate the project version number in bmaptool and setup.py
files. Let's get rid of the duplication and have setup.py parse the bmaptool
file and fetch the version number.

Change-Id: I06ee68ca29b16fac2cbfa53cd9a61329b8606409
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: remove an entry about checking zeroes
Artem Bityutskiy [Tue, 17 Sep 2013 13:44:40 +0000 (16:44 +0300)]
TODO: remove an entry about checking zeroes

I think I will not implement this because it makes little sense. Drop the
unmapped areas anyway, why would we care checking their contents? What for?

Change-Id: I756c073ffef65715cf418a8f3f37bf35eef86218
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoFiemap: synchronize the file before invoking the ioctl
Artem Bityutskiy [Tue, 17 Sep 2013 11:57:35 +0000 (14:57 +0300)]
Fiemap: synchronize the file before invoking the ioctl

Early FIEMAP implementations had many bugs related to cached dirty data. And
this is why it is safer to synchronize the file before invoking FIEMAP for it.
Let's start using the 'FIEMAP_FLAG_SYNC' FIEMAP ioctl flag which does exactly
that.

Change-Id: I1698b88ed3978ffa632502ba72ad345ec8708ce0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: update the list
Artem Bityutskiy [Tue, 17 Sep 2013 11:21:20 +0000 (14:21 +0300)]
TODO: update the list

Remove the item about GPG signatures support, add a reminder about updating the
man pages with the GPG and hash functions information.

Change-Id: Id4a0d0cb7ec907dfbebe9090d8b85ad7138e7bbf
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: implement GPG signature verification
Artem Bityutskiy [Mon, 16 Sep 2013 15:52:02 +0000 (18:52 +0300)]
bmaptool: implement GPG signature verification

This is a feature which was requested by the Fedora communitiy.

Both clearsign and detached GPG signatures are supported. The signature file
auto-discovery is supported (similar to bmap file auto-discovery).

More user-facing information will be added to the man page a bit later.

We add the following command-line options:
    1. --bmap-sig option for specifying the detached signature file path
    2. --no-sig-verify option for making bmaptool avoid verifying the clearsign
       signature and avoid signature file auto-discovery

Change-Id: Id64194415759abdbbe4e2f54d997f0855f67c749
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: disallow simultaneous --bmap and --nobmap
Artem Bityutskiy [Tue, 17 Sep 2013 08:11:08 +0000 (11:11 +0300)]
bmaptool: disallow simultaneous --bmap and --nobmap

Do not allow users to use --bmap and --nobmap at the same time since it makes
no sense.

Change-Id: I69e02c1e885f7877e6b6e1dd5218bab07f1c1f24
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: cleanups
Artem Bityutskiy [Tue, 17 Sep 2013 07:57:37 +0000 (10:57 +0300)]
bmaptool: cleanups

This function improves the commentaries and renames several functions. The
renames are about removing the 'copy_command_' prefix from function names,
because it is not very readable and we do not use it consistently anyway.

Change-Id: Id8030489820cb3d9b03830b7209d30a4c0452f23
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: do not fail when copying a bmap file
Artem Bityutskiy [Tue, 17 Sep 2013 06:44:22 +0000 (09:44 +0300)]
bmaptool: do not fail when copying a bmap file

It is possible that the user copies the bmapfile itself using 'bmaptool copy'.
Most probably this is just by a mistake. In this case bmaptool just fails,
since it discovers the bmap file, and it does not match the "image" (where the
image is the same bmap file).

This patch teaches bmaptool to handle this case by dropping the discoverd bmap
file if its path is the same as the image path.

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