summaryrefslogtreecommitdiff
path: root/community/libpar2
diff options
context:
space:
mode:
Diffstat (limited to 'community/libpar2')
-rw-r--r--community/libpar2/PKGBUILD23
-rw-r--r--community/libpar2/libpar2-0.2-bugfixes.patch43
-rw-r--r--community/libpar2/libpar2-0.2-cancel.patch236
3 files changed, 285 insertions, 17 deletions
diff --git a/community/libpar2/PKGBUILD b/community/libpar2/PKGBUILD
index 4871ee91b..db732b4d4 100644
--- a/community/libpar2/PKGBUILD
+++ b/community/libpar2/PKGBUILD
@@ -1,39 +1,40 @@
-# Maintainer: Jaroslav Lichtblau <tu@dragonlord.cz>
+# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Paul Bredbury <brebs@sent.com>
# Contributor: Matt McDonald <metzen@gmail.com>
pkgname=libpar2
pkgver=0.2
-pkgrel=5
-pkgdesc="Parity checking library,"
+pkgrel=6
+pkgdesc="Parity checking library"
arch=('i686' 'x86_64')
url="http://parchive.sourceforge.net/"
license=('GPL')
depends=('libsigc++2.0')
makedepends=('autoconf' 'automake' 'pkgconfig')
-options=(!libtool)
+options=('!libtool')
source=(http://downloads.sourceforge.net/sourceforge/parchive/${pkgname}-${pkgver}.tar.gz
- libpar2-0.2-bugfixes.patch)
-
-md5sums=('94c6df4e38efe08056ecde2a04e0be91'
- '66c306f42fb81016a7a58af8f45e2b68')
+ libpar2-0.2-bugfixes.patch libpar2-0.2-cancel.patch)
+sha256sums=('074fbf840f73b1e13e0405fce261078c81c8c0a4859e30a7bba10510f9199908'
+ 'bcdb0cf45b97b99bc2fb05074887bd73be15745d5d2ce94d65bd0e0c248fb341'
+ 'b05e08033dd2056b47c5610a5bd1d74b93dc283d2f798bfc0d3d9e3fd4f9da14')
build() {
cd ${srcdir}/${pkgname}-${pkgver}
- patch -p0 < ${srcdir}/libpar2-0.2-bugfixes.patch
+ patch -p2 < ${srcdir}/libpar2-0.2-bugfixes.patch
+ patch -p2 < ${srcdir}/libpar2-0.2-cancel.patch
- autoreconf -fi
./configure --prefix=/usr
make
}
+
package() {
cd ${srcdir}/${pkgname}-${pkgver}
make DESTDIR=${pkgdir} install
- # Docs
+# Docs
install -d ${pkgdir}/usr/share/doc/${pkgname}
install -m644 -t ${pkgdir}/usr/share/doc/${pkgname}/ AUTHORS PORTING README ROADMAP
}
diff --git a/community/libpar2/libpar2-0.2-bugfixes.patch b/community/libpar2/libpar2-0.2-bugfixes.patch
index cb3c938df..0ce3a43bd 100644
--- a/community/libpar2/libpar2-0.2-bugfixes.patch
+++ b/community/libpar2/libpar2-0.2-bugfixes.patch
@@ -1,7 +1,9 @@
-diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
--- ../libpar2-0.2-original/par2repairer.cpp 2006-01-20 18:25:20.000000000 +0100
-+++ ../libpar2-0.2/par2repairer.cpp 2008-02-06 12:02:53.226050300 +0100
-@@ -78,6 +78,7 @@
++++ ../libpar2-0.2/par2repairer.cpp 2012-11-30 14:23:31.000000000 +0100
+@@ -76,10 +76,11 @@
+ ++sf;
+ }
delete mainpacket;
delete creatorpacket;
@@ -9,7 +11,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
}
-@@ -1261,7 +1262,7 @@
+ Result Par2Repairer::PreProcess(const CommandLine &commandline)
+ {
+@@ -1259,11 +1260,11 @@
+ string path;
+ string name;
DiskFile::SplitFilename(filename, path, name);
cout << "Target: \"" << name << "\" - missing." << endl;
@@ -18,12 +24,37 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
}
}
-@@ -1804,7 +1805,7 @@
+ ++sf;
+ }
+@@ -1802,11 +1803,11 @@
+ << "\" - no data found."
+ << endl;
}
}
}
- sig_done.emit(name,count,sourcefile->GetVerificationPacket()->BlockCount());
-+ sig_done.emit(name,count, sourcefile->GetVerificationPacket() ? sourcefile->GetVerificationPacket()->BlockCount() : 0);
++ sig_done.emit(name,count, count>0 && sourcefile->GetVerificationPacket() ? sourcefile->GetVerificationPacket()->BlockCount() : 0);
sig_progress.emit(1000.0);
return true;
}
+
+ // Find out how much data we have found
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.h ../libpar2-0.2/par2repairer.h
+--- ../libpar2-0.2-original/par2repairer.h 2006-01-20 00:38:27.000000000 +0100
++++ ../libpar2-0.2/par2repairer.h 2012-11-30 14:24:46.000000000 +0100
+@@ -34,10 +34,15 @@
+ sigc::signal<void, std::string> sig_filename;
+ sigc::signal<void, double> sig_progress;
+ sigc::signal<void, ParHeaders*> sig_headers;
+ sigc::signal<void, std::string, int, int> sig_done;
+
++ // This method allows to determine whether libpar2 includes the patches
++ // ("libpar2-0.2-bugfixes.patch") submitted to libpar2 project.
++ // Use the method in configure scripts for detection.
++ void BugfixesPatchVersion2() { }
++
+ protected:
+ // Steps in verifying and repairing files:
+
+ // Load packets from the specified file
+ bool LoadPacketsFromFile(string filename);
diff --git a/community/libpar2/libpar2-0.2-cancel.patch b/community/libpar2/libpar2-0.2-cancel.patch
new file mode 100644
index 000000000..4a6d01c35
--- /dev/null
+++ b/community/libpar2/libpar2-0.2-cancel.patch
@@ -0,0 +1,236 @@
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
+--- ../libpar2-0.2-original/par2repairer.cpp 2012-12-03 10:47:04.000000000 +0100
++++ ../libpar2-0.2/par2repairer.cpp 2012-12-03 10:48:13.000000000 +0100
+@@ -50,10 +50,12 @@
+ outputbuffer = 0;
+
+ noiselevel = CommandLine::nlNormal;
+ headers = new ParHeaders;
+ alreadyloaded = false;
++
++ cancelled = false;
+ }
+
+ Par2Repairer::~Par2Repairer(void)
+ {
+ delete [] (u8*)inputbuffer;
+@@ -404,10 +406,14 @@
+ {
+ cout << "Loading: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
+ progress = offset;
+ sig_progress.emit(newfraction);
+
++ if (cancelled)
++ {
++ break;
++ }
+ }
+ }
+
+ // Attempt to read the next packet header
+ PACKET_HEADER header;
+@@ -582,10 +588,15 @@
+ if (noiselevel > CommandLine::nlQuiet)
+ cout << "No new packets found" << endl;
+ delete diskfile;
+ }
+
++ if (cancelled)
++ {
++ return false;
++ }
++
+ return true;
+ }
+
+ // Finish loading a recovery packet
+ bool Par2Repairer::LoadRecoveryPacket(DiskFile *diskfile, u64 offset, PACKET_HEADER &header)
+@@ -831,26 +842,42 @@
+
+ // Load packets from each file that was found
+ for (list<string>::const_iterator s=files->begin(); s!=files->end(); ++s)
+ {
+ LoadPacketsFromFile(*s);
++ if (cancelled)
++ {
++ break;
++ }
+ }
+
+ delete files;
++ if (cancelled)
++ {
++ return false;
++ }
+ }
+
+ {
+ string wildcard = name.empty() ? "*.PAR2" : name + ".*.PAR2";
+ list<string> *files = DiskFile::FindFiles(path, wildcard);
+
+ // Load packets from each file that was found
+ for (list<string>::const_iterator s=files->begin(); s!=files->end(); ++s)
+ {
+ LoadPacketsFromFile(*s);
++ if (cancelled)
++ {
++ break;
++ }
+ }
+
+ delete files;
++ if (cancelled)
++ {
++ return false;
++ }
+ }
+
+ return true;
+ }
+
+@@ -864,13 +891,22 @@
+ // If the filename contains ".par2" anywhere
+ if (string::npos != filename.find(".par2") ||
+ string::npos != filename.find(".PAR2"))
+ {
+ LoadPacketsFromFile(filename);
++ if (cancelled)
++ {
++ break;
++ }
+ }
+ }
+
++ if (cancelled)
++ {
++ return false;
++ }
++
+ return true;
+ }
+
+ // Check that the packets are consistent and discard any that are not
+ bool Par2Repairer::CheckPacketConsistency(void)
+@@ -1208,10 +1244,15 @@
+
+ // Start verifying the files
+ sf = sortedfiles.begin();
+ while (sf != sortedfiles.end())
+ {
++ if (cancelled)
++ {
++ return false;
++ }
++
+ // Do we have a source file
+ Par2RepairerSourceFile *sourcefile = *sf;
+
+ // What filename does the file use
+ string filename = sourcefile->TargetFileName();
+@@ -1560,10 +1601,14 @@
+ if (oldfraction != newfraction)
+ {
+ cout << "Scanning: \"" << shortname << "\": " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
+ sig_progress.emit(newfraction);
+
++ if (cancelled)
++ {
++ break;
++ }
+ }
+ }
+
+ // If we fail to find a match, it might be because it was a duplicate of a block
+ // that we have already found.
+@@ -1649,10 +1694,15 @@
+ return false;
+ }
+ }
+ }
+
++ if (cancelled)
++ {
++ return false;
++ }
++
+ // Get the Full and 16k hash values of the file
+ filechecksummer.GetFileHashes(hashfull, hash16k);
+
+ // Did we make any matches at all
+ if (count > 0)
+@@ -2289,14 +2339,23 @@
+ if (oldfraction != newfraction)
+ {
+ cout << "Repairing: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
+ sig_progress.emit(newfraction);
+
++ if (cancelled)
++ {
++ break;
++ }
+ }
+ }
+ }
+
++ if (cancelled)
++ {
++ break;
++ }
++
+ ++inputblock;
+ ++inputindex;
+ }
+ }
+ else
+@@ -2346,13 +2405,22 @@
+ if (oldfraction != newfraction)
+ {
+ cout << "Processing: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
+ sig_progress.emit(newfraction);
+
++ if (cancelled)
++ {
++ break;
++ }
+ }
+ }
+
++ if (cancelled)
++ {
++ break;
++ }
++
+ ++copyblock;
+ ++inputblock;
+ }
+ }
+
+@@ -2360,10 +2428,15 @@
+ if (lastopenfile != NULL)
+ {
+ lastopenfile->Close();
+ }
+
++ if (cancelled)
++ {
++ return false;
++ }
++
+ if (noiselevel > CommandLine::nlQuiet)
+ cout << "Writing recovered data\r";
+
+ // For each output block that has been recomputed
+ vector<DataBlock*>::iterator outputblock = outputblocks.begin();
+diff -aud -U 5 ../libpar2-0.2-with-bugfixes-patch/par2repairer.h ../libpar2-0.2/par2repairer.h
+--- ../libpar2-0.2-original/par2repairer.h 2012-12-03 10:47:04.000000000 +0100
++++ ../libpar2-0.2/par2repairer.h 2012-12-03 10:48:13.000000000 +0100
+@@ -186,8 +186,9 @@
+
+ u64 progress; // How much data has been processed.
+ u64 totaldata; // Total amount of data to be processed.
+ u64 totalsize; // Total data size
+
++ bool cancelled; // repair cancelled
+ };
+
+ #endif // __PAR2REPAIRER_H__