Skip to content

Force use index #109

@andrius-puksta-sensmetry

Description

Sysand currently allows overriding the index used to resolve packages. This does not change the resolution logic, which goes as follows:

/// Implements "standard" resolution logic given a set of individual resolvers.
/// Use sysand::resolve::null::NullResolver to skip any of the steps.
/// The logic is as follows:
/// 1. Do not resolve any further if file_resolver is successful, otherwise go to step 2.
/// 2. If remote_resolver produces any results, discard any that do not point to a valid
/// project (i.e. do not produce both a info and meta). If at least one project is found
/// proceed to 4. (skipping 3.)
/// 3. Take whatever results are produced by remote_resolver and proceed to step 4.
/// 4. If local_resolver resolves anything, collect all the results. Iterate over the results
/// from previous steps, but interleave results from local_resolver when they have
/// identical hashes. Any results from local_resolver that were not interleaved are returned
/// at the end.
///
/// Cached values are returned exactly once (so if the underlying resolver gives duplicates
/// they will appear cached only one time).
///
/// The above procedure basically amounts to:
/// - file_resolver represents private projects
/// - remote_resolver is prioritised, but may be ignored if it does not resolve valid projects
/// (typically due to using non-resolving URLs to reference a resource)
/// - registry_resolver is what will typically be hit when using non-resolvable IRIs
/// - local_resolver serves to provide a cache, but may contain "dangling" cached projects
///
/// Each resolver is optional, and can be skipped by passing `None`. `NO_RESOLVER` is a typed `None`
/// value that can be used to avoid ambiguous typing.

In case one desires to resolve all packages through a custom index (such as an exposed local sysand_env), there is no way to force the resolution to use the specified index only or to check it first. Control over where the packages are fetched from is useful in a restricted environment.

Options:

  • leave it as-is and document how the package resolution works, i.e. in which order the sources are checked.
    Also mention it in docstring for --use-index, currently it's not clear that overriding the index does not force its usage or make it the primary resolver.
  • add another flag --force-index (to use only the specified index) and/or --index-first (first try the specified index). Exact naming is up for debate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions