eselect-repository
eselect-repository copied to clipboard
Be more receptive to offline environments
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
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
, anduri
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.
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.
(wrong button, meant to run CI)
What are we waiting on here? Code revisions from @Kangie?
Yes. The comments weren't addressed.