diff options
author | Fathi Boudra <fathi.boudra@linaro.org> | 2013-08-17 08:10:14 +0300 |
---|---|---|
committer | Fathi Boudra <fathi.boudra@linaro.org> | 2013-08-17 08:10:14 +0300 |
commit | 47a68988c7c6042cb373402355fa16663b0c62f1 (patch) | |
tree | b7ad8fcbe669d2c7678300b261828cd2877d7e1a /linaro_image_tools | |
parent | e66296ece4e18d3137f5af96138f3461e3fc48f4 (diff) | |
parent | 51605ba19ca3a77c5e52b5e078f804ce78d790e1 (diff) |
Add initial support for Fedora rootfs
Diffstat (limited to 'linaro_image_tools')
-rw-r--r-- | linaro_image_tools/media_create/chroot_utils.py | 2 | ||||
-rw-r--r-- | linaro_image_tools/media_create/rootfs.py | 19 | ||||
-rw-r--r-- | linaro_image_tools/media_create/tests/test_media_create.py | 3 | ||||
-rw-r--r-- | linaro_image_tools/media_create/unpack_binary_tarball.py | 5 | ||||
-rw-r--r-- | linaro_image_tools/utils.py | 12 |
5 files changed, 29 insertions, 12 deletions
diff --git a/linaro_image_tools/media_create/chroot_utils.py b/linaro_image_tools/media_create/chroot_utils.py index 83b0f6d..6776c4c 100644 --- a/linaro_image_tools/media_create/chroot_utils.py +++ b/linaro_image_tools/media_create/chroot_utils.py @@ -105,7 +105,7 @@ def install_hwpack(rootfs_dir, hwpack_file, extract_kpkgs, hwpack_force_yes): print "Installing (linaro-hwpack-install) %s in target rootfs." % ( hwpack_basename) - # Get infromation required by linaro-hwpack-install + # Get information required by linaro-hwpack-install with HardwarepackHandler([hwpack_file]) as hwpack: version, _ = hwpack.get_field("version") architecture, _ = hwpack.get_field("architecture") diff --git a/linaro_image_tools/media_create/rootfs.py b/linaro_image_tools/media_create/rootfs.py index 73bc8eb..765cc99 100644 --- a/linaro_image_tools/media_create/rootfs.py +++ b/linaro_image_tools/media_create/rootfs.py @@ -43,7 +43,8 @@ def rootfs_mount_options(rootfs_type): def populate_rootfs(content_dir, root_disk, partition, rootfs_type, rootfs_id, should_create_swap, swap_size, - mmc_device_id, partition_offset, board_config=None): + mmc_device_id, partition_offset, os_release_id, + board_config=None): """Populate the rootfs and make the necessary tweaks to make it usable. This consists of: @@ -86,13 +87,14 @@ def populate_rootfs(content_dir, root_disk, partition, rootfs_type, append_to_fstab(root_disk, fstab_additions) - print "\nCreating /etc/flash-kernel.conf\n" - create_flash_kernel_config( - root_disk, mmc_device_id, 1 + partition_offset) + if os_release_id == 'debian' or os_release_id == 'ubuntu': + print "\nCreating /etc/flash-kernel.conf\n" + create_flash_kernel_config( + root_disk, mmc_device_id, 1 + partition_offset) - if board_config is not None: - print "\nUpdating /etc/network/interfaces\n" - update_network_interfaces(root_disk, board_config) + if board_config is not None: + print "\nUpdating /etc/network/interfaces\n" + update_network_interfaces(root_disk, board_config) def update_network_interfaces(root_disk, board_config): @@ -136,7 +138,8 @@ def _list_files(directory): not be world-readable. """ p = cmd_runner.run( - ['find', directory, '-maxdepth', '1', '-mindepth', '1'], + ['find', directory, '-maxdepth', '1', '-mindepth', '1', + '!', '-name', 'lost+found'], stdout=subprocess.PIPE, as_root=True) stdout, _ = p.communicate() return stdout.split() diff --git a/linaro_image_tools/media_create/tests/test_media_create.py b/linaro_image_tools/media_create/tests/test_media_create.py index 269f986..565056c 100644 --- a/linaro_image_tools/media_create/tests/test_media_create.py +++ b/linaro_image_tools/media_create/tests/test_media_create.py @@ -3673,7 +3673,8 @@ class TestPopulateRootFS(TestCaseWithFixtures): populate_rootfs( contents_dir, root_disk, partition='/dev/rootfs', rootfs_type='ext3', rootfs_id='UUID=uuid', should_create_swap=True, - swap_size=100, mmc_device_id=0, partition_offset=0) + swap_size=100, mmc_device_id=0, partition_offset=0, + os_release_id='ubuntu', board_config=None) self.assertEqual( ['UUID=uuid / ext3 errors=remount-ro 0 1', diff --git a/linaro_image_tools/media_create/unpack_binary_tarball.py b/linaro_image_tools/media_create/unpack_binary_tarball.py index ba00261..8dcdef8 100644 --- a/linaro_image_tools/media_create/unpack_binary_tarball.py +++ b/linaro_image_tools/media_create/unpack_binary_tarball.py @@ -29,8 +29,11 @@ def unpack_android_binary_tarball(tarball, unpack_dir, as_root=True): def unpack_binary_tarball(tarball, unpack_dir, as_root=True): + extract_opt = '-xf' + if tarball.endswith('.xz'): + extract_opt = '-Jxf' proc = cmd_runner.run( - ['tar', '--numeric-owner', '-C', unpack_dir, '-xf', tarball], + ['tar', '--numeric-owner', '-C', unpack_dir, extract_opt, tarball], as_root=as_root) proc.wait() return proc.returncode diff --git a/linaro_image_tools/utils.py b/linaro_image_tools/utils.py index c8d9682..2710c02 100644 --- a/linaro_image_tools/utils.py +++ b/linaro_image_tools/utils.py @@ -89,11 +89,21 @@ CommandNotFound = try_import('CommandNotFound.CommandNotFound') def path_in_tarfile_exists(path, tar_file): exists = True try: - tarinfo = tarfile.open(tar_file, 'r:gz') + tarinfo = tarfile.open(tar_file, 'r:*') tarinfo.getmember(path) tarinfo.close() except KeyError: exists = False + except (tarfile.ReadError, tarfile.CompressionError): + exists = False + # Fallback to tar command + cmd = ['tar', '-tf', tar_file, '--wildcards', '*' + path] + proc = cmd_runner.run(cmd, + stdout=open('/dev/null', 'w'), + stderr=open('/dev/null', 'w')) + proc.wait() + if proc.returncode == 0: + exists = True finally: return exists |