pmaports/.gitlab-ci/testcases/test_soname_bump.py
Oliver Smith 0d5e2fae31
Add test cases and .gitignore
Copy all test cases from the pmbootstrap repository, that are actually
testing the aports. They were all adjusted to work nicely in this
repository, together with a brand new set of gitlab-ci configs.

This also includes the changes from this merge request, that had a
better detection of changed packages:
<https://gitlab.com/postmarketOS/pmbootstrap/merge_requests/1621>
2018-09-04 08:46:17 +02:00

47 lines
1.6 KiB
Python

#!/usr/bin/env python3
# Copyright 2018 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
"""
This file uses pmb.helper.pkgrel_bump to check if the aports need a pkgrel bump
for any package, caused by a soname bump. Example: A new libressl/openssl
version was released, which increased the soname version, and now all packages
that link against it, need to be rebuilt.
"""
import os
import pytest
import sys
import add_pmbootstrap_to_import_path
import pmb.helpers.pkgrel_bump
import pmb.helpers.logging
import pmb.parse
@pytest.fixture
def args(request):
# Initialize args
sys.argv = ["pmbootstrap",
"--aports", os.path.dirname(__file__) + "/../..",
"--log", "$WORK/log_testsuite_pmaports.txt"
"chroot"]
args = pmb.parse.arguments()
# Initialize logging
pmb.helpers.logging.init(args)
request.addfinalizer(args.logfd.close)
return args
@pytest.mark.pmaports_upstream_compat
def test_soname_bump(args):
if pmb.helpers.pkgrel_bump.auto(args, True):
raise RuntimeError("One or more packages need to be rebuilt, because"
" a library they link against had an incompatible"
" upgrade (soname bump). Run 'pmbootstrap"
" pkgrel_bump --auto' to automatically increase the"
" pkgrel in order to trigger a rebuild. If this"
" test case failed during a pull request, the issue"
" needs to be fixed on the 'master' branch first,"
" then rebase your PR on 'master' afterwards.")