For some projects, having the full repository name makes sense, like for device_samsung_i9300, while for other the directory structure can be omitted like libsamsung-ipc.
While the autodetection isn't complete, it at least handle some common cases. Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]> --- patches/replicant_prepare_patch.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/patches/replicant_prepare_patch.py b/patches/replicant_prepare_patch.py index f76c28c..d42ddb5 100755 --- a/patches/replicant_prepare_patch.py +++ b/patches/replicant_prepare_patch.py @@ -105,18 +105,33 @@ def get_repo_name(config): return output - +# We want to generate a prefix to have the project name in it. +# Examples: +# - [libsamsung-ipc][PATCH v2] Fix IPC_SEC_LOCK_INFOMATION typo +# - [device_samsung_i9300][PATCH] Add scripts to disable the modem def get_subject_prefix(config, revision): repo_name = get_repo_name(config) - project_name = repo_name.split('_')[-1] + + # Try to autodetect the project name: + # external_libsamsung-ipc -> libsamsung-ipc + # device_samsung_i9300 -> device_samsung_i9300 + dirs = repo_name.split('_') + + project_name = None + if dirs[0] == "external": + project_name = dirs[-1] + elif dirs[0] == "device": + project_name =repo_name + else: + project_name =repo_name if project_name == None: return None if revision == None: - return '{project}][PATCH'.format(project=project_name) + return '{project}] [PATCH'.format(project=project_name) else: - return '{project}][PATCH {rev}]['.format(project=project_name, + return '{project}] [PATCH {rev}]['.format(project=project_name, rev=revision) -- 2.27.0 _______________________________________________ Replicant mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/replicant
