2019-07-06 Fabiano Fidêncio  <fidencio@redhat.com>
    
    Don't expose the root_password via command line
    Instead of exposing the root-password in the command line, let's just
    improve our way of handling the option and also accept a 'file:'
    selector.
    
    Together with this change, let's warn the users that using
    --root-password in the old manner is not recommended and that the
    'file:' selector should be used instead.
    
    Reviewed-by: Radostin Stoyanov <rstoyanov1@gmail.com>
    
    
2019-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Set SElinux file context of destination folder
    Set file context to 'container_file_t' on the destination folder when
    SElinux is enabled.
    
    Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
    Tested-by: Fabiano Fidêncio <fidencio@redhat.com>
    
    
2019-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use absolute destination path
    In order to avoid issues, for example, when virt-sandbox might not
    convert relative to absolute path, make sure that we always use
    absolute destination path.
    
    Reviewed-by: Cole Robinson <crobinso@redhat.com>
    Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
    Tested-by: Fabiano Fidêncio <fidencio@redhat.com>
    
    
2019-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    safe-untar: Inherit SElinux context
    Allow virt-sandbox to inherit the SElinux context of virt-bootstrap.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1655305
    https://bugzilla.redhat.com/show_bug.cgi?id=1671794
    
    Reviewed-by: Cole Robinson <crobinso@redhat.com>
    Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
    Tested-by: Fabiano Fidêncio <fidencio@redhat.com>
    
    
2019-05-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Fix pylint too many blank lines
    Reviewed-by: Cole Robinson <crobinso@redhat.com>
    
    
2019-01-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Don't allow overwriting of the root partition
    Closes #7
    
    Reported-by: @loops
    
    
2018-05-31 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Update NEWS file
    
    
2018-05-31 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Bump version to 1.1.0
    
    
2018-04-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    safe_untar: Check for permissions to set attribs
    Make sure we have permissions to restore file extended attributes.
    
    [1] ... all processes have read access to extended security attributes,
    and write access is limited to processes that have the CAP_SYS_ADMIN
    capability.
    
    [2] The file owner and processes capable of CAP_FOWNER are granted the
    right to modify ACLs of a file. This is analogous to the permissions
    required for accessing the file mode. (On current Linux systems, root
    is the only user with the CAP_FOWNER capability.)
    
    [1] https://linux.die.net/man/5/attr
    [2] https://linux.die.net/man/1/setfacl
    
    
    
2018-04-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Support blobs without .tar ext
    Since skopeo v0.1.29 [1] blobs are saved without the .tar extension.
    This commit changes the docker-source module to handle both cases (with
    or without .tar extension)
    
    [1] commit: projectatomic/skopeo@43acc74
    Fix skopeo tests with changes to dir transport
    
    The dir transport has been changed to save the blobs without the .tar extension
    Fixes the skopeo tests failing due to this change
    
    
    
2018-04-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: fix typo
    
    
2018-04-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Revert "docker-source: Support blobs without .tar ext"
    This reverts commit 6146e9ab5e36ff894b8c95d00a45db6181ad8472.
    
    
2018-04-10 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Preserve extended file attributes
    Preserve extended file attributes of extracted rootfs as described in
    https://github.com/opencontainers/image-spec/blob/master/layer.md
    
    
    
2018-04-10 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: docker_source: Update description
    
    
2018-04-10 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Support blobs without .tar ext
    Since skopeo v0.1.29 blobs are saved without the .tar extension.
    
    See commit: projectatomic/skopeo@43acc74
    Fix skopeo tests with changes to dir transport
    
    The dir transport has been changed to save the blobs without the .tar extension
    Fixes the skopeo tests failing due to this change
    
    
    
2018-04-10 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: docker_source: Remove unused code
    
    
2018-04-10 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: docker_source: Mock out is_installed()
    Commit b38f588 (source-docker: Show error if skopeo not installed)
    introduced a check used by Docker-souce to verify that skopeo is
    installed. However, the unit test cases in TestDockerSource do not
    aim to ensure that skopeo is installed and therefore this check is
    redundant.
    
    
    
