From fc10ed0458c9f72f960b35d6bdf893aaa919f461 Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Tue, 30 Apr 2013 12:34:37 +0200 Subject: [PATCH] 2013-04-30 12:30 UTC+0200 Tamas TEVESZ (ice extreme.hu) * bin/3rdpatch.hb * Change diff files to use Unix-style path separators; Thanks to Alexey Myronenko for testing. * src/3rd/jpeg/jpeg.dif * src/3rd/pcre/pcre.dif * src/3rd/tiff/tiff.dif * Change path separators to Unix-style --- ChangeLog.txt | 9 ++++ bin/3rdpatch.hb | 98 +++++++++++++++++++++++++++++++++++++++++-- src/3rd/jpeg/jpeg.dif | 6 +-- src/3rd/pcre/pcre.dif | 12 +++--- src/3rd/tiff/tiff.dif | 78 +++++++++++++++++----------------- 5 files changed, 151 insertions(+), 52 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ff9f13d96d..b64bf5dcf6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,15 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-30 12:30 UTC+0200 Tamas TEVESZ (ice extreme.hu) + * bin/3rdpatch.hb + * Change diff files to use Unix-style path separators; + Thanks to Alexey Myronenko for testing. + * src/3rd/jpeg/jpeg.dif + * src/3rd/pcre/pcre.dif + * src/3rd/tiff/tiff.dif + * Change path separators to Unix-style + 2013-04-30 09:49 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc.hbc ! updated for QT5 MS-Windows and OS2 builds - only windows build tested diff --git a/bin/3rdpatch.hb b/bin/3rdpatch.hb index 70e8956920..d44ed33ab8 100755 --- a/bin/3rdpatch.hb +++ b/bin/3rdpatch.hb @@ -105,7 +105,7 @@ * Harbour tree as `baz.h'. All notes above about hierarchical and flat * trees strictly apply. * - * For hierarchical source trees, the path separator must always be the UNIX + * For hierarchical source trees, the path separator must always be the Unix * forward slash (`/'). DOS-style backslash separators are not recognized and * will produce undefined results. * @@ -202,10 +202,25 @@ * In all error cases 3rdpatch will provide a meaningful error message. Armed with * that and the information here, troubleshooting should not be much of a problem. * - * 4. BUGS + * 5. NOTES + * -------- + * + * It seems that the Unix versions of GNU patch can not handle diff files with + * DOS-style path separators, whereas the Windows (MinGW/Cygwin) versions have no + * problem working with Unix-style path separators. They however can't be coerced + * into generating diffs with Unix-style path separators, which results in diffs + * generated on Windows hosts can not be applied on non-Windows hosts. + * + * To remedy this situation, 3rdpatch will change diffs to use Unix-style path + * separators. Since this is a grave problem (the diff is unapplyable on + * non-Windows hosts), this change takes place unconditionally. The user is + * notified of the change by an informational message stating the fact. These + * changed diffs should be committed back to the repository. + * + * 6. BUGS * ------- * - * None known. More testing on non-UNIX systems is desired. + * None known. More testing on non-Unix systems is desired. * */ @@ -304,7 +319,7 @@ PROCEDURE Main( ... ) SetupTools() - cFile := MemoRead( cFileName ) + cFile := hb_MemoRead( cFileName ) cDiffFile := NIL /* default to `no local diff' */ nMemoLine := 0 @@ -382,6 +397,8 @@ PROCEDURE Main( ... ) ENDIF NEXT + DOSToUnixPathSep( cDiffFile ) + IF lValidateOnly OutStd( "Metadata syntax is OK." + hb_eol() ) QUIT @@ -398,6 +415,8 @@ PROCEDURE Main( ... ) QUIT ENDIF + s_nErrors := 0 + cCWD := hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir() #if defined( _CURDIR ) @@ -525,6 +544,8 @@ PROCEDURE Main( ... ) IF cDiffFile != NIL /* Copy the diff back to the live tree */ hb_FCopy( CombinePath( s_cTempDir, cDiffFile ), cDiffFile ) + /* Convert path separators */ + DOSToUnixPathSep( cDiffFile ) ENDIF ELSE @@ -852,6 +873,75 @@ STATIC FUNCTION FNameEscape( cFileName ) RETURN cFileName +/* Check diff file for DOS-style path separators; convert them to Unix-style if needed. + * Assumes that diffs use host-native line endings (which should be the case anyway). */ +STATIC PROCEDURE DOSToUnixPathSep( cFileName ) + + LOCAL cFile + LOCAL cMemoLine + LOCAL cNewFile + LOCAL cLookFor + LOCAL nStart + LOCAL nEnd + + IF cFileName == NIL .OR. ! hb_FileExists( cFileName ) + RETURN + ENDIF + + s_nErrors := 0 + + cFile := hb_MemoRead( cFileName ) + cNewFile := "" + cLookFor := hb_eol() + nStart := 1 + s_nErrors := 0 + + DO WHILE .T. + + nEnd := At( cLookFor, SubStr( cFile, nStart ) ) - 1 + IF nEnd < 1 + /* If anything is left in the input string, stick it to the end + * of the output string. No path searching as that would be + * an invalid diff anyway */ + IF Len( SubStr( cFile, nStart ) ) > 0 + cNewFile := SubStr( cFile, nStart ) + ENDIF + EXIT + ENDIF + + cMemoLine := SubStr( cFile, nStart, nEnd ) + + IF ( Left( cMemoLine, 5 ) == "diff " .OR. ; + Left( cMemoLine, 4 ) == "+++ " .OR. ; + Left( cMemoLine, 4 ) == "--- " ) .AND. ; + At( "\", cMemoLine ) > 0 + cNewFile += StrTran( cMemoLine, "\", "/" ) + cLookFor + s_nErrors++ + ELSE + cNewFile += cMemoLine + cLookFor + ENDIF + + nStart += nEnd + Len( cLookFor ) + + ENDDO + + IF s_nErrors > 0 + IF hb_MemoWrit( cFileName, cNewFile ) + OutStd( "I: DOS-style path name separators in `" + cFileName + ; + "' have been converted to Unix-style" + hb_eol() ) + OutStd( "W: Do not forget to push this file!" + hb_eol() ) + ELSE + OutStd( "E: Oops, something bad happened while trying to " + ; + "overwrite `" + cFileName + "'" + hb_eol() ) + OutStd( "E: You will probably have to clean up manually" + hb_eol() ) + /* XXX: Error details? */ + ErrorLevel( 2 ) + QUIT + ENDIF + ENDIF + + RETURN + /* * vim: ts=3 expandtab ft=clipper */ diff --git a/src/3rd/jpeg/jpeg.dif b/src/3rd/jpeg/jpeg.dif index e1691595cd..ff9d0bcf71 100644 --- a/src/3rd/jpeg/jpeg.dif +++ b/src/3rd/jpeg/jpeg.dif @@ -1,6 +1,6 @@ -diff -urN jpeg.orig\jmorecfg.h jpeg\jmorecfg.h ---- jpeg.orig\jmorecfg.h Sat Feb 02 19:37:33 2013 -+++ jpeg\jmorecfg.h Sat Feb 02 19:37:33 2013 +diff -urN jpeg.orig/jmorecfg.h jpeg/jmorecfg.h +--- jpeg.orig/jmorecfg.h Sat Feb 02 19:37:33 2013 ++++ jpeg/jmorecfg.h Sat Feb 02 19:37:33 2013 @@ -138,7 +138,9 @@ #ifdef CHAR_IS_UNSIGNED typedef char UINT8; diff --git a/src/3rd/pcre/pcre.dif b/src/3rd/pcre/pcre.dif index f38429e762..d74f3b6462 100644 --- a/src/3rd/pcre/pcre.dif +++ b/src/3rd/pcre/pcre.dif @@ -1,6 +1,6 @@ -diff -urN pcre.orig\pcrejitc.c pcre\pcrejitc.c ---- pcre.orig\pcrejitc.c Wed Jul 11 12:26:04 2012 -+++ pcre\pcrejitc.c Wed Jul 11 12:26:05 2012 +diff -urN pcre.orig/pcrejitc.c pcre/pcrejitc.c +--- pcre.orig/pcrejitc.c Wed Jul 11 12:26:04 2012 ++++ pcre/pcrejitc.c Wed Jul 11 12:26:05 2012 @@ -59,7 +59,7 @@ #define SLJIT_VERBOSE 0 #define SLJIT_DEBUG 0 @@ -10,9 +10,9 @@ diff -urN pcre.orig\pcrejitc.c pcre\pcrejitc.c #if defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED #error Unsupported architecture -diff -urN pcre.orig\sjconfi.h pcre\sjconfi.h ---- pcre.orig\sjconfi.h Wed Jul 11 12:26:04 2012 -+++ pcre\sjconfi.h Wed Jul 11 12:26:05 2012 +diff -urN pcre.orig/sjconfi.h pcre/sjconfi.h +--- pcre.orig/sjconfi.h Wed Jul 11 12:26:04 2012 ++++ pcre/sjconfi.h Wed Jul 11 12:26:05 2012 @@ -282,8 +282,12 @@ #if defined(__GNUC__) diff --git a/src/3rd/tiff/tiff.dif b/src/3rd/tiff/tiff.dif index 6e9af94264..f0ca032b22 100644 --- a/src/3rd/tiff/tiff.dif +++ b/src/3rd/tiff/tiff.dif @@ -1,6 +1,6 @@ -diff -urN tiff.orig\dirread.c tiff\dirread.c ---- tiff.orig\dirread.c Sat Feb 02 20:52:59 2013 -+++ tiff\dirread.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/dirread.c tiff/dirread.c +--- tiff.orig/dirread.c Sat Feb 02 20:52:59 2013 ++++ tiff/dirread.c Sat Feb 02 20:52:59 2013 @@ -2216,7 +2216,7 @@ case TIFF_FLOAT: if (tif->tif_flags&TIFF_SWAB) @@ -36,9 +36,9 @@ diff -urN tiff.orig\dirread.c tiff\dirread.c static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlong8Long8(uint64 value) -diff -urN tiff.orig\dirwrite.c tiff\dirwrite.c ---- tiff.orig\dirwrite.c Sat Feb 02 20:52:59 2013 -+++ tiff\dirwrite.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/dirwrite.c tiff/dirwrite.c +--- tiff.orig/dirwrite.c Sat Feb 02 20:52:59 2013 ++++ tiff/dirwrite.c Sat Feb 02 20:52:59 2013 @@ -2238,7 +2238,7 @@ { assert(count<0x40000000); @@ -57,9 +57,9 @@ diff -urN tiff.orig\dirwrite.c tiff\dirwrite.c if (tif->tif_flags&TIFF_SWAB) TIFFSwabArrayOfDouble(value,count); return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_DOUBLE,count,count*8,value)); -diff -urN tiff.orig\dumpmode.c tiff\dumpmode.c ---- tiff.orig\dumpmode.c Sat Feb 02 20:52:59 2013 -+++ tiff\dumpmode.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/dumpmode.c tiff/dumpmode.c +--- tiff.orig/dumpmode.c Sat Feb 02 20:52:59 2013 ++++ tiff/dumpmode.c Sat Feb 02 20:52:59 2013 @@ -80,19 +80,11 @@ static const char module[] = "DumpModeDecode"; (void) s; @@ -83,9 +83,9 @@ diff -urN tiff.orig\dumpmode.c tiff\dumpmode.c return (0); } /* -diff -urN tiff.orig\luv.c tiff\luv.c ---- tiff.orig\luv.c Sat Feb 02 20:52:59 2013 -+++ tiff\luv.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/luv.c tiff/luv.c +--- tiff.orig/luv.c Sat Feb 02 20:52:59 2013 ++++ tiff/luv.c Sat Feb 02 20:52:59 2013 @@ -224,17 +224,10 @@ tp[i++] |= (int16)*bp++ << shft; } @@ -146,9 +146,9 @@ diff -urN tiff.orig\luv.c tiff\luv.c tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (0); -diff -urN tiff.orig\lzw.c tiff\lzw.c ---- tiff.orig\lzw.c Sat Feb 02 20:52:59 2013 -+++ tiff\lzw.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/lzw.c tiff/lzw.c +--- tiff.orig/lzw.c Sat Feb 02 20:52:59 2013 ++++ tiff/lzw.c Sat Feb 02 20:52:59 2013 @@ -549,15 +549,9 @@ sp->dec_maxcodep = maxcodep; @@ -185,9 +185,9 @@ diff -urN tiff.orig\lzw.c tiff\lzw.c return (0); } return (1); -diff -urN tiff.orig\print.c tiff\print.c ---- tiff.orig\print.c Sat Feb 02 20:52:59 2013 -+++ tiff\print.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/print.c tiff/print.c +--- tiff.orig/print.c Sat Feb 02 20:52:59 2013 ++++ tiff/print.c Sat Feb 02 20:52:59 2013 @@ -98,27 +98,13 @@ || fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *) raw_data)[j]); @@ -277,9 +277,9 @@ diff -urN tiff.orig\print.c tiff\print.c } } -diff -urN tiff.orig\read.c tiff\read.c ---- tiff.orig\read.c Sat Feb 02 20:52:59 2013 -+++ tiff\read.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/read.c tiff/read.c +--- tiff.orig/read.c Sat Feb 02 20:52:59 2013 ++++ tiff/read.c Sat Feb 02 20:52:59 2013 @@ -125,19 +125,11 @@ cc = TIFFReadFile(tif, tif->tif_rawdata + unused_data, to_read); @@ -490,9 +490,9 @@ diff -urN tiff.orig\read.c tiff\read.c return (0); } if (isMapped(tif) && -diff -urN tiff.orig\strip.c tiff\strip.c ---- tiff.orig\strip.c Sat Feb 02 20:52:59 2013 -+++ tiff\strip.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/strip.c tiff/strip.c +--- tiff.orig/strip.c Sat Feb 02 20:52:59 2013 ++++ tiff/strip.c Sat Feb 02 20:52:59 2013 @@ -154,17 +154,10 @@ if (bytecount == 0) @@ -513,9 +513,9 @@ diff -urN tiff.orig\strip.c tiff\strip.c bytecount = (uint64) -1; } -diff -urN tiff.orig\thunder.c tiff\thunder.c ---- tiff.orig\thunder.c Sat Feb 02 20:52:59 2013 -+++ tiff\thunder.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/thunder.c tiff/thunder.c +--- tiff.orig/thunder.c Sat Feb 02 20:52:59 2013 ++++ tiff/thunder.c Sat Feb 02 20:52:59 2013 @@ -143,21 +143,12 @@ tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; @@ -541,9 +541,9 @@ diff -urN tiff.orig\thunder.c tiff\thunder.c return (0); } -diff -urN tiff.orig\tiffconf.h tiff\tiffconf.h ---- tiff.orig\tiffconf.h Sat Feb 02 20:52:59 2013 -+++ tiff\tiffconf.h Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/tiffconf.h tiff/tiffconf.h +--- tiff.orig/tiffconf.h Sat Feb 02 20:52:59 2013 ++++ tiff/tiffconf.h Sat Feb 02 20:52:59 2013 @@ -7,44 +7,65 @@ #ifndef _TIFFCONF_ #define _TIFFCONF_ @@ -706,9 +706,9 @@ diff -urN tiff.orig\tiffconf.h tiff\tiffconf.h +#endif #endif /* _TIFFCONF_ */ -diff -urN tiff.orig\tiffio.h tiff\tiffio.h ---- tiff.orig\tiffio.h Sat Feb 02 20:52:59 2013 -+++ tiff\tiffio.h Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/tiffio.h tiff/tiffio.h +--- tiff.orig/tiffio.h Sat Feb 02 20:52:59 2013 ++++ tiff/tiffio.h Sat Feb 02 20:52:59 2013 @@ -102,6 +102,8 @@ # else typedef HFILE thandle_t; /* client data handle */ @@ -718,9 +718,9 @@ diff -urN tiff.orig\tiffio.h tiff\tiffio.h #else typedef void* thandle_t; /* client data handle */ #endif /* USE_WIN32_FILEIO */ -diff -urN tiff.orig\tiffiop.h tiff\tiffiop.h ---- tiff.orig\tiffiop.h Sat Feb 02 20:52:59 2013 -+++ tiff\tiffiop.h Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/tiffiop.h tiff/tiffiop.h +--- tiff.orig/tiffiop.h Sat Feb 02 20:52:59 2013 ++++ tiff/tiffiop.h Sat Feb 02 20:52:59 2013 @@ -30,7 +30,7 @@ * ``Library-private'' definitions. */ @@ -730,9 +730,9 @@ diff -urN tiff.orig\tiffiop.h tiff\tiffiop.h #ifdef HAVE_FCNTL_H # include -diff -urN tiff.orig\unix.c tiff\unix.c ---- tiff.orig\unix.c Sat Feb 02 20:52:59 2013 -+++ tiff\unix.c Sat Feb 02 20:52:59 2013 +diff -urN tiff.orig/unix.c tiff/unix.c +--- tiff.orig/unix.c Sat Feb 02 20:52:59 2013 ++++ tiff/unix.c Sat Feb 02 20:52:59 2013 @@ -29,7 +29,7 @@ * Windows Common RunTime Library. */