repoman.config_io#

Save and load .repoman state files (pure JSON, no GTK, fully unit-testable).

File format v1: JSON with version, saved_at, and a repos list. Each entry captures enough to reconstruct a Repository and detect drift when the same config is loaded on a different machine or after a reinstall.

save_config(repos)[source]#

Serialise repo list to a JSON string for writing to a .repoman file.

Parameters:

repos (list[Repository])

Return type:

str

load_config(path)[source]#

Parse a .repoman JSON file and return the list of repo entries.

Parameters:

path (Path) – Path to the .repoman file to read.

Returns:

List of raw repo dicts from the repos key.

Return type:

list[dict]

Raises:
match_repos(saved, live)[source]#

Match saved config entries to live repos by primary URI.

Parameters:
  • saved (list[dict]) – List of raw repo dicts from a loaded .repoman file.

  • live (list[Repository]) – Currently loaded repositories from the system.

Returns:

A 2-tuple of (matched, missing), where matched is a list of (saved_entry, live_repo) pairs for repos found on the system, and missing is a list of saved entries whose URI was not found.

Return type:

tuple[list[tuple[dict, Repository]], list[dict]]

entry_to_repository(entry)[source]#

Reconstruct a Repository from a saved config entry.

Used when creating repos that exist in the config but not on the system. Always produces DEB822 format; source_file is taken from the saved entry.

Parameters:

entry (dict)

Return type:

Repository