-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get-template-library: Replace all references to master with main
- Loading branch information
Showing
1 changed file
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
# This script download all the template library subsets from Git repositories | ||
# on GitHub and gather them in a directory whose layout is compliant with | ||
# on GitHub and gather them in a directory whose layout is compliant with | ||
# SCDB cfg/ subdirectory. | ||
# | ||
# Written by Michel Jouvin <[email protected]>, 6/6/2014 | ||
|
@@ -21,15 +21,15 @@ | |
# - xxx_dest_dir: directory where to put the repo contents, under template library root | ||
# (%BRANCH% is replaced by the "branch" name, %TAG% by the | ||
# Quattor version specified in the tag) | ||
# - xxx_rename_master (optional): "branch name" to use if the branch is master | ||
# - xxx_rename_main (optional): "branch name" to use if the branch is main | ||
|
||
git_url_root=https://github.com | ||
quattor_git_url=${git_url_root}/quattor | ||
git_repo_list='core examples grid os standard' | ||
# Do not change the following defaults except if you know what you are doing... | ||
use_tags_default=1 | ||
ignore_version_default=0 | ||
tags_ignore_pattern_pattern=master | ||
tags_ignore_pattern_pattern=main | ||
pull_request='' | ||
use_ci_work_dir=0 | ||
# If true, Quattor version will be updated in cluster.build.properties files | ||
|
@@ -42,13 +42,13 @@ core_dest_dir=quattor/%TAG% | |
# whatever is done for other repos. | ||
core_use_tags=1 | ||
core_ignore_version=1 | ||
# Define the working copy directory used for template-library-core master | ||
# Define the working copy directory used for template-library-core main | ||
# branch (Quattor version = HEAD). | ||
# If underfined, 'master' will be used. | ||
core_master_dir=dev | ||
# If underfined, 'main' will be used. | ||
core_main_dir=dev | ||
|
||
examples_git_repo=template-library-examples | ||
examples_branch_pattern=master | ||
examples_branch_pattern=main | ||
# examples provides sites/ and clusters/ directory directly under the template library root | ||
examples_dest_dir= | ||
|
||
|
@@ -61,11 +61,11 @@ os_branch_pattern=.* | |
os_dest_dir=os/%BRANCH% | ||
|
||
standard_git_repo=template-library-standard | ||
standard_branch_pattern=master | ||
standard_branch_pattern=main | ||
standard_dest_dir=standard | ||
|
||
monitoring_git_repo=template-library-monitoring | ||
monitoring_branch_pattern=master | ||
monitoring_branch_pattern=main | ||
monitoring_dest_dir=standard/monitoring | ||
|
||
# Other initializations | ||
|
@@ -98,7 +98,7 @@ usage () { | |
echo " --pull-request repository:user:branch[:target] : merge the GitHub pull request specifed by the" | ||
echo " source branch repository:user:branch into repository:quattor:target." | ||
echo " target can be a branch or a tag. If not specified, it defaults to" | ||
echo " quattor_version or master when quattor_version=HEAD. Note that using" | ||
echo " quattor_version or main when quattor_version=HEAD. Note that using" | ||
echo " a version other than HEAD generally produces unpredictable results." | ||
echo " --release-candidates: download release candidates in template-library-core (disabled by default)." | ||
echo " --spma : download SPMA-based OS templates (disabled by default)." | ||
|
@@ -193,7 +193,7 @@ fi | |
# - user: the GitHub user who contributed the PR (will be used to select the fork to use) | ||
# - branch: the branch to import from the fork | ||
# - target_branch: the branch in the Quattor repo which is in the target for the PR. It is | ||
# optional and default to master (it is in fact required if the target is not master) | ||
# optional and default to main (it is in fact required if the target is not main) | ||
# Check that the value is syntactically valid. | ||
if [ -n "${pull_request}" ] | ||
then | ||
|
@@ -227,7 +227,7 @@ then | |
then | ||
if [ "${quattor_version}" = "HEAD" ] | ||
then | ||
pr_target=master | ||
pr_target=main | ||
else | ||
pr_target=${quattor_version} | ||
fi | ||
|
@@ -294,7 +294,7 @@ then | |
fi | ||
|
||
# Check (or remove) the template library destination directory. | ||
if [ -d ${template_lib_root} ] | ||
if [ -d ${template_lib_root} ] | ||
then | ||
if [ ${remove_tl_dir} -eq 0 ] | ||
then | ||
|
@@ -328,7 +328,7 @@ do | |
repo_name_variable=${repo}_git_repo | ||
branch_variable=${repo}_branch_pattern | ||
dest_dir_variable=${repo}_dest_dir | ||
master_dir_variable=${repo}_master_dir | ||
main_dir_variable=${repo}_main_dir | ||
use_tags_variable=${repo}_use_tags | ||
ignore_version_variable=${repo}_ignore_version | ||
tags_ignore_pattern_variable=${repo}_tags_ignore_pattern | ||
|
@@ -364,9 +364,9 @@ do | |
fi | ||
|
||
git_clone_dir=${git_clone_root}/${repo} | ||
if [ "${!master_dir_variable}" ] | ||
if [ "${!main_dir_variable}" ] | ||
then | ||
master_dir_name=${!master_dir_variable} | ||
main_dir_name=${!main_dir_variable} | ||
fi | ||
|
||
echo Cloning Git repository ${repo_url} in ${repo_dir}... | ||
|
@@ -393,18 +393,18 @@ do | |
fi | ||
[ ${verbose} -eq 1 ] && echo "Using tags rather than branches for repository ${repo} (branch pattern=${branch_pattern})" | ||
branch_list=$(git tag | grep -E -- "${branch_pattern}") | ||
# If version is HEAD, need to add master branch to all the other tags | ||
# If version is HEAD, need to add main branch to all the other tags | ||
if [ "${quattor_version}" = "HEAD" ] | ||
then | ||
branch_list="${branch_list} master" | ||
branch_list="${branch_list} main" | ||
fi | ||
else | ||
branch_list=$(git branch -r | grep -E "origin/${branch_pattern}" | grep -v HEAD) | ||
fi | ||
[ ${verbose} -eq 1 -o ${list_branches} -eq 1 ] && echo -e "Branches/tags found in ${repo}:\n${branch_list}" | ||
[ ${list_branches} -eq 1 ] && continue | ||
|
||
# Will be set to 1 if at least | ||
# Will be set to 1 if at least | ||
branch_found=0 | ||
|
||
for remote_branch in ${branch_list} | ||
|
@@ -413,40 +413,40 @@ do | |
branch_or_tag=$(echo ${remote_branch} | sed -e 's#^.*origin/##') | ||
|
||
# when using tags, branch_dir contains the branch name retrieved from the tag and | ||
# tag_dir contains the tag version derived from the tag name with the prefix | ||
# tag_dir contains the tag version derived from the tag name with the prefix | ||
# (e.g. template-library-) removed. Define a non empty default value. | ||
# Also define the branch/tag name to use to compare with pr_target (--pull-request): | ||
# when using a branch, use branch name (branch_or_tag) and when using a tag, use | ||
# tag_dir before the rename applied to master. | ||
# tag_dir before the rename applied to main. | ||
tag_dir="undefined_tag" | ||
if [ ${use_tags} -eq 0 ] | ||
then | ||
pr_actual_target=${branch_or_tag} | ||
if [ "${branch_or_tag}" = "master" ] && [ "${master_dir_name}" ] | ||
if [ "${branch_or_tag}" = "main" ] && [ "${main_dir_name}" ] | ||
then | ||
branch_dir=${master_dir_name} | ||
branch_dir=${main_dir_name} | ||
else | ||
branch_dir=${branch_or_tag} | ||
fi | ||
else | ||
branch_dir=$(echo ${branch_or_tag} | sed -e 's%-\([0-9\.]\+\)\+\(-[0-Z]\+\)*$%%') | ||
tag_dir=$(echo ${branch_or_tag} | sed -e "s%^.*${branch_dir}-%%") | ||
pr_actual_target=${tag_dir} | ||
# master is normally not a tag name but master branch can be added to | ||
# main is normally not a tag name but main branch can be added to | ||
# other tags when the version is HEAD (for example for template-library-core) | ||
if [ "${tag_dir}" = "master" ] && [ "${master_dir_name}" ] | ||
if [ "${tag_dir}" = "main" ] && [ "${main_dir_name}" ] | ||
then | ||
tag_dir=${master_dir_name} | ||
tag_dir=${main_dir_name} | ||
fi | ||
# If branch_dir = template_library, reset it to tag_dir (old tag format) | ||
if [ "${branch_dir}" == "template-library" ] | ||
then | ||
branch_dir=${tag_dir} | ||
fi | ||
# If branch_dir is not tag_dir or master, indicates a repository without a master | ||
# branch (e.g. template-library-grid). In this case, pr_actual_target must be | ||
# If branch_dir is not tag_dir or main, indicates a repository without a main | ||
# branch (e.g. template-library-grid). In this case, pr_actual_target must be | ||
# redefined as branch_dir-tag_dir, as the tag name is prefixed by the branch name (branch_dir). | ||
if [ "${branch_dir}" != "master" ] && [ "${branch_dir}" != "${tag_dir}" ] | ||
if [ "${branch_dir}" != "main" ] && [ "${branch_dir}" != "${tag_dir}" ] | ||
then | ||
pr_actual_target="${branch_dir}-${tag_dir}" | ||
fi | ||
|
@@ -575,7 +575,7 @@ done # repository loop | |
|
||
|
||
# cluster.build.properties: update version used to the requested Quattor version. | ||
# Ine the case of HEAD, use the directory the master branch has been checkout to/ | ||
# Ine the case of HEAD, use the directory the main branch has been checkout to/ | ||
|
||
if [ ${list_branches} -eq 0 ] && [ ${cluster_build_properties_update} -eq 1 ] | ||
then | ||
|
@@ -585,11 +585,11 @@ then | |
then | ||
if [ "${quattor_version}" = "HEAD" ] | ||
then | ||
if [ ${core_master_dir} ] | ||
if [ ${core_main_dir} ] | ||
then | ||
quattor_version_dir=${core_master_dir} | ||
quattor_version_dir=${core_main_dir} | ||
else | ||
quattor_version_dir=master | ||
quattor_version_dir=main | ||
fi | ||
else | ||
quattor_version_dir=${branch_or_tag} | ||
|