aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README3
-rw-r--r--linaro_image_tools/fetch_image.py13
-rw-r--r--linaro_image_tools/hwpack/builder.py52
-rw-r--r--linaro_image_tools/media_create/tests/test_media_create.py2
-rw-r--r--linaro_image_tools/tests/test_pyflakes.py4
5 files changed, 40 insertions, 34 deletions
diff --git a/README b/README
index 4ffb43e..1cfa052 100644
--- a/README
+++ b/README
@@ -33,6 +33,9 @@ Before running any tests you need to install the following packages:
- qemu-kvm
- sfdisk
+Also consider installing pyflakes, which is optional but will enable more
+tests.
+
And run the following command:
$ testr init
diff --git a/linaro_image_tools/fetch_image.py b/linaro_image_tools/fetch_image.py
index 88823f3..f10a4d9 100644
--- a/linaro_image_tools/fetch_image.py
+++ b/linaro_image_tools/fetch_image.py
@@ -47,7 +47,6 @@ class DownloadManager():
self.event_queue = None
self.to_download = None
self.sha1_files = None
- self.gpg_files = None
self.downloaded_files = None
self.sig_files = None
self.verified_files = None
@@ -382,8 +381,8 @@ class DownloadManager():
self.to_download = self.generate_download_list()
gpg_urls = [f for f in self.to_download if re.search('\.asc$', f)]
- gpg_files = self.download_files(gpg_urls, self.settings,
- force_download=force_download)
+ self.download_files(
+ gpg_urls, self.settings, force_download=force_download)
def _check_downloads(self):
self.get_sig_files()
@@ -475,10 +474,10 @@ class DownloadManager():
else:
print "Re-downloading corrupt files"
# There are some files to re-download
- redownloaded_files = self.download_files(
- to_retry, self.settings,
- self.event_queue,
- force_download=True)
+ self.download_files(to_retry,
+ self.settings,
+ self.event_queue,
+ force_download=True)
(self.verified_files,
self.gpg_sig_ok) = utils.verify_file_integrity(self.sig_files)
diff --git a/linaro_image_tools/hwpack/builder.py b/linaro_image_tools/hwpack/builder.py
index 08e9d72..c4c233a 100644
--- a/linaro_image_tools/hwpack/builder.py
+++ b/linaro_image_tools/hwpack/builder.py
@@ -134,28 +134,30 @@ class HardwarePackBuilder(object):
fetcher = PackageFetcher(
sources, architecture=architecture,
prefer_label=LOCAL_ARCHIVE_LABEL)
- with fetcher, PackageUnpacker() as package_unpacker:
- fetcher.ignore_packages(self.config.assume_installed)
- packages = fetcher.fetch_packages(
- packages, download_content=self.config.include_debs)
-
- if self.config.u_boot_package is not None:
- u_boot_package = self.find_fetched_package(
- packages, self.config.u_boot_package)
- hwpack.metadata.u_boot = self.add_file_to_hwpack(
- u_boot_package, self.config.u_boot_file,
- package_unpacker, hwpack, hwpack.U_BOOT_DIR)
-
- logger.debug("Adding packages to hwpack")
- hwpack.add_packages(packages)
- for local_package in local_packages:
- if local_package not in packages:
- logger.warning(
- "Local package '%s' not included",
- local_package.name)
- hwpack.add_dependency_package(self.config.packages)
- with open(hwpack.filename(), 'w') as f:
- hwpack.to_file(f)
- logger.info("Wrote %s" % hwpack.filename())
- with open(hwpack.filename('.manifest.txt'), 'w') as f:
- f.write(hwpack.manifest_text())
+ with fetcher:
+ with PackageUnpacker() as package_unpacker:
+ fetcher.ignore_packages(self.config.assume_installed)
+ packages = fetcher.fetch_packages(
+ packages,
+ download_content=self.config.include_debs)
+
+ if self.config.u_boot_package is not None:
+ u_boot_package = self.find_fetched_package(
+ packages, self.config.u_boot_package)
+ hwpack.metadata.u_boot = self.add_file_to_hwpack(
+ u_boot_package, self.config.u_boot_file,
+ package_unpacker, hwpack, hwpack.U_BOOT_DIR)
+
+ logger.debug("Adding packages to hwpack")
+ hwpack.add_packages(packages)
+ for local_package in local_packages:
+ if local_package not in packages:
+ logger.warning(
+ "Local package '%s' not included",
+ local_package.name)
+ hwpack.add_dependency_package(self.config.packages)
+ with open(hwpack.filename(), 'w') as f:
+ hwpack.to_file(f)
+ logger.info("Wrote %s" % hwpack.filename())
+ with open(hwpack.filename('.manifest.txt'), 'w') as f:
+ f.write(hwpack.manifest_text())
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 a13435c..50c897e 100644
--- a/linaro_image_tools/media_create/tests/test_media_create.py
+++ b/linaro_image_tools/media_create/tests/test_media_create.py
@@ -2068,6 +2068,8 @@ class TestMountedPartitionContextManager(TestCaseWithFixtures):
with partition_mounted('foo', 'bar'):
pass
test_func()
+ expected = ['sudo -E mount foo bar', 'sync']
+ self.assertEqual(expected, popen_fixture.mock.commands_executed)
class TestPopulateBoot(TestCaseWithFixtures):
diff --git a/linaro_image_tools/tests/test_pyflakes.py b/linaro_image_tools/tests/test_pyflakes.py
index 81df2f9..a70fe20 100644
--- a/linaro_image_tools/tests/test_pyflakes.py
+++ b/linaro_image_tools/tests/test_pyflakes.py
@@ -29,8 +29,8 @@ class TestPyflakes(TestCase):
(stdout, stderr) = proc.communicate()
stdout = stdout.splitlines()
stdout.sort()
- expected = ["./linaro_image_tools/utils.py:27: redefinition of "
- "unused 'CommandNotFound' from line 25" ]
+ expected = ["./linaro_image_tools/utils.py:29: redefinition of "
+ "unused 'CommandNotFound' from line 27" ]
self.assertEquals(expected, stdout)
self.assertEquals('', stderr)