2018-03-12 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    setup: Use pylint/pycodestyle modules
    Use pylint/pycodestyle modules instead of calling the executables
    to ensure that Python 3 code is checked with Py 3 version of
    pylint/pycodestyle.
    
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    setup: Use pylint-3 and pycodestyle-3
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    pylint: Resolve similar lines
    This patch resolves the following pylint warning:
    
    R:  1, 0: Similar lines in 2 files
    ==virtBootstrap.sources.docker_source:306
    ==virtBootstrap.sources.file_source:87
    dest,
    self.uid_map,
    self.gid_map,
    (self.root_password is None)  # Create new disk?
    )
    
    else:
    raise Exception("Unknown format:" + self.output_format)
    (duplicate-code)
    R:  1, 0: Similar lines in 2 files
    ==virtBootstrap.sources.file_source:50
    ==virtBootstrap.sources.virt_builder_source:58
    self.output_format = kwargs.get('fmt', utils.DEFAULT_OUTPUT_FORMAT)
    self.uid_map = kwargs.get('uid_map', [])
    self.gid_map = kwargs.get('gid_map', [])
    self.root_password = kwargs.get('root_password', None)
    self.progress = kwargs['progress'].update_progress
    (duplicate-code)
    
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    pylint: Resolve logging-not-lazy
    Specify string format arguments as logging function parameters
    (logging-not-lazy)
    
    https://docs.python.org/3/library/logging.html#logging.Logger.debug
    
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    pylint: Resolve - two spaces before comment
    E261 at least two spaces before inline comment
    
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    pylint: Resolve test for membership
    E713 test for membership should be 'not in'
    
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add empty line at the end of file
    Resolves pylint: "W292 no newline at end of file"
    
    
2018-03-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    pylint: Provide modules instead of files
    We should give Pylint the name of a python package or module. [1]
    
    A python module is a file containing Python definitions and statements
    or directory containing the input script (__init__.py) [2]
    
    1: https://pylint.readthedocs.io/en/latest/user_guide/run.html#invoking-pylint
    2: https://docs.python.org/2/tutorial/modules.html
    
    
    
2017-12-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Get list of layers without `--raw`
    When `skopeo inspect --raw docker://feodra` is used the returned
    manifest content contains a list with manifests for specific
    platforms [1] rather than a list with layers.
    
    By using `skopeo inpect docker://fedora` the correct manifest
    content is retrieved and a list with layers is provided. In addition,
    skopeo handles the difference between schemaVersion 1 and 2.
    
    [1] https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
    
    
2017-12-12 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    docker-source: Avoid skopeo copy in cache
    The `skopeo copy` command has changed it's behaviour to keep only a files for
    single container image per directory. To get around this and keep cache of
    downloaded images is used temporary destination directory for 'skopeo copy'
    and image files are then moved in the cache folder.
    
    
2017-11-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    source-docker: Show error if skopeo not installed
    Show appropriate error message when skopeo is not installed.
    
    
2017-11-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Show error when guestfs-python is not installed
    Show appropriate error message when the python bindings for
    libguestfs are not installed.
    
    
2017-11-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    utils: Add is_installed function
    Add utility function to check whether an executable is available in
    the PATH env variable.
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    NEWS: fix formatting
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Add NEWS files
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Bump version to 1.0.0
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Prepare setup.py for release
    Clean up the file, tell the world we are now stable enough, generate
    ChangeLog and AUTHORS files and add license header. Add the test files
    to the distribution.
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    README: complete dependencies list
    
    
2017-09-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    tox setup: pass HOME environment variable
    Tests need the HOME environment variable, tell tox to pass it to the
    virtual environment.
    
    Also fix line endings of tox.ini to unix ones.
    
    
2017-09-06 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    python3 compat: python3 strings have no decode()
    Since python3 strings are already Unicode-capable, there have no
    decode() function. Libguestfs content strings can be either python 2
    or 3 strings, only decode them to utf-8 for python2.
    
    
