.. _archive repository:

==================
Archive Repository
==================

An archive repository is a directory that stores historical package files and
source tarballs. It maintains a complete history of all packages that have been
added to any :ref:`binary repository` and their source tarballs.

.. note::

  The archive repository uses a directory structure that organizes packages by
  their first letter and name, making it efficient to locate specific packages
  and their history.

Directory Structure
------------------

The archive repository consists of two main subdirectories:

- ``package/`` - Contains archived package files
- ``source/`` - Contains archived source tarballs

Each subdirectory organizes files using the following structure::

  archive/
  ├── package/
  │   └── p/
  │       └── package_a/
  │           ├── package_a-1.0.0-1-any.pkg.tar.zst
  │           └── package_a-1.0.0-1-any.pkg.tar.zst.sig
  └── source/
      └── p/
          └── package_a/
              └── package_a-1.0.0.tar.gz

The structure has the following characteristics:

- Files are organized under the first letter of their package name
- Each package has its own subdirectory named after the package
- All versions of a package are stored in its package directory
- Both package files and their signatures (if present) are archived
- Source tarballs follow the same organization pattern

This structure allows for:

- Easy lookup of package history
- Efficient storage of multiple versions
- Simple package file verification using signatures
- Build reproducibility verification using source tarballs

.. note::

  The archive repository is not exposed publicly like the :ref:`binary
  repository`. It serves as an internal historical record and helps ensure
  build reproducibility by maintaining original package files and sources.

Configuration
------------

The archive repository location can be configured globally or per-repository in
:ref:`repod.conf`. By default, the archive is stored in:

- ``/var/lib/repod/archive/`` for system-wide use
- ``$XDG_STATE_HOME/repod/archive/`` for per-user use

See :ref:`repod.conf` for more details on configuring archive locations. 