From bf91b18c6a435181f20822b766bf5f3b36b993b2 Mon Sep 17 00:00:00 2001 From: P-A Loizeau <p.-a.loizeau@gsi.de> Date: Thu, 20 Jun 2024 11:55:20 +0200 Subject: [PATCH] Remove all tools switching to the mCBM forks of geo and par repos --- external/CMakeLists.txt | 5 - external/InstallGeometry.cmake | 6 - external/InstallParameter.cmake | 6 - macro/beamtime/mcbm2024/README_GeoPar.md | 59 --------- .../beamtime/mcbm2024/commit_push_geo_par.sh | 109 ---------------- macro/beamtime/mcbm2024/rebase_cbmroot.sh | 55 -------- macro/beamtime/mcbm2024/switch_geo_par.sh | 122 ------------------ macro/beamtime/mcbm2024/update_geo_par.sh | 84 ------------ 8 files changed, 446 deletions(-) delete mode 100644 macro/beamtime/mcbm2024/README_GeoPar.md delete mode 100755 macro/beamtime/mcbm2024/commit_push_geo_par.sh delete mode 100755 macro/beamtime/mcbm2024/rebase_cbmroot.sh delete mode 100755 macro/beamtime/mcbm2024/switch_geo_par.sh delete mode 100755 macro/beamtime/mcbm2024/update_geo_par.sh diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 0b6630140d..d084368360 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -6,11 +6,6 @@ # it off execept for the checker. Option(DOWNLOAD_EXTERNALS "Download the code from the external repositories." ON) -Option(CBM_MCBM_PARS "Download mCBM forks for geometry and parameters" OFF) -if (CBM_MCBM_PARS) - message(WARNING "MCBM PARS ENABLED: Using mcbm forks of parameters and geometry.") -endif() - if(DOWNLOAD_EXTERNALS) Include(InstallFlesnet.cmake) Set(FLES_IPC_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flesnet/lib/fles_ipc PARENT_SCOPE) diff --git a/external/InstallGeometry.cmake b/external/InstallGeometry.cmake index 61f207d10c..48248ee505 100644 --- a/external/InstallGeometry.cmake +++ b/external/InstallGeometry.cmake @@ -1,12 +1,6 @@ set(GEOMETRY_VERSION 978685b9e8fee29a7e69946bd6e32e933ff012ff) set(GEOMETRY_SRC_URL "https://git.cbm.gsi.de/CbmSoft/cbmroot_geometry.git") -if (CBM_MCBM_PARS) - # Override defaults to use mcbm fork instead - set(GEOMETRY_VERSION mcbm24_master) - set(GEOMETRY_SRC_URL https://git.cbm.gsi.de/mcbm/cbmroot_geometry.git) -endif() - download_project_if_needed(PROJECT Geometry_source GIT_REPOSITORY ${GEOMETRY_SRC_URL} GIT_TAG ${GEOMETRY_VERSION} diff --git a/external/InstallParameter.cmake b/external/InstallParameter.cmake index 1ae5d92f4e..9436acfd2b 100644 --- a/external/InstallParameter.cmake +++ b/external/InstallParameter.cmake @@ -2,12 +2,6 @@ set(PARAMETER_VERSION 5cc8f25e8e493f29947416af9b02e700b7653ae0) # 2024-06-20 set(PARAMETER_SRC_URL "https://git.cbm.gsi.de/CbmSoft/cbmroot_parameter.git") -if (CBM_MCBM_PARS) - # Override defaults to use mcbm fork instead - set(PARAMETER_VERSION mcbm24_master) - set(PARAMETER_SRC_URL "https://git.cbm.gsi.de/mcbm/cbmroot_parameter.git") -endif() - download_project_if_needed(PROJECT Parameter_source GIT_REPOSITORY ${PARAMETER_SRC_URL} GIT_TAG ${PARAMETER_VERSION} diff --git a/macro/beamtime/mcbm2024/README_GeoPar.md b/macro/beamtime/mcbm2024/README_GeoPar.md deleted file mode 100644 index fa4a77b2e6..0000000000 --- a/macro/beamtime/mcbm2024/README_GeoPar.md +++ /dev/null @@ -1,59 +0,0 @@ - -# Usage - -**All these scripts need you to have sourced the login script first!!!! (for VMCWORKDIR)** - -1. Initialization and switch between the `Official detached commit` and the `mCBM repository HEAD` mode: just execute - the following script - ``` - ./macro/beamtime/mcbm2024/switch_geo_par.sh - ``` -1. Rebasing Cbmroot - 1. Commit **and push** any local files/changes if you were in "mCBM mode" and did local changes in either the - geometry or parameters folders. Otherwise the rebase script will not do anything or they - 1. Execute the following script. \ - It relies on the presence of a remote pointing to the offical version (e.g. `origin` or `upstream`) and may ask - for some login information when fetching the latest changes depending on your remote definition. - ``` - ./macro/beamtime/mcbm2024/rebase_cbmroot.sh - ``` - Rebasing directly from the CLI without caring about the state of the geo and params folders will fail if they are - in "mCBM mode" and may lead to a broken local copy \ - => As soon as you start using the `switch_geo_par.sh` script in a Cbmroot copy, rebase it only with this script!!! -1. Updating/rebasing the mCBM versions of the geometry and parameters folders: just execute the following script - ``` - ./macro/beamtime/mcbm2024/update_geo_par.sh - ``` - => This will bring in the local copy the latest changes from the remote branch in the mCBM fork \ - => This will also ensure the local copies are compatible with a fast-forward push to the remote branch in the mCBM - fork (force-push or any git history changes are not allowed). -1. Commiting changes - - Either do it by hand in the geometry/parameters folders (they are independent git clones) - - Or use the following script. This will take care of making a single commit for each of the two folders, - prepare them for a fast-forward push and push them. You will probably be asked for some login/password. - ``` - ./macro/beamtime/mcbm2024/commit_push_geo_par.sh - ``` - => This script was not 100% tested as the original author (@p.-a.loizeau) did not have local changes to push \ - => **But all individual commands were tested and the scripts was checked with a semantics checker!** - -# CAVEATS - -1. The mCBM repository branch will not be rebased on the official version as that would break the local copies of all - users - 1. => If somebody in mCBM need some files/changes from the official version, they will have to `cherry-pick` them or - copy them by hand into a new commit on top of the current state of the mCBM branch - 1. After the end of the period where this branch is used, **somebody from the mCBM team** (not one of the central - developers) will have invest the time to cleanup a copy of the branch and prepare clean merge requests to the - official repositories -1. These scripts allow only to work on the `mcbm24_master branch` of the "mcbm versions" and go back to the "offical - versions" \ - => Switching to another branch or a different detached commit than the "official version" will confuse them \ - => This in turn has high chances to lead to broken copies of the `geometry` and/or `parameters` folders -1. **All these scripts apart from the one to commit changes will work only on clean copies!!!** \ - => local changes have to be either committed or deleted/reverted before using them!!! \ - => This also means that the scripts will all switch to the latest remote version. So doing "mcbm > official > mcbm" - may lead to a different commit! And local commits which are not yet pushed may be lost! -1. Space needed: - - around `100 MB` for geometries - - around `1.6 GB` for parameters diff --git a/macro/beamtime/mcbm2024/commit_push_geo_par.sh b/macro/beamtime/mcbm2024/commit_push_geo_par.sh deleted file mode 100755 index 0b551dcb3c..0000000000 --- a/macro/beamtime/mcbm2024/commit_push_geo_par.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -# Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt -# SPDX-License-Identifier: GPL-3.0-only -# First commited by Pierre-Alain Loizeau - -check_author_info() -{ - name_set=$(git config -l | grep -c "user.name") - email_set=$(git config -l | grep -c "user.email") - - author_ok=0 - if [[ 1 -ne ${name_set} ]]; then - echo "Error: user.name not set in git config (neither globally no locally)" - author_ok=1 - fi - if [[ 1 -ne ${email_set} ]]; then - echo "Error: user.email not set in git config (neither globally no locally)" - author_ok=$((author_ok+2)) - fi - return ${author_ok} -} - -Help() -{ - # Non-aligned raw text due to escaped characters! - echo "Allowed input parameters for this script are:" - echo " -h | --help this help" - echo " -f | --folder [\"geometry\", \"parameters\"] folder to push (and commitbefore if needed) (mandatory)" - echo " -m | --message \"<commit message>\" commit message in case some not-yet committed local" - echo " files/changes are present in the folder (optional)" -} - -while [ $# -gt 0 ]; do - case "$1" in - -h|--help) Help; exit 0;; - -f|--folder) folder="$2"; shift;; - -m|--message) message="$2"; shift;; - \?) # Invalid option - echo "Error: Invalid option" - Help - exit 1;; - esac - shift -done - -if [ -z "${folder}" ]; then - echo "Missing mandatory parameter: folder to commit/push" - Help - exit 1 -fi -if [[ ! "${folder}" =~ ^(geometry|parameters)$ ]]; then - echo "Invalid value for the folder parameter: ${folder}" - echo "It has to be either \"geometry\" or \"parameters\"" - Help - exit 1 -fi - -# I: pre-checks, this part should be read-only actions in terms of the current files (changes only in .git folders)! -# I-1) Go to folder -cd ${VMCWORKDIR}/${folder} -# I-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - echo "${folder} folder is in official version, cannot update to get latest mCBM changes, stopping there" - exit 2 -fi -# I-3) Check if some local changes are present, in which case make a commit with them if commit message was provided -if [[ 0 -ne $(git status --porcelain | wc -l) ]]; then - echo "Local changes found in the geometry folder." - if [ -n "${message}" ]; then - echo "=> Commit message provided, trying to make a commit with all of them" - if ! check_author_info; then - echo "Author info missing, cannot make a proper commit" - exit 4 - fi - git add . - git commit -m"${message}" - else - echo "=> no commit message provided, stopping there. Following files/changes are present" - git status --short - Help - exit 3 - fi -fi - -# II: check that local history is compatible with remote version and push if ok -# II-1) fetch latest version of remote -git fetch mcbm -# II-2) rebase only this folder. -# FIXME ?: Could call the rebase script to avoid copy-paste, but then both folders would be rebased which may make -# to a deadlock if both have local changed? -if ! git rebase mcbm/mcbm24_master; then - echo "Rebasing the ${folder} folder failed, most probably due to local commits in conflict" - echo "Aborting (=reverting) the rebase!!!" - git rebase --abort - echo "Please rebase by hand in the geometry folder with the following commands:" - echo "git rebase mcbm/mcbm24_master # Will lead to a conflict" - echo "git rebase --continue # After each resolution of problems, for each conflicting commit" - echo "git rebase --abort # If not able to resolve the conflicts" - echo "=> If lost, please google \"git rebase resolve conflicts\" or ask other mcbm members" - exit 5 -else - echo "Now up to date with the mcbm remote version of the ${folder} folder" -fi -# II-3) push without force or force-with-lease, no change to remote history allowed -git push - -cd ${START_DIR} - -exit 0 diff --git a/macro/beamtime/mcbm2024/rebase_cbmroot.sh b/macro/beamtime/mcbm2024/rebase_cbmroot.sh deleted file mode 100755 index b2a2201cef..0000000000 --- a/macro/beamtime/mcbm2024/rebase_cbmroot.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt -# SPDX-License-Identifier: GPL-3.0-only -# First commited by Pierre-Alain Loizeau - -WAS_MCBM_MODE=0 -START_DIR=$PWD - -# I: switch of branch/commit. Done only after all checks to avoid Geometry and Parameter folder going out of sync -# (one in "Official detached commit" and the other on "mCBM repo HEAD" mode) -# I-A: Geometry folder -# I-A-1) Go to folder -cd ${VMCWORKDIR}/geometry -# I-A-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - echo "Geometry folder already in official version, no need to switch back" -else - WAS_MCBM_MODE=1 - if ! ${VMCWORKDIR}/macro/beamtime/mcbm2024/switch_geo_par.sh; then - echo "Failed switching the geometry and parameters folders back to the official version, stopping there" - exit 1 - fi -fi -# I-B: parameters folder -# I-B-1) Go to folder -cd ${VMCWORKDIR}/parameters -# I-B-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - echo "Parameters folder already in official version, no need to switch back" -else - echo "Check on geometry folder should have already reverted the parameters one but still in mCBM mode" - echo "Please check your local folders with git status, your copy may be brocken/have folders out of sync" - exit 2 -fi - -cd $START_DIR - -# II: Cbmroot update in the standard way, -# => assumes in the source root folder but should anyway work anywhere in the tree -# => assumes that the official repo remote is already defined (e.g. either as origin or upstream) -official=$(git remote -v | grep fetch | grep "computing/cbmroot.git" | cut -f1) -if [ -n "${official}" ]; then - # Depending on your remote settings, the next command may ask for login/password information - git fetch ${official} - git rebase ${official}/master -else - echo "No remote found pointing to the official cbmroot repository/fork, rebase will not be done!!!!" -fi - -# III: revert geometry and parameters folders to mCBM mode if was the case before this call -if [[ 1 -eq ${WAS_MCBM_MODE} ]]; then - ${VMCWORKDIR}/macro/beamtime/mcbm2024/switch_geo_par.sh -fi - -exit 0 diff --git a/macro/beamtime/mcbm2024/switch_geo_par.sh b/macro/beamtime/mcbm2024/switch_geo_par.sh deleted file mode 100755 index 023f6b1afe..0000000000 --- a/macro/beamtime/mcbm2024/switch_geo_par.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash -# Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt -# SPDX-License-Identifier: GPL-3.0-only -# First commited by Pierre-Alain Loizeau - -check_fix_remote() -{ - # Copied/adapted from scripts/connect_upstream_repo.sh - if [[ $# -ne 1 ]]; then - echo "check_fix_remote needs at least one parameter: the url for the remote" - return 1 - fi - mcbm_repo=$1 - - echo "Checking/fixing the mcbm remote in $PWD" - bla=$(git remote -v | grep mcbm) - if [ $? -eq 0 ]; then - bla=$(git remote -v | grep mcbm | grep ${mcbm_repo}) - if [ $? -eq 0 ]; then - echo "Remote link mcbm already exist and points to the correct repo" - # don't do anything - else - echo "Remote link mcbm already exist and points to the wrong repo" - git remote set-url mcbm ${mcbm_repo} - fi - else - echo "Remote repo not existing yet => connecting it now" - git remote add mcbm ${mcbm_repo} - fi - - return 0 -} - -START_DIR=$PWD - -# I: pre-checks, this part should be read-only actions in terms of the current files (changes only in .git folders)! -# I-A: Geometry folder -# I-A-1) Go to folder -cd ${VMCWORKDIR}/geometry -# I-A-2) Check if the mCBM remote is present and proper, add/fix it if not -if ! check_fix_remote https://git.cbm.gsi.de/mcbm/cbmroot_geometry.git; then - echo "Failed to check/fix the remote of the geometry folder, stopping there" - exit 1 -fi -# I-A-3) Check if some local changes are present -if [[ 0 -ne $(git status --porcelain | wc -l) ]]; then - echo "Local changes found in the geometry folder." - echo "=> You need to remove them (or commit them if in mCBM mode) before switching mode" - git status --short - exit 2 -fi -# I-B: Parameters folder -# I-B-1) Go to folder -cd ${VMCWORKDIR}/parameters -# I-B-2) Check if the mCBM remote is present and proper, add/fix it if not -if ! check_fix_remote https://git.cbm.gsi.de/mcbm/cbmroot_parameter.git; then - echo "Failed to check/fix the remote of the parameters folder, stopping there" - exit 1 -fi -# I-B-3) Check if some local changes are present -if [[ 0 -ne $(git status --porcelain | wc -l) ]]; then - echo "Local changes found in the parameters folder." - echo "=> You need to remove them (or commit them if in mCBM mode) before switching mode" - git status --short - exit 2 -fi - -# II: switch of branch/commit. Done only after all checks to avoid Geometry and Parameter folder going out of sync -# (one in "Official detached commit" and the other on "mCBM repo HEAD" mode) -# II-A: Geometry folder -# II-A-1) Go to folder -cd ${VMCWORKDIR}/geometry -# II-A-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - # II-A-2a) Switch from "Official detached commit" to "mCBM repo HEAD" - # =====> Fetch latest version - git fetch mcbm - # =====> Simple switch to latest version - if git switch mcbm24_master 2>/tmp/mcbm_switch_err; then - cat /tmp/mcbm_switch_err - else - git switch -t mcbm/mcbm24_master - fi - rm /tmp/mcbm_switch_err - # <= FIXME: Error, master already existing, prob. need check on existing + checkout mcbm_master -else - # IIA-2b) Revert from "mCBM repo HEAD" to "Official detached commit" - # =====> Extract the original commit hash from the InstallGeometry cmake file - hash=$(grep "set(GEOMETRY_VERSION" $VMCWORKDIR/external/InstallGeometry.cmake | sed 's/^[^ ]* //') - hash=${hash%)*} - # =====> Force the switch - echo ${hash} - git checkout ${hash} -fi -# II-B: Parameters folder -# II-B-1) Go to folder -cd ${VMCWORKDIR}/parameters -# II-B-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - # II-B-2a) Switch from "Official detached commit" to "mCBM repo HEAD" - # =====> Fetch latest version - git fetch mcbm - # =====> Simple switch to latest version, create and track if not existing - if git switch mcbm24_master 2>/tmp/mcbm_switch_err; then - cat /tmp/mcbm_switch_err - else - git switch -t mcbm/mcbm24_master - fi - rm /tmp/mcbm_switch_err -else - # II-B-2b) Revert from "mCBM repo HEAD" to "Official detached commit" - # =====> Extract the original commit hash from the InstallParameters cmake file - hash=$(grep "set(PARAMETER_VERSION" $VMCWORKDIR/external/InstallParameter.cmake | sed 's/^[^ ]* //') - hash=${hash%)*} - # =====> Force the switch - echo ${hash} - git checkout ${hash} -fi - -cd $START_DIR - -exit 0 diff --git a/macro/beamtime/mcbm2024/update_geo_par.sh b/macro/beamtime/mcbm2024/update_geo_par.sh deleted file mode 100755 index 99c59f95ed..0000000000 --- a/macro/beamtime/mcbm2024/update_geo_par.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt -# SPDX-License-Identifier: GPL-3.0-only -# First commited by Pierre-Alain Loizeau - -START_DIR=$PWD - -# I: pre-checks, this part should be read-only actions in terms of the current files (changes only in .git folders)! -# I-A: Geometry folder -# I-A-1) Go to folder -cd ${VMCWORKDIR}/geometry -# I-A-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - echo "Geometry folder is in official version, cannot update to get latest mCBM changes, stopping there" - exit 2 -fi -# I-A-3) Check if some local changes are present -if [[ 0 -ne $(git status --porcelain | wc -l) ]]; then - echo "Local changes found in the geometry folder." - echo "=> You need to remove them (or commit them if in mCBM mode) before updating" - git status --short - exit 3 -fi -# I-B: Parameters folder -# I-B-1) Go to folder -cd ${VMCWORKDIR}/parameters -# I-B-2) Check if current version is the Official detached commit or the mCBM repo HEAD -if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then - echo "Parameters folder is in official version, cannot update to get latest mCBM changes, stopping there" - exit 2 -fi -# I-B-3) Check if some local changes are present -if [[ 0 -ne $(git status --porcelain | wc -l) ]]; then - echo "Local changes found in the parameters folder." - echo "=> You need to remove them (or commit them if in mCBM mode) before updating" - git status --short - exit 3 -fi - -# II: Fetch latest changes and rebase the folder on them -# => straight-forward if no local commits -# => otherwise revert if conflicts found -# II-A: Geometry folder -# II-A-1) Go to folder -cd ${VMCWORKDIR}/geometry -# II-A-2) Fetch latest changes -git fetch mcbm -# II-A-3) Try to rebase, revert if this fails -if ! git rebase mcbm/mcbm24_master; then - echo "Rebasing the geometry folder failed, most probably due to local commits in conflict" - echo "Aborting (=reverting) the rebase!!!" - git rebase --abort - echo "Please rebase by hand in the geometry folder with the following commands:" - echo "git rebase mcbm/mcbm24_master # Will lead to a conflict" - echo "git rebase --continue # After each resolution of problems, for each conflicting commit" - echo "git rebase --abort # If not able to resolve the conflicts" - echo "=> If lost, please google \"git rebase resolve conflicts\" or ask other mcbm members" - exit 4 -else - echo "Now up to date with the mcbm remote version of the geometry folder" -fi -# II-A: Parameters folder -# II-A-1) Go to folder -cd ${VMCWORKDIR}/parameters -# II-A-2) Fetch latest changes -git fetch mcbm -# II-A-3) Try to rebase, revert if this fails -if ! git rebase mcbm/mcbm24_master; then - echo "Rebasing the parameters folder failed, most probably due to local commits in conflict" - echo "Aborting (=reverting) the rebase!!!" - git rebase --abort - echo "Please rebase by hand in the parameters folder with the following commands:" - echo "git rebase mcbm/mcbm24_master # Will lead to a conflict" - echo "git rebase --continue # After each resolution of problems, for each conflicting commit" - echo "git rebase --abort # If not able to resolve the conflicts" - echo "=> If lost, please google \"git rebase resolve conflicts\" or ask other mcbm members" - exit 4 -else - echo "Now up to date with the mcbm remote version of the parameters folder" -fi - -cd ${START_DIR} - -exit 0 -- GitLab