2017-09-06 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    docker: only one layer drive per guestfs appliance
    The current code was trying to save time by adding all drives to the
    guestfs handle and launch the instance from it. However, this doesn't
    fly since backing chain images would be used more than once.
    
    To bad for performance, but sticking to one layer per guestfs launch
    is safer and gets the tests to the pass.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add man page for virt-bootstrap
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use cache directory to store downloaded tar files
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Update doc strings
    These documentation can be seen using:
    
    $ pydoc virtBootstrap
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Show warning for unprivileged users
    Show warning message and don't allow ownership mapping for non-root
    user when the output format is 'dir'.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Define source code encoding
    The default source code encoding in Python2.* is ASCII (PEP 263 [1])
    and in Python3.* is UTF-8 (PEP 3120 [2]). Define the encoding on top
    of each file for consistency.
    
    [1] https://www.python.org/dev/peps/pep-0263/
    [2] https://www.python.org/dev/peps/pep-3120/
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use environment variable for temporary directory
    Allow the user to specify path for temporary directory used by
    virt-bootstrap using the `VIRTBOOTSTRAP_TMPDIR` environment variable.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Update helper message for source uri
    Use more general description for source URI.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve readability of parser arguments
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add --version flag
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add virt-builder source
    Add implementation for virt-builder source which aims to create
    container root file system from VM image build with virt-builder.
    
    Usage examples:
    $ virt-bootstrap virt-builder://fedora-25 /tmp/foo
    $ virt-bootstrap virt-builder://ubuntu-16.04 /tmp/bar --root-password secret
    $ virt-bootstrap virt-builder://fedora-25 /tmp/foo -f qcow2 --idmap 0:1000:10
    $ sudo virt-bootstrap virt-builder://fedora-25 /tmp/foo --idmap 0:1000:10
    
    Tests are also introduced along with the implementation. They cover
    creation of root file system and UID/GID mapping for 'dir' and 'qcow2'
    output format by mocking the build_image() method to avoid the time
    consuming call to virt-builder which might also require network
    connection with function which creates dummy disk image.
    Setting root password is handled by virt-builder and hence the
    introduced test only ensures that the password string is passed
    correctly.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Set root password with guestfs-python
    Use the python bindings of libguestfs to create additional qcow2 image
    which has as backing file the last layer (layer-0.qcow2 for FileSource)
    and insert hashed value of given root password in the /etc/shadow file.
    
    Note: This additional qcow2 image is also used to apply UID/GID map.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Enable UID/GID mapping for qcow2
    Apply ownership mapping in qcow2 images using libguestfs python
    bindings. To make this solution more general we introduce function
    guestfs_walk() which will return the root file system tree of disk
    image along with UID/GID values.
    
    These changes are applied in additional qcow2 disk image using the
    last layer as backing file. For FileSource this is layer-1.qcow2
    with backing file layer-0.qcow2.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Create qcow2 images with guestfs-python
    Use the python bindings of libguestfs to create qcow2 image with
    backing chains to mimic the layers of container image.
    
    This commit also changes the behavior of FileSource when 'qcow2'
    output format is used. Now the string layer-0.qcow2 will be used
    as name of the output file.
    
    This change is applied in the test suite as an update to the function
    get_image_path().
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Simplify setting permissions of shadow file
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Make set_root_password_in_rootfs reusable
    Make the code for setting password hash in the content of shadow file
    reusable and hence can be used with qcow2 output format.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    UID/GID mapping: Use empty list instead of None
    Resolve an issue when only uid_map or only gid_map is specified.
    
    We set the default values to None. However, `len(None)` will raise
    an exception. To avoid this we need to set the default values to
    [] (empty list).
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Split the function mapping_uid_gid
    Split the function mapping_uid_gid in two parts so that the code which
    makes both lists map_uid and map_gid with equal length can be
    reused.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Make UID/GID mapping reusable
    Move the functions implementing UID/GID mapping in the utils module
    and hence they can be reused with qcow2 output format.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Make get_compression_type() reusable
    Take out the code for getting compression type of tarball
    in separate function.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Get layer size if not provided
    Docker registry with Manifest v1 does not require the size of layers to
    be included. However, when this information is not provided we can use
    os.path.getsize() to get and show the size of tarball. We can also
    use this function for FileSource to provide consistent output messages.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Split checksum and layers
    The current implementation store in one list:
    - checksum
    - checksum type
    - file path
    - file size
    However, the information about checksum and checksum type is only used
    to verify the content of tarball before it is being extracted. Splitting
    these into separate lists would allow us to reuse the function
    untar_layers() with FileSource.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    get_mime_type: Properly close stdout handle
    This aims to fix the warning of Python3:
    ResourceWarning: unclosed file <_io.BufferedReader name=3>
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    untar: Use unique name with virt-sandbox
    Specify unique name when creating Libvirt domain with virt-sandbox.
    Otherwise the default name "sandbox" will be used and this might result
    in collision with another instance of virt-bootstrap.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add regression tests
    These tests aim to verify the output of virt-bootstrap by creating tar
    archives which contain dummy root file system and call the function
    bootstrap(). The check the extracted root file system.
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve untar command
    Add "--overwrite" to enforce the overwrite of existing files.
    
    Add the flag "--absolute-names" to disable the strip of leading '/'s
    This is used to get around the error "Cannot open:Permission denied"
    which occurs when the qemu driver is used by virt-sandbox. It is used
    for unprivileged users to create isolated environment in which tar is
    executed to extract the content from container image layers.
    
    In particular this error occurs when the tar archive contains symbolic
    link which has target path starting with '/'.
    
    Steps to reproduce:
    $ mkdir /tmp/foo
    $ cd /tmp/foo
    $ touch file
    $ ln -s /tmp/foo/file link
    $ tar -cf archive.tar link
    $ mkdir /tmp/foo/dest
    $ virt-sandbox -c qemu:///session \
    -m host-bind:/mnt=/tmp/foo/dest \
    -- /bin/tar xf /tmp/foo/archive.tar -C /mnt
    
    Error message:
    tar: link: Cannot open: Permission denied
    tar: Exiting with failure status due to previous errors
    
    
