Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/commit_template_validation.py
Original file line number Diff line number Diff line change
@@ -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 <new_revision> --message <commit_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())




25 changes: 25 additions & 0 deletions .github/workflows/commit-message-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Validate Commit Message AAMP
on:
pull_request_target:
pull_request:
branches:
- dev_sprint_25_2
- feature/VPLAY-10292_new
- feature/VPLAY-10292
- feature/VPLAY-10292_temp
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:
ref: ${{ github.event.pull_request.head.sha }}

- name: Executing Validation Script
run: |
python3 .github/commit_template_validation.py --newrev "${{ github.event.pull_request.head.sha }}" --message "${{ github.event.pull_request.title }}"
2 changes: 1 addition & 1 deletion AampTsbDataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions AampTsbDataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TsbFragmentData> GetNextDiscFragment(double position, bool backwordSerach = false);
std::shared_ptr<TsbFragmentData> GetNextDiscFragment(double position, bool backwordSearch = false);

/**
* @fn DumpData
Expand Down
2 changes: 1 addition & 1 deletion dash/mpd/MPDModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ void DashMPDRoot::setLocation(string location) {
}

/**
* @briefa Set fetchTime
* @brief Set fetchTime
* @param FetchTime
*/
void DashMPDRoot::setFetchTime(double fetchTime) {
Expand Down
2 changes: 1 addition & 1 deletion main_aamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion ota_shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions tsprocessor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's license file the

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/0.0.0.1.1, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/RPIMC_0.0.0.1.1.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/2009.sprint.end, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/2009_sprint_end.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/stable2, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/stable2.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/2.10.1.0, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/2.10.1.0.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/0.0.0.1.1, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/RPIMC_0.0.0.1.1.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/2009.sprint.end, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/2009_sprint_end.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/stable2, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/stable2.tar.gz, file: tsprocessor.cpp)

Check failure on line 2 in tsprocessor.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'tsprocessor.cpp' (Match: rdk/components/generic/aamp/rdk/components/generic/aamp/2.10.1.0, 3881 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/aamp/+archive/2.10.1.0.tar.gz, file: tsprocessor.cpp)
* following copyright and licenses apply:
*
* Copyright 2018 RDK Management
Expand Down Expand Up @@ -2045,9 +2045,9 @@
}
}
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;
Expand Down
Loading