- Update patches required by nzbget
PR: ports/175846 Submitted by: Mark Felder <feld@feld.me> Approved by: Jeff Burchell <toxic@doobie.com> (maintainer)
This commit is contained in:
parent
693cd1a03c
commit
691448468f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=312445
3 changed files with 106 additions and 40 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
PORTNAME= libpar2
|
||||
PORTVERSION= 0.2
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
CATEGORIES= archivers
|
||||
MASTER_SITES= SF/parchive/${PORTNAME}/${PORTVERSION}
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
#####
|
||||
# This patch is maintained by Andrei Prygounkov, author of news/nzbget
|
||||
# It fixes a memory leak and a segfault triggered by a corrupted par2 file.
|
||||
#
|
||||
# For more details, see:
|
||||
# http://sf.net/tracker/?func=detail&aid=2209433&group_id=30568&atid=399700
|
||||
#####
|
||||
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;
|
||||
|
@ -16,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;
|
||||
|
@ -25,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);
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
#####
|
||||
# This patch is maintained by Andrei Prygounkov, author of news/nzbget
|
||||
# It adds a graceful method to cancel file repair operations in progress.
|
||||
#
|
||||
# For more details, see:
|
||||
# http://sf.net/tracker/?func=detail&aid=2209488&group_id=30568&atid=399700
|
||||
#####
|
||||
diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
|
||||
--- ../libpar2-0.2-original/par2repairer.cpp 2008-10-26 19:54:33.000000000 +0100
|
||||
+++ ../libpar2-0.2/par2repairer.cpp 2008-10-29 10:24:48.000000000 +0100
|
||||
@@ -52,6 +52,8 @@
|
||||
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;
|
||||
|
@ -17,7 +12,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
}
|
||||
|
||||
Par2Repairer::~Par2Repairer(void)
|
||||
@@ -406,6 +408,10 @@
|
||||
{
|
||||
delete [] (u8*)inputbuffer;
|
||||
@@ -404,10 +406,14 @@
|
||||
{
|
||||
cout << "Loading: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
|
||||
progress = offset;
|
||||
sig_progress.emit(newfraction);
|
||||
|
||||
|
@ -28,7 +27,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
}
|
||||
}
|
||||
|
||||
@@ -584,6 +590,11 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -40,7 +43,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -833,9 +844,17 @@
|
||||
// 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);
|
||||
|
@ -58,7 +65,10 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
}
|
||||
|
||||
{
|
||||
@@ -846,9 +865,17 @@
|
||||
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);
|
||||
|
@ -76,7 +86,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -866,9 +893,18 @@
|
||||
}
|
||||
|
||||
@@ -864,13 +891,22 @@
|
||||
// If the filename contains ".par2" anywhere
|
||||
if (string::npos != filename.find(".par2") ||
|
||||
string::npos != filename.find(".PAR2"))
|
||||
{
|
||||
LoadPacketsFromFile(filename);
|
||||
|
@ -95,7 +109,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -1210,6 +1246,11 @@
|
||||
// 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())
|
||||
{
|
||||
|
@ -107,7 +125,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
// Do we have a source file
|
||||
Par2RepairerSourceFile *sourcefile = *sf;
|
||||
|
||||
@@ -1562,6 +1603,10 @@
|
||||
// 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);
|
||||
|
||||
|
@ -118,7 +140,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1651,6 +1696,11 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +156,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
// Get the Full and 16k hash values of the file
|
||||
filechecksummer.GetFileHashes(hashfull, hash16k);
|
||||
|
||||
@@ -2291,10 +2341,19 @@
|
||||
// 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);
|
||||
|
||||
|
@ -150,7 +180,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
++inputblock;
|
||||
++inputindex;
|
||||
}
|
||||
@@ -2348,9 +2407,18 @@
|
||||
}
|
||||
else
|
||||
@@ -2346,13 +2405,22 @@
|
||||
if (oldfraction != newfraction)
|
||||
{
|
||||
cout << "Processing: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
|
||||
sig_progress.emit(newfraction);
|
||||
|
||||
|
@ -169,7 +203,11 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
++copyblock;
|
||||
++inputblock;
|
||||
}
|
||||
@@ -2362,6 +2430,11 @@
|
||||
}
|
||||
|
||||
@@ -2360,10 +2428,15 @@
|
||||
if (lastopenfile != NULL)
|
||||
{
|
||||
lastopenfile->Close();
|
||||
}
|
||||
|
||||
|
@ -181,10 +219,14 @@ diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.c
|
|||
if (noiselevel > CommandLine::nlQuiet)
|
||||
cout << "Writing recovered data\r";
|
||||
|
||||
diff -aud ../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 2008-10-26 19:01:08.000000000 +0100
|
||||
@@ -183,6 +183,7 @@
|
||||
// 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue