Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D debexpo
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 42
    • Issues 42
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • mentors.debian.net
  • debexpo
  • Merge requests
  • !101

django: package upload

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Baptiste Beauplat requested to merge lyknode/debexpo:dj/upload into django Dec 28, 2019
  • Overview 17
  • Commits 16
  • Pipelines 2
  • Changes 23

Django migration: #47 (closed)

This MR adds package upload under the route /upload. The route only accepts PUT method for uploading files.

Although the upload logic stay the same (re-upload files while upload is marked as incomplete: no .changes), a lot of the class/object representation in the code has changed. Here is a brief summary of how it works.

At the top, we have a Spool object that represents the actual location of the uploaded files and, later, where the files will be processed. There are two queues: incoming where the upload happens and processing for a later use.

The Spool object allow new files to be uploaded with upload(). This method checks if the file is already owned by a previous upload, checks some allowed extensions and return a file handler for the views to fill up with uploaded data.

Ownership of a file to a previous upload can be determined by a Changes object. That object is created from a .changes file that will be parsed and inherit properties of a GPGSignedFile (allowing later validation of the GPG signature). The Changes object holds a ControlFiles object representing a list of the files referenced in the .changes.

The list of files of a ControlFiles object are instances of CheckSumedFile. This new object allow checking of file integrity using the given hashes.

Those new types of objects (Changes, ControlFiles, CheckSumedFile and GPGSignedFile) allow a simple validation of a changes and its files:

changes = Changes('my.changes')

changes.validate()  # validate mandatory fields for a .changes
changes.authenticate()  # authenticate the file by its GPG key
changes.files.validate()  # validate checksums of the files references by the .changes
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: dj/upload