From 7247d074c01462138b878b1339b8ccdf39902a7d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 25 Feb 2025 11:07:07 +0100 Subject: [PATCH] extend script + turn into bash script --- ci/get_float_ref_branch_name.py | 59 ------------------------------ ci/get_float_ref_branch_name.sh | 65 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 59 deletions(-) delete mode 100644 ci/get_float_ref_branch_name.py create mode 100644 ci/get_float_ref_branch_name.sh diff --git a/ci/get_float_ref_branch_name.py b/ci/get_float_ref_branch_name.py deleted file mode 100644 index b8da8979e7..0000000000 --- a/ci/get_float_ref_branch_name.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -""" -(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. -""" - -import re -import sys -import argparse - -BASOP_PATTERN = r"\d+[_-]basop[_-].*" - -MSG_DOES_NOT_MATCH = """Your branch name {branchname} does not match the template '_basop_', e.g. '123_basop_fix_this_one_bug-2'. -Sticking 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 -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 -""" - -parser = argparse.ArgumentParser() -parser.add_argument("branchname") -args = parser.parse_args() -branchname = args.branchname - -re_match = re.match(BASOP_PATTERN, branchname) -if re_match is None: - print(MSG_DOES_NOT_MATCH.format(branchname=branchname)) - sys.exit(1) - -# the float ref branch is just the same name, but with basop -> ref replacement -# replace only the first occurrence, as "basop" mit be present in the later description -# if the format is correct, then before "_basop", only numbers can occur -print(branchname.replace("basop", "ref", 1)) diff --git a/ci/get_float_ref_branch_name.sh b/ci/get_float_ref_branch_name.sh new file mode 100644 index 0000000000..0d791b6f5c --- /dev/null +++ b/ci/get_float_ref_branch_name.sh @@ -0,0 +1,65 @@ +#!/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 '_basop_', e.g. '123_basop_fix_this_one_bug-2'. +Sticking 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 +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 [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +branchname="$1" + +if ! [[ "$branchname" =~ $BASOP_PATTERN ]]; then + printf "$MSG_DOES_NOT_MATCH" "$branchname" + exit 1 +fi + +float_ref_branchname="${branchname/basop/ref}" +git_result=$(git branch --list "$float_ref_branchname") + +# If the branch does not exist, default to "float-pc" +if [[ -z "$git_result" ]]; then + branchname="float-pc" +else + # 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 + branchname="${float_ref_branchname}" +fi + +echo "$branchname" -- GitLab