c49d413
diff --git a/module_build_service/utils/reuse.py b/module_build_service/utils/reuse.py
9d3a492
index efbbc0a..dcdbc07 100644
c49d413
--- a/module_build_service/utils/reuse.py
c49d413
+++ b/module_build_service/utils/reuse.py
c49d413
@@ -25,7 +25,7 @@
c49d413
 import kobo.rpmlib
c49d413
 
c49d413
 import module_build_service.messaging
c49d413
-from module_build_service import log, models, conf
c49d413
+from module_build_service import log, models, conf, glib
c49d413
 
c49d413
 
c49d413
 def reuse_component(component, previous_component_build,
9d3a492
@@ -110,6 +110,27 @@ def _get_reusable_module(session, module):
c49d413
         log.info("Cannot re-use.  %r is the first module build." % module)
c49d413
         return None
c49d413
 
c49d413
+    xmd = glib.from_variant_dict(mmd.get_xmd())
c49d413
+    old_mmd = previous_module_build.mmd()
c49d413
+    old_xmd = glib.from_variant_dict(old_mmd.get_xmd())
c49d413
+
9d3a492
+    try:
9d3a492
+        # Make sure that the module buildrequires commit hashes are exactly the same
9d3a492
+        for br_module_name, br_module in xmd['mbs']['buildrequires'].items():
9d3a492
+            # Assumes that the streams have been replaced with commit hashes, so we
9d3a492
+            # can compare to see if they have changed. Since a build is unique to
9d3a492
+            # a commit hash, this is a safe test.
9d3a492
+            ref1 = br_module.get('ref')
9d3a492
+            ref2 = old_xmd['mbs']['buildrequires'][br_module_name].get('ref')
9d3a492
+            if not (ref1 and ref2) or ref1 != ref2:
9d3a492
+                log.info('Cannot re-use.  The buildrequired module %s ref hash changed',
9d3a492
+                         br_module_name)
9d3a492
+                return None
9d3a492
+    except KeyError:
9d3a492
+        log.info('Cannot re-use.  The buildrequired module %s does not have the same '
9d3a492
+                 'set of buildrequires.', br_module_name)
9d3a492
+        return None
c49d413
+
c49d413
     return previous_module_build
c49d413
 
c49d413