Skip to content

Commit

Permalink
fix the repository downloads
Browse files Browse the repository at this point in the history
- introduction of single repository download
  and build broke the download of all repositories...
- problem was that the new code did not take into
  account the BINFO_APP_SRC_CLONE_DIR variable

fixes: #120

Signed-off-by: Mika Laitio <lamikr@pilppa.org>
  • Loading branch information
lamikr committed Aug 3, 2024
1 parent 273ca4f commit 836d401
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 77 deletions.
35 changes: 17 additions & 18 deletions babs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,25 @@ func_repolist_upstream_remote_repo_add() {
if [ ! -d src_projects ]; then
echo ""
echo "Download of source projects will start shortly"
echo "It will take up about 20 gb under 'src_projects' directory."
echo "Advice:"
echo "If you work with multible copies of this sdk,"
echo "you could tar 'src_projects' and extract it manually for other SDK copies."
echo "Total download size under 'src_projects' directory will be about 30 GB."
echo ""
echo "----------------------------------------------------------------"
echo "You could speedup future builds by using a backup of src_projects directory:"
echo "Backup:"
echo " tar -cvf src_backup.tar 'src_projects'"
echo "Restore:"
echo " cd rocm_sdk_builder_dir2"
echo " tar -xvf src_backup.tar"
echo "----------------------------------------------------------------"
echo ""
sleep 3
fi
# Initialize git repositories and add upstream remote
while [ "x${LIST_APP_SRC_CLONE_DIR[jj]}" != "x" ]
do
if [ ! -d ${LIST_APP_SRC_CLONE_DIR[$jj]} ]; then
echo "[${jj}]: Creating source code directory: ${LIST_APP_SRC_CLONE_DIR[$jj]}"
echo ""
echo "[${jj}]: Creating repository source code directory: ${LIST_APP_SRC_CLONE_DIR[$jj]}"
sleep 0.1
mkdir -p ${LIST_APP_SRC_CLONE_DIR[$jj]}
# LIST_APP_ADDED_UPSTREAM_REPO parameter is used in
Expand Down Expand Up @@ -209,7 +216,7 @@ func_repolist_upstream_remote_repo_add() {
# Fetch updates and initialize submodules
while [ "x${LIST_APP_SRC_CLONE_DIR[jj]}" != "x" ]
do
#echo "LIST_APP_ADDED_UPSTREAM_REPO[$jj]: ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]}"
# echo "LIST_APP_ADDED_UPSTREAM_REPO[$jj]: ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]}"
# check if directory was just created and git fetch needs to be done
if [ ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]} -eq 1 ]; then
echo ""
Expand Down Expand Up @@ -248,7 +255,7 @@ func_repolist_upstream_remote_repo_add() {
# apply patches if patch directory exists
while [ "x${LIST_APP_PATCH_DIR[jj]}" != "x" ]
do
#echo "LIST_APP_ADDED_UPSTREAM_REPO[$jj]: ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]}"
# echo "LIST_APP_ADDED_UPSTREAM_REPO[$jj]: ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]}"
# check if directory was just created and git am needs to be done
if [ ${LIST_APP_ADDED_UPSTREAM_REPO[$jj]} -eq 1 ]; then
TEMP_PATCH_DIR=${LIST_APP_PATCH_DIR[$jj]}
Expand Down Expand Up @@ -329,7 +336,8 @@ func_babs_init_and_fetch_single_repo_by_binfo() {
# Initialize git repositories and add upstream remote
if [ "x${BINFO_APP_SRC_DIR}" != "x" ]; then
if [ ! -d ${BINFO_APP_SRC_DIR} ]; then
echo "Creating source code directory: ${BINFO_APP_SRC_DIR}"
echo ""
echo "Creating repository source code directory: ${BINFO_APP_SRC_DIR}"
sleep 0.1
mkdir -p ${BINFO_APP_SRC_DIR}
# LIST_APP_ADDED_UPSTREAM_REPO parameter is used in
Expand Down Expand Up @@ -366,7 +374,7 @@ func_babs_init_and_fetch_single_repo_by_binfo() {
#echo "CUR_APP_UPSTREAM_REPO_ADDED: ${CUR_APP_UPSTREAM_REPO_ADDED}"
# check if directory was just created and git fetch needs to be done
echo ""
echo "[${jj}]: Source Fetch"
echo "[${jj}]: Repository Source Code Fetch"
echo "Repository name: ${BINFO_APP_NAME}"
echo "Repository URL: ${BINFO_APP_UPSTREAM_REPO_URL}"
echo "Source directory: ${BINFO_APP_SRC_DIR}"
Expand Down Expand Up @@ -1131,15 +1139,6 @@ func_repolist_checkout_by_version_param() {
fi
}

#this method not used at the moment and needs refactoring if needed in future
func_repolist_download() {
func_build_version_init
func_envsetup_init
func_repolist_binfo_list_print
func_repolist_upstream_remote_repo_add
func_repolist_is_changes_committed
}

func_env_variables_print() {
echo "SDK_CXX_COMPILER_DEFAULT: ${SDK_CXX_COMPILER_DEFAULT}"
echo "HIP_PLATFORM_DEFAULT: ${HIP_PLATFORM_DEFAULT}"
Expand Down
2 changes: 2 additions & 0 deletions binfo/core/003_llvm_project_llvm.binfo
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
BINFO_APP_NAME=llvm-project
BINFO_APP_SRC_TOPDIR_BASENAME=${BINFO_APP_NAME}
BINFO_APP_SRC_SUBDIR_BASENAME=llvm
# special case where the BINFO_APP_SRC_CLONE_DIR needs to be defined
# because it's different than the default location on BINFO_APP_SRC_DIR that is subfolder under it
BINFO_APP_SRC_CLONE_DIR="${SDK_SRC_ROOT_DIR}/${BINFO_APP_SRC_TOPDIR_BASENAME}"
BINFO_APP_SRC_DIR="${SDK_SRC_ROOT_DIR}/${BINFO_APP_SRC_TOPDIR_BASENAME}/${BINFO_APP_SRC_SUBDIR_BASENAME}"
BINFO_APP_UPSTREAM_REPO_URL=https://github.com/ROCm/llvm-project
Expand Down
5 changes: 4 additions & 1 deletion build/binfo_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func_binfo_utils__init_binfo_app_list() {
source "${LIST_BINFO_FILE_FULLNAME[jj]}"

# Initialize source clone directory
# There are applications like llvm-project where the
# BINFO_APP_SRC_CLONE_DIR points to root and
# BINFO_APP_SRC_DIR points to llvm subfolder under it
if [[ -n "${BINFO_APP_SRC_CLONE_DIR}" ]]; then
LIST_APP_SRC_CLONE_DIR[jj]="${BINFO_APP_SRC_CLONE_DIR}"
elif [[ -n "${BINFO_APP_SRC_DIR-}" ]]; then
Expand Down Expand Up @@ -74,4 +77,4 @@ func_binfo_utils__init_binfo_app_list() {

((jj++))
done
}
}
Loading

0 comments on commit 836d401

Please sign in to comment.