Skip to content

Commit 582443d

Browse files
authored
[Sources] Consider URLs starting with git:// as Git repositories (#281)
1 parent dd8ee21 commit 582443d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilderBase"
22
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "1.18.0"
4+
version = "1.18.1"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"

src/Sources.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ end
9898
DirectorySource(path::String; target::String = "", follow_symlinks::Bool=false) =
9999
DirectorySource(path, target, follow_symlinks)
100100

101+
# Try to guess if a URL is a Git repository
102+
isgitrepo(url::AbstractString) = endswith(url, ".git") || startswith(url, "git://")
103+
101104
# This is not meant to be used as source in the `build_tarballs.jl` scripts but
102105
# only to set up the source in the workspace.
103106
struct SetupSource{T<:AbstractSource}
@@ -112,7 +115,7 @@ SetupSource{T}(path::String, hash::String, target::String) where {T} =
112115
# This is used in wizard/obtain_source.jl to automatically guess the parameter
113116
# of SetupSource from the URL
114117
function SetupSource(url::String, path::String, hash::String, target::String)
115-
if endswith(url, ".git")
118+
if isgitrepo(url)
116119
return SetupSource{GitSource}(path, hash, target)
117120
elseif any(endswith(path, ext) for ext in archive_extensions)
118121
return SetupSource{ArchiveSource}(path, hash, target)

test/sources.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ using JSON
1414
@test SetupSource("https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz", "wget-1.20.3.tar.gz", "", "") isa SetupSource{ArchiveSource}
1515
@test SetupSource("https://ftp.gnu.org/gnu/wget/wget-1.20.3.zip", "wget-1.20.3.zip", "", "") isa SetupSource{ArchiveSource}
1616
@test SetupSource("https://github.com/jedisct1/libsodium.git", "libsodium.git", "", "") isa SetupSource{GitSource}
17+
@test SetupSource("git://developer.intra2net.com/libftdi", "libftdi", "", "") isa SetupSource{GitSource}
1718
@test SetupSource("https://curl.haxx.se/ca/cacert-2020-01-01.pem", "cacert-2020-01-01.pem", "", "") isa SetupSource{FileSource}
1819

1920
@testset "Download and setup" begin

0 commit comments

Comments
 (0)