Unverified Commit d1329d20 authored by Simon McVittie's avatar Simon McVittie Committed by Andrej Shadura
Browse files

main: Ignore 404 error when trying to download _link

With at least obs-api 2.7.4-3co2 and osc 0.167.1-1, when a package is
newly branched from another project, it has a pseudo-file named _link
in its remote file list but that file cannot actually be downloaded.
Ignore the resulting 404 error.

Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 0e3a3038
......@@ -11,6 +11,7 @@ from osc.oscerr import WrongArgs, OscIOError
from debian.deb822 import Changes, Dsc
from tempfile import TemporaryDirectory
from pathlib import Path
from urllib.request import HTTPError
def get_objects_from_file(filename):
......@@ -205,11 +206,20 @@ def do_dput(self, subcmd, opts, *args):
for f in retained:
print('retaining non-source file: %r' % f)
# this will undo branch links since _link needs meta=0 when fetching
if not os.path.exists(f) and f != '_link':
if not os.path.exists(f):
print('fetching %r from server' % f)
package.updatefile(f, latest_revision)
package.updatefile(f, latest_revision)
except HTTPError as e:
# _link sometimes appears in remote_file_list but can't
# be downloaded
if f == '_link' and e.code == 404:
print('Ignoring 404 error for _link')
# adding local_file_list to the package as links
for f in local_file_list:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment