tools/bmap-tools.git
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>
10 years agoFiemap: fix failure for zero-sized files
Artem Bityutskiy [Tue, 17 Sep 2013 06:23:11 +0000 (09:23 +0300)]
Fiemap: fix failure for zero-sized files

The Fiemap module fails for zero-sized file with these symptoms:

Traceback (most recent call last):
  File "./bmaptool", line 561, in <module>
    sys.exit(main())
  File "./bmaptool", line 545, in main
    args.func(args, log)
  File "./bmaptool", line 419, in create_command
    creator = BmapCreate.BmapCreate(args.image, output, "sha256")
  File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/BmapCreate.py", line 163, in __init__
    self.fiemap = Fiemap.Fiemap(self._f_image)
  File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/Fiemap.py", line 120, in __init__
    self.block_is_mapped(0)
  File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/Fiemap.py", line 175, in block_is_mapped
    struct_fiemap = self._invoke_fiemap(block, 1)
  File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/Fiemap.py", line 149, in _invoke_fiemap
    % (block, self.blocks_cnt))

This patch fixes the issue.

Change-Id: I3eb2c6e69c892aea2a3d41f2b9bf830907d7658e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptool: start using sha256 when creating bmap file
Artem Bityutskiy [Mon, 16 Sep 2013 11:47:06 +0000 (14:47 +0300)]
bmaptool: start using sha256 when creating bmap file

Switch from using SHA1 to SHA256 for the 'bmaptool create' command.

Basically, this is what the Fedora community requested, with a reference to
this:

http://csrc.nist.gov/groups/ST/hash/policy_2006.html

Change-Id: I3facbd8d5588903b1d7d28eac77d147d0390a1c4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: remove sha256 entry
Artem Bityutskiy [Mon, 16 Sep 2013 11:43:18 +0000 (14:43 +0300)]
TODO: remove sha256 entry

Change-Id: I5e36f03362ad3706501fbbd1c6e2dd78893b55e7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCreate: implement arbitrary hash type support
Artem Bityutskiy [Mon, 16 Sep 2013 10:35:44 +0000 (13:35 +0300)]
BmapCreate: implement arbitrary hash type support

Instead of just supporting SHA1 hash functions type, support arbitrary hash
function type. Well, actually "arbitrary" means any hash function supported by
the "hashlib" python module.

In particular, we are interested to switch from SHA1 to SHA256.

Unfortunately, this is a format change, since format version 1.3 guaranteed
that checksum is always SHA1. This is why this patch also increases the format
version to 1.4.

Change-Id: I096b47d6e4a413368d42e40ce8ebb06f612619c5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: support arbitrary checksum types
Artem Bityutskiy [Mon, 16 Sep 2013 11:21:35 +0000 (14:21 +0300)]
BmapCopy: support arbitrary checksum types

This patch makes BmapCopy support bmap format version 1.4 which allows for
and arbitrary checksum type, not only SHA1. We are, particularly, interested in
SHA256 support.

Change-Id: I9306907ac5d29b0ce524c2abcdbcafac60096958
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotest_api_base: use sha256 instead of sha1
Artem Bityutskiy [Mon, 16 Sep 2013 09:53:45 +0000 (12:53 +0300)]
test_api_base: use sha256 instead of sha1

Well, this does not matter in this case at all, but I am going to switch to
SHA256 in BmapCreate, so changing the tests just for consistency.

Change-Id: I930314a20655da88333b1d6e8e177324794c9ba5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptools: preparations to switch to sha256
Artem Bityutskiy [Mon, 16 Sep 2013 09:47:22 +0000 (12:47 +0300)]
bmaptools: preparations to switch to sha256

In all places where it does not matter which exactly checksum we calculate,
substitute 'sha1' with 'chksum'. This is a preparation for the further change
where we will switch from using SHA1 checksums to using SHA256 checksums.

