Index: modules/update/update.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.module,v
retrieving revision 1.70
diff -u -p -r1.70 update.module
--- modules/update/update.module	6 Oct 2010 13:36:30 -0000	1.70
+++ modules/update/update.module	20 Nov 2010 21:23:46 -0000
@@ -336,6 +336,32 @@ function update_form_system_modules_alte
 }
 
 /**
+ * Implements hook_archive_verify().
+ *
+ * @see drupal_system_listing()
+ * @see _system_rebuild_modules()
+ */
+function update_verify_update_archive($project, $archive_file, $directory) {
+  $files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', array('key' => 'name', 'min_depth' => 0));
+  $failures = array();
+  foreach ($files as $key => $file) {
+    // If it has no info file, then we just behave liberally and accept it.
+    if (file_exists($info_file = dirname($file->uri) . '/' . $file->name . '.info')) {
+      // Get the .info file for the module or theme this file belongs to.
+      $info = drupal_parse_info_file($info_file);
+
+      // If the module or theme is incompatible with Drupal core, return an
+      // error.
+      if (isset($info['core']) && $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
+        $failures[$file->name] = 'incompatible';
+        throw new Exception(t('One or more modules in the archive is not compatible with Drupal 7.x.'));
+      }
+    }
+  }
+  return $failures;
+}
+
+/**
  * Helper function for use as a form submit callback.
  */
 function update_cache_clear_submit($form, &$form_state) {