2017-08-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Drop unit tests
    Unit tests were used to ensure that functions and methods work as
    expected. However, these tests are closely related to the
    implementation and will result in major changes after some refactoring.
    To reduce the amount of work needed to add new features or changes to
    the code most of these tests will be replaced with more abstract form
    of testing introduced in the following commits.
    
    
2017-08-03 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Add a more to gitignore
    
    
2017-08-03 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Add guestfs python binding dependency
    Adding the python binding of libguestfs as dependency will allow
    switching from calls to the virt-* tools and potentially optimize
    processing time.
    
    
2017-08-03 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Use requirements.txt for dependencies
    Later on when we will introduce libguestfs dependency, we would need
    to add a dependency_links to setup.py. This is rather hacky and
    https://caremad.io/posts/2013/07/setup-vs-requirement/ recommends
    using requirements.txt.
    
    Thus, to install the package when all dependencies are already
    installed, the following command can be used:
    
    python setup.py install
    
    Otherwise, the recommended way is to use pip as follows:
    
    pip install -r recommends.txt -e .
    
    This will also download the guestfs python binding, build and install
    it. However this would be skipped if installed from a linux distro
    package if this one provides the egg-info.
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Split 'sources' module into files
    Improve readability by spliting the 'sources' module into separate
    files. Each file contains only one class.
    
    In addition update the mock statements in the unit tests to match these
    changes.
    
    Add recursive-include in MANIFEST.in to include virtBootstrap.sources
    module.
    
    Update the unit tests to match these changes.
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    setup: Use find_packages()
    The find_packages() [1] function returns a list of package names
    suitable for use as the packages argument to setup().
    
    [1] http://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use explicit import
    Reduce the number of import statements and improve readability.
    Update the unit tests to match these changes.
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Remove redundant arguments
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    sources: Use default values of arguments
    
    
2017-08-03 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    sources: Set default format with a constant
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add unit tests for the "utils" module
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add unit tests for "progress" module
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add unit tests for FileSource
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add unit tests for DockerSource
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add unit tests for 'virt_bootstrap' module
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use tox to test against multiple Python versions
    'Tox' is tool that will check if the package installs correctly and all
    unit tests pass with different Python versions.
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add support for setting root passowrd in qcow2
    For containers bootstrapped in qcow2 format use the tool 'virt-edit'
    to insert the hashed root password in the shadow file of the last layer
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Show correct err msg on skopeo fail
    The first argument of CalledProcessError() must be the returncode not
    the command.
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Fix formula of download progress
    When downloading image with multiple layers, the download progress
    value of every following layer should not start from 0.
    
    If we have 10 layers, downloading each of them should increase the
    total download progress by 10%.
    
    Assuming that the download and extraction are 50/50 of the total work.
    
    Then, downloading each of 10 layers will increase the progress value
    with 5% of the total work.
    
    When all layers are downloaded the progress value should be 50%.
    
    However, with the current formula the progress value of each layer
    starts from 0%.
    (E.g. when downloading 2nd layer of 10 the download progress starts
    from 0% instead of 5%.)
    
    This bug can be seen when downloading images with multiple layers of
    large size.
    
    Example:
    virt-bootstrap docker://rails /tmp/foo --status-only
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    tests: Add test suite
    
    
2017-07-24 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add remapping ownership of files in rootfs
    When Libvirt creates LXC container with enabled user namespace the
    ownership of files in the container should be mapped to the specified
    target UID/GID.
    
    The implementation of the mapping is inspired by the tool uidmapshift:
    http://bazaar.launchpad.net/%7Eserge-hallyn/+junk/nsexec/view/head:/uidmapshift.c
    
    Mapping values can be specified with the flags:
    
    --idmap    Map both UIDs/GIDs
    --uidmap   Map UIDs
    --gidmap   Map GIDs
    
    Each of these flags can be specified multiple times.
    
    Example:
    
    virt-bootstrap docker://fedora /tmp/foo --uidmap 0:1000:10 --gidmap 0:1000:10
    
    Will map the ownership of files with UIDs/GIDs: 0-9 to 1000-1009
    
    The same result can be achived with:
    
    virt-bootstrap docker://fedora /tmp/foo --idmap 0:1000:10
    
    Multiple mapping values can be specified as follows:
    
    virt_bootstrap.py docker://ubuntu /tmp/foo --idmap 0:1000:10 --idmap 500:1500:10
    
    This will map the UID/GIDs: 0-9 to 1000-1009 and 500-509 to 1500-1509
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Update argument helpers
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Specify logger name when executed directly
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    readme: Fix typo
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Drop need of root privileges to set root password
    These changes aim to avoid the requirement for root privileges when
    setting the password of root user on root file system.
    
    The "-R, --root" flag of chpasswd is using chroot to apply changes in
    root file system and this requires root privileges. [1]
    
    Instead compute hash of the root password using passlib [2] and insert
    the value in the /etc/shadow file in the rootfs.
    
    [1] https://en.wikipedia.org/wiki/Chroot#Limitations
    [2] http://passlib.readthedocs.io/en/stable/lib/passlib.hosts.html
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Add support for Manifest version 1
    Handle differences between version 1 and 2 of the Manifest file for
    Docker registry.
    
    Layers' blob sums in v1 are stored in a list "fsLayers" and the digest
    is stored in following filed with name "blobSum". [1]
    
    In v2 the layer list is stored in field with name "layers" and
    ordered starting from the base image (opposite order of v1). The digest
    is stored under a following field with name "digest". The size in bytes
    is included in a field with name "size". [2]
    
    [1] https://docs.docker.com/registry/spec/manifest-v2-1/#manifest-field-descriptions
    [2] https://docs.docker.com/registry/spec/manifest-v2-2/#image-manifest-field-descriptions
    
    
