@@ -569,6 +569,8 @@ Base.@kwdef mutable struct Context
569
569
num_concurrent_downloads:: Int = 8
570
570
graph_verbose:: Bool = false
571
571
stdlibs:: Dict{UUID,String} = gather_stdlib_uuids ()
572
+ # Remove next field when support for Pkg2 CI scripts is removed
573
+ old_pkg2_clone_name:: String = " "
572
574
end
573
575
574
576
function Context! (ctx:: Context ; kwargs... )
@@ -652,7 +654,7 @@ function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec})
652
654
pkg. path = abspath (pkg. repo. url)
653
655
folder_already_downloaded = true
654
656
project_path = pkg. repo. url
655
- parse_package! (env , pkg, project_path)
657
+ parse_package! (ctx , pkg, project_path)
656
658
else
657
659
# We save the repo in case another environement wants to
658
660
# develop from the same repo, this avoids having to reclone it
@@ -675,11 +677,17 @@ function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec})
675
677
cp (repo_path, project_path; force= true )
676
678
repo = LibGit2. GitRepo (project_path)
677
679
rev = pkg. repo. rev
678
- isempty (rev) && (rev = LibGit2. branch (repo))
680
+ if isempty (rev)
681
+ if LibGit2. isattached (repo)
682
+ rev = LibGit2. branch (repo)
683
+ else
684
+ rev = string (LibGit2. GitHash (LibGit2. head (repo)))
685
+ end
686
+ end
679
687
gitobject, isbranch = checkout_rev! (repo, rev)
680
688
close (repo); close (gitobject)
681
689
682
- parse_package! (env , pkg, project_path)
690
+ parse_package! (ctx , pkg, project_path)
683
691
dev_pkg_path = joinpath (Pkg3. devdir (), pkg. name)
684
692
if isdir (dev_pkg_path)
685
693
if ! isfile (joinpath (dev_pkg_path, " src" , pkg. name * " .jl" ))
@@ -735,7 +743,13 @@ function handle_repos_add!(ctx::Context, pkgs::AbstractVector{PackageSpec}; upgr
735
743
end
736
744
737
745
# see if we can get rev as a branch
738
- isempty (rev) && (rev = LibGit2. branch (repo); pkg. repo. rev = rev)
746
+ if isempty (rev)
747
+ if LibGit2. isattached (repo)
748
+ rev = LibGit2. branch (repo)
749
+ else
750
+ rev = string (LibGit2. GitHash (LibGit2. head (repo)))
751
+ end
752
+ end
739
753
gitobject, isbranch = checkout_rev! (repo, rev)
740
754
if ! isbranch
741
755
# If the user gave a shortened commit SHA, might as well update it to the full one
@@ -765,7 +779,7 @@ function handle_repos_add!(ctx::Context, pkgs::AbstractVector{PackageSpec}; upgr
765
779
LibGit2. checkout_tree (repo, git_tree, options= opts)
766
780
end
767
781
close (repo); close (git_tree); close (gitobject)
768
- parse_package! (env , pkg, project_path)
782
+ parse_package! (ctx , pkg, project_path)
769
783
if ! folder_already_downloaded
770
784
version_path = Pkg3. Operations. find_installed (pkg. name, pkg. uuid, pkg. repo. git_tree_sha1)
771
785
mkpath (version_path)
@@ -777,7 +791,8 @@ function handle_repos_add!(ctx::Context, pkgs::AbstractVector{PackageSpec}; upgr
777
791
return new_uuids
778
792
end
779
793
780
- function parse_package! (env, pkg, project_path)
794
+ function parse_package! (ctx, pkg, project_path)
795
+ env = ctx. env
781
796
found_project_file = false
782
797
for projname in project_names
783
798
if isfile (joinpath (project_path, projname))
@@ -796,10 +811,14 @@ function parse_package!(env, pkg, project_path)
796
811
end
797
812
if ! found_project_file
798
813
@warn " packages will require to have a [Julia]Project.toml file in the future"
799
- # This is an old style package, get the name from the url.
800
- m = match (reg_pkg, pkg. repo. url)
801
- m === nothing && cmderror (" cannot determine package name from URL: $(pkg. repo. url) " )
802
- pkg. name = m. captures[1 ]
814
+ if ! isempty (ctx. old_pkg2_clone_name) # remove when legacy CI script support is removed
815
+ pkg. name = ctx. old_pkg2_clone_name
816
+ else
817
+ # This is an old style package, get the name from src/PackageName
818
+ m = match (reg_pkg, pkg. repo. url)
819
+ m === nothing && cmderror (" cannot determine package name from URL: $(pkg. repo. url) " )
820
+ pkg. name = m. captures[1 ]
821
+ end
803
822
reg_uuids = registered_uuids (env, pkg. name)
804
823
is_registered = ! isempty (reg_uuids)
805
824
if ! is_registered
0 commit comments