Revision: 130541 https://trac.macports.org/changeset/130541 Author: larryv@macports.org Date: 2014-12-31 12:52:48 -0800 (Wed, 31 Dec 2014) Log Message: ----------- p5-macosx-file: Refactor patches - use-FSPathCopyObjectSync.patch: r48869 - fix-Copy-tiger.patch: r49288 Revision Links: -------------- https://trac.macports.org/changeset/48869 https://trac.macports.org/changeset/49288 Modified Paths: -------------- trunk/dports/perl/p5-macosx-file/Portfile Added Paths: ----------- trunk/dports/perl/p5-macosx-file/files/fix-Copy-tiger.patch trunk/dports/perl/p5-macosx-file/files/use-FSPathCopyObjectSync.patch Removed Paths: ------------- trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff Modified: trunk/dports/perl/p5-macosx-file/Portfile =================================================================== --- trunk/dports/perl/p5-macosx-file/Portfile 2014-12-31 19:33:15 UTC (rev 130540) +++ trunk/dports/perl/p5-macosx-file/Portfile 2014-12-31 20:52:48 UTC (rev 130541) @@ -24,8 +24,8 @@ if {${perl5.major} ne ""} { supported_archs i386 ppc -patchfiles patch-Copy-Copy.pm.diff \ - patch-Copy-filecopy.c.diff +patchfiles use-FSPathCopyObjectSync.patch \ + fix-Copy-tiger.patch post-patch { reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile.PL } Copied: trunk/dports/perl/p5-macosx-file/files/fix-Copy-tiger.patch (from rev 130540, trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff) =================================================================== --- trunk/dports/perl/p5-macosx-file/files/fix-Copy-tiger.patch (rev 0) +++ trunk/dports/perl/p5-macosx-file/files/fix-Copy-tiger.patch 2014-12-31 20:52:48 UTC (rev 130541) @@ -0,0 +1,19 @@ +Index: Copy/filecopy.c +=================================================================== +--- Copy/filecopy.c.orig ++++ Copy/filecopy.c +@@ -6,6 +6,14 @@ + #include <Files.h> + #include "common/util.c" + ++#ifndef kPOSIXErrorBase ++#define kPOSIXErrorBase 100000L ++#endif ++ ++#ifndef kPOSIXErrorERANGE ++#define kPOSIXErrorERANGE 100034L ++#endif ++ + #ifdef _INC_PERL_XSUB_H + static int + setcopyerr(int err, char *filename, int line) Deleted: trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff =================================================================== --- trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff 2014-12-31 19:33:15 UTC (rev 130540) +++ trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff 2014-12-31 20:52:48 UTC (rev 130541) @@ -1,11 +0,0 @@ ---- Copy/Copy.pm.orig 2005-08-18 23:12:28.000000000 -0700 -+++ Copy/Copy.pm 2009-03-25 17:22:19.000000000 -0700 -@@ -85,7 +85,7 @@ - - my ($srcdev, $srcino, $srcmode, $srcuid, $srcgid, $srcatime, $srcmtime) - = (lstat($src))[0,1,2,4,5,8,9]; -- unless(-f _){ -+ unless(-e _){ - $MacOSX::File::OSErr = -43; # fnfErr; - $! = &Errno::ENOENT; - return; Deleted: trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff =================================================================== --- trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff 2014-12-31 19:33:15 UTC (rev 130540) +++ trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff 2014-12-31 20:52:48 UTC (rev 130541) @@ -1,106 +0,0 @@ ---- Copy/filecopy.c.orig 2005-08-18 23:12:28.000000000 -0700 -+++ Copy/filecopy.c 2009-04-03 18:02:48.000000000 -0700 -@@ -3,9 +3,18 @@ - */ - - #undef I_POLL -+// #include <libgen.h> - #include <Files.h> - #include "common/util.c" - -+#ifndef kPOSIXErrorBase -+# define kPOSIXErrorBase 100000L -+#endif /* kPOSIXErrorBase */ -+ -+#ifndef kPOSIXErrorERANGE -+# define kPOSIXErrorERANGE 100034L -+#endif /* kPOSIXErrorERANGE */ -+ - #ifdef _INC_PERL_XSUB_H - static int - setcopyerr(int err, char *filename, int line) -@@ -166,46 +175,46 @@ - - #define min(x, y) ((x) < y) ? (x) : (y) - --static OSErr --filecopy(char *src, char *dst, UInt64 maxbufsize, int preserve){ -- OSErr err; -- FSCatalogInfo srcCat, dstCat; -- FSRef srcFS, dstFS; -- HFSUniStr255 forkName; -- UTCDateTime now; -- -- if (err = FSPathMakeRef(src, &srcFS, NULL)) -- { return err; } -- -- if (err = FSGetCatalogInfo(&srcFS, kFSCatInfoGettableInfo, &srcCat, -- NULL, NULL, NULL)) -- { return err; } -- -- bcopy(&srcCat, &dstCat, sizeof(FSCatalogInfo)); -- -- if (err = newfile(dst, &dstFS, &dstCat)){ -- fpf(stderr, "Cannot Create File %s\n", dst); -- return err; -- } -- if (srcCat.dataLogicalSize){ -- setbufsiz(min(srcCat.dataPhysicalSize, maxbufsize)); -- FSGetDataForkName(&forkName); -- if (err = copyfork(&forkName, &srcFS, &dstFS)) -- { return err; } -- } -- if (srcCat.rsrcLogicalSize){ -- setbufsiz(min(srcCat.rsrcPhysicalSize, maxbufsize)); -- FSGetResourceForkName(&forkName); -- if (err = copyfork(&forkName, &srcFS, &dstFS)) -- { return err; } -- } -- freebuf(); -- if (preserve){ -- err = FSSetCatalogInfo(&dstFS, kFSCatInfoSettableInfo, &srcCat); -- } -- return err; -+static OSStatus -+filecopy(char *src, char *dst, UInt64 maxbufsize, int preserve) -+{ -+ OSStatus status; -+ char *destDir = NULL; -+ CFStringRef destFname; -+ char *lastSlash = NULL; -+ char *tmpString = NULL; -+ -+ if (NULL == dst || NULL == src) { -+ return -1; -+ } -+ /* split the dst into the dir and the filename */ -+ if (NULL == (tmpString = dirname(dst))) { -+ /* dirname() failed... */ -+ return errno + kPOSIXErrorBase; -+ } -+ destDir = calloc((strlen(tmpString) + 2), sizeof(char)); -+ if (NULL == destDir) { -+ /* failed to allocate mem */ -+ return errno + kPOSIXErrorBase; -+ } -+ if (strlcpy(destDir, tmpString, (strlen(tmpString) + 1)) > (strlen(tmpString))) { -+ /* argh! */ -+ return kPOSIXErrorERANGE; -+ } -+ if (NULL == (tmpString = basename(dst))) { -+ /* basename() failed... */ -+ return errno + kPOSIXErrorBase; -+ } -+ destFname = CFStringCreateWithCString(kCFAllocatorDefault, tmpString, kCFStringEncodingMacRoman); -+ -+ status = FSPathCopyObjectSync(src, destDir, destFname, NULL, kFSFileOperationSkipPreflight); -+ -+ // fprintf(stderr, "FSPathCOpyObjectSync(%s, %s, %s,...) status is \"%d\"\n", (NULL != src ? src : "<NULL>"), (NULL != destDir ? destDir: "<NULL>"), (NULL != tmpString ? tmpString: "<NULL>"), status); -+ -+ return status; - } - -+ - /* - static OSErr - filemove(char *src, char *dst){ Copied: trunk/dports/perl/p5-macosx-file/files/use-FSPathCopyObjectSync.patch (from rev 130540, trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff) =================================================================== --- trunk/dports/perl/p5-macosx-file/files/use-FSPathCopyObjectSync.patch (rev 0) +++ trunk/dports/perl/p5-macosx-file/files/use-FSPathCopyObjectSync.patch 2014-12-31 20:52:48 UTC (rev 130541) @@ -0,0 +1,102 @@ +Index: Copy/filecopy.c +=================================================================== +--- Copy/filecopy.c.orig ++++ Copy/filecopy.c +@@ -166,46 +166,46 @@ copyfork(HFSUniStr255 *forkName, FSRef * + + #define min(x, y) ((x) < y) ? (x) : (y) + +-static OSErr +-filecopy(char *src, char *dst, UInt64 maxbufsize, int preserve){ +- OSErr err; +- FSCatalogInfo srcCat, dstCat; +- FSRef srcFS, dstFS; +- HFSUniStr255 forkName; +- UTCDateTime now; +- +- if (err = FSPathMakeRef(src, &srcFS, NULL)) +- { return err; } +- +- if (err = FSGetCatalogInfo(&srcFS, kFSCatInfoGettableInfo, &srcCat, +- NULL, NULL, NULL)) +- { return err; } +- +- bcopy(&srcCat, &dstCat, sizeof(FSCatalogInfo)); +- +- if (err = newfile(dst, &dstFS, &dstCat)){ +- fpf(stderr, "Cannot Create File %s\n", dst); +- return err; +- } +- if (srcCat.dataLogicalSize){ +- setbufsiz(min(srcCat.dataPhysicalSize, maxbufsize)); +- FSGetDataForkName(&forkName); +- if (err = copyfork(&forkName, &srcFS, &dstFS)) +- { return err; } +- } +- if (srcCat.rsrcLogicalSize){ +- setbufsiz(min(srcCat.rsrcPhysicalSize, maxbufsize)); +- FSGetResourceForkName(&forkName); +- if (err = copyfork(&forkName, &srcFS, &dstFS)) +- { return err; } +- } +- freebuf(); +- if (preserve){ +- err = FSSetCatalogInfo(&dstFS, kFSCatInfoSettableInfo, &srcCat); +- } +- return err; ++static OSStatus ++filecopy(char *src, char *dst, UInt64 maxbufsize, int preserve) ++{ ++ OSStatus status; ++ char *destDir = NULL; ++ CFStringRef destFname; ++ char *lastSlash = NULL; ++ char *tmpString = NULL; ++ ++ if (NULL == dst || NULL == src) { ++ return -1; ++ } ++ /* split the dst into the dir and the filename */ ++ if (NULL == (tmpString = dirname(dst))) { ++ /* dirname() failed... */ ++ return errno + kPOSIXErrorBase; ++ } ++ destDir = calloc((strlen(tmpString) + 2), sizeof(char)); ++ if (NULL == destDir) { ++ /* failed to allocate mem */ ++ return errno + kPOSIXErrorBase; ++ } ++ if (strlcpy(destDir, tmpString, (strlen(tmpString) + 1)) > (strlen(tmpString))) { ++ /* argh! */ ++ return kPOSIXErrorERANGE; ++ } ++ if (NULL == (tmpString = basename(dst))) { ++ /* basename() failed... */ ++ return errno + kPOSIXErrorBase; ++ } ++ destFname = CFStringCreateWithCString(kCFAllocatorDefault, tmpString, kCFStringEncodingMacRoman); ++ ++ status = FSPathCopyObjectSync(src, destDir, destFname, NULL, kFSFileOperationSkipPreflight); ++ ++ // fprintf(stderr, "FSPathCOpyObjectSync(%s, %s, %s,...) status is \"%d\"\n", (NULL != src ? src : "<NULL>"), (NULL != destDir ? destDir: "<NULL>"), (NULL != tmpString ? tmpString: "<NULL>"), status); ++ ++ return status; + } + ++ + /* + static OSErr + filemove(char *src, char *dst){ +Index: Copy/Copy.pm +=================================================================== +--- Copy/Copy.pm.orig ++++ Copy/Copy.pm +@@ -85,7 +85,7 @@ sub copy($$;$$){ + + my ($srcdev, $srcino, $srcmode, $srcuid, $srcgid, $srcatime, $srcmtime) + = (lstat($src))[0,1,2,4,5,8,9]; +- unless(-f _){ ++ unless(-e _){ + $MacOSX::File::OSErr = -43; # fnfErr; + $! = &Errno::ENOENT; + return;
participants (1)
-
larryv@macports.org