2017-07-21 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Python 3/2 compatibility: Convert Byte-str to Str
    Encoded Unicode in Python 3 is represented as binary data. The
    difference with Python2 is that any attempt to mix text and data in
    Python 3.0 raises TypeError, whereas if you were to mix Unicode and
    8-bit strings in Python 2.x, it would work if the 8-bit string happened
    to contain only 7-bit (ASCII) bytes, but you would get
    UnicodeDecodeError if it contained non-ASCII values.
    
    Reference:
    https://docs.python.org/release/3.0.1/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit
    
    Example:
    
    Python 2:
    
    >>> b'foo.bar'.split('.')
    ['foo', 'bar']
    
    Python 3:
    
    >>> b'foo.bar'.split('.')
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: a bytes-like object is required, not 'str'
    
    >>> b'foo.bar'.split(b'.')
    [b'foo', b'bar']
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Don't calc progress on short lines
    Perform additional check of the input to avoid unexpected behaviour
    when string is passed instead of list or a list with short length.
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Remove '/' at the end of URI
    This change aims to convert URI:
    
    docker:///repository/my_image/
    to:
    
    docker://repository/my_image
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Encapsulate URI generation
    This change makes it easier to test the code.
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Encapsulate layers' info retrieval
    This change makes it easier to test the code.
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    sources: Update doc strings
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    utils: bytes_to_size remove trailing space
    Remove traling space which occurs when the number is
    smaller than kibibyte.
    
    
