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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>