diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-06-19 16:10:09 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-07-03 05:25:20 +0200 |
commit | 8960e49e8b338a541dabe58e0ae4f993e33f0ef8 (patch) | |
tree | e6315f59558b596467fb1d58102c15477ddedd46 | |
parent | 2993f95755ca2d3aaf8377b05b6a4cd1c5e7a0fd (diff) | |
download | vendor_replicant-scripts-8960e49e8b338a541dabe58e0ae4f993e33f0ef8.tar.gz vendor_replicant-scripts-8960e49e8b338a541dabe58e0ae4f993e33f0ef8.tar.bz2 vendor_replicant-scripts-8960e49e8b338a541dabe58e0ae4f993e33f0ef8.zip |
replicant_prepare_patch: subject prefix: add crude project names autodetection
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 <GNUtoo@cyberdimension.org>
-rwxr-xr-x | patches/replicant_prepare_patch.py | 23 |
1 files 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) |