diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3e1942 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/python-cpio-0.1.tar.bz2 diff --git a/EMPTY b/EMPTY deleted file mode 100644 index 0519ecb..0000000 --- a/EMPTY +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/cpioarchive_bytes_str_compatibility.patch b/cpioarchive_bytes_str_compatibility.patch new file mode 100644 index 0000000..29be265 --- /dev/null +++ b/cpioarchive_bytes_str_compatibility.patch @@ -0,0 +1,20 @@ +--- cpioarchive.py 2018-11-12 17:32:04.568654580 +0100 ++++ cpioarchive.py 2018-11-12 17:33:03.378570874 +0100 +@@ -26,7 +26,7 @@ + """Create a new CpioEntry instance. Internal use only.""" + if len(hdr)<110: + raise CpioError('cpio header too short') +- if not hdr.startswith('070701'): ++ if not hdr.startswith(b'070701'): + raise CpioError('cpio header invalid') + self.inode=int(hdr[6:14], 16) + self.mode=int(hdr[14:22], 16) +@@ -44,7 +44,7 @@ + self.checksum=int(hdr[102:110], 16) + if len(hdr)<110+namesize: + raise CpioError('cpio header too short') +- self.name=hdr[110:110+namesize-1] ++ self.name=hdr[110:110+namesize-1].decode("utf-8") + """Name of the file stored in the entry.""" + self.datastart=offset+110+namesize + self.datastart+=(4-(self.datastart%4))%4 diff --git a/cpioarchive_supports_2_3.patch b/cpioarchive_supports_2_3.patch new file mode 100644 index 0000000..05740fd --- /dev/null +++ b/cpioarchive_supports_2_3.patch @@ -0,0 +1,65 @@ +--- cpioarchive.py.orig 2006-01-03 19:49:29.000000000 +0000 ++++ cpioarchive.py 2015-08-14 17:06:40.580092327 +0100 +@@ -1,3 +1,5 @@ ++from __future__ import absolute_import ++ + """ cpioarchive: Support for cpio archives + Copyright (C) 2006 Ignacio Vazquez-Abrams """ + +@@ -54,7 +56,7 @@ + """Close this cpio entry. Further calls to methods will raise an + exception.""" + self.closed=True +- ++ + def flush(self): + """Flush the entry (no-op).""" + pass +@@ -77,7 +79,7 @@ + + def seek(self, offset, whence=0): + """Move to new position within an entry. +- ++ + Keyword arguments: + offset -- Byte count + whence -- Describes how offset is used. +@@ -107,7 +109,7 @@ + def open(name=None, mode='r', fileobj=None): + """Open a cpio archive. Defers to CpioArchive.__init__().""" + return CpioArchive(name, mode, fileobj) +- ++ + def __init__(self, name=None, mode='r', fileobj=None): + """Open a cpio archive. + +@@ -140,6 +142,9 @@ + if not self.external: + self.file.close() + ++ def __next__(self): ++ return self.next() ++ + def next(self): + """Return the next entry in the archive.""" + if self.closed: +@@ -154,8 +159,8 @@ + return iter(self._infos) + + def _readfile(self, name): +- self._readobj(file(name, 'rb')) +- ++ self._readobj(open(name, 'rb')) ++ + def _readobj(self, fileobj): + self.file=fileobj + start=self.file.tell() +@@ -168,7 +173,7 @@ + if not ce.name=="TRAILER!!!": + self._infos.append(ce) + else: +- return ++ return + self.file.seek((4-(self.file.tell()-istart)%4)%4, 1) + self.file.seek(self._infos[-1].size, 1) + self.file.seek((4-(self.file.tell()-istart)%4)%4, 1) diff --git a/python-cpio.spec b/python-cpio.spec new file mode 100644 index 0000000..77729b7 --- /dev/null +++ b/python-cpio.spec @@ -0,0 +1,165 @@ +%if 0%{?rhel} > 7 +# Disable python2 build by default +%bcond_with python2 +%else +%bcond_without python2 +%endif + +Name: python-cpio +Version: 0.1 +Release: 29%{?dist} +Summary: A Python module for accessing cpio archives + +License: LGPLv2+ +URL: http://developer.berlios.de/projects/python-cpio/ +Source0: http://download.berlios.de/python-cpio/python-cpio-0.1.tar.bz2 +Patch0: cpioarchive_supports_2_3.patch +Patch1: cpioarchive_bytes_str_compatibility.patch + +BuildArch: noarch +%if %{with python2} +BuildRequires: python2-devel +%endif +BuildRequires: python3-devel + +%global _description\ +This is a Python module for accessing cpio archives. + +%description %_description + +%if %{with python2} +%package -n python2-cpio +Summary: %summary +%{?python_provide:%python_provide python2-cpio} + +%description -n python2-cpio %_description +%endif + +%package -n python3-cpio +Summary: A Python module for accessing cpio archives + +%description -n python3-cpio +This is a Python module for accessing cpio archives. + +%prep +%setup -q +%patch0 +%patch1 + +%build +%if %{with python2} +%py2_build +%endif +%py3_build + +%install +%if %{with python2} +%py2_install +%endif +%py3_install + +%if %{with python2} +%files -n python2-cpio +%license COPYING.lib +%doc AUTHORS ChangeLog README TODO +%{python2_sitelib}/cpioarchive.py* +%{python2_sitelib}/*.egg-info +%endif + +%files -n python3-cpio +%license COPYING.lib +%doc AUTHORS ChangeLog README TODO +%{python3_sitelib}/cpioarchive.py* +%{python3_sitelib}/__pycache__/* +%{python3_sitelib}/*.egg-info + + +%changelog +* Mon Nov 12 2018 Watson Yuuma Sato - 0.1-29 +- Fix for python3 compatibility - bytes to str (rhbz#1638499) + +* Wed Jul 04 2018 Lumír Balhar - 0.1-28 +- Python 2 subpackage disabled by default + +* Fri Feb 09 2018 Fedora Release Engineering - 0.1-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 0.1-26 +- Python 2 binary package renamed to python2-cpio + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Jul 27 2017 Fedora Release Engineering - 0.1-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.1-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 19 2016 Miro Hrončok - 0.1-23 +- Rebuild for Python 3.6 + +* Tue Jul 19 2016 Fedora Release Engineering - 0.1-22 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 0.1-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 0.1-20 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Fri Aug 14 2015 José Matos - 0.1-19 +- Add python3 subpackage + +* Thu Jun 18 2015 Fedora Release Engineering - 0.1-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 0.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 0.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 0.1-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 0.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 0.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Thu Jul 8 2010 Toshio Kuratomi - 0.1-10 +- Update for new python guidelines +- Fix spec so that EPEL-6 will build + +* Sun Jul 26 2009 Fedora Release Engineering - 0.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 0.1-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.1-7 +- Rebuild for Python 2.6 + +* Fri Aug 29 2008 Tom "spot" Callaway - 0.1-6 +- fix license tag + +* Tue Apr 1 2008 José Matos - 0.1-5 +- Add egg-info for F9+. + +* Tue Aug 28 2007 José Matos - 0.1-4 +- License fix, rebuild for devel (F8). + +* Tue Dec 12 2006 José Matos - 0.1-3 +- Rebuild for python 2.5. + +* Mon Sep 11 2006 José Matos - 0.1-2 +- Rebuild for FC6. + +* Tue Jan 3 2006 Ignacio Vazquez-Abrams 0.1-1 +- Initial RPM release diff --git a/sources b/sources new file mode 100644 index 0000000..541cb22 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (python-cpio-0.1.tar.bz2) = 425b149b80a532968669ecb1bcb916552977ff9f7f3bf39fc00f779c4a474ebbfe31bf109116dc9f9c2a83803af2e47f15fd6508c71c2cb90dcb7cd6835ec6c4