Change-Id: I51000ad7669d1459c5d6d5e8141e0a6d74f93a56
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: remove local caching functionality
Artem Bityutskiy [Mon, 16 Sep 2013 09:23:03 +0000 (12:23 +0300)]
TransRead: remove local caching functionality

Remove the local caching functionality of the TransRead module. This
functionality does not really belong to the module, and it only makes things
more complex. It is better to either make users of TransRead to locally cache
remote files, or create a small wrapper over TransRead for these purposes.

Since currently there is only one user of this functionality, we just implement
local caching in bmaptool directly.

Change-Id: I649a5e761b9bc4b6b10d035bfd790357eaf6c373
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: add another item
Artem Bityutskiy [Fri, 13 Sep 2013 11:52:06 +0000 (14:52 +0300)]
TODO: add another item

Change-Id: I5cf46966858e3aa71f3cc6e55430499a9750730e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: improve user experience
Artem Bityutskiy [Fri, 13 Sep 2013 10:33:04 +0000 (13:33 +0300)]
TransRead: improve user experience

This patch solves the following problem.

1. I forgot to define the proxy.
2. I run bmaptool, it blocks, and several minutes later it fails with an error
   like "Connection timed out"

I would instead like it to tell me that something is going wrong much earlier,
why should I wait for several minutes?

This patch improves the way we open URLs. Now instead of using the default
(usually long) timeout, we first try with a short timeout, and if we cannot
open the URL, we print user a warning, and then try to open with the default
timeout. The user may press Ctrl-C once he/she sees the warning, or start
checking the connectivity.

Change-Id: Ia5f387de62574d84d914c21794f782b1b41d530f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: accept the logger object
Artem Bityutskiy [Fri, 13 Sep 2013 09:55:14 +0000 (12:55 +0300)]
TransRead: accept the logger object

In order to improve user experience, I would like to print warnings when we
cannot open the URL for some time. This requires the TransRead object to accept
the logger object, or take the global one.

Change-Id: I4fc9f3d6544a2a699b6476dddf362aa127e81550
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: handle the urllib2.URLError exception
Artem Bityutskiy [Fri, 13 Sep 2013 09:26:56 +0000 (12:26 +0300)]
TransRead: handle the urllib2.URLError exception

When opening an URL with urllib2, handle the URLError exceptions too.

This patch adds a new "except" statement instead of adding the exception object
to the existing array. The reason is that in the next commit we will need to
handle the urllib2.URLError exceptions a bit differently.

This patch also refactors the code a tiny bit as a preparation to the next
commit.

Change-Id: I69856aa8698b495c5a2450979db9384aad1b713a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: add another comment release-2.0 v2.6
Artem Bityutskiy [Mon, 19 Aug 2013 13:16:37 +0000 (16:16 +0300)]
TODO: add another comment

Change-Id: I8ae67484c49eefdbd0d030059a6a6a259ce8d33f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRelease version 2.6
Artem Bityutskiy [Tue, 13 Aug 2013 11:56:24 +0000 (14:56 +0300)]
Release version 2.6

Change-Id: Ic0aba0b20847454b35c7dee9d50dccdbd2cf11fa
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release.sh: add few more reminders
Artem Bityutskiy [Fri, 16 Aug 2013 09:39:54 +0000 (12:39 +0300)]
make_a_release.sh: add few more reminders

Change-Id: Ifaf378a0b803a97ca3c15bb2b3adf8ffa73cdde9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTODO: add more entries
Artem Bityutskiy [Fri, 16 Aug 2013 09:38:59 +0000 (12:38 +0300)]
TODO: add more entries

Change-Id: I9cc5be56bb7f535fc20d50cc6ee1ffd5e708a138
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoREADME: document the make_a_release.sh script
Artem Bityutskiy [Thu, 15 Aug 2013 07:01:40 +0000 (10:01 +0300)]
README: document the make_a_release.sh script

Change-Id: Ie90e707d2546d66064a6ec9af61ce6216984b1a2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoAdd the TODO list
Artem Bityutskiy [Wed, 14 Aug 2013 11:07:23 +0000 (14:07 +0300)]
Add the TODO list

