From fc7a39666b82ad07576e0ee0e6db8d2d17ab48f5 Mon Sep 17 00:00:00 2001
From: Adam G-H <32250-phenaproxima@users.noreply.drupalcode.org>
Date: Mon, 12 Jun 2023 17:20:41 +0000
Subject: [PATCH] Issue #3365414 by phenaproxima, Wim Leers, tedbow: Don't
 declare compatibility with Drupal 9.7, which is not a thing

---
 automatic_updates.info.yml                    |  2 +-
 .../automatic_updates_extensions.info.yml     |  2 +-
 composer.json                                 |  1 -
 package_manager/package_manager.info.yml      |  2 +-
 .../src/Build/TemplateProjectTestBase.php     | 24 +++++++++++++++++--
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/automatic_updates.info.yml b/automatic_updates.info.yml
index 8240f6e933..e94f888103 100644
--- a/automatic_updates.info.yml
+++ b/automatic_updates.info.yml
@@ -1,7 +1,7 @@
 name: 'Automatic Updates'
 type: module
 description: 'Automatically updates Drupal core.'
-core_version_requirement: ^9.7 || ^10
+core_version_requirement: ^10
 dependencies:
   - drupal:package_manager
   - drupal:update
diff --git a/automatic_updates_extensions/automatic_updates_extensions.info.yml b/automatic_updates_extensions/automatic_updates_extensions.info.yml
index 6cfd52e6c4..0b07b77e6e 100644
--- a/automatic_updates_extensions/automatic_updates_extensions.info.yml
+++ b/automatic_updates_extensions/automatic_updates_extensions.info.yml
@@ -1,7 +1,7 @@
 name: 'Automatic Updates Extensions'
 type: module
 description: 'Allows updates to themes and modules'
-core_version_requirement: ^9.7 || ^10
+core_version_requirement: ^10
 lifecycle: experimental
 dependencies:
   - drupal:automatic_updates
diff --git a/composer.json b/composer.json
index e5dee7f574..fbb4ef280f 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,6 @@
     },
     "require": {
         "ext-json": "*",
-        "drupal/core": "^9.7 || ^10",
         "php-tuf/composer-stager": "2.0-alpha1",
         "composer-runtime-api": "^2.1"
     },
diff --git a/package_manager/package_manager.info.yml b/package_manager/package_manager.info.yml
index 5aad751530..87bc319efc 100644
--- a/package_manager/package_manager.info.yml
+++ b/package_manager/package_manager.info.yml
@@ -1,6 +1,6 @@
 name: 'Package Manager'
 type: module
 description: 'API module providing functionality to stage package installs and updates with Composer.'
-core_version_requirement: ^9.7 || ^10
+core_version_requirement: ^10
 dependencies:
   - drupal:update
diff --git a/package_manager/tests/src/Build/TemplateProjectTestBase.php b/package_manager/tests/src/Build/TemplateProjectTestBase.php
index 9cbc66d733..1fe602e452 100644
--- a/package_manager/tests/src/Build/TemplateProjectTestBase.php
+++ b/package_manager/tests/src/Build/TemplateProjectTestBase.php
@@ -5,6 +5,7 @@ declare(strict_types = 1);
 namespace Drupal\Tests\package_manager\Build;
 
 use Drupal\BuildTests\QuickStart\QuickStartTestBase;
+use Drupal\Component\Serialization\Yaml;
 use Drupal\Composer\Composer;
 use Drupal\package_manager\Event\PostApplyEvent;
 use Drupal\package_manager\Event\PostCreateEvent;
@@ -312,6 +313,12 @@ END;
     // Now that we know the project was created successfully, we can set the
     // web root with confidence.
     $this->webRoot = 'project/' . $this->runComposer('composer config extra.drupal-scaffold.locations.web-root', 'project');
+    // List the info files that need to be made compatible with our fake version
+    // of Drupal core.
+    $info_files = [
+      'core/modules/package_manager/package_manager.info.yml',
+      'core/modules/automatic_updates/automatic_updates.info.yml',
+    ];
     // BEGIN: DELETE FROM CORE MERGE REQUEST
     // Install Automatic Updates into the test project and ensure it wasn't
     // symlinked.
@@ -319,11 +326,24 @@ END;
     if (str_contains($automatic_updates_dir, 'automatic_updates')) {
       $dir = 'project';
       $this->runComposer("composer config repo.automatic_updates path $automatic_updates_dir", $dir);
-      $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer require  psr/http-message', $dir);
-      $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer require --update-with-all-dependencies "drupal/automatic_updates:@dev"', $dir);
+      $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer require --update-with-all-dependencies psr/http-message "drupal/automatic_updates:@dev"', $dir);
       $this->assertStringNotContainsString('Symlinking', $output);
     }
+    // In contrib, the info files have different paths.
+    $info_files = [
+      'modules/contrib/automatic_updates/package_manager/package_manager.info.yml',
+      'modules/contrib/automatic_updates/automatic_updates.info.yml',
+      'modules/contrib/automatic_updates/automatic_updates_extensions/automatic_updates_extensions.info.yml',
+    ];
     // END: DELETE FROM CORE MERGE REQUEST
+    foreach ($info_files as $path) {
+      $path = $this->getWebRoot() . $path;
+      $this->assertFileIsWritable($path);
+      $info = file_get_contents($path);
+      $info = Yaml::decode($info);
+      $info['core_version_requirement'] .= ' || ^9.7';
+      file_put_contents($path, Yaml::encode($info));
+    }
 
     // Install Drupal.
     $this->installQuickStart('minimal');
-- 
GitLab