swh.lister.opam.lister module

class swh.lister.opam.lister.OpamLister(scheduler: swh.scheduler.interface.SchedulerInterface, url: str, instance: str, credentials: Optional[Dict[str, Dict[str, List[Dict[str, str]]]]] = None)[source]

Bases: swh.lister.pattern.StatelessLister[str]

List all repositories hosted on an opam repository.

On initialisation, we create an opam root, with no ocaml compiler (no switch) as we won’t need it and it’s costly. In this opam root, we add a single opam repository (url) and give it a name (instance). Then, to get pages, we just ask opam to list all the packages for our opam repository in our opam root.

Parameters
  • url – base URL of an opam repository (for instance https://opam.ocaml.org)

  • instance – string identifier for the listed repository

LISTER_NAME: str = 'opam'
get_pages() Iterator[str][source]

Retrieve a list of pages of listed results. This is the main loop of the lister.

Returns

an iterator of raw pages fetched from the platform currently being listed.

get_origins_from_page(page: str) Iterator[swh.scheduler.model.ListedOrigin][source]

Convert a page of OpamLister repositories into a list of ListedOrigins