Skip to content

django: importer

Baptiste Beauplat requested to merge lyknode/debexpo:dj/importer into django

Django migration: #47 (closed)

This MR re-adds the importer.

It includes:

  • The actual Importer() class to import new packages into the database
  • The importer command to import a package from the CLI
  • A worker that will periodically trigger an import.
  • A context manager to ensure an action can only be run one at a time (useful for importer or repository events).
  • Updated docs and tests

It does not includes:

  • Plugins
  • Any repository implementation
  • Package orig.tar retrieval (from debian or the local repository)
  • GitStorage

Those will be implemented in a later MR.

The importer can be called either using a Spool or a Changes. In both case, the workflow will be:

  • Validate the Changes object
  • Create and validate a Dsc object from the Changes
  • Create and validate a Source object (representing a source package), from the Dsc
  • Create and validate a Changelog, Control and Copyright objects from the Source
  • Create all DB entries from the Source object

On error, the importer will gracefully fail either with _reject or _fail(). The latter one will mail the admins in addition to the uploader. On success, the uploader will be notified and the package will be accessible from the site.

The worker is implemented with celery. It can be use to run periodically the Importer as a task. docs/worker.rst has been updated to explain how to use it. It will require an instance of redis.

The binary version of the importer as been added as a django management command and is accessible via python setup.py import *.changes.

New dependencies to install on mentors:

sudo apt install redis-server \
    python3-celery \
    python3-django-celery-beat \
    python3-redis \
    python3-django-redis \
    python3-fakeredis \
    python3-lupa
Edited by Baptiste Beauplat

Merge request reports

Loading