Change-Id: Ib67bb47a25e3781ee6986693ed45fe22a418f343
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: do not cache local uncompressed files
Artem Bityutskiy [Wed, 14 Aug 2013 10:58:34 +0000 (13:58 +0300)]
TransRead: do not cache local uncompressed files

When the file is already local and uncompressed, do not create a temporary copy
of it when 'local' is True.

On top of this, re-use own __init__ function to re-open the local copy of the
remote/compressed file.

Change-Id: I2093419ed2cfc6d40f73a47657682436b8932402
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agotests: cover .xz files too
Artem Bityutskiy [Wed, 14 Aug 2013 10:33:09 +0000 (13:33 +0300)]
tests: cover .xz files too

Change-Id: I4e8318174a0a92f7c795c0c5cc61aeeff7237442
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: store all file descriptors in a list
Artem Bityutskiy [Wed, 14 Aug 2013 10:14:11 +0000 (13:14 +0300)]
TransRead: store all file descriptors in a list

This patch improves readability and does not do any functional changes.

In the TransRead module we have chains of file-like objects, every next element
of the chain is based on the previous one. And we store each element of the
chain in own variable like 'self._file_obj3', which is a bit ugly. Let's
introduce a 'self._f_objs' list, and just append there, and the last element is
always the final "transparent read" file descriptor.

Change-Id: I498130e9de35e65bddc7d3dbb4f47bdab795549e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: remove unneeded files
Artem Bityutskiy [Wed, 14 Aug 2013 07:56:52 +0000 (10:56 +0300)]
packaging: remove unneeded files

I cannot really explain why these files were needed, but they are not needed
anymore, according to Ed Bartosh. So removing them with pleasure.

Change-Id: I8239416e603ed86f2e0302cc1a7c14a9ba94d2dd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRELEASE_NOTES: add changelog for release 2.6
Artem Bityutskiy [Tue, 13 Aug 2013 10:58:04 +0000 (13:58 +0300)]
RELEASE_NOTES: add changelog for release 2.6

Strictly speaking I've added a feature, so 2.6 is not just a bug-fix release,
but the feature is rather small and does not deserve a new major release.

Change-Id: Ice89d533a873687141412aaefe814eb3b221ac5f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: uncompress 'tar.xz' files on-the-fly
Artem Bityutskiy [Tue, 13 Aug 2013 10:37:39 +0000 (13:37 +0300)]
TransRead: uncompress 'tar.xz' files on-the-fly

Change-Id: Ia8ed3c1c276510b3d63e831135f7ad6ce6bc1743
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: uncompress .xz files on-the-fly
Artem Bityutskiy [Tue, 13 Aug 2013 10:12:33 +0000 (13:12 +0300)]
TransRead: uncompress .xz files on-the-fly

Change-Id: I401e20224bc2d0050b7c6354e346e10f13e99024
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoTransRead: close all the files
Artem Bityutskiy [Tue, 13 Aug 2013 09:46:16 +0000 (12:46 +0300)]
TransRead: close all the files

Although CPython reference-counts objects and destroys them when they are no
longer used, it is still good practice to close all the opened files
explicitly, especially if we are talking about a library.

TransRead did not explicitely close the tar file object, and this patch fixes
this.

Additionally, add few useful commentaries.

Change-Id: Ib146be0a8e358bf208329932ca3a62ab2617f7bd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoBmapCopy: fix a typo in error message
Artem Bityutskiy [Tue, 13 Aug 2013 10:38:50 +0000 (13:38 +0300)]
BmapCopy: fix a typo in error message

... add a missing whitespace.

Change-Id: I8d713263de9899ff314d83e69aae9f3a672c3285
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobmaptools: put __init__ first
Artem Bityutskiy [Tue, 13 Aug 2013 09:26:54 +0000 (12:26 +0300)]
bmaptools: put __init__ first

