rsync for frameworks does not copy symlinks #1063

Closed
ashtom opened this Issue May 23, 2013 · 11 comments

4 participants

@ashtom

The command

rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}

in Pods-resources.sh does not copy all symlinks within the framework bundle. As a consequence, the folders Frameworks, Headers, Resources, and - in our case - the symlink to the binary HockeySDK is missing inside the framework in the .app bundle. This leads to this issue when the framework tries to open a resource.

I can work around the issue by adding the option --copy-links to the rsync command:

rsync -rp --copy-links "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"

Is there a better solution for this? If not, I am happy to provide a pull request.

@fabiopelosin
CocoaPods member

The copy resources script is a fragile solution because it is difficult to asses how it is used. Unfortunately until we don't implement the support for resources bundles we have to live with it. Is there any negative effect that you identified by the introduction of the --copy-links flag? If not I a pull request would be welcome (please don't forget to update the changelog).

@ashtom

The negative effect seems to be that Apple rejects those builds, see here. What's the reason the script uses rsync instead of cp?

@fabiopelosin
CocoaPods member

With cp (as it used to be) the script sensibly affects the build time. Just to be sure, your issue was present in CocoaPods 0.19.1 as well, right?

@ashtom

Yes:

~ pod --version
0.19.1

How about using cp for only the *.framework case?

@fabiopelosin
CocoaPods member

@alloy It would be great to hear your input about this.

@alloy
CocoaPods member

@irrationalfab For the time being (before we have all the funky resources v2 stuff), I agree with @ashtom.

@fabiopelosin
CocoaPods member

Great! @ashtom are you interested in submitting a pull request? In case the line is this.

@ashtom ashtom added a commit to ashtom/CocoaPods that referenced this issue Jun 20, 2013
@ashtom ashtom Use cp instead of rsync to copy frameworks (refs #1063).
Add mkdir command to make sure the folder Contents/Frameworks exists (otherwise the first framework becomes this folder).
Change rsync command to cp to keep the file structure and all symbolic links.
48068f2
@ashtom

@irrationalfab Pull request is here. I tested it with a sample OS X app and the pods for HockeySDK and DropboxSDK.

@fabiopelosin fabiopelosin added a commit that referenced this issue Jul 3, 2013
@fabiopelosin fabiopelosin Merge branch 'master' of https://github.com/ashtom/CocoaPods into ash…
…tom-master

* 'master' of https://github.com/ashtom/CocoaPods:
  Use cp instead of rsync to copy frameworks (refs #1063).
4b78c94
@nschum

After this change, I keep getting messages like this:

cannot overwrite directory /Users/nik/Library/Developer/Xcode/DerivedData/XXX-fblzblixtvaiirdhllllqolnnsbq/Build/Products/Debug/XXX.app/Contents/Frameworks/DropboxOSX.framework/Versions/Current with non-directory /Users/nik/src/XXX/Pods/Dropbox-OSX-SDK/dropbox-osx-sdk-1.3.5/DropboxOSX.framework/Versions/Current

Looks like cp does not want to overwrite the directory symlink. However, rsync -avr does and also preserves the symlinks. Is cp missing another flag? Otherwise I suggest going back to rsync.

@fabiopelosin
CocoaPods member

@ashtom, @alloy any opinion about @nschum point?

@ashtom

I didn't see the error message that @schum is getting, but rsync -avr seems to work too. According to man rsync, the option -a matches -rlptgoD, so the additional parameter r is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment