Verified Commit 5c491242 authored byBrowse files
Correct and extend models and defaults
repo_management/defaults.py: Add the IntEnum `RepoDbType` to be able to identify/address the different types of binary database files (e.g. .db vs. .files). Change the %LICENSE% entry in `DESC_JSON` to not track the name in plural (use "license" instead of "licenses") to stay in line with the naming of the original variable. Add `DB_USER`, `DB_GROUP`, `DB_FILE_MODE`, `DB_DIR_MODE`, to provide defaults for which user and group to create files and directories with which file mode for, when generating a database file. repo_management/models.py: Change the `License` model to track an optional list of license identifiers using the singular term ("license" instead of "licenses") to have more predictable and coherent naming of variables and attributes. Add `Base` to `OutputPackageBase` as this way the model is more complete and it becomes much easier to use it, without having to also pass the pkgbase alongside it. Add the convenience method `get_packages_as_models()` to `OutputPackageBase` which returns the list of packages as tuples of `PackageDesc` and `Files`. Extend `PackageDesc` by the convenience method `get_output_package()` to easily convert an instance of `PackageDesc` and an optional instance of `Files` to an instance of `OutputPackage`. Move the declaration of `OutputPackage` above that of `PackageDesc` so that `PackageDesc.get_output_package()` can declare typing. tests/test_models.py Add tests for `PackageDesc.get_output_package()` and `OutputPackageBase.get_packages_as_models()`.
Showing with 262 additions and 31 deletions