Re: Downloading from generated mirror



On Mon, 2018-04-30 at 16:48 +0100, Jonathan Maw wrote:
On 2018-04-30 12:56, Valentin David wrote:
 2. Multiple directories
 -----------------------

For some plugins, in #330, there is an extra component in the path.
It
is a number incrementing from 0. There are some plugins that might
get
new incompatible repositories or files for a same URL. And when we
detect this, we create a new directory.

 - ostree and git should not suffer of this problem, because we can
just compose repositories and collisions are unlikely.
 - zip and tar need it when the file is changed.
 - bzr needs it, when we detect that remote repository does not
contain
at least all the commits we have locally.

The loop that tries mirrors should retry while counting on the last
path component for those plugins requiring it.

There must be now two exceptions raised from source plugins:
 - one that says the URL works but the reference is not available,
 - another one for any other error.
The loop should count until it find the second error.

Hi Valentin,

Looking at this, the Source.fetch() method currently expects a 
SourceError
to be raised whenever there's a network error or if the source
reference
couldn't be matched.

Do you think it would help backwards-compatibility if we keep to 
returning
SourceErrors, but distinguish between the two cases based on the
error's
"reason" field?

e.g. in GitSource we extend assert_ref to have the reason "no-ref",
and 
use
any other SourceError when fetching as a reason to stop looping and
try
another alias mapping.


I was thinking of creating a class that inherits SourceError so we can
write:

except RefNotFound:
  # Next path
except SourceError:
  # Next mirror

And still be backwards-compatible.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]