1. 18 Mar, 2021 1 commit
    • David Runge's avatar
      Correct and extend models and defaults · 5c491242
      David Runge authored
      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.
      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.
      Add tests for `PackageDesc.get_output_package()` and
  2. 08 Mar, 2021 1 commit
  3. 07 Mar, 2021 1 commit
    • David Runge's avatar
      Add conversion of 'desc' files · 84e32326
      David Runge authored
      Add the IntEnmu `FieldType` which tracks the required type for an
      attribute when converting from 'desc' or 'files' files to pydantic
      Extend the DESC_JSON and FILES_JSON globals by introducing a dict per
      key, that describes the name and the required type, when converting to
      pydantic models.
      Rename `_files_data_to_dict()` to `_read_files_data_to_model()` and
      return a pydantic model (`models.Files`) instead of a custom dict.
      Add `_desc_data_to_model()` which allows for conversion of a 'desc' data
      file (represented as io.StringIO) to a pydantic model
      Add another test for raising RuntimeError in
      Add a parametrized test for `_desc_data_to_model()`.
  4. 06 Mar, 2021 1 commit
    • David Runge's avatar
      Add repo_management package · 02936e68
      David Runge authored
      Add the basic defaults module, providing data that translates keywords
      found in the 'desc' and 'files' files of a binary repository database to
      those used in JSON files, representing the same data.
      Add the convert module, and introduce the simple private method
      (reimplementing a subset of the features from db2json)
      `_files_data_to_dict()`, which translates the contents of a `files` file
      to a typed dict.