It is just a common convention to put __init__ at the very beginning of the
class. And let's also put then the __del__ function to be the second.

So this patch does not do any functional modifications, just re-structuring.

Change-Id: I2ebdd8c4c54cf5bf3f9be21d7520b42865305dab
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agodebian: add a dependency to python-lzma
Artem Bityutskiy [Mon, 12 Aug 2013 15:16:06 +0000 (18:16 +0300)]
debian: add a dependency to python-lzma

We'll soon need it in order to support .xz files.

Change-Id: Iafcae3a81f64934ff6d7fdede070fe39e75a58e1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: add pyliblzma for Fedora dependencies
Artem Bityutskiy [Mon, 12 Aug 2013 15:01:53 +0000 (18:01 +0300)]
packaging: add pyliblzma for Fedora dependencies

Change-Id: I3fb1515c0ada923bc27a470979077f9c4e450f86
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: remove tabs and extra white-spaces
Artem Bityutskiy [Mon, 12 Aug 2013 14:55:41 +0000 (17:55 +0300)]
packaging: remove tabs and extra white-spaces

Put one white-space after every keyword and do not try to align things, and
also do not use tabs. I think I saw this recommendation is the Fedore guide or
something, but not 100% sure. But at least this makes it easier to change the
spec file.

Change-Id: I6cee1b700287c9287637184978906af53862a04c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release.sh: use git send-email
Artem Bityutskiy [Sat, 10 Aug 2013 12:11:49 +0000 (15:11 +0300)]
make_a_release.sh: use git send-email

Use git send-email instead of mutt, since the mutt command we had does not
really work, and I am unable to find out how to make it work.

Additinally, inform about where to find packages for various distributions.

Change-Id: Ia6408683a4794377f0ebf9f6b5cd1dc1f8559ca3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRelease version 2.5 v2.5
Artem Bityutskiy [Mon, 5 Aug 2013 07:07:28 +0000 (10:07 +0300)]
Release version 2.5

Change-Id: Ibeed08d6913893452bec9587297f2417808a6057
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agomake_a_release.sh: a script for cutting releases
Artem Bityutskiy [Mon, 5 Aug 2013 07:24:20 +0000 (10:24 +0300)]
make_a_release.sh: a script for cutting releases

Not complete, but a good start anyway. Intended to be used by me.

Change-Id: I64b7ef72ac8fe729f234f5d74847dc85225ccee0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: improve the summary text in RPM packaging
Artem Bityutskiy [Mon, 5 Aug 2013 07:15:23 +0000 (10:15 +0300)]
packaging: improve the summary text in RPM packaging

Change-Id: I71b36a801c4a4898bf73c8226f7a7495a2b8407c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopackaging: use opensuse_bs macro
Artem Bityutskiy [Mon, 5 Aug 2013 07:11:22 +0000 (10:11 +0300)]
packaging: use opensuse_bs macro

The <CI_CNT>.<B_CNT> trick is OBS-specific, so wrap it with the 'opensuse_bs'
macro.

Change-Id: I817757ffdacddc32077b2876185220e880655ad7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoREADME: add more information for opensource community
Artem Bityutskiy [Fri, 2 Aug 2013 09:54:10 +0000 (12:54 +0300)]
README: add more information for opensource community

Plus some minor re-structuring.

Change-Id: I66c60057949ec6bd0ccdcb29c7fabf691a36bb43
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRemove junk back-slashes
Artem Bityutskiy [Thu, 4 Jul 2013 07:40:27 +0000 (10:40 +0300)]
Remove junk back-slashes

In Python we don't need the line-continuation "\" inside (), [], {}.

Suggested by Simon McVittie <simon.mcvittie@collabora.co.uk>.

Change-Id: I2c258cd1099e5c07bd710cd66854f6291c04f623
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobmap-tools: make one-line comments comply with PEP257
Artem Bityutskiy [Thu, 4 Jul 2013 05:38:53 +0000 (08:38 +0300)]
bmap-tools: make one-line comments comply with PEP257