2017-07-18 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    utils: size_to_bytes convert from int
    When converting 0 KB with string input the result will be string
    with zeroes.
    
    >>> print(size_to_bytes('0', 'KB'))
    000000...
    
    Instead convert the string input to integer and then perform the conversion.
    
    Rename the variable from "string" to "number" to avoid confusion.
    
    
2017-07-18 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Add script to run virt-bootstrap for hackers
    run script takes care of setting the environment variables (only
    PYTHONPATH so far) needed to run virt-bootstrap without installing
    it. This wrapper script works in the same fashion than the ones in
    virt-manager or libvirt projects for consistency.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Ignore short lines from skopeo
    Avoid parsing short lines when detecting download progress
    from skopeo's output.
    
    
2017-07-05 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Rename format_number() into bytes_to_size()
    rename the function to match its counterpart size_to_bytes().
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Gather common utility functions in "utils" module
    Add new module to collect utility functions used in virt-bootstrap.
    Move the function definitions from "sources" and "virt_bootstrap" to
    the new module.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    get_image_details: Use connection options
    Pass the "not_secure", "username" and "password" values to
    "skopeo inspect" when manifest is retrieved.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Detect and log download progress of layers
    Parse skopeo's output messages to detect and log the donwload
    progress for each layer and update the progress of virt-bootstrap.
    
    Example:
    
    virt-bootstrap docker://ubuntu /tmp/foo --status-only
    Status: Downloading layer (2/5), Progress: 25.30%
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add --status-only flag
    When this flag is passed only the current state of virt-bootstrap
    will be shown along with the total bootstrap progress.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add new module to store the progress
    This module is used to store the progress of the bootstrap process and
    could be used by other applications to get status of virt-bootstrap as
    well as percentage of completion.
    
    Convert some info messages to use this new system for a clean reporting
    in client applications.
    
    Example usage:
    
    import virtBootstrap
    
    def show_progress(data):
    print("Status: %s, Progress: %.2f"
    % (data['status'], data['value']))
    
    virtBootstrap.bootstrap(uri='docker://ubuntu', dest="/tmp/test1",
    progress_cb=show_progress)
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    checksum: Log failures
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Remove redundant checksum verification
    The checksum verification of downloaded layers is already done in the
    method validate_image_layers() or "skopeo copy" [1] [2].
    
    [1] https://github.com/containers/image/blob/master/copy/copy.go#L352
    [2] https://github.com/containers/image/blob/master/copy/copy.go#L358
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Use downloaded layers
    Do not call "skopeo copy" if layers were downloaded and have valid
    hash sum.
    
    Although, "skopeo copy" already does such check for us this change
    allow us to control the output and avoids spawning a binary.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Encapsulate skopeo copy in a method
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Compact layers' details passed to extract methods
    Improve maintainability by putting layers' digest, sum_type, size and
    file_path in a list which is then passed to extract methods. This
    change replaces the function get_layer_info().
    
    Reduce the amount of duplicated code by taking out the logging calls
    in a method.
    
    
2017-07-05 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Log the size of layers when extracting
    
    
2017-07-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Retrieve manifest before download
    Get manifest of Docker image before the calling "skopeo copy" command.
    
    The aim of this change is to:
    
    - Make available method get_image_details() which could be used to
    get information about Docker image or detect whether Docker URI is
    valid and accessible.
    
    - Get information about the layers before the download process (skopeo
    copy) is called.
    
    
