diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6e4a70 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bmap-tools-3.5.tar.gz diff --git a/bmap-tools.spec b/bmap-tools.spec new file mode 100644 index 0000000..65e557c --- /dev/null +++ b/bmap-tools.spec @@ -0,0 +1,77 @@ +%global module_name bmaptools + +Name: bmap-tools +Version: 3.5 +Release: 1%{?dist} +Summary: Tools to generate and flash sparse images using the "block map" (bmap) format +License: GPLv2+ +URL: https://github.com/intel/bmap-tools +Source0: https://github.com/intel/bmap-tools/archive/v%{version}/%{name}-%{version}.tar.gz +# https://github.com/intel/bmap-tools/commit/db7087b883bf52cbff063ad17a41cc1cbb85104 +Patch1: db7087b883bf52cbff063ad17a41cc1cbb85104d.patch +BuildArch: noarch + +%description +Tools to generate "block map" (a.k.a. bmap) files and flash images. Bmaptool is +a generic tool for creating the block map (bmap) for a file, and copying files +using the block map. The idea is that large file containing unused blocks, like +raw system image files, can be copied or flashed a lot faster with bmaptool +than with traditional tools like "dd" or "cp". See +https://source.tizen.org/documentation/reference/bmaptool for more information. + +%package -n python3-%{module_name} +Summary: Python library to manipulate sparse images in the "block map" (bmap) format +%{?python_provide:%python_provide python3-%{module_name}} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-nose +BuildRequires: python3-six +Requires: python3-six +Requires: python3-gpg +Requires: bzip2 +Requires: pbzip2 +Requires: gzip +Requires: xz +Requires: tar +Requires: unzip +Requires: lzop +Requires: pigz + +%description -n python3-%{module_name} +Python library for bmap-tools. + +%package -n bmaptool +Summary: Tool to manipulate sparse images in the "block map" (bmap) format +Requires: python3-%{module_name} = %{version}-%{release} + +%description -n bmaptool +Command-line utility for bmap-tools. + +%prep +%setup -q +%patch1 -p1 + +%build +%py3_build + +%install +%py3_install +install -d %{buildroot}/%{_mandir}/man1 +install -m644 docs/man1/bmaptool.1 %{buildroot}/%{_mandir}/man1 + +%check +nosetests-3 + +%files -n python3-%{module_name} +%doc docs/README docs/RELEASE_NOTES +%license COPYING +%{python3_sitelib}/%{module_name} +%{python3_sitelib}/bmap_tools*.egg-info + +%files -n bmaptool +%{_bindir}/bmaptool +%{_mandir}/man1/bmaptool.1* + +%changelog +* Tue Jan 29 2019 Dan Callaghan - 3.5-1 +- initial version diff --git a/db7087b883bf52cbff063ad17a41cc1cbb85104d.patch b/db7087b883bf52cbff063ad17a41cc1cbb85104d.patch new file mode 100644 index 0000000..0d8c98e --- /dev/null +++ b/db7087b883bf52cbff063ad17a41cc1cbb85104d.patch @@ -0,0 +1,32 @@ +From 2d3d0aeead0ac1b1f5e9fa5ef351aac8b14b5da9 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Mon, 10 Dec 2018 15:23:47 +0000 +Subject: [PATCH] Filemap: catch StopIteration from next(iterator) + +In Python >= 3.7, if code in a generator raises StopIteration, it is +transformed into a RuntimeError instead of terminating the generator +gracefully. + +Closes: https://github.com/intel/bmap-tools/issues/57 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915686 +--- + bmaptools/Filemap.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/bmaptools/Filemap.py b/bmaptools/Filemap.py +index 3e56798..e06e654 100644 +--- a/bmaptools/Filemap.py ++++ b/bmaptools/Filemap.py +@@ -476,7 +476,11 @@ def get_mapped_ranges(self, start, count): + _log.debug("FilemapFiemap: get_mapped_ranges(%d, %d(%d))" + % (start, count, start + count - 1)) + iterator = self._do_get_mapped_ranges(start, count) +- first_prev, last_prev = next(iterator) ++ ++ try: ++ first_prev, last_prev = next(iterator) ++ except StopIteration: ++ return + + for first, last in iterator: + if last_prev == first - 1: diff --git a/sources b/sources new file mode 100644 index 0000000..b62368c --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (bmap-tools-3.5.tar.gz) = 8e15ea7c410565f7c240fae6364842ac03f0c52082c2bdf783932d260db2c6661b7369845dc9e0fb2b6ded4511b9ee31214c4d46cc486ded42425d71552b395d