Change-Id: Ib40a22d44a56e1c7274e415a2ee67db99efc992f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobmap-tools: do not use extra spaces to comply with PEP8
Artem Bityutskiy [Thu, 4 Jul 2013 05:18:39 +0000 (08:18 +0300)]
bmap-tools: do not use extra spaces to comply with PEP8

Apparently in python it is preferrable to avoid white-spaces when specifying
the default values.

Change-Id: I6d70de456358278df270e4107e90f760e8041b8d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebian: switch to debhelper 9
Simon McVittie [Mon, 1 Jul 2013 13:31:03 +0000 (14:31 +0100)]
debian: switch to debhelper 9

Debhelper 9 "compatibility level" is what's currently recommended.
Debian 7 and Ubuntu 12.04 both have a suitable debhelper version.

At the Debhelper 7 or 8 "compatibility level" we would have used
the deprecated python-support helper tool, whereas Debhelper 9 does
not have a default Python packaging tool: choose dh_python2, part
of the Debian/Ubuntu 'python' package since before Ubuntu 12.04
and currently the recommended option. This needs a dependency on
python-all (>= 2.7) so do that.

In the process, switch the XS-Python-Version field from the deprecated
keyword 'current' to ">= 2.7" (the recommended syntax),
and remove the deprecated XB-Python-Version field.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRemove stdeb-generated boilerplate from debian/rules
Simon McVittie [Mon, 1 Jul 2013 13:25:55 +0000 (14:25 +0100)]
Remove stdeb-generated boilerplate from debian/rules

This particular package doesn't contain any compiled code, let alone
f2py, so there's no point in doing strange things with compiler/linker
flags. If we gain any C code later, respecting the CFLAGS etc. is
recommended anyway, to pick up "hardening" flags.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebian/control: depend on python-setuptools instead of -distribute
Simon McVittie [Mon, 1 Jul 2013 13:19:03 +0000 (14:19 +0100)]
debian/control: depend on python-setuptools instead of -distribute

python-setuptools is the module we actually import, and
python-distribute has been merged into python-setuptools upstream.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebian/control: move to Section: utils
Simon McVittie [Mon, 1 Jul 2013 13:12:09 +0000 (14:12 +0100)]
debian/control: move to Section: utils

Packages that are primarily a command-line tool, like git-buildpackage
or offlineimap, usually go in the Section for that tool rather than
Section: python. If this package ends up primarily acting like a library,
it should produce a python-bmaptools package in Section: python,
but that doesn't seem necessary or appropriate until it has
third-party users.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoPut proper GPL declarations on the source files
Simon McVittie [Mon, 1 Jul 2013 13:08:24 +0000 (14:08 +0100)]
Put proper GPL declarations on the source files

This is GPL best-practice. I have assumed that this package is
intentionally placed under the GPL version 2 only (like Linux or
ConnMan), and not dual- or multiple-licensed under the GPL version 2
"or any later version" (like BlueZ).

As a result, the wording used is similar to what is recommended in
the GPL v2, but modified to omit the "or later" clause.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: fix-up a commentary
Artem Bityutskiy [Thu, 4 Jul 2013 04:57:07 +0000 (07:57 +0300)]
BmapCopy: fix-up a commentary

Wrap a very long line which appeared after PEP8-nization.

Change-Id: I0ba4ffdc835fc957fe6cea7b968b2b88af4206d7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoUse machine-readable format for debian/copyright
Simon McVittie [Wed, 3 Jul 2013 17:29:41 +0000 (18:29 +0100)]
Use machine-readable format for debian/copyright

Change-Id: I0f17c9e02e7a816121ad0ba3a3d38c779bbcaf03
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobmap-tools.spec: improve commentaries about Centos6 and argparse
Artem Bityutskiy [Thu, 4 Jul 2013 04:49:48 +0000 (07:49 +0300)]
bmap-tools.spec: improve commentaries about Centos6 and argparse