2017-07-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    DockerSource: Use getter for image directory
    Make the method for getting image directory reusable and use instance
    variable to store the path where image layers will be stored.
    
    
2017-07-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve URI parse of DockerSource
    Decrease the number of instance attributes of class DockerSource.
    Since variables "image" and "registry" are only used to create valid
    Docker URI they could be used as local variables instead of instance
    attributes to improve encapsulation.
    
    Add comments to improve readability.
    
    Fix problem with invalid docker URLs
    
    
2017-07-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    bootstrap: Use explicit arguments
    Specify explicitly the arguments of bootstrap method.
    
    This change allows to easily bootstrap a container from
    another python application when the module virtBootstrap
    is imported.
    
    Example:
    
    import virtBootstrap
    virtBootstrap.bootstrap(uri="docker://fedora", dest="/tmp/foo")
    
    
2017-07-04 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Expose bootstrap method from virtBootstrap module
    This allows other python applications to import the virtBootstrap
    module and call the bootstrap() method.
    
    Example:
    >>> import virtBootstrap
    >>> virtBootstrap.bootstrap()
    
    
2017-07-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve help menu
    
    
2017-07-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Set logger name/format/level
    This patch aims to set logger name for the virtBootstrap module.
    Set logging format to: %(levelname)s: %(message)s
    and use an elegant way of setting log level.
    
    
2017-07-01 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Check for write permissions on destination path
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Auto-correct docker source URI
    Skopeo does not accept "docker:///" as valid URI format. [1]
    However, driver URIs within the Libvirt project and virtualization
    tools such as libvirt-sandbox use three slashes after URI scheme. [2]
    
    Make virt-bootstrap auto-correct the source URI for consistency with
    other tools.
    
    Following the syntax specifications in RFC 1808, "urlparse" recognizes
    a netloc only if it is properly introduced by ‘//’. [3] Otherwise the
    input is presumed to be a relative URL and thus to start with a path
    component. [4]
    
    - "self.image" is the path component
    - "self.registry" is the netloc component
    
    [1] https://github.com/projectatomic/skopeo/blob/master/docs/skopeo.1.md#skopeo-copy-1
    [2] http://libvirt.org/uri.html
    [3] https://docs.python.org/2/library/urlparse.html
    [4] https://hg.python.org/cpython/file/2.7/Lib/urlparse.py#l187
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Resolve pylint issues
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Refactor info messages
    Update logged messages to provide information about the current
    state of virt-bootstrap.
    
    E.g "Downloading container image" or "Extracting layer (1/5)"
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve logging of virt-sandbox
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Raise exception if file source is invalid
    
    
2017-06-28 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve logging of executed processes
    Improve readability of logged messages by separating the prefix
    from the message with new line and raise CalledProcessError if
    the exit code is non-zero.
    
    
2017-06-25 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    setup: update project URL
    The project is now live on github's virt-manager/virt-bootstrap, reflect
    this change in the setup.py
    
    
2017-06-19 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Show error if destination path is not folder
    
    
2017-06-19 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add "debug" and "quiet" flags
    These flags aim to control the logging level [1] of virt-bootstrap.
    
    Default = INFO (Confirmation that things are working as expected)
    
    --debug = DEBUG (Detailed information,
    typically of interest only when diagnosing problems)
    
    --quiet = WARNING (An indication that something unexpected happened,
    or indicative of some problem in the near future)
    
    [1] https://docs.python.org/3/howto/logging.html
    
    
2017-06-19 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Log executed process calls
    Log executed commands as well as their stdout/stderr
    for easier debugging.
    
    
2017-06-19 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add automated check for code style
    To run the code style checks, run `python setup.py pylint`
    Only errors could be reported using the option --errors-only.
    Could be useful to run in interactive git rebase
    
    Fix the reported pylint errors as well
    
    
2017-06-16 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Improve README
    Add the lastest dependencies and a description of what the tool does.
    
    
