From 96850a6af200d2514364d7bd14eaf8812ade2ad6 Mon Sep 17 00:00:00 2001 From: heinezen Date: Wed, 2 Aug 2023 15:59:55 +0200 Subject: [PATCH] doc: Add 'versionstr' field to modpack info format. Helps distinguishing between openage modpack versions and the versions of converted/external mods. --- doc/media/openage/modpack_definition_file.md | 101 +++++++++--------- libopenage/assets/modpack.cpp | 3 + libopenage/assets/modpack.h | 1 + .../export/formats/modpack_info.py | 11 +- .../conversion/aoc/modpack_subprocessor.py | 2 +- .../conversion/de2/modpack_subprocessor.py | 2 +- .../conversion/hd/modpack_subprocessor.py | 2 +- .../conversion/ror/modpack_subprocessor.py | 2 +- .../conversion/swgbcc/modpack_subprocessor.py | 2 +- 9 files changed, 69 insertions(+), 57 deletions(-) diff --git a/doc/media/openage/modpack_definition_file.md b/doc/media/openage/modpack_definition_file.md index c4549f4cc9..a9ff6d6a41 100644 --- a/doc/media/openage/modpack_definition_file.md +++ b/doc/media/openage/modpack_definition_file.md @@ -1,6 +1,6 @@ # Modpack Definition File -**Format Version:** 1 +**Format Version:** 2 The modpack definition file is the header file for [modpacks](modpacks.md). @@ -22,54 +22,55 @@ find this specification document. The following parameters have to be specified. -Parameter | Data Type | Optional | Description ----------------------|-----------|----------|------------ -`file_version` | String | No | Version of the modpack definition file format. +| Parameter | Data Type | Optional | Description | +| -------------- | --------- | -------- | ---------------------------------------------- | +| `file_version` | String | No | Version of the modpack definition file format. | ## [info] Section `[info]` contains general information about the modpack. -Parameter | Data Type | Optional | Description --------------------|---------------|----------|------------ -`packagename` | String | No | Name of the modpack. -`version` | String | No | Version number. -`repo` | String | Yes | Name of the repo where the package is hosted. -`alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks. -`title` | String | Yes | Title used in UI. -`description` | String | Yes | Path to a file with a short description (max 500 chars). -`long_description` | String | Yes | Path to a file with a detailed description. -`url` | String | Yes | Link to the modpack's website. -`license` | Array[String] | Yes | License(s) of the modpack. +| Parameter | Data Type | Optional | Description | +| ------------------ | ------------- | -------- | ------------------------------------------------------------------------ | +| `packagename` | String | No | Name of the modpack. | +| `version` | String | No | Internal version number. Must have [semver](https://semver.org/) format. | +| `versionstr` | String | Yes | Human-readable version string. | +| `repo` | String | Yes | Name of the repo where the package is hosted. | +| `alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks. | +| `title` | String | Yes | Title used in UI. | +| `description` | String | Yes | Path to a file with a short description (max 500 chars). | +| `long_description` | String | Yes | Path to a file with a detailed description. | +| `url` | String | Yes | Link to the modpack's website. | +| `license` | Array[String] | Yes | License(s) of the modpack. | ## [assets] Section `[assets]` contains paths to assets in the modpack. -Parameter | Data Type | Optional | Description ----------------|----------------|----------|------------ -`include` | Array[String] | No | List of paths to assets that should be mounted on load time. Paths are allowed to contain wildcards. -`exclude` | Array[String] | Yes | List of paths to assets that should be excluded from mounting. Paths are allowed to contain wildcards. +| Parameter | Data Type | Optional | Description | +| --------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------ | +| `include` | Array[String] | No | List of paths to assets that should be mounted on load time. Paths are allowed to contain wildcards. | +| `exclude` | Array[String] | Yes | List of paths to assets that should be excluded from mounting. Paths are allowed to contain wildcards. | ## [dependency] Section `[dependency]` contains a list of other modpacks that the modpack depends on. -Parameter | Data Type | Optional | Description ----------------|----------------|----------|------------ -`modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. +| Parameter | Data Type | Optional | Description | +| ---------- | ------------- | -------- | --------------------------------------- | +| `modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. | ## [conflict] Section `[conflict]` contains a list of other modpacks that the modpack conflicts with. -Parameter | Data Type | Optional | Description ----------------|----------------|----------|------------ -`modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. +| Parameter | Data Type | Optional | Description | +| ---------- | ------------- | -------- | --------------------------------------- | +| `modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. | ## [authors] Section @@ -78,29 +79,29 @@ Parameter | Data Type | Optional | Description Every author must have their own subtable `[authors.{authorname}]`. The subtable can set the following parameters. -Parameter | Data Type | Optional | Description ------------|---------------|----------|------------ -`name` | String | No | Nickname of the author. Must be unique for the modpack. -`fullname` | String | Yes | Full name of the author. -`since` | String | Yes | Version number of the release where the author started to contribute. -`until` | String | Yes | Version number of the release where the author stopped to contribute. -`roles` | Array[String] | Yes | List of roles of the author during the creation of the modpack. -`contact` | Table | Yes | Contact information (see below). +| Parameter | Data Type | Optional | Description | +| ---------- | ------------- | -------- | --------------------------------------------------------------------- | +| `name` | String | No | Nickname of the author. Must be unique for the modpack. | +| `fullname` | String | Yes | Full name of the author. | +| `since` | String | Yes | Version number of the release where the author started to contribute. | +| `until` | String | Yes | Version number of the release where the author stopped to contribute. | +| `roles` | Array[String] | Yes | List of roles of the author during the creation of the modpack. | +| `contact` | Table | Yes | Contact information (see below). | The contact table can use the following parameters. -Parameter | Data Type | Optional | Description ------------|---------------|----------|------------ -`discord` | String | Yes | Discord username. -`email` | String | Yes | Email address. -`github` | String | Yes | GitHub username. -`gitlab` | String | Yes | Gitlab username. -`irc` | String | Yes | IRC username. -`mastodon` | String | Yes | Mastodon username. -`matrix` | String | Yes | Matrix username. -`reddit` | String | Yes | Reddit username. -`twitter` | String | Yes | Twitter username. -`youtube` | String | Yes | YouTube username. +| Parameter | Data Type | Optional | Description | +| ---------- | --------- | -------- | ------------------ | +| `discord` | String | Yes | Discord username. | +| `email` | String | Yes | Email address. | +| `github` | String | Yes | GitHub username. | +| `gitlab` | String | Yes | Gitlab username. | +| `irc` | String | Yes | IRC username. | +| `mastodon` | String | Yes | Mastodon username. | +| `matrix` | String | Yes | Matrix username. | +| `reddit` | String | Yes | Reddit username. | +| `twitter` | String | Yes | Twitter username. | +| `youtube` | String | Yes | YouTube username. | ## [authorgroups] Section @@ -110,8 +111,8 @@ It can be used in addition to `[authors]` to signify that the modpack is a team effort. -Parameter | Data Type | Optional | Description ---------------|---------------|----------|------------ -`name` | String | No | Group or team name. -`authors` | Array[String] | No | List of author identifiers. These must match up with subtable keys in the `[authors]` section, e.g. `"xxbunny123"` references `[authors.xxbunny123]`. -`description` | String | Yes | Path to a file with a description of the team. +| Parameter | Data Type | Optional | Description | +| ------------- | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | String | No | Group or team name. | +| `authors` | Array[String] | No | List of author identifiers. These must match up with subtable keys in the `[authors]` section, e.g. `"xxbunny123"` references `[authors.xxbunny123]`. | +| `description` | String | Yes | Path to a file with a description of the team. | diff --git a/libopenage/assets/modpack.cpp b/libopenage/assets/modpack.cpp index 8d784ef92e..acc3865696 100644 --- a/libopenage/assets/modpack.cpp +++ b/libopenage/assets/modpack.cpp @@ -33,6 +33,9 @@ ModpackInfo parse_modepack_def(const util::Path &info_file) { } // optionals + if (info.contains("versionstr")) { + def.versionstr = info.at("versionstr").as_string(); + } if (info.contains("repo")) { def.repo = info.at("repo").as_string(); } diff --git a/libopenage/assets/modpack.h b/libopenage/assets/modpack.h index 96ee08fa29..7c858b5ed7 100644 --- a/libopenage/assets/modpack.h +++ b/libopenage/assets/modpack.h @@ -43,6 +43,7 @@ struct ModpackInfo { // see /doc/media/openage/modpack_definition_file.md std::string id; std::string version; + std::string versionstr; std::string repo; std::string alias; std::string title; diff --git a/openage/convert/entity_object/export/formats/modpack_info.py b/openage/convert/entity_object/export/formats/modpack_info.py index 143a261f81..1a6017ce4e 100644 --- a/openage/convert/entity_object/export/formats/modpack_info.py +++ b/openage/convert/entity_object/export/formats/modpack_info.py @@ -10,7 +10,7 @@ from ..data_definition import DataDefinition -FILE_VERSION = "1" +FILE_VERSION = "2" class ModpackInfo(DataDefinition): @@ -25,6 +25,7 @@ def __init__(self, targetdir: str, filename: str): # Info self.packagename: str = None self.version: str = None + self.versionstr: str = None self.extra_info: dict[str, str] = {} # Assets @@ -153,6 +154,7 @@ def set_info( self, packagename: str, version: str, + versionstr: str = None, repo: str = None, alias: str = None, title: str = None, @@ -166,8 +168,10 @@ def set_info( :param packagename: Name of the modpack. :type packagename: str - :param version: Version number. + :param version: Internal version number. Must have semver format. :type version: str + :param versionstr: Human-readable version number. + :type versionstr: str :param repo: Name of the repo where the package is hosted. :type repo: str :param alias: Alias of the modpack. @@ -186,6 +190,9 @@ def set_info( self.packagename = packagename self.version = version + if versionstr: + self.extra_info["versionstr"] = versionstr + if repo: self.extra_info["repo"] = repo diff --git a/openage/convert/processor/conversion/aoc/modpack_subprocessor.py b/openage/convert/processor/conversion/aoc/modpack_subprocessor.py index cd365d1a51..8d54d68fed 100644 --- a/openage/convert/processor/conversion/aoc/modpack_subprocessor.py +++ b/openage/convert/processor/conversion/aoc/modpack_subprocessor.py @@ -44,7 +44,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack: mod_def = modpack.get_info() - mod_def.set_info("aoe2_base", "1.0c", repo="openage") + mod_def.set_info("aoe2_base", "0.5", versionstr="1.0c", repo="openage") mod_def.add_include("data/**") diff --git a/openage/convert/processor/conversion/de2/modpack_subprocessor.py b/openage/convert/processor/conversion/de2/modpack_subprocessor.py index 13c20cca53..22d9d220e2 100644 --- a/openage/convert/processor/conversion/de2/modpack_subprocessor.py +++ b/openage/convert/processor/conversion/de2/modpack_subprocessor.py @@ -40,7 +40,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack: mod_def = modpack.get_info() - mod_def.set_info("de2_base", "1.0c", repo="openage") + mod_def.set_info("de2_base", "0.5", versionstr="1.0c", repo="openage") mod_def.add_include("data/**") diff --git a/openage/convert/processor/conversion/hd/modpack_subprocessor.py b/openage/convert/processor/conversion/hd/modpack_subprocessor.py index e491660107..50e77ba711 100644 --- a/openage/convert/processor/conversion/hd/modpack_subprocessor.py +++ b/openage/convert/processor/conversion/hd/modpack_subprocessor.py @@ -40,7 +40,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack: mod_def = modpack.get_info() - mod_def.set_info("hd_base", "5.8", repo="openage") + mod_def.set_info("hd_base", "0.5", versionstr="5.8", repo="openage") mod_def.add_include("data/**") diff --git a/openage/convert/processor/conversion/ror/modpack_subprocessor.py b/openage/convert/processor/conversion/ror/modpack_subprocessor.py index 0269f7da92..dfe485b003 100644 --- a/openage/convert/processor/conversion/ror/modpack_subprocessor.py +++ b/openage/convert/processor/conversion/ror/modpack_subprocessor.py @@ -41,7 +41,7 @@ def _get_aoe1_base(cls, full_data_set: GenieObjectContainer) -> Modpack: mod_def = modpack.get_info() - mod_def.set_info("aoe1_base", "1.0a", repo="openage") + mod_def.set_info("aoe1_base", "0.5", versionstr="1.0a", repo="openage") mod_def.add_include("data/**") diff --git a/openage/convert/processor/conversion/swgbcc/modpack_subprocessor.py b/openage/convert/processor/conversion/swgbcc/modpack_subprocessor.py index bc50d080c7..cef278f9eb 100644 --- a/openage/convert/processor/conversion/swgbcc/modpack_subprocessor.py +++ b/openage/convert/processor/conversion/swgbcc/modpack_subprocessor.py @@ -40,7 +40,7 @@ def _get_swgb_base(cls, full_data_set: GenieObjectContainer) -> Modpack: mod_def = modpack.get_info() - mod_def.set_info("swgb_base", "1.1-gog4", repo="openage") + mod_def.set_info("swgb_base", "0.5", versionstr="1.1-gog4", repo="openage") mod_def.add_include("data/**")