The previous comment was a bit confusing.

Change-Id: Iab06d0d486bf3d6a0e7f4bb6df7c991251be579c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebian/control: wrap and sort lists of (Build-)Depends
Simon McVittie [Mon, 1 Jul 2013 12:46:03 +0000 (13:46 +0100)]
debian/control: wrap and sort lists of (Build-)Depends

This minimizes VCS diff/conflicts when they change.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agorpm-packaging: improve the description
Artem Bityutskiy [Thu, 4 Jul 2013 04:45:19 +0000 (07:45 +0300)]
rpm-packaging: improve the description

Improve the tool description for rpm packages.

Change-Id: I8f8c47f2fc9188381ff573083cf06b6e276cdc16
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebian/control: add a longer Description
Simon McVittie [Mon, 1 Jul 2013 12:42:45 +0000 (13:42 +0100)]
debian/control: add a longer Description

This paragraph from the bmaptool documentation on tizen.org matches
what Debian packages typically have in their Description. The original
description didn't really indicate why you would prefer bmaptool over
alternatives like dd.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: correct logged warning
Simon McVittie [Wed, 3 Jul 2013 17:21:45 +0000 (18:21 +0100)]
BmapCopy: correct logged warning

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agotests: also comply with PEP8 for multiline comments
Artem Bityutskiy [Wed, 3 Jul 2013 15:03:48 +0000 (18:03 +0300)]
tests: also comply with PEP8 for multiline comments

Change-Id: Ie43d8f4e682e5b8d83aa29aeb563ce81291bd707
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobmaptool: use PEP8 commenting style
Artem Bityutskiy [Wed, 3 Jul 2013 14:00:41 +0000 (17:00 +0300)]
bmaptool: use PEP8 commenting style

No functional changes, just amend multiline comments to match PEP8's
recommendation.

Change-Id: I91aa25026d73d2b6fad4230705d2bc1f14d4fb91
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: downgrade inability to set sysfs parameters to a warning
Simon McVittie [Tue, 25 Jun 2013 11:56:28 +0000 (12:56 +0100)]
BmapCopy: downgrade inability to set sysfs parameters to a warning

On distributions where unprivileged users can write to removable
USB disks, this allows such a disk to be written with bmaptool
(albeit with non-optimal performance) without being root.

Artem: got some more explanations from Simon McVittie
<simon.mcvittie@collabora.co.uk> about why we don't just add a special
case for EPERM/EACCESS:

"""
> On 28/06/13 12:47, Artem Bityutskiy wrote:
> For a library, requiring the user to have a logger object is probably
> not the nicest thing. And usually libraries do not print error messages,
> they throw exceptions instead.

I made the logger optional: if the caller doesn't supply one, BmapCopy
will use logging.getLogger(__name__), i.e. the logger named
"bmaptools.BmapCopy", which appears to be best-practice for Python
logging. (You could use it for debug-logging too, if you wanted to.)

Having logger=None cause logging to be suppressed, instead of using the
logging module's defaults (which are to print 'No handlers could be
found for logger "foo.bar"' the first time you use it, and not log
anything...) would also be fine.

Libraries throw exceptions if they couldn't do what you asked, but I
think there's some room for a middle ground between "no, I can't" and
silent success.
"""

Fair enough, I think.

Hoewver, I massged the patch a bit and improved the warnings to make
them a bit more user-friendly and give users the idea what is the
consequence of the warning.

Change-Id: I644d9777b7bf9e97dbe002814f7d4e411a7618db
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: have a Logger object
Simon McVittie [Tue, 25 Jun 2013 11:54:45 +0000 (12:54 +0100)]
BmapCopy: have a Logger object

Artem: In some situations we may want inform about various happenings, see the
next patch for example. So let's teach the BmapCopy class to accept a 'logger'
object.

Change-Id: Idcfe6d7acfb8e327be39496898415e9f4b08d0dd
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodebianisation: change versioning
Artem Bityutskiy [Wed, 3 Jul 2013 12:55:11 +0000 (15:55 +0300)]
debianisation: change versioning

