swiftlang / swift-docker

Docker Official Image packaging for Swift
https://swift.org
Apache License 2.0
1.36k stars 182 forks source link

Upgrade version of Git to work with SPM #258

Open kneekey23 opened 2 years ago

kneekey23 commented 2 years ago

The older version of git installed on CentOS does not work with the version SPM uses to checkout packages. Using this image results in the following error from Swift Package Manager:

> swift build -c release
Fetching https://github.com/apple/swift-collections
Fetched https://github.com/apple/swift-collections (0.99s)
Computing version for https://github.com/apple/swift-collections
/root/aws-crt-swift/.build/repositories/swift-collections-7977a4e0: error: Couldnt get the list of tags:
    Unknown option: -C
    usage: git [--version] [--help] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]
Failed to run swift build -c release: Command exited with code 1:
Fetching https://github.com/apple/swift-collections
Fetched https://github.com/apple/swift-collections (0.99s)
Computing version for https://github.com/apple/swift-collections
/root/aws-crt-swift/.build/repositories/swift-collections-7977a4e0: error: Couldnt get the list of tags:
    Unknown option: -C
    usage: git [--version] [--help] [-c name=value]
               [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
               [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
               [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
               <command> [<args>]

If I update git version in my docker file that is coming from this one, it works.

tomerd commented 2 years ago

cc @shahmishal @drexin

=> which version of CentOS is this? => how did you update git to make it work?

kneekey23 commented 2 years ago

Version 7 of CentOS And this seems to work:

yum install -y make libcurl-devel git clone https://github.com/git/git -bv2.33.1 --depth 1 && cd git make prefix=/usr -j all install NO_OPENSSL=1 NO_EXPAT=1 NO_TCLTK=1 NO_GETTEXT=1 NO_PERL=1

tomerd commented 2 years ago

@drexin wdyt?

tomerd commented 2 years ago

@kneekey23 thanks do you need to use centos 7 or centos 8 is a option as well?

kneekey23 commented 2 years ago

Let me investigate that, good question @tomerd

shahmishal commented 10 months ago

@kneekey23 Let us know if this is still an issue, otherwise we can close the issue. Thanks!