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:
1. Open issues based on the information provided in a CSV file:
e.g.: `python systems.py -o --csv Contribs.csv`
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):
e.g.: `python systems.py -d --csv Contribs.csv --template template.docx`
4. Close issues based on the information provided in a CSV file:
e.g.: `python systems.py -c --csv Contribs.csv`
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:
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:
- **Number** - MPEG document number with entries like `m12345`
- 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 (*recommended*)
- 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`.
- **Number** - MPEG document numbers
- **Project URL** - a full URL to your GitLab project
- **Close issue** - (optional) 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
Number;Title;Project URL;Sub Group;Project Name
m55958;On item 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;FileFormat;CENC
Number;Whatever column;Project URL
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
...
```
## 3. generate_ballot_issues.py
......
......@@ -167,18 +167,15 @@ def find_document(documents, document_number):
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:
return None
striped_url_or_path = url_or_path.replace(' ', '').strip().strip('/')
for project in projects:
if striped_url_or_path == project['url']:
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()):
if project['url'] in striped_url_or_path:
return project
return None
......
......@@ -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:
e.g.: python systems.py -o --csv Contribs.csv
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:
e.g.: python systems.py -d --csv Contribs.csv --template template.docx
4. Close issues based on the information provided in a CSV file:
e.g.: python systems.py -c --csv Contribs.csv
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:
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
requests to both systems and to impove the performance. You can use the -u option to update
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 any issues on GitLab.
requests to both systems and to impove the performance. You can use the -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.
"""
import argparse
......@@ -304,23 +303,18 @@ def parse_csv(csv_file, projects, docs):
# skip empty lines
if len(' '.join(row).strip()) == 0:
continue
project_url_or_path = None
# try URL first
project_url = None
if project_url_idx is not None:
if len(row[project_url_idx]) > 0:
project_url_or_path = row[project_url_idx]
# If URL failed, try subgroup/projectname
if project_url_or_path is None and subgroup_idx is not None and project_name_idx is not None:
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)
project_url = row[project_url_idx]
if project_url is None:
print('NOTE: No project URL found:', row)
continue
close_flag = False
if close_idx is not None:
if 'true' in row[close_idx].lower() or '1' == row[close_idx]:
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])
if not project:
print('WARNING: No project on GitLab for:', row)
......@@ -335,12 +329,12 @@ def parse_csv(csv_file, projects, docs):
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 = []
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:
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
for doc in docs:
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