2017-06-16 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Remove useless shebang
    
    
2017-06-16 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Fix file headers for GPLv3
    Using the header as mentioned in the GPLv3 text avoids rpmlint
    to complain about bad FSF address.
    
    
2017-06-16 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Use setuptools (setup.py) for installation
    - Rename "virt-bootstrap.py" to "virt_bootstrap.py" to avoid installation
    issues. Reference: https://stackoverflow.com/a/30284007
    
    Install:
    $ sudo ./setup.py install
    
    Clean:
    $ sudo ./setup.py clean --all
    
    Uninstall:
    $ sudo pip uninstall virt-bootstrap
    Or:
    $ sudo ./setup.py install --record installed_files.txt
    $ cat installed_files.txt | xargs sudo rm -rf
    
    
2017-06-16 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Change shebang to use /usr/bin/env
    When python is not /usr/bin/python but something else that is still
    found by your system, /usr/bin/env still finds it.
    :x
    Reference:
    https://mail.python.org/pipermail/python-list/2012-September/631967.html
    
    
2017-06-16 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Move source files in src/virtBootstrap
    Preparatory commit before setup.py introduction.
    
    
2017-06-16 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Add support for layer extraction in qcow2 images
    Add support for extracting image layers in qcow2 format.
    Avoid requirement for root privileges by using libguestfs.
    
    - Use "qemu-img" to create backing chain which links the layers.
    - Use "virt-format" to format the qcow2 image.
    - Use "virt-tar-in" to extract each tar archives in the qcow2 image.
    
    
2017-06-16 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Extract tar archives safely using virt-sandbox
    This is used to prevent the possibility to create files outside of
    the destination path.
    For example, members that have absolute file names starting with "/"
    or file names with two dots "..".
    
    Use qemu://session to avoid requirement for root privileges.
    
    
2017-06-07 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Cache downloaded container images
    Store container images downloaded with skopeo to avoid re-download.
    Allow user to disable this option by passing "--no-cache" parameter
    
    
2017-06-07 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Improve code fomatting
    Follow PEP8 using pycodestyle
    https://pypi.python.org/pypi/pycodestyle/
    
    
2017-04-14 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    File source fixes
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Remove trailing slash after docker image
    Skopeo does not accept any trailing slash at the end of the url.
    See https://github.com/projectatomic/skopeo#copying-images.
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Fix error: `subprocess.CalledProcessError: Command
    Fix the following failing skopeo call:
    'skopeo copy docker://ubuntu:latest/ dir://tmp/tmpyFFP9Wvirt-bootstrap'
    
    The function `tempfile.mkdtemp()` returns full path and do not need additional
    slash at the beginning. Thus the destination path is incorrect.
    
    `dir://tmp/tmpyFFP9Wvirt-bootstrap`
    -----^
    
    it should be:
    
    `dir:/tmp/tmpyFFP9Wvirt-bootstrap`
    -----^
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Handle error case when creating destination folder
    `OSError: [Errno 17] File exists: ...` error occurs when trying to
    create the destination directory specified from the user without
    checking if it already exists.
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Python 3/2 compatibility: gettext.install unicode flag
    The unicode flag is passed to `gettext.install` has default value `False` in Python2. [1]
    In Python3 this flag does not exists. [2]
    
    [1] https://docs.python.org/2/library/gettext.html#gettext.NullTranslations.install
    [2] https://docs.python.org/3.5/library/gettext.html#gettext.NullTranslations.install
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Python 3/2 compatibility: use print with brackets
    The `print` function in Python3 is used with brackets.[1]
    This syntax is also accepted in Python2.[2]
    
    [1] https://docs.python.org/3.5/library/functions.html#print
    [2] https://docs.python.org/2.7/library/functions.html#print
    
    
2017-04-14 Radostin Stoyanov  <rstoyanov1@gmail.com>
    
    Python 3/2 compatibility: exceptions handling
    Examine an exception during exception handling in Python3
    is done with 'as' instead of comma.
    This approach works in Python2 as well.
    
    https://wiki.python.org/moin/HandlingExceptions
    
    
2017-03-07 Cédric Bosdonnat  <cbosdonnat@suse.com>
    
    Initial commit
    
