1. 24 Mar, 2021 1 commit
    • David Runge's avatar
      Add first validators to models · 1a61c3d1
      David Runge authored
      repo_management/models.py:
      Add validators to the `BuildDate`, `CSize`, `ISize`, `Name` and
      `Version` models to ensure positive integers, correct names and
      versions.
      Add the comparator instance methods `Version.is_older_than()` and
      `Version.is_newer_than()` which rely on pyalpm's `vercmp()` to compare
      two version strings and return whether they are older or newer
      (respectively).
      Update the documentation for `ISize` to reflect, that it represents size
      of an installed package.
      
      tests/test_models.py:
      Add tests for added validators and comparator methods.
      1a61c3d1
  2. 18 Mar, 2021 1 commit
    • David Runge's avatar
      Correct and extend models and defaults · 5c491242
      David Runge authored
      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()`.
      5c491242