[48869] trunk/dports/perl/p5-macosx-file
ricci at macports.org
ricci at macports.org
Mon Mar 30 18:02:51 PDT 2009
Revision: 48869
http://trac.macports.org/changeset/48869
Author: ricci at macports.org
Date: 2009-03-30 18:02:51 -0700 (Mon, 30 Mar 2009)
Log Message:
-----------
take maintainership
add patches to use FSPathCopyObjectSync():
- copies files or directories (recursively)
- preserves all file forks
- preserves file metadata (times, permissions, etc.)
(patches sent upstream for improvement and inclusion)
Modified Paths:
--------------
trunk/dports/perl/p5-macosx-file/Portfile
Added Paths:
-----------
trunk/dports/perl/p5-macosx-file/files/
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 2009-03-31 00:57:50 UTC (rev 48868)
+++ trunk/dports/perl/p5-macosx-file/Portfile 2009-03-31 01:02:51 UTC (rev 48869)
@@ -3,7 +3,8 @@
PortGroup perl5 1.0
perl5.setup MacOSX-File 0.71 BSD/DANKOGAI
-maintainers nomaintainer
+revision 1
+maintainers ricci
categories-append sysutils
description A collection of Perl modules to manipulate files on Mac OS X
long_description MacOSX::File is a collection of Perl modules that \
@@ -14,6 +15,9 @@
checksums md5 c63681cb87eb52df07d78897283bd493
platforms darwin
+patchfiles patch-Copy-Copy.pm.diff \
+ patch-Copy-filecopy.c.diff
+
post-patch {
reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile.PL
}
Added: trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff
===================================================================
--- trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff (rev 0)
+++ trunk/dports/perl/p5-macosx-file/files/patch-Copy-Copy.pm.diff 2009-03-31 01:02:51 UTC (rev 48869)
@@ -0,0 +1,11 @@
+--- 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;
Added: trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff
===================================================================
--- trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff (rev 0)
+++ trunk/dports/perl/p5-macosx-file/files/patch-Copy-filecopy.c.diff 2009-03-31 01:02:51 UTC (rev 48869)
@@ -0,0 +1,87 @@
+--- Copy/filecopy.c.orig 2005-08-18 23:12:28.000000000 -0700
++++ Copy/filecopy.c 2009-03-25 17:30:15.000000000 -0700
+@@ -166,46 +167,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){
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090330/2001fc0c/attachment-0001.html>
More information about the macports-changes
mailing list