.. _archive_repository:

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

The archive repository is a directory structure that stores historical package files and their signatures. This allows for reproducible builds by preserving build dependencies.

Structure
=========

The archive repository uses a hierarchical directory structure to organize packages:

.. code-block:: text

    archive/
    ├── package/
    │   ├── a/
    │   │   ├── alsa-lib/
    │   │   │   ├── alsa-lib-1.2.8-1-x86_64.pkg.tar.zst
    │   │   │   └── alsa-lib-1.2.8-1-x86_64.pkg.tar.zst.sig
    │   │   └── ...
    │   ├── b/
    │   │   └── ...
    │   └── ...
    └── source/
        └── ...

The structure consists of:

- A top-level ``archive`` directory
- Subdirectories ``package`` and ``source`` 
- First-letter subdirectories (e.g. ``a/``, ``b/``)
- Package name subdirectories containing the package files and signatures

.. note::

  The default archive directories are:
  - System-wide: ``/var/lib/repod/archive/``
  - Per-user: ``$XDG_STATE_HOME/repod/archive/`` 

Build Reproducibility
===================

The archive plays an important role in ensuring build reproducibility by preserving exact versions of packages used as build dependencies. This allows verification that all build dependencies exist before accepting new packages.

See Also
========

- :ref:`binary_repository` - Documentation on binary package repositories
- :ref:`source_repository` - Documentation on source package repositories 