Commit 9c4839c2 authored by Dimitri Podborski's avatar Dimitri Podborski
Browse files

remove SubGroup,ProjectName. Only allow ProjectURL

parent 9e640873
...@@ -51,32 +51,29 @@ Below are a few examples: ...@@ -51,32 +51,29 @@ Below are a few examples:
1. Open issues based on the information provided in a CSV file: 1. Open issues based on the information provided in a CSV file:
e.g.: `python systems.py -o --csv Contribs.csv` e.g.: `python systems.py -o --csv Contribs.csv`
2. Open issues based on CLI options: 2. Open issues based on CLI options:
e.g.: `python systems.py -o -m 55958,55959,56121 -p FileFormat/CENC --meeting 133` e.g.: `python systems.py -o -m 55958,55959,56121 -p http://... --meeting 133`
3. Generate an output document based on the information provided in a CSV file. Use a template as a basis (`--template` is optional): 3. Generate an output document based on the information provided in a CSV file. Use a template as a basis (`--template` is optional):
e.g.: `python systems.py -d --csv Contribs.csv --template template.docx` e.g.: `python systems.py -d --csv Contribs.csv --template template.docx`
4. Close issues based on the information provided in a CSV file: 4. Close issues based on the information provided in a CSV file:
e.g.: `python systems.py -c --csv Contribs.csv` e.g.: `python systems.py -c --csv Contribs.csv`
5. Close issues based on CLI options: 5. Close issues based on CLI options:
e.g.: `python systems.py -c -m m55958,m55959,m56121 -p FileFormat/CENC --meeting 133` e.g.: `python systems.py -c -m m55958,m55959,m56121 -p http://... --meeting 133`
6. Print information about input documents on MDMS and GitLab: 6. Print information about input documents on MDMS and GitLab:
e.g.: `python systems.py -l -m m55958,m55959,m56121 -p FileFormat/CENC --meeting 133` e.g.: `python systems.py -l -m m55958,m55959,m56121 -p http://... --meeting 133`
The CSV file must have a header row with the folowing entries: The CSV file must have a header row with the folowing entries:
- **Number** - MPEG document number with entries like `m12345` - **Number** - MPEG document numbers
- To determine which GitLab project needs to be used make sure that your CSV file has either: - **Project URL** - a full URL to your GitLab project
- **Project URL** - a full URL to your GitLab project (*recommended*) - **Close issue** - (optional) if you want to close multiple issues at once. Supported values are `0`, `1`, `TRUE`, `FALSE`, `true` and `false`.
- or **Sub Group** and **Project Name** - two last elements of the Project URL. (non-case-sensitive)
e.g.: http://mpegx.int-evry.fr/software/MPEG/Systems/PCC-SYS/V-PCC → `Sub Group=PCC-SYS`, `Project Name=V-PCC`.
e.g.: http://mpegx.int-evry.fr/software/MPEG/Systems/FileFormat/isobmff → `Sub Group=FileFormat`, `Project Name=ISOBMFF`
- **Close issue** - is required if you want to close multiple issues at once. Supported values are `0`, `1`, `TRUE`, `FALSE`, `true` and `false`.
The example CSV below has both `Project URL` and (`Sub Group` with `Project Name`) but you can also have one of these in your CSV. The CSV delimiter is determined automatically. The CSV delimiter is determined automatically. The order of columns does not matter. CSV file example:
```csv ```csv
Number;Title;Project URL;Sub Group;Project Name Number;Whatever column;Project URL
m55958;On item encryption;http://mpegx.int-evry.fr/software/MPEG/Systems/FileFormat/CENC;FileFormat;CENC m55958;On item encryption;http://mpegx.int-evry.fr/software/MPEG/Systems/FileFormat/CENC
m55959;On multi-key encryption;http://mpegx.int-evry.fr/software/MPEG/Systems/FileFormat/CENC;FileFormat;CENC m55959;On multi-key encryption;http://mpegx.int-evry.fr/software/MPEG/Systems/FileFormat/CENC
...
``` ```
## 3. generate_ballot_issues.py ## 3. generate_ballot_issues.py
......
...@@ -167,18 +167,15 @@ def find_document(documents, document_number): ...@@ -167,18 +167,15 @@ def find_document(documents, document_number):
return None return None
def find_project(projects, url_or_path, path_root='MPEG/'): def find_project(projects, url_or_path):
""" """
Search for gitlab project based on URL or path_with_namespace. Search for gitlab project based on URL.
""" """
if url_or_path is None: if url_or_path is None:
return None return None
striped_url_or_path = url_or_path.replace(' ', '').strip().strip('/') striped_url_or_path = url_or_path.replace(' ', '').strip().strip('/')
for project in projects: for project in projects:
if striped_url_or_path == project['url']: if project['url'] in striped_url_or_path:
return project
path_ns = project['path_with_namespace'].lower()
if striped_url_or_path.lower() in path_ns and path_ns.startswith(path_root.lower()):
return project return project
return None return None
......
...@@ -6,20 +6,19 @@ Some of the things you can do with this script are listed below: ...@@ -6,20 +6,19 @@ Some of the things you can do with this script are listed below:
1. Open issues based on the information provided in a CSV file: 1. Open issues based on the information provided in a CSV file:
e.g.: python systems.py -o --csv Contribs.csv e.g.: python systems.py -o --csv Contribs.csv
2. Open issues based on CLI options: 2. Open issues based on CLI options:
e.g.: python systems.py -o -m 55958,55959,56121 -p FileFormat/CENC e.g.: python systems.py -o -m 55958,55959,56121 -p http://...
3. Generate an output document based on the information provided in a CSV file: 3. Generate an output document based on the information provided in a CSV file:
e.g.: python systems.py -d --csv Contribs.csv --template template.docx e.g.: python systems.py -d --csv Contribs.csv --template template.docx
4. Close issues based on the information provided in a CSV file: 4. Close issues based on the information provided in a CSV file:
e.g.: python systems.py -c --csv Contribs.csv e.g.: python systems.py -c --csv Contribs.csv
5. Close issues based on CLI options: 5. Close issues based on CLI options:
e.g.: python systems.py -c -m m55958,m55959,m56121 -p FileFormat/CENC e.g.: python systems.py -c -m m55958,m55959,m56121 -p http://...
6. Print information about input documents on MDMS and GitLab: 6. Print information about input documents on MDMS and GitLab:
e.g.: python systems.py -l -m m55958,m55959,m56121 -p FileFormat/CENC e.g.: python systems.py -l -m m55958,m55959,m56121 -p http://...
NOTE 1: The script stores data from mdms and gitlab to ./data folder to minimize the number of NOTE 1: The script stores data from mdms and gitlab to ./data folder to minimize the number of
requests to both systems and to impove the performance. You can use the -u option to update requests to both systems and to impove the performance. You can use the -U option to update all data.
MDMS input document table only, or use -U option to update all data. NOTE 2: You can use --test option to 'test run' the script. It will not create or close any issues on GitLab.
NOTE 2: You can use --test option to 'test run' the script. It will not create any issues on GitLab.
""" """
import argparse import argparse
...@@ -304,23 +303,18 @@ def parse_csv(csv_file, projects, docs): ...@@ -304,23 +303,18 @@ def parse_csv(csv_file, projects, docs):
# skip empty lines # skip empty lines
if len(' '.join(row).strip()) == 0: if len(' '.join(row).strip()) == 0:
continue continue
project_url_or_path = None project_url = None
# try URL first
if project_url_idx is not None: if project_url_idx is not None:
if len(row[project_url_idx]) > 0: if len(row[project_url_idx]) > 0:
project_url_or_path = row[project_url_idx] project_url = row[project_url_idx]
# If URL failed, try subgroup/projectname if project_url is None:
if project_url_or_path is None and subgroup_idx is not None and project_name_idx is not None: print('NOTE: No project URL found:', row)
if len(row[subgroup_idx]) > 0 and len(row[project_name_idx]) > 0:
project_url_or_path = row[subgroup_idx] + '/' + row[project_name_idx]
if project_url_or_path is None:
print('NOTE: No project or path found:', row)
continue continue
close_flag = False close_flag = False
if close_idx is not None: if close_idx is not None:
if 'true' in row[close_idx].lower() or '1' == row[close_idx]: if 'true' in row[close_idx].lower() or '1' == row[close_idx]:
close_flag = True close_flag = True
project = helpers.find_project(projects, project_url_or_path, 'MPEG/Systems') project = helpers.find_project(projects, project_url)
doc = helpers.find_document(docs, row[doc_number_idx]) doc = helpers.find_document(docs, row[doc_number_idx])
if not project: if not project:
print('WARNING: No project on GitLab for:', row) print('WARNING: No project on GitLab for:', row)
...@@ -335,12 +329,12 @@ def parse_csv(csv_file, projects, docs): ...@@ -335,12 +329,12 @@ def parse_csv(csv_file, projects, docs):
return table_entries return table_entries
def parse_cli(docs, project_url_or_path, close_flag, gitlab_projects, input_docs): def parse_cli(docs, project_url, close_flag, gitlab_projects, input_docs):
table_entries = [] table_entries = []
docs = docs.replace('m', '').replace('M', '').strip().split(',') docs = docs.replace('m', '').replace('M', '').strip().split(',')
project = helpers.find_project(gitlab_projects, project_url_or_path, 'MPEG/Systems') project = helpers.find_project(gitlab_projects, project_url)
if not project: if not project:
print(' - Could not find a GitLab project with project URL or path "{}"'.format(project_url_or_path)) print(' - Could not find a GitLab project with project URL "{}"'.format(project_url))
return table_entries return table_entries
for doc in docs: for doc in docs:
document = helpers.find_document(input_docs, 'm' + doc) document = helpers.find_document(input_docs, 'm' + doc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment