Artem Bityutskiy [Mon, 11 Mar 2013 12:43:22 +0000 (14:43 +0200)]
Release version 2.2
Change-Id: I6bc0773f3faff84e53d46d5997d419ed349ea26a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 8 Mar 2013 09:09:27 +0000 (11:09 +0200)]
RELEASE_NOTES: amendments and prepare for release 2.2
Create own section for release 2.1, and start preparing for release 2.2 by
describing the 2.2 changes.
Change-Id: I621ae05085e2b6a432b66cc9d4ab9c968f38afba
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 8 Mar 2013 08:35:52 +0000 (10:35 +0200)]
TransRead: support URLs with user name and password
Markus Lehtonen reported that bmaptool does not support URLs which contain user
name and password, e.g., https://marquiz:qwerty@server.com/nice.image.bz2.
This patch adds the corresponding support. What we do is we first parse the URL
and try to figure out if it contains user name and password, and if it does,
open the URL with a specially build opener which supports authentication.
Change-Id: I517eb9ffd21ff5de6e9deac4c0cacffe82e53ad5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 8 Mar 2013 07:50:31 +0000 (09:50 +0200)]
TransRead: handle more exceptions
Handle a couple of exceptions from httplib which may be caused by incorrect
URL. Just catch them, and re-raise with a more understandable error message.
The TransRead user will catch it and exit nicely, without a scary stackdupm
like this:
Traceback (most recent call last):
File "./bmaptool", line 389, in <module>
sys.exit(main())
File "./bmaptool", line 373, in main
args.func(args, log)
File "./bmaptool", line 154, in copy_command
copy_command_open_all(args, log)
File "./bmaptool", line 109, in copy_command_open_all
image_obj = TransRead.TransRead(args.image)
File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/TransRead.py", line 232, in __init__
self._open_url(filepath)
File "/mnt/bigssd/dedekind/work/tizen/git/bmap-tools/bmaptools/TransRead.py", line 210, in _open_url
self._file_obj = opener.open(url)
File "/usr/lib64/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1215, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1174, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib64/python2.7/httplib.py", line 958, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.7/httplib.py", line 992, in _send_request
self.endheaders(body)
File "/usr/lib64/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/usr/lib64/python2.7/httplib.py", line 776, in send
self.connect()
File "/usr/lib64/python2.7/httplib.py", line 1160, in connect
self._tunnel()
File "/usr/lib64/python2.7/httplib.py", line 741, in _tunnel
(version, code, message) = response._read_status()
File "/usr/lib64/python2.7/httplib.py", line 371, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
Change-Id: I48c0f63a6c33c816eb8cc833aeb400682c0f861f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 8 Mar 2013 07:47:42 +0000 (09:47 +0200)]
TransRead: introduce a helper for opening URLs
Indroduce an '_open_url()' helper method which opens an URL. This helper will
be useful soon, because we are going to make the URL opening a bit more
complex.
Change-Id: Iaab56d85eef46ed3f1ebc8be37950443100f4d84
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 8 Mar 2013 07:45:31 +0000 (09:45 +0200)]
TransRead: relocate the close method
This is a minor change which relocates the 'close' method to a different place,
in order to keep all the file methods together.
Change-Id: I8a7e481d2788951500c6532bcd2af92bcad57827
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 26 Feb 2013 09:13:12 +0000 (11:13 +0200)]
README: minor typo fix
Change-Id: Ifcd8b7b6a0172e47fb78f6115c4aaf9f826cd5c7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 25 Feb 2013 07:34:05 +0000 (09:34 +0200)]
packaging: correct dependencies for Centos6
Centos6 uses python 2.6 which does not have the argparse module that we use.
However, there is a possibility to add the argparse module by installing the
'python-argparse' package which is available from 3rd party Centos6
repositories. Thus, add the corresponding dependency for Centos6.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Artem Bityutskiy [Fri, 22 Feb 2013 09:22:34 +0000 (11:22 +0200)]
test_fiemap: fix pylint warning
Using builtins like 'filter()' is discouraged nowadays, and pylint generates
this warning:
W: 46,22:_check_ranges: Used builtin function 'filter'
Use a generator expression instead of the 'filter' built-in.
Change-Id: I0b07685967927a84804d443f22369d68da106af3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 12:00:13 +0000 (14:00 +0200)]
BmapCopy: disable a flals pylint warning
Silence this one:
W:275,0: Anomalous backslash in string: '\0'. String constant might be missing an r prefix.
Change-Id: I816d20f284154f2c424a35090461db5a265edcbb
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 11:28:40 +0000 (13:28 +0200)]
BmapCopy: fix writitng to a dm-zero device
Dm-zero devices expose "none" in their '/sys/block/<disk>/queue/scheduler' file
and there is no current scheduler. Our code was assuming there is always the
current scheduler in brackets (e.g., "noop deadline [cfq]"), which lead to a
crash when writing to a dm-zero device:
Traceback (most recent call last):
File "./bmaptool", line 389, in <module>
sys.exit(main())
File "./bmaptool", line 373, in main
args.func(args, log)
File "./bmaptool", line 192, in copy_command
writer.copy(False, not args.no_verify)
File "/mnt/bigssd/dedekind/work/tizen/tools/git/bmap-tools/bmaptools/BmapCopy.py", line 578, in copy
self._tune_block_device()
File "/mnt/bigssd/dedekind/work/tizen/tools/git/bmap-tools/bmaptools/BmapCopy.py", line 535, in _tune_block_device
self._old_scheduler_value = match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
This patch fixes the crash.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Change-Id: Ic13f4f69ee859244e5413d4b0b890d6c599becae
Artem Bityutskiy [Thu, 21 Feb 2013 11:06:23 +0000 (13:06 +0200)]
TransRead: limit the amount of bytes we read at a time
In the function which implements fake seek forward we first calculate the
amount of bytes we have to read from the file to seek forward to the requisted
position, and then read that data in one go. However, the seek may be really
far forward, and we'll end up reading really a lot of data in one go, which
leads to high memory consumption.
This patch fixes the issue by limiting the amount of data we read in one go to
1MiB.
Change-Id: Idfdde2e432c216de34b4675e47c859f5e68a2928
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 09:56:25 +0000 (11:56 +0200)]
bmaptool: print useful information in sace of MemoryError
Catch the MemoryError exception which means that the script ran out of memory
and print useful debugging information in this case (/proc/meminfo and
/proc/self/status).
Change-Id: Ie52b8426867366d5a5110f91f8731c8c9b3b7f54
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 09:00:49 +0000 (11:00 +0200)]
bmaptool: silence few false pylint warnings
W:339,0: Anomalous backslash in string: '\0'. String constant might be missing an r prefix.
W:340,0: Anomalous backslash in string: '\0'. String constant might be missing an r prefix.
W:341,0: Anomalous backslash in string: '\0'. String constant might be missing an r prefix.
Change-Id: I182700967c1efab7137ae368246e5a9537e14976
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 08:40:10 +0000 (10:40 +0200)]
bmaptool: remove an unused variable
Change-Id: I71870ad52cdc4ea374ad1907526bd8d3c3dad6e0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 21 Feb 2013 08:39:19 +0000 (10:39 +0200)]
bmaptool: minor white-space cleanup
Change-Id: I2c50ddf8c98819c9178133fc81943f4ef373d8a7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 20 Feb 2013 12:27:47 +0000 (14:27 +0200)]
Really release version 2.1
Change-Id: I5560450707065676847828f2a7a2ffde67b50b7c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 18 Feb 2013 14:40:57 +0000 (16:40 +0200)]
Release version 2.1
Change-Id: Ib03595e0a404ec0a31efdf6a8aa84d49e656e78b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 18 Feb 2013 14:47:58 +0000 (16:47 +0200)]
tests: make tests work in Fedora 18
The tests create many temporary files and run FIEMAP on them. However, in
Fedora 18 the '/tmp' is tmpfs which does not support FIEMAP, so 'nosetests'
fails. Let's use the current directory for the tests instead.
Change-Id: I2cc2d402fd15517e043e38188d3046876a11cbec
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 18 Feb 2013 14:25:06 +0000 (16:25 +0200)]
TransRead: fix out of memory issues with bzip2 files
This commit fixes a 'bmaptool copy' problem with the following symptom:
Traceback (most recent call last):
File "./bmaptool", line 372, in <module>
sys.exit(main())
File "./bmaptool", line 369, in main
args.func(args, setup_logger(loglevel))
File "./bmaptool", line 191, in copy_command
writer.copy(False, not args.no_verify)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/BmapCopy.py", line 580, in copy
BmapCopy.copy(self, sync, verify)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/BmapCopy.py", line 368, in _get_data
self._f_image.seek(first * self.block_size)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/TransRead.py", line 247, in seek
self._transfile_obj.seek(offset, whence)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/TransRead.py", line 69, in seek
self._pos = _fake_seek_forward(self, self._pos, offset, whence)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/TransRead.py", line 33, in _fake_seek_forward
buf = file_obj.read(to_read)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/TransRead.py", line 102, in read
data = self._read_from_buffer(size)
File "/opt/home/root/bmap/bmap-tools-2.0/bmaptools/TransRead.py", line 81, in _read_from_buffer
data = self._buffer[self._buffer_pos:self._buffer_pos + length]
MemoryError
The reason is that bmaptool runs out of memory when copying a bzip2-compressed
file which has large chunks of zeroes.
I experimented a bit with a 4GiB file full of zeroes and compressed with bzip2.
The memory consumption of 'bmaptool copy' was about 1.4GiB! The reason is that
we read 128KiB of compressed input and decompress them in one go, which results
in a huge output array. The situation with gzip2 is similar, but less severe.
This patch adds a 'chunk_size' parameter to the '_CompressedFile' class
constructor which we can use to limit the maximum amount of data we decompress
at a time. For .bz2 files I found 128bytes to be reasonable, and for gzip files
the default 128KiB seems to be just fine.
Change-Id: Iaeadb69e21332069f0de8b7ce40b7dc72e7b0e02
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 18 Feb 2013 13:57:38 +0000 (15:57 +0200)]
TransRead: minor nicification
The 'decompress_func' argument of the '_CompressedFile' class constructor is
optional, so make it be 'None' by default.
Change-Id: I94e8fc185ae4ccc3e1fc2312dc943908dc7ecdd9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 15:20:57 +0000 (17:20 +0200)]
RELEASE_NOTES: tell that map page was added
Change-Id: I9963416ec0c797664a8d4aeff755e73e5edef8c5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 14:40:38 +0000 (16:40 +0200)]
packaging: add man pages
Change-Id: Id52d41c844ccc25d0189484467674263876ac12e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 14:29:11 +0000 (16:29 +0200)]
Remove the TODO file
.. as it is empty now.
Change-Id: I7a58e103cf65dba0706edc4f3a8ef5a8367cbcac
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 14:28:47 +0000 (16:28 +0200)]
Add bmaptool man page
Change-Id: I9a0e7b29e3d0506801f04000cd20eb4283c253b3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 10:41:27 +0000 (12:41 +0200)]
docs: move documentation to a separate sub-directory
Change-Id: Ife1ba4593725f1691b1cfddd76ff034adecd54c5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 18 Jan 2013 06:51:20 +0000 (08:51 +0200)]
RELEASE_NOTES: a minor fix
Change-Id: I67f781769d212da9e5ec1af337cfaf230f8647da
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 17 Jan 2013 09:36:04 +0000 (11:36 +0200)]
Release version 2.0
Change-Id: I2b6233c43a52b4d4a405584e7f548c0128b22016
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 17 Jan 2013 09:08:01 +0000 (11:08 +0200)]
TransRead: fix a MemoryError issu
Sometimes we run out of memory in TransRead.py, as it was reported by
Dawei Wu <daweix.wu@intel.com>. I believe the problem is that we read too much
of compressed data at a time. If the data contain all zeroes, they are
decompressed into a huge buffer.
Change-Id: I4090cef33dd1afed1015bd29517ac1b8abec9ffa
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 17 Jan 2013 08:21:07 +0000 (10:21 +0200)]
TransRead: fix corner case in the fake seek function
When seeking beyond the file, the fake seek function returned incorrect value.
Fix this.
Change-Id: I44f043e6504d99e6e46beb8e29206d3e2fee119e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 15 Jan 2013 12:53:16 +0000 (14:53 +0200)]
Pre-release version 2.0-rc5
Change-Id: Iad8b4cadbcc294d15bb756ab7dc7e1afbf1b8110
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 14 Jan 2013 15:17:24 +0000 (17:17 +0200)]
TODO: remove an entry about locking
Let's add it when/if it is really needed.
Change-Id: I560093f9cf5335d0bb361cb188be8c4ceb62ce81
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 14 Jan 2013 14:46:42 +0000 (16:46 +0200)]
BmapCopy: restore the block device settings
Always restore the block device settings at the end.
Change-Id: I04ba70598b2e9616d22790248795a460ec710400
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 14 Jan 2013 14:35:13 +0000 (16:35 +0200)]
BmapCopy: fail if an optimization did not work
Instead of hiding failures when we are enabling optimizations - fail. This way
we'll at least notice them.
Change-Id: I683b14188b3181ee4d8bfcf8fca137cd0984e4b2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 14 Jan 2013 14:16:20 +0000 (16:16 +0200)]
BmapCopy: do not check for os.path.exists exceptions
It is very unlikely that it fails, but if it does, we'll just have an unhandled
exception, which is fine in this case.
Change-Id: If89940b0e38ed9874380788c088f44e733d6435f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 14 Jan 2013 09:19:45 +0000 (11:19 +0200)]
README: minor amendments
Change-Id: I474127bf49036db5c35f66e3e8b968f5a4db209e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 7 Jan 2013 08:21:54 +0000 (10:21 +0200)]
Pre-release 2.0-rc4
Change-Id: I0f848639ca9b12cd2ca14bfa0523df729b4b5358
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 8 Jan 2013 15:02:34 +0000 (17:02 +0200)]
bmaptool: improve --nobmap error message
Change-Id: Iccf3994c83fb461105010f6d771f5b091c396840
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 8 Jan 2013 15:00:03 +0000 (17:00 +0200)]
bmaptool: fix flashing without bmap
The auto-discovery function was buggy and returned a junk bmap file name if no
bmap files was found.
Change-Id: I2ab3db14dcccd72e687e6afb8e3cfcaa9c827452
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 7 Jan 2013 08:21:54 +0000 (10:21 +0200)]
Pre-release 2.0-rc3
Change-Id: I54f2f8ed3401a67be28937708085c1c295ac95f2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 4 Jan 2013 14:46:31 +0000 (16:46 +0200)]
TransRead: catch ValueError exceptions
Sometimes urllib2 throws ValueError exceptions when it cannot open a local
file. Catch it as well.
Change-Id: I1f5707ad37d079368a2bf4b3ed3d092c43064387
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 4 Jan 2013 07:57:54 +0000 (09:57 +0200)]
Pre-release 2.0-rc2
Change-Id: I43508315224221e42dbf149dd026b0636b17358e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 4 Jan 2013 07:47:22 +0000 (09:47 +0200)]
bmaptool: slight readability imporovement
Full paths may be very long, so print only basenames in the informational
messages.
Change-Id: Iae2a1a35112f1da3f6d613b33d986d60ffe7c5e5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Mikko Ylinen [Fri, 4 Jan 2013 07:39:39 +0000 (09:39 +0200)]
bmaptool: add image_size parameter to BmapBdevCopy constructor
Align BmapBdevCopy class contructor parameters with BmapCopy
class consturctor parameters.
Change-Id: Idc941e0f4baaeee5c8f52772aa536e56848129fa
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 4 Jan 2013 07:34:21 +0000 (09:34 +0200)]
bmaptool: print auto-discovered bmap file correctly
When the bmapfile was auto-discovered, we did not print its name correctly.
Change-Id: Ief4747ccc401219ac2cd546e6a0c2b00f5b020ff
Reported-by: Mikko Ylinen <mikko.ylinen@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 08:52:10 +0000 (10:52 +0200)]
Pre-release 2.0-rc1
Change-Id: I0a46065988a14183ee33c49fc571974f4b09d188
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 11:21:19 +0000 (13:21 +0200)]
BmapCopy: implement progress wheel
.. for the cases when the image size is not known.
Change-Id: I44a892aca1a34f1acc47aef396dfb4c27717bb1b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 11:20:56 +0000 (13:20 +0200)]
bmaptool: do not discover bmap if --nobmap was given
Change-Id: Ia4dcfa3da319d079500b0849f07f52633534d464
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 08:41:26 +0000 (10:41 +0200)]
RELEASE_NOTES: prepare 2.0-rc1 release notes
Change-Id: Ie7744bd4d0bbdac644dcf56b4870eb31e891bfeb
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 08:25:59 +0000 (10:25 +0200)]
TODO: remove a done entry
Change-Id: Ie27fe214f2d6668536b05e96b5596064dd6ae0a8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 08:23:25 +0000 (10:23 +0200)]
bmaptool: do not print progress bar when --quiet was used
Change-Id: Ibffa68a2dd2d541b37e187cd81e50b9e4bad7bee
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 20 Dec 2012 08:21:19 +0000 (10:21 +0200)]
bmaptool: provied a link to the docs in help output
Change-Id: Id4d130ee29af411119ff5218ff99190f011f12a8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 16:25:57 +0000 (18:25 +0200)]
TransRead: fix opening URLs
Proxy did not work.
Change-Id: I0e7bf28bc7bf232a24aaa1a3898188a9c3207621
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 15:55:53 +0000 (17:55 +0200)]
bmaptool: implement automatic bmap file discovery
Change-Id: I25abad028cab641ab6a143562783d8cbe516ff1e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 14:28:12 +0000 (16:28 +0200)]
TODO: add another item
Change-Id: I766107ec1d93fed45f4e9dfa17623d0c1fae5f2d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 14:13:06 +0000 (16:13 +0200)]
BmapCopy: small documentation improvements
Change-Id: I8e39c895d930ea8d9eeef1ff80cb45cc0e359819
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 14:09:51 +0000 (16:09 +0200)]
TransRead: fix few pylint warnings
Change-Id: I19af8f035c3469fc4035a0f075100f230475e06b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 14:08:43 +0000 (16:08 +0200)]
TransRead: improve comments a bit
Change-Id: I80ef9be8e7ab82935c2da26e902749c2ff74a18a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 15:07:13 +0000 (17:07 +0200)]
test_api_base: test urllib2 as well
Prepend "file:" to file names sometimes to make all the I/O go through urllib2.
Change-Id: I0ed499f33edb7b7c2ec43a69bec4ed781716a8b3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 13:47:37 +0000 (15:47 +0200)]
TransRead: cleanup fake seek
Instead of patching objects run-time, just add seek() and tell() methods
to classes we need to support and use a helper '_fake_seek_forward()' function
from there. This is cleaner.
Change-Id: Ib8ca83eb078322e5468206b4440051451eac70ab
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 13:07:59 +0000 (15:07 +0200)]
BmapCopy: make error message more verbose
Print all file names in case of short read/write error.
Change-Id: If86e676541371d246f4202a736604d4024cbe6b6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 09:00:11 +0000 (11:00 +0200)]
BmapCopy: print file name as well
When printing about SHA1 mismatch, also print the image file name.
Change-Id: I5c5aeea63943e15dfecc8a00db92e620cb45c7f9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 11:05:41 +0000 (13:05 +0200)]
TransRead: switch to stream tar decompression
Unfortunatelly we lose the check for amount of members, because it is not
compatible with stream extraction as it generates random seeks.
Change-Id: I5b56d2283abeca298e90c212d460049fd06b4a4c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 10:40:23 +0000 (12:40 +0200)]
TransRead: switch to CompressedFile for gzip compression
Switch to use the '_CompressedFile' class for gzip files as well. The benefit
is that it does not require 'seek()' in the underlying file object, which
urllib2 does not provide.
Change-Id: Id737374885b29cf162976cea4a249ded55f5978f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 09:41:08 +0000 (11:41 +0200)]
TransRead: get rid of the __getattr__ method
The TransRead class implements very limited file-like objects. It is safer
to explicitely specify all the methods it supports, instead of defaulting
to the methods of the underlying 'transfile_obj'.
Change-Id: I51c4ee16f0313e0b39741f10bc04d480e48d19dc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 09:36:11 +0000 (11:36 +0200)]
TransRead: generalize the Bzip2Read class
Turn it into a '_CompressedFile' class which can transparently decompress any
compressed file-like object granted there is the 'decompress(buffer)' function
available.
Change-Id: I69e48052cccbd2ad7237456b1c49c4d9994522f1
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 09:35:53 +0000 (11:35 +0200)]
TODO: add another entry
Change-Id: Ifff6c1a61f502e7b39b4d2b4bd1471b9f32fcf6c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 16:21:11 +0000 (18:21 +0200)]
test_api_base: use stdout for progress bar
Because otherwise the output is visible when runnint nosetest without -s.
Change-Id: Ifa9ec61f4fdf2679bab215b316e70afcf7a6ad15
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 19 Dec 2012 09:07:52 +0000 (11:07 +0200)]
TransRead: code re-arrangement
Move class Error a little bit up.
Change-Id: Ia5308ff3fbb3f4098bd9ca01d43a814a8c6475cf
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 14:16:01 +0000 (16:16 +0200)]
TransRead: implement better fake seek method
Implement a generic '_add_fake_seek()' function which adds fake seek support to
any file-like object.
Also add support of URLs - open them using urllib2.
Change-Id: I20467631136031f3471f8c7d3ee79927d3fc4719
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 14:56:53 +0000 (16:56 +0200)]
test_api_base: add an extra assertion
Change-Id: Ic0aab643450b00a9d31444c2fc86102279f29ead
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 14:53:02 +0000 (16:53 +0200)]
tests: helpers: remove unnecessary truncation
Change-Id: I72737ea81032cd4b72324727a9e1ae2d74b1d5c3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 13:22:21 +0000 (15:22 +0200)]
test_base_api: generate uncompressed files as well
Improve the '_generate_compressed_files()' and make it generate uncompressed
vesion of the file as well.
Change-Id: Ie2d042180a152914d42340c01e48f5a887da4185
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 12:30:04 +0000 (14:30 +0200)]
test_api_base: rework the test to match the changed API
BmapCopy does not accept paths anymore - amend the tests.
Change-Id: Ib78dcceb959bce673c08bfb1dca0aa86b985c7d4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 10:42:02 +0000 (12:42 +0200)]
BmapCopy: drop the file opening functionality
The BmapCopy class is getting too large and specialized. Improve the situation
by changing the API and removing the file opening functionality. Now it
requires file-like objects all the time. The bmaptool, in turn, now opens the
files itself.
Change-Id: Id62794dfcf21e422fb5e4b9a3a025b2beb25506f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 10:41:19 +0000 (12:41 +0200)]
TransRead: implement the 'name' attribute
The standare attribute for the file name in file objects is 'name', not
'fullpath' - rename it.
Change-Id: I4544bab07c185a730c351fcefd8ff19047162ee7
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 17 Dec 2012 07:52:14 +0000 (09:52 +0200)]
BmapCopy: document that BmapCopy objects are one-time usable
Change-Id: I92ce7cd9444491386ababa93e9b747b00891e29a
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 13:49:11 +0000 (15:49 +0200)]
TransRead: implement reading from file object
This patch changes the way we open the file: instead of opening by name, open
it by its file object. This is not needed right now, but one of the next
patches will implement reading from an URL, in which case we'll have to be able
to read and decompress from a urlib file-object. In other words, this is a
preparations.
The good thing is that both tarfile and gzip modules allow to open by file
objects. However, the bad news is that bzip2 module does not support this.
This is why we implement the '_Bzip2Read' class which is a simple wrapper over
bzip2's 'stream decompressor': we just read from the back-end file-like object,
stream the data trhough the bzip2 decompressor, and provide to the caller.
Change-Id: I241c1dad4a0bc9619af61f393e6834b9568545fc
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 16:12:07 +0000 (18:12 +0200)]
BmapCopy: add a /dev/null quirk
It is sometimes useful to copy to /dev/null, e.g., for benchmarking. Hoever,
the /dev/null character device does not support 'fsync()', so bmaptool dies.
Intorduce a quirk for this situation.
Change-Id: Ic61bf86ad5a4e112d7ccd82aa41114dc8b207361
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 09:38:43 +0000 (11:38 +0200)]
TransRead: improve file size detection
In case of a tar archive, we know the file size for 'TarInfo'. Propagate it to
the users via our 'size' attribute.
Change-Id: I11dc7daa1d788fe98769ba6537f4117d89d06b34
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 15:44:52 +0000 (17:44 +0200)]
TODO: add an entry about improving the progress bar
Change-Id: Ib7b3ca6d63ff1d1fbe5d16f96080600f4f92ff39
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 13:04:30 +0000 (15:04 +0200)]
BmapCopy: make object one-time usable
Make the 'BmapCopy' objects usable only once, just like many other
complex objects like Bzip2File.
The reason for this is that it is too complex to make them re-usable,
because this requires seeking image file and the destination file to the
beginning, and not all files are easily seekable.
In fact, some files are not seekable at all. So remove the unneeded
complexity.
Change-Id: I30ecdd44dead485ae9d187e3487b0efa548c15d5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 13 Dec 2012 17:32:16 +0000 (19:32 +0200)]
TransRead: introduce a TransRead module
Separate out the transparent file reading functionality to a module.
We'll add reading from an URL soon, so the module will become more complex.
Change-Id: I7bd45fba5c6265f10f1a41ba109e3662a8f50d7b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 08:29:54 +0000 (10:29 +0200)]
test_api_base: include set_image_size testing
Improve test coverage by also testing the 'set_image_size()' interface of
'BmapCopy'.
Change-Id: I86d8541a127a8ea514cad8a666bc49da52b29435
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 08:24:34 +0000 (10:24 +0200)]
tests: helpers: change generate_test_files's interface a bit
Improve the API of the 'generate_test_files()' helper and teach it to return
file size. This allow testing the 'BmapCopy' module a bit better in the next
patch.
Also propagate the size to the 'do_test()' method of the 'test_api_base' test.
Change-Id: Ib20f57bc6120d770d59dec5705f6f5ffae4300ca
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Fri, 14 Dec 2012 07:58:09 +0000 (09:58 +0200)]
BmapCopy.py: allow users setting image size
The user sometimes knows the size of compressed image, so let him/her set it
in order to enable the progress bar.
This patch essentially changes an internal method to a pulic method.
Change-Id: I91e8c5de8196b17ae6bb8cab963bdc11145ede3c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 13 Dec 2012 12:43:24 +0000 (14:43 +0200)]
TODO: add another improvement idea
Change-Id: I86f91d1d157a2dfc26fefb9981e489142fc3c36d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 13 Dec 2012 11:59:05 +0000 (13:59 +0200)]
bmaptool: disable pylint recommendation
Disable the 'too many statements' recommendation.
Change-Id: I514038cb7c5c7e472f7da66aba2762160b3a92bf
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 13 Dec 2012 11:54:49 +0000 (13:54 +0200)]
bmaptool: refuse copying without bmap by default
Allow copying without bmap only when the --nobmap. This way users will for
sure notice when they copy without bmap.
Change-Id: If323e995a22df23b4365859c940e1717fa7e8d28
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Thu, 13 Dec 2012 09:44:37 +0000 (11:44 +0200)]
TODO: add few new ideas to the list
Change-Id: I1272fadc84463a5b9fddc58706eda4756fcfada4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 14:52:18 +0000 (16:52 +0200)]
TODO: remove an entry about magic sequences
I've tried this, it is not really eassy to do. For example, for tar.bz2
and .bz2 the magic sequence is the same. Lets' leave it as it is.
Change-Id: I4919b1c35104457b1aa42b367e227497f9fd1127
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 14:20:10 +0000 (16:20 +0200)]
README: master branch points to the latest release
Update the documentaion and tell that the master branch points to the latest
release, not pre-release.
Change-Id: Icb51a71b36809097c84466f5d7cbbffdf9c4ffe0
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 14:01:12 +0000 (16:01 +0200)]
bmaptool: improve warning message
The tool tries to be generic and it is better to use word "copying" instead of
"flashing".
Change-Id: I85ac53a955da14a6acf4ef87cf72005b9d550ee4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 13:59:43 +0000 (15:59 +0200)]
test_api_base: use progress indicator sometimes
Increase test coverage by using the progress indicator or the BmapCopy class
sometimes.
Change-Id: I2fd766de7d171965a2784e497b42ac358f75d4d9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 13:51:25 +0000 (15:51 +0200)]
BmapCopy: implement progress inicator
I got a feature request from users to implement a progress bar in order to
show that the process is alive. This commit implements it.
I add a possibility to configure the BmapCopy class to print the progress
indicator to a user-defined file object with a user-defined pattern.
Change-Id: Ida0331a692163cbcf909ebf984917e2466eb0b70
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Wed, 12 Dec 2012 08:20:01 +0000 (10:20 +0200)]
bmaptool: make warnings and errors more visible
People usually do not read docs and forget to use the --bmap option, and then
wonder why flashing is not fast enough. bmaptool prints some kind of warning
in this case, but it is not visible enough. Make it to be more visible:
1. Change the message to say that flashing will be slow.
2. Make the warning/error prefix to use capital letters.
3. Make the output to be coloured.
This should hopefully draw more attention and people will notice warnings
and errors more easily.
Change-Id: Iccf44430c5b9e671a5d540c2966fead3aa800337
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 11 Dec 2012 12:41:40 +0000 (14:41 +0200)]
TODO: add an entry about progress indicator
Change-Id: I05d16959ceec0dcfe800179a566ee82267233c00
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Tue, 4 Dec 2012 09:54:34 +0000 (11:54 +0200)]
packaging: remove an internal URL
Change-Id: Ide9bf02a7ff0e02f1e7eaca6a2b46e98fffb0839
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 3 Dec 2012 08:08:23 +0000 (10:08 +0200)]
Release bmap-tools version 1.0
Change-Id: Ifa6e3142330bc2a082ed05a678a5c3a2dbf937b4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Artem Bityutskiy [Mon, 3 Dec 2012 07:57:34 +0000 (09:57 +0200)]
RELEASE_NOTES: turn into 1.0 notes
I am going to make release 1.0, and there are no differences between 1.0-rc7
and 1.0, so let's turn rc7 release notes into 1.0 release notes.
Change-Id: I01f69aae0103af7b96464efe6b0cd2d6d5126a38
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>