As a means for binhost clients to select source repo
revisions which are consistent with binhosts, inject
REPO_REVISIONS from a package into the index header,
using a history of synced revisions to guarantee
forward progress. This queries the relevant repos to
check if any new revisions have appeared in the
absence of a proper sync operation.

The history of synced revisions is provided by a new
get_repo_revision_history function and corresponding
/var/lib/portage/repo_revisions file, with history
limit currently capped at 25 revisions. If a change
is detected and the current process has permission
to update the repo_revisions file, then the file will
be updated with any newly detected revisions.
For volatile repos the revisions may be unordered,
which makes them unusable for the purposes of the
revision history, so the revisions of volatile repos
are not tracked. This functions detects revisions
which are not yet visible to the current process due
to the sync-rcu option.

The emaint revisions --purgerepos and --purgeallrepos
options allow revisions for some or all repos to be
easily purged from the history. For example, the
emerge-webrsync script uses this emaint commmand to
purge the revision history of the gentoo repo when
the emerge-webrsync --revert option is used to roll
back to a previous snapshot:

    emaint revisions --purgerepos="${repo_name}"

This series can also be reviewed at https://github.com/gentoo/portage/pull/1306.

Bug: https://bugs.gentoo.org/924772
Signed-off-by: Zac Medico <[email protected]>

Zac Medico (2):
  Add get_repo_revision_history function and repo_revisions file
  bintree: Add REPO_REVISIONS to package index header

 bin/emerge-webrsync                           |   3 +-
 lib/portage/const.py                          |   1 +
 lib/portage/dbapi/bintree.py                  |  66 +++++++-
 lib/portage/emaint/modules/meson.build        |   1 +
 .../emaint/modules/revisions/__init__.py      |  36 +++++
 .../emaint/modules/revisions/meson.build      |   8 +
 .../emaint/modules/revisions/revisions.py     |  95 ++++++++++++
 lib/portage/sync/controller.py                |   8 +-
 lib/portage/sync/meson.build                  |   1 +
 lib/portage/sync/revision_history.py          | 133 ++++++++++++++++
 lib/portage/tests/sync/test_sync_local.py     | 146 ++++++++++++++++--
 man/emaint.1                                  |  18 ++-
 man/portage.5                                 |  17 +-
 13 files changed, 511 insertions(+), 22 deletions(-)
 create mode 100644 lib/portage/emaint/modules/revisions/__init__.py
 create mode 100644 lib/portage/emaint/modules/revisions/meson.build
 create mode 100644 lib/portage/emaint/modules/revisions/revisions.py
 create mode 100644 lib/portage/sync/revision_history.py

-- 
2.41.0


Reply via email to