1 |
It seems that the code initially supported fetching without size |
2 |
'digest' but it got broken over time. Add proper conditionals to avoid |
3 |
ugly failures in this case. |
4 |
--- |
5 |
pym/portage/checksum.py | 2 +- |
6 |
pym/portage/package/ebuild/fetch.py | 7 ++++--- |
7 |
2 files changed, 5 insertions(+), 4 deletions(-) |
8 |
|
9 |
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
10 |
index f24a90f..1efe74e 100644 |
11 |
--- a/pym/portage/checksum.py |
12 |
+++ b/pym/portage/checksum.py |
13 |
@@ -303,7 +303,7 @@ def verify_all(filename, mydict, calc_prelink=0, strict=0): |
14 |
reason = "Reason unknown" |
15 |
try: |
16 |
mysize = os.stat(filename)[stat.ST_SIZE] |
17 |
- if mydict["size"] != mysize: |
18 |
+ if mydict["size"] is not None and mydict["size"] != mysize: |
19 |
return False,(_("Filesize does not match recorded size"), mysize, mydict["size"]) |
20 |
except OSError as e: |
21 |
if e.errno == errno.ENOENT: |
22 |
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py |
23 |
index 7b856a2..f60db9e 100644 |
24 |
--- a/pym/portage/package/ebuild/fetch.py |
25 |
+++ b/pym/portage/package/ebuild/fetch.py |
26 |
@@ -700,7 +700,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, |
27 |
os.unlink(myfile_path) |
28 |
except OSError: |
29 |
pass |
30 |
- elif distdir_writable: |
31 |
+ elif distdir_writable and size is not None: |
32 |
if mystat.st_size < fetch_resume_size and \ |
33 |
mystat.st_size < size: |
34 |
# If the file already exists and the size does not |
35 |
@@ -806,8 +806,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, |
36 |
# assume that it is fully downloaded. |
37 |
continue |
38 |
else: |
39 |
- if mystat.st_size < mydigests[myfile]["size"] and \ |
40 |
- not restrict_fetch: |
41 |
+ if (mydigests[myfile]["size"] is not None |
42 |
+ and mystat.st_size < mydigests[myfile]["size"] |
43 |
+ and not restrict_fetch): |
44 |
fetched = 1 # Try to resume this download. |
45 |
elif parallel_fetchonly and \ |
46 |
mystat.st_size == mydigests[myfile]["size"]: |
47 |
-- |
48 |
2.3.5 |