From 22028f73f67131edc4bf10a49a22954a3b53ad3f Mon Sep 17 00:00:00 2001 From: asasik397 Date: Tue, 19 Aug 2025 11:51:23 +0530 Subject: [PATCH 1/7] VPLAY-10292 : Jira ticket number verification Reason for change: Jira ticket number verification Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/commit_template_validation.py | 139 ++++++++++++++++++++ .github/workflows/commit-message-policy.yml | 25 ++++ AampTsbDataManager.cpp | 2 +- AampTsbDataManager.h | 4 +- dash/mpd/MPDModel.cpp | 2 +- main_aamp.h | 2 +- ota_shim.cpp | 2 +- tsprocessor.cpp | 6 +- 8 files changed, 173 insertions(+), 9 deletions(-) create mode 100755 .github/commit_template_validation.py create mode 100644 .github/workflows/commit-message-policy.yml diff --git a/.github/commit_template_validation.py b/.github/commit_template_validation.py new file mode 100755 index 0000000000..26b550b1a2 --- /dev/null +++ b/.github/commit_template_validation.py @@ -0,0 +1,139 @@ +import subprocess +import sys +import argparse +import re + +COMMIT_MESSAGE_FORMAT = ''' +########### ERROR : INVALID COMMIT MESSAGE! ############ +-------------- Please follow the commit message format as below -------------- + +RDKDEV-1234 : Fixes code download failure to set-top via IP download + +Reason for change: Enable capabilities for IPV6 connections . +Test Procedure: Refer ticket +-------------------------------------------------------------------------------- +''' + + +# Execute a command and return the output and error. +# +# Args: +# cmd (str): The command to execute. +# ignore (bool): Whether to ignore the error if the command fails. Default is True. +# cwd (str): The current working directory for the command. Default is None. +# +# Returns: +# tuple: A tuple containing the output (stdout) and error (stderr) of the command. +def executeCmd(cmd, ignore=True, cwd=None): + + proc = subprocess.Popen("%s" % cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, cwd=cwd) + out, err = proc.communicate() + if proc.returncode != 0: + out = proc.returncode + if ignore is False: + raise IOError('Failed to execute: %s, error %s' % (cmd, err)) + err = str('Failed to execute: %s, error %d' % (cmd, proc.returncode)) + return out, err + +# Validate the commits in a project. +# +# Args: +# newrev (str): The new revision. +# +# Returns: +# dict: A dictionary containing the commits and their validation errors. +def validate_commits(newrev, message): + + commits = {} + #commit_message, _ = executeCmd('git log --format=%s -n 1 {0} --no-merges'.format(newrev), ignore=False) + errors = [] + errors += validate_message(message) + if errors: + commits[newrev] = errors + print (COMMIT_MESSAGE_FORMAT) + print('-------------- Commit message in PR is: --------------') + print(message) + print('--------------------------------------------------------------------------------') + + return commits + + +# Validate the commit message has a JIRA ticket reference and is not a revert. +# In addition, the commit message should have : +# 1] Synopsis with a Jira ticket reference in first line +# 2] Title should not exceed 80 characters +# 3] Commit message should not contain new line character +# +# Args: +# message (str): The commit message. +# +# Returns: +# list: A list of validation errors. +def validate_message(message): + errors = [] + JIRA_PROJ_REGEX = r"\s*[A-Z0-9]+-[0-9]+" + + if message.startswith('Revert'): + # Do not validate revert messages. + return errors + + # check if message contains new line character + if '\n' in message: + errors.append('Commit message should not contain new line character') + + if len(message) > 80: + errors.append('Summary line must not exceed 80 characters.') + + if not re.match(JIRA_PROJ_REGEX, message): + errors.append('Summary line must have at least one JIRA ticket reference.') + + return errors + + + + + +# Validate pushed refs. + +# Usage: +# python commit_template_validation.py --newrev --message + +# Arguments: +# --newrev: The sha revision in Pull Request. +# --message: The commit message title of the PR. + +# Returns: +# int: 0 for success, 1 for failure. + +def main(): + + parser = argparse.ArgumentParser(description='Validate pushed refs:', formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument('--newrev', required=True) + parser.add_argument('--message', required=True) + + params = parser.parse_args() + + commits = validate_commits(params.newrev, params.message) + error_messages = set() + commits_sha = set() + + for commit, errors in commits.items(): + commits_sha.add(commit) + for error_message in errors: + error_messages.add(error_message) + + is_invalid = any(error_messages) + if is_invalid: + print('ERRORS:\n - ' + '\n - '.join(error_messages)) + print('COMMIT ID:\n - ' + '\n - '.join(commits_sha)) + + print('\n########################################################') + + return 1 if is_invalid else 0 + +if __name__ == '__main__': + sys.exit(main()) + + + + diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml new file mode 100644 index 0000000000..929521f87b --- /dev/null +++ b/.github/workflows/commit-message-policy.yml @@ -0,0 +1,25 @@ +name: Validate Commit Message AAMP +on: + pull_request_target: + branches: + - dev_sprint_25_2 + - feature/VPLAY-10292_new + - feature/VPLAY-10292 + types: [ opened, reopened, edited, synchronize, unlocked ] + +jobs: + validate-commit-message: + name: commit-template-validation + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + with: + path: 'code' + ref: ${{ github.event.pull_request.head.sha }} + + - name: Executing Validation Script + run: | + cd code + python3 .github/commit_template_validation.py --newrev "${{ github.event.pull_request.head.sha }}" --message "${{ github.event.pull_request.title }}" diff --git a/AampTsbDataManager.cpp b/AampTsbDataManager.cpp index 24ec9a37eb..a7c42ea8ec 100644 --- a/AampTsbDataManager.cpp +++ b/AampTsbDataManager.cpp @@ -446,7 +446,7 @@ void AampTsbDataManager::Flush() * @fn GetNextDiscFragment * @brief API to get next discontinuous fragment in the list. If not found, will return nullptr. * @param[in] position - Absolute position, in seconds since 1970, for querying the discontinuous fragment - * @param[in] backwordSerach - Search direction from the position to discontinuous fragment, default forward + * @param[in] backwordSearch - Search direction from the position to discontinuous fragment, default forward * @return TsbFragmentData shared object to fragment data */ TsbFragmentDataPtr AampTsbDataManager::GetNextDiscFragment(double position, bool backwardSearch) diff --git a/AampTsbDataManager.h b/AampTsbDataManager.h index 6468774162..06905f993f 100644 --- a/AampTsbDataManager.h +++ b/AampTsbDataManager.h @@ -391,10 +391,10 @@ class AampTsbDataManager * @fn GetNextDiscFragment * @brief API to get next discontinuous fragment in the list. If not found, will return nullptr. * @param[in] position - Absolute position, in seconds since 1970, for querying the discontinuous fragment - * @param[in] backwordSerach - Search direction from the position to discontinuous fragment, default forward + * @param[in] backwordSearch - Search direction from the position to discontinuous fragment, default forward * @return TsbFragmentData shared object to fragment data */ - std::shared_ptr GetNextDiscFragment(double position, bool backwordSerach = false); + std::shared_ptr GetNextDiscFragment(double position, bool backwordSearch = false); /** * @fn DumpData diff --git a/dash/mpd/MPDModel.cpp b/dash/mpd/MPDModel.cpp index 46b0ac9757..53409dc93b 100644 --- a/dash/mpd/MPDModel.cpp +++ b/dash/mpd/MPDModel.cpp @@ -1432,7 +1432,7 @@ void DashMPDRoot::setLocation(string location) { } /** - * @briefa Set fetchTime + * @brief Set fetchTime * @param FetchTime */ void DashMPDRoot::setFetchTime(double fetchTime) { diff --git a/main_aamp.h b/main_aamp.h index ae1eccb736..1c02070c6a 100644 --- a/main_aamp.h +++ b/main_aamp.h @@ -717,7 +717,7 @@ class StreamSink * @brief API to set track Id to audio sync property in case of AC4 audio * * @param[in] trackId - AC4 track Id parsed by aamp based of preference - * @return bol sttaus of API + * @return bol status of API */ /** diff --git a/ota_shim.cpp b/ota_shim.cpp index abb69544fd..c67b05b136 100644 --- a/ota_shim.cpp +++ b/ota_shim.cpp @@ -46,7 +46,7 @@ void StreamAbstractionAAMP_OTA::onPlayerStatusHandler(PlayerStatusData data) { { // Check if event is for current aamp instance, // sometimes blocked events are delayed and in fast channel change - // senario , it is delivered late. + // scenario , it is delivered late. currentLocator = aamp->GetManifestUrl(); if( 0 != currentLocator.compare(data.eventUrl)) diff --git a/tsprocessor.cpp b/tsprocessor.cpp index 021ec73b66..0a391ca3c6 100644 --- a/tsprocessor.cpp +++ b/tsprocessor.cpp @@ -2045,9 +2045,9 @@ bool TSProcessor::processStartCode(unsigned char *buffer, bool& keepScanning, in } } break; - case 2: // Slice data partiton A - case 3: // Slice data partiton B - case 4: // Slice data partiton C + case 2: // Slice data partition A + case 3: // Slice data partition B + case 4: // Slice data partition C break; case 6: // SEI break; From 2e9bef8ec8337513e6c5ef166eb7554d76a3120f Mon Sep 17 00:00:00 2001 From: asasik397 Date: Tue, 19 Aug 2025 12:51:26 +0530 Subject: [PATCH 2/7] VPLAY-10292 : Jira ticket number verification Reason for change:Modified the yml file.Removed checkout to code folder Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/workflows/commit-message-policy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml index 929521f87b..4d34270319 100644 --- a/.github/workflows/commit-message-policy.yml +++ b/.github/workflows/commit-message-policy.yml @@ -16,10 +16,8 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - path: 'code' ref: ${{ github.event.pull_request.head.sha }} - name: Executing Validation Script run: | - cd code python3 .github/commit_template_validation.py --newrev "${{ github.event.pull_request.head.sha }}" --message "${{ github.event.pull_request.title }}" From eba3b72cd6ff104c6712e6ea33efea77f9054095 Mon Sep 17 00:00:00 2001 From: asasik397 Date: Tue, 19 Aug 2025 20:42:50 +0530 Subject: [PATCH 3/7] VPLAY-10292 : Jira ticket number verification Reason for change: Added on pull_request Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/workflows/commit-message-policy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml index 4d34270319..387d1c8b7c 100644 --- a/.github/workflows/commit-message-policy.yml +++ b/.github/workflows/commit-message-policy.yml @@ -1,6 +1,7 @@ name: Validate Commit Message AAMP on: pull_request_target: + pull_request: branches: - dev_sprint_25_2 - feature/VPLAY-10292_new From 21f6e79353542a5ec59dae21358a41ef2d4cb152 Mon Sep 17 00:00:00 2001 From: asasik397 Date: Tue, 19 Aug 2025 20:51:54 +0530 Subject: [PATCH 4/7] VPLAY-10292 : Jira ticket number verification Reason for change: Added target branch name in yml file Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/workflows/commit-message-policy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml index 387d1c8b7c..b623665ce6 100644 --- a/.github/workflows/commit-message-policy.yml +++ b/.github/workflows/commit-message-policy.yml @@ -6,6 +6,7 @@ on: - dev_sprint_25_2 - feature/VPLAY-10292_new - feature/VPLAY-10292 + - feature/VPLAY-10292_temp types: [ opened, reopened, edited, synchronize, unlocked ] jobs: From f404fc8b1afc4e5504e5194560cdfb0ffeaf7c11 Mon Sep 17 00:00:00 2001 From: asasik397 Date: Wed, 20 Aug 2025 10:18:19 +0530 Subject: [PATCH 5/7] VPLAY-10292 : Jira ticket number verification Reason for change: Added target branch checkout Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/workflows/commit-message-policy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml index b623665ce6..253a80caf9 100644 --- a/.github/workflows/commit-message-policy.yml +++ b/.github/workflows/commit-message-policy.yml @@ -19,7 +19,8 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} + path: target_branch - name: Executing Validation Script run: | - python3 .github/commit_template_validation.py --newrev "${{ github.event.pull_request.head.sha }}" --message "${{ github.event.pull_request.title }}" + python3 target_branch/.github/commit_template_validation.py --newrev "${{ github.event.pull_request.head.sha }}" --message "${{ github.event.pull_request.title }}" From 658eab44b1e77214b88b3c3307a1ef1c1ca01fe3 Mon Sep 17 00:00:00 2001 From: asasik397 Date: Wed, 20 Aug 2025 10:30:47 +0530 Subject: [PATCH 6/7] VPLAY-10292 : Jira ticket number verification Reason for change: Added target branch name Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/workflows/commit-message-policy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/commit-message-policy.yml b/.github/workflows/commit-message-policy.yml index 253a80caf9..4f399921ee 100644 --- a/.github/workflows/commit-message-policy.yml +++ b/.github/workflows/commit-message-policy.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: feature/VPLAY-10292 path: target_branch - name: Executing Validation Script From 2f55ba1a48ee3f0fd920a5ddf58213f683274efb Mon Sep 17 00:00:00 2001 From: asasik397 Date: Wed, 20 Aug 2025 11:48:48 +0530 Subject: [PATCH 7/7] VPLAY-10292 : Jira ticket number verification Reason for change: Cleanup Test Procedure: Updated in ticket Risks: Medium Priority: P1 Signed-off-by: asasik397 --- .github/commit_template_validation.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/commit_template_validation.py b/.github/commit_template_validation.py index 26b550b1a2..d271cf6159 100755 --- a/.github/commit_template_validation.py +++ b/.github/commit_template_validation.py @@ -7,10 +7,8 @@ ########### ERROR : INVALID COMMIT MESSAGE! ############ -------------- Please follow the commit message format as below -------------- -RDKDEV-1234 : Fixes code download failure to set-top via IP download +VPLAY-1234 : Fixes code download failure to set-top via IP download -Reason for change: Enable capabilities for IPV6 connections . -Test Procedure: Refer ticket -------------------------------------------------------------------------------- '''