diff --git a/mbs-fix-reuse-buildrequires-change.patch b/mbs-fix-reuse-buildrequires-change.patch new file mode 100644 index 0000000..7543a2e --- /dev/null +++ b/mbs-fix-reuse-buildrequires-change.patch @@ -0,0 +1,35 @@ +diff --git a/module_build_service/utils/reuse.py b/module_build_service/utils/reuse.py +index efbbc0a..d548264 100644 +--- a/module_build_service/utils/reuse.py ++++ b/module_build_service/utils/reuse.py +@@ -25,7 +25,7 @@ + import kobo.rpmlib + + import module_build_service.messaging +-from module_build_service import log, models, conf ++from module_build_service import log, models, conf, glib + + + def reuse_component(component, previous_component_build, +@@ -110,6 +110,21 @@ def _get_reusable_module(session, module): + log.info("Cannot re-use. %r is the first module build." % module) + return None + ++ xmd = glib.from_variant_dict(mmd.get_xmd()) ++ old_mmd = previous_module_build.mmd() ++ old_xmd = glib.from_variant_dict(old_mmd.get_xmd()) ++ ++ # Make sure that the module buildrequires commit hashes are exactly the same ++ for br_module_name, br_module in xmd['mbs']['buildrequires'].items(): ++ # Assumes that the streams have been replaced with commit hashes, so we ++ # can compare to see if they have changed. Since a build is unique to ++ # a commit hash, this is a safe test. ++ ref1 = br_module.get('ref') ++ ref2 = old_xmd['mbs']['buildrequires'][br_module_name].get('ref') ++ if not (ref1 and ref2) or ref1 != ref2: ++ log.info('Cannot re-use. The buildrequired module %s ref hash changed', br_module_name) ++ return None ++ + return previous_module_build + + diff --git a/module-build-service.spec b/module-build-service.spec index 7d955f5..b8dc961 100644 --- a/module-build-service.spec +++ b/module-build-service.spec @@ -1,6 +1,6 @@ Name: module-build-service Version: 2.0.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The Module Build Service for Modularity Group: Development/Tools @@ -8,6 +8,7 @@ License: MIT URL: https://pagure.io/fm-orchestrator Source0: https://files.pythonhosted.org/packages/source/m/%{name}/%{name}-%{version}.tar.gz Patch0: mbs-fix-empty-requires.patch +Patch1: mbs-fix-reuse-buildrequires-change.patch BuildArch: noarch @@ -148,6 +149,7 @@ for a number of tasks: sed -i '/koji/d' requirements.txt %patch0 -p1 +%patch1 -p1 # Simply remove an old .pyc file that was included in one release. @@ -204,6 +206,9 @@ done %changelog +* Thu Apr 05 2018 Jan Kaluza - 2.0.2-3 +- fix wrong component reuse caused by missing change for buildrequires. + * Thu Apr 05 2018 Jan Kaluza - 2.0.2-2 - fix issue with expanded requires section in case empty list is used as input.