Commit 08d978a6 authored by Florian Pritz's avatar Florian Pritz
Browse files

Capture all errors and set exit code accordingly



Apparently some package doesn't have the pkginfo['license'] value set so
we get an exception, but that exception isn't expected and thus we don't
get the name of the broken package. Also, we really want that the
uploader tries to upload all the other files instead of aborting early.
We still want it to exit non-zero though.
Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent 252af237
......@@ -102,19 +102,27 @@ class ArchiveUploader:
def main(self, pkg_dirs):
"""Upload all versions of each package"""
exitcode = 0
for pkg_dir in pkg_dirs:
pkgname = os.path.basename(pkg_dir)
identifier = self.clean_name('archlinux_pkg_' + pkgname)
metadata = {
'collection': ['archlinuxarchive'],
'mediatype': 'software',
'publisher': 'Arch Linux',
'creator': 'Arch Linux',
'subject': ['archlinux', 'archlinux package'],
}
metadata['title'] = pkgname + " package archive from Arch Linux"
metadata['subject'].append(pkgname)
self.upload_pkg(identifier, pkgname, metadata, pkg_dir)
try:
pkgname = os.path.basename(pkg_dir)
identifier = self.clean_name('archlinux_pkg_' + pkgname)
metadata = {
'collection': ['archlinuxarchive'],
'mediatype': 'software',
'publisher': 'Arch Linux',
'creator': 'Arch Linux',
'subject': ['archlinux', 'archlinux package'],
}
metadata['title'] = pkgname + " package archive from Arch Linux"
metadata['subject'].append(pkgname)
self.upload_pkg(identifier, pkgname, metadata, pkg_dir)
except Exception as e:
print(f"{identifier}: exception raised", file=sys.stderr)
print(e, file=sys.stderr)
print(pkg_dir)
exitcode = 1
return exitcode
if __name__ == '__main__':
ArchiveUploader().main(sys.argv[1:])
sys.exit(ArchiveUploader().main(sys.argv[1:]))
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