diff --git a/.cvsignore b/.cvsignore index 52e9fd1..89772a5 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -par2cmdline-0.4.tar.gz +par2cmdline-0.4-tbb-20090203.tar.gz diff --git a/par2-tbb-disable-concurrent-support.patch b/par2-tbb-disable-concurrent-support.patch new file mode 100644 index 0000000..887e500 --- /dev/null +++ b/par2-tbb-disable-concurrent-support.patch @@ -0,0 +1,23 @@ +--- par2cmdline.h.orig 2009-07-31 18:33:00.825819583 +0200 ++++ par2cmdline.h 2009-07-31 18:33:24.414821405 +0200 +@@ -428,6 +428,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -449,9 +449,12 @@ + #endif + #define offsetof(TYPE, MEMBER) ((size_t) ((char*)(&((TYPE *)1)->MEMBER) - (char*)1)) + ++/* ++Intel-tbb isn't operational yet on PPC/PPC64 + #define WANT_CONCURRENT 1 + #define WANT_CONCURRENT_PAR2_FILE_OPENING 1 + #define WANT_CONCURRENT_SOURCE_VERIFICATION 1 ++*/ + + #if WANT_CONCURRENT + #include "tbb/task_scheduler_init.h" diff --git a/par2-tbb-fortify-source-fix.patch b/par2-tbb-fortify-source-fix.patch new file mode 100644 index 0000000..a475b2f --- /dev/null +++ b/par2-tbb-fortify-source-fix.patch @@ -0,0 +1,11 @@ +--- diskfile.cpp.orig 2009-07-31 17:42:14.904127403 +0200 ++++ diskfile.cpp 2009-07-31 17:42:23.006819616 +0200 +@@ -655,7 +655,7 @@ + return filename; + + // Get the current directory +- char curdir[1000]; ++ char curdir[PATH_MAX]; + if (0 == getcwd(curdir, sizeof(curdir))) + { + return filename; diff --git a/par2-tbb-packed.patch b/par2-tbb-packed.patch new file mode 100644 index 0000000..552bf28 --- /dev/null +++ b/par2-tbb-packed.patch @@ -0,0 +1,225 @@ +diff -ur par2cmdline-0.4-orig/letype.h par2cmdline-0.4/letype.h +--- par2cmdline-0.4-orig/letype.h 2003-05-26 20:01:17.000000000 +0200 ++++ par2cmdline-0.4/letype.h 2006-05-09 10:47:29.000000000 +0200 +@@ -28,44 +28,15 @@ + + #else + +-class leu16 ++struct leu16 + { +-public: +- leu16(void); +- +- leu16(const leu16 &other); +- leu16& operator=(const leu16 &other); +- +- leu16(const u16 &other); + leu16& operator=(const u16 &other); + + operator u16(void) const; + +-protected: + u16 value; + }; + +-inline leu16::leu16(void) +-{ +-} +- +-inline leu16::leu16(const leu16 &other) +-: value(other.value) +-{ +-} +- +-inline leu16& leu16::operator =(const leu16 &other) +-{ +- value = other.value; +- return *this; +-} +- +-inline leu16::leu16(const u16 &other) +-{ +- ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +- ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff); +-} +- + inline leu16& leu16::operator=(const u16 &other) + { + ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +@@ -81,46 +52,15 @@ + } + + +-class leu32 ++struct leu32 + { +-public: +- leu32(void); +- +- leu32(const leu32 &other); +- leu32& operator=(const leu32 &other); +- +- leu32(const u32 &other); + leu32& operator=(const u32 &other); + + operator u32(void) const; + +-protected: + u32 value; + }; + +-inline leu32::leu32(void) +-{ +-} +- +-inline leu32::leu32(const leu32 &other) +-: value(other.value) +-{ +-} +- +-inline leu32& leu32::operator =(const leu32 &other) +-{ +- value = other.value; +- return *this; +-} +- +-inline leu32::leu32(const u32 &other) +-{ +- ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +- ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff); +- ((unsigned char*)&value)[2] = (unsigned char)((other >> 16) & 0xff); +- ((unsigned char*)&value)[3] = (unsigned char)((other >> 24) & 0xff); +-} +- + inline leu32& leu32::operator=(const u32 &other) + { + ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +@@ -140,50 +80,15 @@ + } + + +-class leu64 ++struct leu64 + { +-public: +- leu64(void); +- +- leu64(const leu64 &other); +- leu64& operator=(const leu64 &other); +- +- leu64(const u64 &other); + leu64& operator=(const u64 &other); + + operator u64(void) const; + +-protected: + u64 value; + }; + +-inline leu64::leu64(void) +-{ +-} +- +-inline leu64::leu64(const leu64 &other) +-: value(other.value) +-{ +-} +- +-inline leu64& leu64::operator =(const leu64 &other) +-{ +- value = other.value; +- return *this; +-} +- +-inline leu64::leu64(const u64 &other) +-{ +- ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +- ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff); +- ((unsigned char*)&value)[2] = (unsigned char)((other >> 16) & 0xff); +- ((unsigned char*)&value)[3] = (unsigned char)((other >> 24) & 0xff); +- ((unsigned char*)&value)[4] = (unsigned char)((other >> 32) & 0xff); +- ((unsigned char*)&value)[5] = (unsigned char)((other >> 40) & 0xff); +- ((unsigned char*)&value)[6] = (unsigned char)((other >> 48) & 0xff); +- ((unsigned char*)&value)[7] = (unsigned char)((other >> 56) & 0xff); +-} +- + inline leu64& leu64::operator=(const u64 &other) + { + ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff); +diff -ur par2cmdline-0.4-orig/md5.h par2cmdline-0.4/md5.h +--- par2cmdline-0.4-orig/md5.h 2003-08-02 01:41:04.000000000 +0200 ++++ par2cmdline-0.4/md5.h 2006-05-09 10:47:29.000000000 +0200 +@@ -20,6 +20,13 @@ + #ifndef __MD5_H__ + #define __MD5_H__ + ++#ifdef WIN32 ++#pragma pack(push, 1) ++#define PACKED ++#else ++#define PACKED __attribute__ ((packed)) ++#endif ++ + // This file defines the MD5Hash and MD5Context objects which are used + // to compute and manipulate the MD5 Hash values for a block of data. + +@@ -35,15 +42,11 @@ + + // MD5 Hash value + +-class MD5Hash ++struct MD5Hash; ++ostream& operator<<(ostream &s, const MD5Hash &hash); ++ ++struct MD5Hash + { +-public: +- // removed this to stop GCC warnings about using the 'pack' attribute on +- // non-POD members in classes such as PACKET_HEADER: +- +- // Constructor does not initialise the value +- //MD5Hash(void) {}; +- + // Comparison operators + bool operator==(const MD5Hash &other) const; + bool operator!=(const MD5Hash &other) const; +@@ -57,16 +60,8 @@ + friend ostream& operator<<(ostream &s, const MD5Hash &hash); + string print(void) const; + +- // removed these to stop GCC warnings about using the 'pack' attribute on +- // non-POD members in classes such as PACKET_HEADER: +- +- // Copy and assignment +- //MD5Hash(const MD5Hash &other); +- //MD5Hash& operator=(const MD5Hash &other); +- +-public: + u8 hash[16]; // 16 byte MD5 Hash value +-}; ++} PACKED; + + // Intermediate computation state + +@@ -150,16 +145,9 @@ + return !other.operator<(*this); + } + +-/*inline MD5Hash::MD5Hash(const MD5Hash &other) +-{ +- memcpy(&hash, &other.hash, sizeof(hash)); +-} +- +-inline MD5Hash& MD5Hash::operator=(const MD5Hash &other) +-{ +- memcpy(&hash, &other.hash, sizeof(hash)); +- +- return *this; +-}*/ ++#ifdef WIN32 ++#pragma pack(pop) ++#endif ++#undef PACKED + + #endif // __MD5_H__ diff --git a/par2cmdline.spec b/par2cmdline.spec index 75886de..50515af 100644 --- a/par2cmdline.spec +++ b/par2cmdline.spec @@ -1,17 +1,24 @@ -Summary: PAR 2.0 compatible file verification and repair tool -Name: par2cmdline -Version: 0.4 -Release: 16%{?dist} -License: GPLv2+ -Group: Applications/Archiving -Source: http://dl.sourceforge.net/parchive/%{name}-%{version}.tar.gz -Patch0: par2cmdline-reedsolomon.cpp.patch -Patch1: par2cmdline-packed.patch -Patch2: par2cmdline-Makefile.am.patch -URL: http://parchive.sourceforge.net/ -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Obsoletes: parchive <= 1.1.4 -Provides: parchive = 1.1.4.0.par2.%{version} +%global revision 20090203 + +Summary: PAR 2.0 compatible file verification and repair tool +Name: par2cmdline +Version: 0.4.tbb.%{revision} +Release: 1%{?dist} +License: GPLv2+ +Group: Applications/Archiving +Source: http://www.chuchusoft.com/par2_tbb/par2cmdline-0.4-tbb-%{revision}.tar.gz +Patch1: par2-tbb-packed.patch +Patch3: par2-tbb-fortify-source-fix.patch +Patch4: par2-tbb-disable-concurrent-support.patch +URL: http://parchive.sourceforge.net/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Obsoletes: parchive <= 1.1.4 +Provides: parchive = 1.1.4.0.par2.%{version} + +%ifarch %{ix86} x86_64 +BuildRequires: tbb-devel +%endif + %description par2cmdline is a program for creating and using PAR2 files to detect damage @@ -20,38 +27,65 @@ published in binary newsgroups on Usenet; they apply the data-recovery capability concepts of RAID-like systems to the posting and recovery of multi-part archives. + %prep -%setup -q -%patch0 -p1 +%setup -q -n par2cmdline-0.4-tbb-%{revision} %patch1 -p1 -%patch2 -p1 +%patch3 -p0 + +# Intel threading blocks is only available on x86 hardware +%ifnarch %{ix86} x86_64 + # This patch strips out the TBB-specific code + %patch4 -p0 + + # Don't link against TBB, but against the rt library (for aio_read/aio_write) + sed -i s/-ltbb/-lrt/ Makefile.in +%endif # fix end-of-lines of several files sed -i 's/\r//' AUTHORS PORTING README ROADMAP + %build %configure make %{_smp_mflags} chmod 644 ChangeLog galois.h par1repairer.cpp par2repairer.cpp par2repairersourcefile.cpp par2repairersourcefile.h + %install rm -rf $RPM_BUILD_ROOT %makeinstall ln -sf par2 $RPM_BUILD_ROOT/%{_bindir}/par + %clean rm -rf $RPM_BUILD_ROOT + %check +chmod +x test[1-6] pretest posttest make check-TESTS + %files %defattr(-,root,root,-) %doc AUTHORS COPYING ChangeLog README -%{_bindir}/* +%{_bindir}/par +%{_bindir}/par2 +%{_bindir}/par2create +%{_bindir}/par2repair +%{_bindir}/par2verify + %changelog +* Mon Aug 3 2009 Erik van Pienbroek - 0.4.tbb.20090203-1 +- Updated to the par2_tbb fork of par2cmdline (revision 20090203) + This fork is maintained at http://www.chuchusoft.com/par2_tbb/ +- This adds support for PAR2 verifications and repairs using multiple CPU cores +- As Intel Threading Building Blocks (TBB) only works on x86 hardware, fall + back to the old behaviour on other platforms (like PPC/PPC64) + * Sat Jul 25 2009 Fedora Release Engineering - 0.4-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild diff --git a/sources b/sources index 16c1fba..0a44096 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1551b63e57e3c232254dc62073b723a9 par2cmdline-0.4.tar.gz +f32c83c524f55171e8d639d6bfe9a7d8 par2cmdline-0.4-tbb-20090203.tar.gz