django: importer
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
Changesobject - Create and validate a
Dscobject from theChanges - Create and validate a
Sourceobject (representing a source package), from theDsc - Create and validate a
Changelog,ControlandCopyrightobjects from theSource - Create all DB entries from the
Sourceobject
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