Commit fb3e3656 authored by Jan Kiene's avatar Jan Kiene
Browse files

change mechanism for getting the float ref branch for a BASOP port

branch
parent 55305a10
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -796,7 +796,7 @@ fail-pipeline-if-in-draft:
    - exit 1

# this branch runs on merges to main-pc only and will fail if the branch itself does not conform to the naming conventions
check-naming-of-branch-for-basop-update-merges:
.check-naming-of-branch-for-basop-update-merges:
  extends:
    - .rules-merge-request-to-main
    - .job-linux
@@ -806,7 +806,7 @@ check-naming-of-branch-for-basop-update-merges:
  script:
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh
    - if [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[skip[[:space:]_-]name[[:space:]_-]check\] ]] && [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[CI\] ]]; then
    -   ci/get_float_ref_branch_name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
    -   bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
    - fi

branch-is-up-to-date-with-target-pre:
+66 −0
Original line number Diff line number Diff line
#!/bin/bash

# (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository. All Rights Reserved.
#
# This software is protected by copyright law and by international treaties.
# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
# contributors to this repository retain full ownership rights in their respective contributions in
# the software. This notice grants no license of any kind, including but not limited to patent
# license, nor is any license granted by implication, estoppel or otherwise.
#
# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
# contributions.
#
# This software is provided "AS IS", without any express or implied warranties. The software is in the
# development stage. It is intended exclusively for experts who have experience with such software and
# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
# and fitness for a particular purpose are hereby disclaimed and excluded.
#
# Any dispute, controversy or claim arising under or in relation to providing this software shall be
# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
# the United Nations Convention on Contracts on the International Sales of Goods.

BASOP_PATTERN="^[0-9]+[_-]basop[_-].*"
MSG_DOES_NOT_MATCH="Your branch name %s does not match the template '<issue_number>_basop_<description>', e.g. '123_basop_fix_this_one_bug-2'.
If this branch is porting a float MR with a corresponding float part, then
ticking to this branch is needed for the testing system to match this branch with its float-reference counterpart.
Please rename your branch. You can easily do this by creating a new branch from this branch:
  - git checkout -b <new branch name here>
You then also need to create a new merge request and update the links in your issue.
See here for details on the porting work process: https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/wikis/Porting-MRs-from-floating-point-codec#workflow-for-porting-a-merge-request-from-floating-point-codec-to-basop-codec

If this is not a porting branch, ignore above message.
"

if [ $# -ne 1 ]; then
  echo "Usage: $0 <branchname>"
  exit 1
fi

branchname_in="$1"
branchname_out="float-pc"

if ! [[ "$branchname_in" =~ $BASOP_PATTERN ]]; then
  printf "$MSG_DOES_NOT_MATCH" "$branchname_in"
fi

# The float ref branch is just the same name, but with basop -> ref replacement
# Replace only the first occurrence, as "basop" may be present in the later description
# If the format is correct, then before "_basop", only numbers can occur
float_ref_branchname="${branchname_in/basop/ref}"
git_result=$(git branch -a)

# If the branch does not exist, default to "float-pc"
if [[ "$git_result" =~ "$float_ref_branchname" ]]; then
  branchname_out="${float_ref_branchname}"
fi

echo "$branchname_out"
+5 −8
Original line number Diff line number Diff line
@@ -7,15 +7,12 @@ cd "${CI_PROJECT_DIR}"
# use ivas-float-update as reference for the merge source per default
FLOAT_REF_BRANCH_MERGE_SOURCE=$FLOAT_REF_BRANCH

# for porting MRs use the name-check script
if [[ $CI_MERGE_REQUEST_TARGET_BRANCH_NAME = "main" ]] && [[ "${CI_MERGE_REQUEST_TITLE,,}" =~ \[porting\] ]]; then
if [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[skip[[:space:]_-]name[[:space:]_-]check\] ]] && [[ ! "$CI_MERGE_REQUEST_TITLE" =~ \[CI\] ]]; then
  bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh
  # a bit awkward: write to file + standard out first so that the error message is visible in case of failure. Then fill the variable from the file
    ci/get_float_ref_branch_name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME | tee tmp_ref_branch.txt
  bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/get-float-ref-branch-name.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME | tee tmp_ref_branch.txt
  FLOAT_REF_BRANCH_MERGE_SOURCE=$(cat tmp_ref_branch.txt)
fi
fi

# TODO: remove after merge to main
FLOAT_REF_BRANCH_MERGE_SOURCE=float-pc