On Sun, Oct 04, 2015 at 10:15:12PM +0100, Mikolaj Kucharski wrote:
> Hi,
> 
> I finally looked into the issue with par2cmdline and it seems that
> somewhere between OpenBSD 5.5 and 5.6 behaviour changed in gcc and
> it surfaced issue with defines in par2cmdline.
> 
> Below patch updates par2cmdline to 0.6.14 and includes my patch
> which seems to fix the issue for me.
> 
> Discussion around this problem started in this thread on ports@
> 
>       https://marc.info/?t=143069779000003&r=1&w=2
> 
> I've reported this problem to upstream:
> 
>       https://github.com/Parchive/par2cmdline/issues/55
> 
> and my pull request is at:
> 
>       https://github.com/Parchive/par2cmdline/pull/60
> 
> I would appreciate if someone look is my change sane. As this is long
> overdue update from 0.4 to 0.6 which has also different upstream, I
> decided to include whitespace changes in Makefile, as this update is
> intrusive.

- switch to sed -i
- fix regress tests
- all regress tests pass


Index: Makefile
===================================================================
RCS file: /cvs/ports/archivers/par2cmdline/Makefile,v
retrieving revision 1.10
diff -u -p -u -r1.10 Makefile
--- Makefile    19 Apr 2015 17:52:47 -0000      1.10
+++ Makefile    4 Oct 2015 21:37:28 -0000
@@ -1,22 +1,44 @@
 # $OpenBSD: Makefile,v 1.10 2015/04/19 17:52:47 jca Exp $
 
-COMMENT=       command line implementation of the PAR v2.0 specification
-DISTNAME=      par2cmdline-0.4
-REVISION=      2
-CATEGORIES=    archivers
-MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=parchive/}
+COMMENT =      command line implementation of the PAR v2.0 specification
 
-HOMEPAGE=      http://parchive.sourceforge.net/\#client_par2cmdline
+V =            0.6.14
+DISTNAME =     par2cmdline-$V
+DISTFILES =    ${DISTNAME}{v$V}.tar.gz
 
-# GPL
-PERMIT_PACKAGE_CDROM=  Yes
+CATEGORIES =   archivers
 
-WANTLIB=               c m stdc++
+HOMEPAGE =     https://github.com/BlackIkeEagle/par2cmdline/
 
