From 309a2bdc90300fa1c500415a2e0504b9ea5e47bc Mon Sep 17 00:00:00 2001 From: Michel Jouvin Date: Sat, 9 Nov 2024 13:32:14 +0100 Subject: [PATCH] get-template-library: code modernization - Replace -a by && --- src/scripts/get-template-library | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/scripts/get-template-library b/src/scripts/get-template-library index 7651338d34..52139219c2 100755 --- a/src/scripts/get-template-library +++ b/src/scripts/get-template-library @@ -382,7 +382,7 @@ do # In fact branch_pattern can be a regexp matched against existing branch names if [ ${use_tags} -eq 1 ] then - if [ -n "${quattor_version}" -a ${ignore_version} -eq 0 ] + if [ -n "${quattor_version}" ] && [ ${ignore_version} -eq 0 ] then if [ ${tags_ignore_pattern} -eq 1 ] then @@ -422,7 +422,7 @@ do if [ ${use_tags} -eq 0 ] then pr_actual_target=${branch_or_tag} - if [ "${branch_or_tag}" = "master" -a $?{master_dir_name} ] + if [ "${branch_or_tag}" = "master" ] && [ $?{master_dir_name} ] then branch_dir=${master_dir_name} else @@ -434,7 +434,7 @@ do pr_actual_target=${tag_dir} # master is normally not a tag name but master branch can be added to # other tags when the version is HEAD (for example for template-library-core) - if [ "${tag_dir}" = "master" -a $?{master_dir_name} ] + if [ "${tag_dir}" = "master" ] && [ $?{master_dir_name} ] then tag_dir=${master_dir_name} fi @@ -446,7 +446,7 @@ do # 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 # redefined as branch_dir-tag_dir, as the tag name is prefixed by the branch name (branch_dir). - if [ "${branch_dir}" != "master" -a "${branch_dir}" != "${tag_dir}" ] + if [ "${branch_dir}" != "master" ] && [ "${branch_dir}" != "${tag_dir}" ] then pr_actual_target="${branch_dir}-${tag_dir}" fi @@ -459,7 +459,7 @@ do for ignore_pattern in ${ignore_branch_patterns} do [ ${verbose} -eq 1 ] && echo "Branch=${remote_branch}, ignore_pattern = >>${ignore_pattern}<<" - if [ -n "$(echo ${branch_dir} | egrep -- ${ignore_pattern})" -a "${branch_dir}" != "${quattor_version}" ] + if [ -n "$(echo ${branch_dir} | egrep -- ${ignore_pattern})" ] && [ "${branch_dir}" != "${quattor_version}" ] then [ ${verbose} -eq 1 ] && echo "Branch ${remote_branch} ignored" ignore_branch=1 @@ -470,7 +470,7 @@ do for ignore_pattern in ${ignore_version_patterns} do [ ${verbose} -eq 1 ] && echo "Branch=${remote_branch}, version=${tag_dir}, ignore_version_pattern = >>${ignore_pattern}<<" - if [ -n "$(echo ${tag_dir} | egrep -- ${ignore_pattern})" -a "${tag_dir}" != "${quattor_version}" ] + if [ -n "$(echo ${tag_dir} | egrep -- ${ignore_pattern})" ] && [ "${tag_dir}" != "${quattor_version}" ] then [ ${verbose} -eq 1 ] && echo "Branch ${remote_branch} (version ${tag_dir}) ignored" ignore_branch=1 @@ -486,7 +486,7 @@ do # If --continuous-inegration and the current repo/target matches the CI context, just define src_dir # to be what has been checked out as part of the CI. [ ${verbose} -eq 1 ] && echo "use_ci_work_dir=${use_ci_work_dir}, repo_name=${repo_name}, pr_repo=${pr_repo}, pr_target=${pr_target}, pr_actual_target=${pr_actual_target}" - if [ ${use_ci_work_dir} -eq 1 -a "${pr_repo}" = "${repo_name}" -a "${pr_target}" = "${pr_actual_target}" ] + if [ ${use_ci_work_dir} -eq 1 ] && [ "${pr_repo}" = "${repo_name}" ] && [ "${pr_target}" = "${pr_actual_target}" ] then src_dir=${ci_work_dir} @@ -500,7 +500,7 @@ do if [ -n "${pull_request}" ] then [ ${verbose} -eq 1 ] && echo "Checking if pull request applies to current branch/tag (pr_repo=${pr_repo}, pr_target=${pr_target}, pr_actual_target=${pr_actual_target})..." - if [ "${pr_repo}" = "${repo_name}" -a "${pr_target}" = "${pr_actual_target}" ] + if [ "${pr_repo}" = "${repo_name}" ] && [ "${pr_target}" = "${pr_actual_target}" ] then echo "Merging pull request from ${pr_user}/${pr_branch} into branch/tag ${branch_or_tag}..." pr_remote=${git_url_root}/${pr_user}/${pr_repo} @@ -567,7 +567,7 @@ do fi # Except if --debug has been specified, remove Git clone created - if [ ${verbose} -eq 0 -a -d ${repo_dir} ] + if [ ${verbose} -eq 0 ] && [ -d ${repo_dir} ] then rm -Rf ${repo_dir} fi @@ -577,7 +577,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/ -if [ ${list_branches} -eq 0 -a ${cluster_build_properties_update} -eq 1 ] +if [ ${list_branches} -eq 0 ] && [ ${cluster_build_properties_update} -eq 1 ] then property_files=$(find ${template_lib_root}/clusters -name cluster.build.properties) if [ -n "${property_files}" ]