Simon McVittie <simon.mcvittie@collabora.co.uk> requested this:

"In Debian packaging it's conventional for version numbers like "2.4-1"
to be the Debian package, and if derivatives need to fork it, they use a
version like "2.4-1ubuntu1" (or "2.4-0ubuntu1" if they package something
that isn't in Debian yet). You've been using version numbers like 2.4-1
as upstream versions, so for now I'll have to act like a derivative
distribution and use 2.4-1debian1 or something."

So let's become a "native" package in order to make live of derivative
distributions easier.

Change-Id: I0e77774c8bf186fe03cea1548e68a48466e90a8e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCreate: fix a typo in the bmap file comments
Artem Bityutskiy [Sat, 29 Jun 2013 11:21:23 +0000 (14:21 +0300)]
BmapCreate: fix a typo in the bmap file comments

zeoro -> zero

Change-Id: I0709004ddae37238a97439a165c12b4bfc7dc258
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: remove a left-over comment
Artem Bityutskiy [Fri, 28 Jun 2013 11:49:05 +0000 (14:49 +0300)]
BmapCopy: remove a left-over comment

Change-Id: Iaced0f210f7122fc800c6dac2c81fd6b185fee4d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoFix debian/changelog syntax
Simon McVittie [Tue, 25 Jun 2013 11:59:41 +0000 (12:59 +0100)]
Fix debian/changelog syntax

dpkg-source requires two spaces between the closing ">" around the
email address and the first letter of the date.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoAdd COPYING, a copy of the GPL v2
Simon McVittie [Tue, 25 Jun 2013 12:05:46 +0000 (13:05 +0100)]
Add COPYING, a copy of the GPL v2

This makes it considerably more straightforward for distributors
to comply with the GPL's requirement to accompany the package with
a copy of its license.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRelease version 2.4 v2.4
Artem Bityutskiy [Wed, 5 Jun 2013 15:19:12 +0000 (18:19 +0300)]
Release version 2.4

Change-Id: Ia947af3cb02a4e53873136c1be270139342f81f1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodocs: update man pages
Artem Bityutskiy [Wed, 5 Jun 2013 15:14:12 +0000 (18:14 +0300)]
docs: update man pages

Change-Id: I250b03151c9002b3f55fdf4cbe487ed8291047a0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoTransRead: amend commentaries
Artem Bityutskiy [Wed, 5 Jun 2013 15:06:46 +0000 (18:06 +0300)]
TransRead: amend commentaries

Update and fix spelling in several commentaries. No functional changes.

Change-Id: Idd2a6a5bc7485aa4d4cbea1490aea13169ea699e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRELEASE_NOTES: add a record for release 2.4
Artem Bityutskiy [Mon, 3 Jun 2013 12:57:57 +0000 (15:57 +0300)]
RELEASE_NOTES: add a record for release 2.4

Change-Id: Ie3177b1ad7cc9f0c03dd0ce1388ffb203d2bbe6b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoTransRead: add support for ssh:// URLs
Artem Bityutskiy [Mon, 3 Jun 2013 12:47:37 +0000 (15:47 +0300)]
TransRead: add support for ssh:// URLs

This patch adds support for flashing from an SSH source. I need this
functionality, for example, when I build images on a remote host, but flash
them locally, and I want bmaptool to read the image directly from the SSH
host.

Unfortunately, liburl2 does not support ssh:// URLs, and there seem to be no
standard python libraries for such URLs. There is a "paramiko" python module,
but it is not a standard part of python, and not at least Tizen does not have
it, so I do not want to use it.

Thus, I use the system 'ssh' tool directly. Note, the paramiko module actually
does the same.

Both password and key authentication types are supported. In order to use
password authentication, the password has to be passed via URL:

bmaptool copy ssh://user:pass@host:path destination

If the URL does not contain a password, we assume key-based authentication is
configured.

Change-Id: Ief72b5bf9adc3e67f25009dc47a90767741826eb
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoTransFile: introduce "_force_fake_seek" attribute
Artem Bityutskiy [Mon, 3 Jun 2013 11:02:16 +0000 (14:02 +0300)]
TransFile: introduce "_force_fake_seek" attribute

TransFile object provide read interface to compressed and/or remote files.
TransFile objects also allow seeking files forward. When the file happens to be
a local uncompressed file, seeking is done using the native 'seek()' method.
Otherwise, we emulate this by just reading the required amount of bytes from the
file and discarding the data.

The way we detect whether we can seek using the native method or not is that we
call 'hasattr(file_obj, "seek")', and if the file object has the "seek()"
method, we use it.

However, there are situations when a files have the "seek()" method, but it is
not really usable. For example, stdout.

This patch introduces an internal attribute named "_force_fake_seek", which
will force fake seek implementation for such file objects.

We do not need this change right now, but will need it soon. So this is just a
preparation for the coming changes.

Change-Id: I0128499e7c3fba0b6aa665ece405ecb33085d4be
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRELEASE_NOTES: improve 2.3 release notes v2.3
Artem Bityutskiy [Tue, 7 May 2013 12:11:27 +0000 (15:11 +0300)]
RELEASE_NOTES: improve 2.3 release notes

Change-Id: If40be06cc19ed45419b4cef65e72a952a7b053cc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoRelease version 2.3
Artem Bityutskiy [Mon, 6 May 2013 08:00:48 +0000 (11:00 +0300)]
Release version 2.3

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agodocs: update release notes for release 2.3
Artem Bityutskiy [Mon, 6 May 2013 07:55:29 +0000 (10:55 +0300)]
docs: update release notes for release 2.3

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCopy: verify bmap file checksum
Artem Bityutskiy [Mon, 6 May 2013 14:51:58 +0000 (17:51 +0300)]
BmapCopy: verify bmap file checksum

If bmap file format is greater than 1.3, verify its integrity by checking the
SHA1 checksum.

Change-Id: I2b1ed51d9eda71fe3f3681cc92314b1bcc83a23f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCreate: generate bmap file checksum
Artem Bityutskiy [Mon, 6 May 2013 14:25:39 +0000 (17:25 +0300)]
BmapCreate: generate bmap file checksum

I got a bug report recently and the investigation showed that it is caused by
corrupted bmap file. Once the user re-downloaded the bmap file, the problem
was solved.

This patch tries to improve robustness by protecting the bmap file with SHA1
checksum. At the very end we calculate the SHA1 checksum of the entire bmap
file with the in-file SHA1 value = all zeroes, and put the result to the bmap
file.

In order to verify the checksum, we will have to substitute the SHA1 checksum
with all zeroes again and calculate SHA1 of the file.

Change-Id: Ia8f109c8238a0e5e2e609f53255a699b35d72cde
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoTransRead: fix pylint warning
Artem Bityutskiy [Mon, 6 May 2013 14:55:23 +0000 (17:55 +0300)]
TransRead: fix pylint warning

Remove an unused module.

Change-Id: I8f6ddc09d49fa4664130b7fc329ee417903529d7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agoBmapCreate: enable scalability optimization
Artem Bityutskiy [Mon, 6 May 2013 14:12:25 +0000 (17:12 +0300)]
BmapCreate: enable scalability optimization

This patch changes the layout of the bmap file a little bit. Before this
change, we wrote the mapped blocks count at the very end, because we only knew
at the very end.

In BmapCopy we need to know the amount of mapped blocks before we start
copying, and this forces us to read entire bmap file to find out the amount of
mapped blocks. This is not an issue when bmap file is small, but if it gets a
lot bigger, this becomes a lot slower.

In this patch, we change bmap file layout a little bit and now we put the
mapped block cound at the beginning of the bmap file. This makes it possible to
parse it more effeciently. This also makes it more human readable.

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