Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7559] Building swiftpm requires rsync, and crashes with an obscure message if not found #4820

Closed
alblue opened this issue Apr 28, 2018 · 4 comments
Labels

Comments

@alblue
Copy link
Contributor

alblue commented Apr 28, 2018

Previous ID SR-7559
Radar None
Original Reporter @alblue
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, StarterBug
Assignee freak4pc (JIRA)
Priority Medium

md5: 72850b6a70529d6c4d42a430f3971fa8

Issue Description:

cmd = ["rsync", "-a", module_input_path, runtime_module_path]
subprocess.check_call(cmd)
cmd = ["rsync", "-a", swiftdoc_input_path, runtime_swiftdoc_path]

SwiftPM uses rsync here as part of its build process. If rsync is not found on the system (say, a minimal container without many dependencies) then it will fail with a terse/cryptic error message:

Compile Swift Module 'Commands' (14 sources)
Compile Swift Module 'swift_package' (1 sources)
Compile Swift Module 'swift_build' (1 sources)
Compile Swift Module 'swift_test' (1 sources)
Compile Swift Module 'swift_run' (1 sources)

      • bootstrap: note: building runtime v4_2 target: PackageDescription4:
        Compile Swift Module 'PackageDescription' (9 sources)

      • bootstrap: note: building runtime v3 target: PackageDescription:
        Compile Swift Module 'PackageDescription' (6 sources)

      • bootstrap: note: building runtime v4 target: PackageDescription4:
        Compile Swift Module 'PackageDescription' (9 sources)
        Traceback (most recent call last):
        File "/swift-source/swiftpm/Utilities/bootstrap", line 1276, in <module>
        main()
        File "/swift-source/swiftpm/Utilities/bootstrap", line 949, in main
        build, args, lib_path)
        File "/swift-source/swiftpm/Utilities/bootstrap", line 659, in process_runtime_libraries
        subprocess.check_call(cmd)
        File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        retcode = call(*popenargs, **kwargs)
        File "/usr/lib/python2.7/subprocess.py", line 172, in call
        return Popen(*popenargs, **kwargs).wait()
        File "/usr/lib/python2.7/subprocess.py", line 394, in init
        errread, errwrite)
        File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
        raise child_exception
        OSError: [Errno 2] No such file or directory
        ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
        ./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

It would be better if a fallback position determined that rsync was not available, and used a different mechanism (and/or failed with a sensible error message) instead of the above

@alblue
Copy link
Contributor Author

alblue commented Apr 28, 2018

Maybe a pure python function would work?

https://docs.python.org/2/distutils/apiref.html#distutils.dir_util.copy_tree

@ankitspd
Copy link
Member

ankitspd commented Jun 8, 2018

I think we should check for rsync and emit the appropriate error if not found.

@swift-ci
Copy link
Contributor

swift-ci commented Jun 9, 2018

Comment by Shai Mishali (JIRA)

Have a PR for this here: #1595

@swift-ci
Copy link
Contributor

Comment by Shai Mishali (JIRA)

Resolved in #1595

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants