Skip to content

Commit f680353

Browse files
alexfiklinducer
authored andcommitted
allow passing user and branch to downstream
1 parent a4573f2 commit f680353

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

ci-support.sh

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,10 @@ function install_ispc()
697697

698698
function prepare_downstream_build()
699699
{
700-
local proj_name="$1"
700+
# NOTE: parses https://github.com/user/repo.git@branch_name
701+
local proj_url="${1%%@*}"
702+
local proj_branch=${1#"${proj_url}@"}
703+
local proj_name=$(basename "$proj_url" .git)
701704

702705
# This is here because PyOpenCL needs to record a config change so
703706
# CL headers are found. It git adds siteconf.py.
@@ -707,10 +710,10 @@ function prepare_downstream_build()
707710
git commit -a -m "Fake commit to record local changes"
708711
fi
709712

710-
if [[ "$proj_name" = "mirgecom" ]]; then
711-
git clone "https://github.com/illinois-ceesd/$proj_name.git"
713+
if [[ "$proj_branch" != "$proj_url" ]]; then
714+
git clone "$proj_url" --branch "$proj_branch"
712715
else
713-
git clone "https://github.com/inducer/$proj_name.git"
716+
git clone "$proj_url"
714717
fi
715718

716719
cd "$proj_name"
@@ -747,22 +750,32 @@ function prepare_downstream_build()
747750

748751
function test_downstream()
749752
{
750-
local downstream_proj="$1"
751-
local proj_name="$downstream_proj"
753+
local downstream_url="$1"
754+
local proj_url=""
752755
local test_examples=0
753756

754-
if [[ "$downstream_proj" = *_examples ]]; then
755-
proj_name="${downstream_proj%_examples}"
757+
if [[ "$downstream_url" =~ .*_examples ]]; then
758+
downstream_url="${downstream_url%_examples}"
756759
test_examples=1
757760
fi
758761

759-
prepare_downstream_build "$proj_name"
762+
if [[ "$downstream_url" =~ https://.* ]]; then
763+
proj_url="$downstream_url"
764+
else
765+
if [[ "$downstream_url" == "mirgecom" ]]; then
766+
proj_url="https://github.com/illinois-ceesd/$downstream_url.git"
767+
else
768+
proj_url="https://github.com/inducer/$downstream_url.git"
769+
fi
770+
fi
771+
772+
prepare_downstream_build "$proj_url"
760773
build_py_project_in_conda_env
761774

762775
if [[ "$test_examples" == "0" ]]; then
763776
test_py_project
764777
else
765-
if [[ "$proj_name" = "mirgecom" ]]; then
778+
if [[ "$proj_url" =~ .*mirgecom.* ]]; then
766779
examples/run_examples.sh ./examples
767780
else
768781
run_examples

0 commit comments

Comments
 (0)