eselect-repository icon indicating copy to clipboard operation
eselect-repository copied to clipboard

Be more receptive to offline environments

Open Kangie opened this issue 1 year ago • 5 comments

Current behaviour is to update the cached repositories.xml whenever an operation is performed, regardless of whether we need that information to continue (e.g. creating a new local repo, adding a repo by uri, removing an existing repo).

This commit changes this behaviour to only update the cache when performing operations that use the cache and adds a new OFFLINE_MODE configuration variable that skips fetching repositories.xml entirely.

Closes #19

Kangie avatar Jul 20 '23 06:07 Kangie

the TL;DR here is that now only enable and list try to update the repositories.xml by default (this is in line with existing documentation), and that can be overridden by OFFLINE_MODE.

Rationale:

  • Disabling means you know the cached number or are using name
  • Removing is the same
  • Creation is an offline action
  • Add provides name, sync-type, and uri

This came out of my recent experiences trying to use something as basic as eselect repository create in a firewalled environment; it's a really convenient helper that shouldn't rely on a webrequest succeeding to perform most functions.

Kangie avatar Jul 20 '23 06:07 Kangie

It's not quite there yet, as there's an edge case around 'what do we do if there isn't a cached xml', but I figured it was worth raising for comment while I iron the rough edges out.

Edit: What we do is create an empty XML file if we don't have a cached version to fall back on in offline mode, with predictable results - list only shows local repositories (though doesn't get remote URIs from repos.conf, hm, potential enhancement), and enable does nothing useful because we only know about local repositories.

Kangie avatar Jul 20 '23 06:07 Kangie

(wrong button, meant to run CI)

thesamesam avatar Oct 04 '23 08:10 thesamesam

What are we waiting on here? Code revisions from @Kangie?

maffblaster avatar Aug 22 '24 05:08 maffblaster

Yes. The comments weren't addressed.

mgorny avatar Aug 22 '24 06:08 mgorny