-CONFIGURE_STYLE=gnu
+# GPLv2+
+PERMIT_PACKAGE_CDROM = Yes
+
+WANTLIB =      c m stdc++
+
+MASTER_SITES = ${HOMEPAGE}archive/
+
+BUILD_DEPENDS =        ${MODGNU_AUTOCONF_DEPENDS} \
+               ${MODGNU_AUTOMAKE_DEPENDS}
+
+CONFIGURE_STYLE =      gnu
+
+AUTOCONF_VERSION =     2.69
+AUTOMAKE_VERSION =     1.15
+
+MAKE_ENV =             AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+                       AUTOMAKE_VERSION=${AUTOMAKE_VERSION}
+
+post-patch:
+       cd ${WRKSRC}; \
+           export AUTOCONF_VERSION=${AUTOCONF_VERSION}; \
+           export AUTOMAKE_VERSION=${AUTOMAKE_VERSION}; \
+           aclocal; automake --add-missing; autoconf
 
 post-install:
        ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/par2cmdline
        ${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/par2cmdline
+
+pre-test:
+       sed -i -e 's,^tar -xf,tar -xzf,' ${WRKSRC}/tests/test*
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/archivers/par2cmdline/distinfo,v
retrieving revision 1.5
diff -u -p -u -r1.5 distinfo
--- distinfo    4 Apr 2013 16:03:56 -0000       1.5
+++ distinfo    4 Oct 2015 21:37:28 -0000
@@ -1,2 +1,2 @@
-SHA256 (par2cmdline-0.4.tar.gz) = njK32897yoJJ+YgkdX1IaHFBVv4idlFlBM0m9zbp9nc=
-SIZE (par2cmdline-0.4.tar.gz) = 239312
+SHA256 (par2cmdline-0.6.14.tar.gz) = 
L9gxupJNnw7NkkLKRVUbaZXt4e0oGveaow50kNVZbno=
+SIZE (par2cmdline-0.6.14.tar.gz) = 3539262
Index: patches/patch-Makefile_in
===================================================================
RCS file: patches/patch-Makefile_in
diff -N patches/patch-Makefile_in
--- patches/patch-Makefile_in   27 Jun 2004 23:06:47 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-$OpenBSD: patch-Makefile_in,v 1.2 2004/06/27 23:06:47 jolan Exp $
---- Makefile.in.orig   Mon Apr 12 11:44:18 2004
-+++ Makefile.in        Sun Jun 27 17:56:29 2004
-@@ -669,7 +669,6 @@ install-data-am:
- 
- install-exec-am: install-binPROGRAMS
-       @$(NORMAL_INSTALL)
--      $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
- 
- install-info: install-info-am
- 
Index: patches/patch-README
===================================================================
RCS file: patches/patch-README
diff -N patches/patch-README
--- patches/patch-README        9 May 2010 15:30:53 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-README,v 1.2 2010/05/09 15:30:53 robert Exp $
---- README.orig        Thu Apr 22 16:46:05 2004
-+++ README     Sun May  9 17:23:38 2010
-@@ -81,12 +81,6 @@ The command line parameters for par2cmdline are as fol
-     par2 v(erify) [options] <par2 file> [files]
-     par2 r(epair) [options] <par2 file> [files]
- 
--  Also:
--
--    par2create [options] <par2 file> [files]
--    par2verify [options] <par2 file> [files]
--    par2repair [options] <par2 file> [files]
--    
-   Options:
- 
-     -b<n>  : Set the Block-Count
Index: patches/patch-diskfile_cpp
===================================================================
RCS file: patches/patch-diskfile_cpp
diff -N patches/patch-diskfile_cpp
--- patches/patch-diskfile_cpp  9 May 2010 15:30:53 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-diskfile_cpp,v 1.3 2010/05/09 15:30:53 robert Exp $
---- diskfile.cpp.orig  Mon Apr 12 13:25:37 2004
-+++ diskfile.cpp       Sun May  9 17:23:38 2010
-@@ -17,6 +17,8 @@
- //  along with this program; if not, write to the Free Software
- //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- 
-+#include <sys/param.h>
-+
- #include "par2cmdline.h"
- 
- #ifdef _MSC_VER
-@@ -562,7 +564,7 @@ string DiskFile::GetCanonicalPathname(string filename)
-     return filename;
- 
-   // Get the current directory
--  char curdir[1000];
-+  char curdir[MAXPATHLEN];
-   if (0 == getcwd(curdir, sizeof(curdir)))
-   {
-     return filename;
Index: patches/patch-par2cmdline_h
===================================================================
RCS file: patches/patch-par2cmdline_h
diff -N patches/patch-par2cmdline_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-par2cmdline_h 4 Oct 2015 21:37:28 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+- https://github.com/Parchive/par2cmdline/issues/55 and
+  https://github.com/Parchive/par2cmdline/pull/60
+
+--- par2cmdline.h.orig Sun Aug  2 17:09:46 2015
++++ par2cmdline.h      Sun Oct  4 18:32:15 2015
+@@ -156,9 +156,9 @@ typedef unsigned long long u64;
+ #  ifndef __LITTLE_ENDIAN
+ #    ifdef _LITTLE_ENDIAN
+ #      define __LITTLE_ENDIAN _LITTLE_ENDIAN
+-#      define __LITTLE_ENDIAN _LITTLE_ENDIAN
+ #      define __BIG_ENDIAN _BIG_ENDIAN
+ #      define __PDP_ENDIAN _PDP_ENDIAN
++#      define __BYTE_ORDER _BYTE_ORDER
+ #    else
+ #      error <endian.h> does not define __LITTLE_ENDIAN etc.
+ #    endif
Index: patches/patch-par2creatorsourcefile_cpp
===================================================================
RCS file: patches/patch-par2creatorsourcefile_cpp
diff -N patches/patch-par2creatorsourcefile_cpp
--- patches/patch-par2creatorsourcefile_cpp     19 Apr 2015 17:53:59 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-par2creatorsourcefile_cpp,v 1.2 2015/04/19 17:53:59 jca Exp $
-
-- par2 crash with -q or -qq: https://bugs.debian.org/299658 and
-  http://sf.net/p/parchive/bugs/37/
-
---- par2creatorsourcefile.cpp.orig     Thu Apr 15 14:45:23 2004
-+++ par2creatorsourcefile.cpp  Sun Apr 19 10:57:32 2015
-@@ -213,11 +213,12 @@ bool Par2CreatorSourceFile::Open(CommandLine::NoiseLev
-         }
-       }
- 
-+      offset += want;
-+
-       if (noiselevel > CommandLine::nlQuiet)
-       {
-         // Display progress
-         u32 oldfraction = (u32)(1000 * offset / filesize);
--        offset += want;
-         u32 newfraction = (u32)(1000 * offset / filesize);
-         if (oldfraction != newfraction)
-         {
Index: patches/patch-reedsolomon_cpp
===================================================================
RCS file: /cvs/ports/archivers/par2cmdline/patches/patch-reedsolomon_cpp,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-reedsolomon_cpp
--- patches/patch-reedsolomon_cpp       9 May 2010 15:30:53 -0000       1.1
+++ patches/patch-reedsolomon_cpp       4 Oct 2015 21:37:28 -0000
@@ -1,57 +1,25 @@
-$OpenBSD: patch-reedsolomon_cpp,v 1.1 2010/05/09 15:30:53 robert Exp $
---- reedsolomon.cpp.orig       Sun May  9 17:26:56 2010
-+++ reedsolomon.cpp    Sun May  9 17:28:12 2010
-@@ -51,7 +51,7 @@ u32 gcd(u32 a, u32 b)
-   }
- }
- 
--bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
-+template<> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
- {
-   inputcount = (u32)present.size();
- 
-@@ -80,7 +80,7 @@ bool ReedSolomon<Galois8>::SetInput(const vector<bool>
-   return true;
- }
- 
--bool ReedSolomon<Galois8>::SetInput(u32 count)
-+template<> bool ReedSolomon<Galois8>::SetInput(u32 count)
- {
-   inputcount = count;
- 
-@@ -101,7 +101,7 @@ bool ReedSolomon<Galois8>::SetInput(u32 count)
-   return true;
- }
- 
--bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void 
*inputbuffer, u32 outputindex, void *outputbuffer)
-+template<> bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, 
const void *inputbuffer, u32 outputindex, void *outputbuffer)
- {
-   // Look up the appropriate element in the RS matrix
-   Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + 
inputindex];
-@@ -189,7 +189,7 @@ bool ReedSolomon<Galois8>::Process(size_t size, u32 in
- 
- // Set which of the source files are present and which are missing
- // and compute the base values to use for the vandermonde matrix.
--bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
-+template<> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
- {
-   inputcount = (u32)present.size();
- 
-@@ -233,7 +233,7 @@ bool ReedSolomon<Galois16>::SetInput(const vector<bool
- 
- // Record that the specified number of source files are all present
- // and compute the base values to use for the vandermonde matrix.
--bool ReedSolomon<Galois16>::SetInput(u32 count)
-+template<> bool ReedSolomon<Galois16>::SetInput(u32 count)
- {
-   inputcount = count;
- 
-@@ -267,7 +267,7 @@ bool ReedSolomon<Galois16>::SetInput(u32 count)
-   return true;
- }
- 
--bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void 
*inputbuffer, u32 outputindex, void *outputbuffer)
-+template<> bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, 
const void *inputbuffer, u32 outputindex, void *outputbuffer)
- {
-   // Look up the appropriate element in the RS matrix
+$OpenBSD$
+
+- c++: warning: suggest parentheses around arithmetic in operand of '|' 
[-Wparentheses]
+  https://github.com/Parchive/par2cmdline/pull/60
+
+--- reedsolomon.cpp.orig       Sun Aug  2 17:09:46 2015
++++ reedsolomon.cpp    Sun Oct  4 18:31:57 2015
+@@ -294,7 +294,7 @@ template<> bool ReedSolomon<Galois16>::InternalProcess
+     *pL = *LL + *HL;
+ #else
+     unsigned int temp = *LL + *HL;
+-    *pL = (temp >> 8) & 0xff | (temp << 8) & 0xff00;
++    *pL = ((temp >> 8) & 0xff) | ((temp << 8) & 0xff00);
+ #endif
+ 
+     pL++;
+@@ -305,7 +305,7 @@ template<> bool ReedSolomon<Galois16>::InternalProcess
+     *pH = *LH + *HH;
+ #else
+     temp = *LH + *HH;
+-    *pH = (temp >> 8) & 0xff | (temp << 8) & 0xff00;
++    *pH = ((temp >> 8) & 0xff) | ((temp << 8) & 0xff00);
+ #endif
  
+     pH++;
Index: patches/patch-tests_test12
===================================================================
RCS file: patches/patch-tests_test12
diff -N patches/patch-tests_test12
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tests_test12  4 Oct 2015 21:37:28 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+- Fix regress tests, head -c not working on OpenBSD
+
+--- tests/test12.orig  Sun Aug  2 17:09:46 2015
++++ tests/test12       Sun Oct  4 22:23:04 2015
+@@ -19,7 +19,7 @@ echo $banner
+ echo $dashes
+ 
+ mv test.data test.data-correct
+-head -c 113579 test.data-correct > test.data
++dd if=test.data-correct bs=113579 count=1 status=none of=test.data
+ 
+ ../../par2 r test.par2 > ../$testname.log || { echo "ERROR: repair files 
using PAR 2.0 failed" ; exit 1; } >&2
+ 
Index: patches/patch-tests_test13
===================================================================
RCS file: patches/patch-tests_test13
diff -N patches/patch-tests_test13
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tests_test13  4 Oct 2015 21:37:28 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+- Fix regress tests, head -c not working on OpenBSD
+
+--- tests/test13.orig  Sun Aug  2 17:09:46 2015
++++ tests/test13       Sun Oct  4 22:23:56 2015
+@@ -28,7 +28,7 @@ echo $banner
+ echo $dashes
+ 
+ mv test-1.data test-1.data-correct
+-head -c 177173 test-1.data-correct > test-1.data
++dd if=test-1.data-correct bs=177173 count=1 status=none of=test-1.data
+ 
+ ../../par2 r testdata.par2 > ../$testname.log || { echo "ERROR: repair files 
using PAR 2.0 failed" ; exit 1; } >&2
+ 
Index: patches/patch-tests_test18
===================================================================
RCS file: patches/patch-tests_test18
diff -N patches/patch-tests_test18
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tests_test18  4 Oct 2015 21:37:28 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+- Fix regress tests, head -c not working on OpenBSD
+
+--- tests/test18.orig  Sun Aug  2 17:09:46 2015
++++ tests/test18       Sun Oct  4 22:24:50 2015
+@@ -28,7 +28,7 @@ echo $banner
+ echo $dashes
+ 
+ mv flatdata.tar.gz flatdata.tar.gz-orig
+-head -c 1983 flatdata.tar.gz-orig > flatdata.tar.gz
++dd if=flatdata.tar.gz-orig bs=1983 count=1 status=none of=flatdata.tar.gz
+ rm -f flatdata.tar.gz-orig
+ 
+ ../../par2 r recovery.par2 ./* > ../$testname.log || { echo "ERROR: PAR 2.0 
repair failed" ; exit 1; } >&2
Index: patches/patch-tests_test20
===================================================================
RCS file: patches/patch-tests_test20
diff -N patches/patch-tests_test20
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tests_test20  4 Oct 2015 21:37:28 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+- On OpenBSD iflag is not supported
+
+--- tests/test20.orig  Sun Oct  4 22:27:11 2015
++++ tests/test20       Sun Oct  4 22:30:27 2015
+@@ -16,7 +16,7 @@ echo $dashes
+ echo $banner
+ echo $dashes
+ 
+-dd bs=1000 count=2 iflag=fullblock if=/dev/random of=myfile.dat
++dd bs=1000 count=2 if=/dev/random of=myfile.dat
+ 
+ banner="Creating PAR 2.0 recovery data"
+ dashes=`echo "$banner" | sed s/./-/g`
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/archivers/par2cmdline/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -r1.2 PLIST
--- pkg/PLIST   24 Jul 2004 14:20:49 -0000      1.2
+++ pkg/PLIST   4 Oct 2015 21:37:28 -0000
@@ -1,4 +1,8 @@
 @comment $OpenBSD: PLIST,v 1.2 2004/07/24 14:20:49 espie Exp $
-bin/par2
+@bin bin/par2
+bin/par2create
+bin/par2repair
+bin/par2verify
+@man man/man1/par2.1
 share/doc/par2cmdline/
 share/doc/par2cmdline/README

-- 
best regards
q#

Reply via email to