ci: fix failure with check_changed_aports when testing new aport
Apparently some callers of `get_package_version` expect it to return
None if a package wasn't found... e.g. when CI is testing a branch that
introduces a new aport and it's trying to get the upstream version for
it, which doesn't exist.
This leads to a spectacular crash in CI:
upstream = get_package_version(args, package, commit, False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/clayton/src/pmaports/./.ci/lib/check_changed_aports_versions.py", line 47, in get_package_version
return parsed["pkgver"] + "-r" + parsed["pkgrel"]
~~~~~~^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
When I refactored this method in 07812a918
I goofed up and changed this
behavior, so let's restore it to fix the crash.
This commit is contained in:
parent
f940d37fa4
commit
a263494c1c
1 changed files with 4 additions and 0 deletions
|
@ -43,7 +43,11 @@ def get_package_contents(args, package, revision, check=True):
|
|||
|
||||
|
||||
def get_package_version(args, package, revision, check=True):
|
||||
""" returns version in the format "{pkgver}-r{pkgrel}", or None if no
|
||||
matching package is found """
|
||||
parsed = get_package_contents(args, package, revision, check)
|
||||
if parsed is None:
|
||||
return None
|
||||
return parsed["pkgver"] + "-r" + parsed["pkgrel"]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue