@@ -4,6 +4,23 @@ if is_apple()
44 using Homebrew
55end
66
7+ function download_and_unpack (baseurl, filename)
8+ downloadurl = baseurl * filename
9+ info (" Downloading $filename from $downloadurl \n To avoid this " *
10+ " download, install git manually and add it to your path " *
11+ " before\n running Pkg.add(\" Git\" ) or Pkg.build(\" Git\" )" )
12+ dest = joinpath (" usr" , string (Sys. MACHINE))
13+ for dir in (" downloads" , " usr" , dest)
14+ isdir (dir) || mkdir (dir)
15+ end
16+ filename = joinpath (" downloads" , filename)
17+ isfile (filename) || run (download_cmd (downloadurl, filename))
18+ # TODO : checksum validation
19+ (b, ext, sec_ext) = splittarpath (filename)
20+ run (unpack_cmd (filename, dest, is_windows () ? " .7z" : ext, sec_ext))
21+ # TODO : make this less noisy on windows, see how WinRPM does it
22+ end
23+
724gitcmd = ` git`
825gitver = " notfound"
926try
@@ -16,40 +33,30 @@ if gitver == "notfound"
1633 error (" Working git not found on path, try running\n Pkg.build(\" Homebrew\" )" )
1734 end
1835 baseurl = " "
19- filename = " "
20- if is_linux () && Sys. ARCH === :x86_64
21- # use conda for a non-root option
22- gitver = " 2.8.2"
23- baseurl = " http://anaconda.org/conda-forge/git/$gitver /download/linux-64/"
24- filename = " git-$gitver -2.tar.bz2"
25- elseif is_linux () && (Sys. ARCH in (:i686 , :i586 , :i486 , :i386 ))
26- # conda-forge doesn't build for 32 bit linux
36+ if is_linux () && (Sys. ARCH in (:x86_64 , :i686 , :i586 , :i486 , :i386 ))
37+ # use conda for a non-root option on x86/amd64 linux
38+ # TODO ? use conda-forge when we no longer build julia on centos 5
2739 gitver = " 2.6.4"
28- baseurl = " http://anaconda.org/anaconda/git/$gitver /download/linux-32/"
29- filename = " git-$gitver -0.tar.bz2"
40+ plat = " download/linux-$(Sys. WORD_SIZE) /"
41+ baseurl = " http://anaconda.org/anaconda/git/$gitver /$plat "
42+ download_and_unpack (baseurl, " git-$gitver -0.tar.bz2" )
43+ # dependencies for linux
44+ sslver = " 1.0.2h"
45+ sslbase = " http://anaconda.org/anaconda/openssl/$sslver /$plat "
46+ download_and_unpack (sslbase, " openssl-$sslver -1.tar.bz2" )
47+ zlibver = " 1.2.8"
48+ zlibbase = " http://anaconda.org/anaconda/zlib/$zlibver /$plat "
49+ download_and_unpack (zlibbase, " zlib-$zlibver -3.tar.bz2" )
3050 elseif is_windows ()
3151 # download and extract portablegit
3252 gitver = " 2.9.0"
33- baseurl = " https://github.com/git-for-windows/git/releases/" *
34- " download/ v$gitver .windows.1/"
35- filename = " PortableGit-$gitver -$(Sys. WORD_SIZE) -bit.7z.exe"
53+ baseurl = " https://github.com/git-for-windows/git/releases/download/ "
54+ download_and_unpack (baseurl * " v$gitver .windows.1/" ,
55+ " PortableGit-$gitver -$(Sys. WORD_SIZE) -bit.7z.exe" )
3656 end
37- downloadurl = baseurl * filename
38- if ! isempty (downloadurl)
39- info (" Downloading git version $gitver from $downloadurl \n To " *
40- " avoid this download, install git manually and add it to your " *
41- " path before\n running Pkg.add(\" Git\" ) or Pkg.build(\" Git\" )" )
42- dest = joinpath (" usr" , string (Sys. MACHINE))
43- for dir in (" downloads" , " usr" , dest)
44- isdir (dir) || mkdir (dir)
45- end
46- filename = joinpath (" downloads" , filename)
47- isfile (filename) || run (download_cmd (downloadurl, filename))
48- # TODO : checksum validation
49- (b, ext, sec_ext) = splittarpath (filename)
50- run (unpack_cmd (filename, dest, is_windows () ? " .7z" : ext, sec_ext))
51- # TODO : make this less noisy on windows, see how WinRPM does it
52- gitcmd = ` $(joinpath (dirname (@__FILE__ ), dest, " bin" , " git" )) `
57+ if ! isempty (baseurl)
58+ gitpath = joinpath (dirname (@__FILE__ ), " usr" , string (Sys. MACHINE), " bin" , " git" )
59+ gitcmd = ` $gitpath `
5360 end
5461 try
5562 gitver = readchomp (` $gitcmd --version` )
@@ -58,8 +65,8 @@ if gitver == "notfound"
5865 # by setting an environment variable in deps.jl
5966 catch err
6067 error (" Could not automatically install git, error was: $err \n " *
61- (is_windows () ? " " : " Try installing git via your " *
62- " system package manager then running\n Pkg.build(\" Git\" )" ))
68+ (is_windows () ? " Report an issue at https://github.com/JuliaPackaging/Git.jl/issues/new " :
69+ " Try installing git via your system package manager then running\n Pkg.build(\" Git\" )" ))
6370 end
6471else
6572 try
0 commit comments