cweagans / composer-patches

Simple patches plugin for Composer
https://www.cweagans.net/project/composer-patches
BSD 3-Clause "New" or "Revised" License
1.52k stars 239 forks source link

Selective Failures Cannot Apply Patch #275

Closed MCDELTAT closed 5 years ago

MCDELTAT commented 5 years ago

I'm having a strange one that I'll have to track down. I have a script to pull down our git repo, perform composer install, etc. When pulling it onto our live servers that are 100% the same (slight assumption) it worked on the first 4, and then fails to apply the patch on two specific servers. Spun up an AWS instance very quickly with nothing besides composer and it also worked, so not sure what these two specific servers have that's stopping composer install.

Composer is same 1.8.6 across servers, git is same, php is same (7.2.18)

With composer install -vvv:

Exception trace:
 () at /var/www/html/pvusd/vendor/cweagans/composer-patches/src/Patches.php:320
 cweagans\Composer\Patches->postInstall() at n/a:n/a
 call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:176
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:116
 Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/bin/composer/src/Composer/Installer.php:620
 Composer\Installer->doInstall() at phar:///usr/bin/composer/src/Composer/Installer.php:229
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/InstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:258
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:61
 require() at /usr/bin/composer:24

composer.json:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
       {
        "type": "package",
        "package": {
        "name": "richardscarrott/jquery-ui-carousel",
        "type": "drupal-library",
        "version": "dev-master",
        "dist": {
        "url": "https://github.com/richardscarrott/jquery-ui-carousel/archive/master.zip",
        "type": "zip"
                }
                    }
        }
    ],
    "require": {
        "php": ">=5.6",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal-composer/drupal-scaffold": "^2.5",
        "drupal/admin_toolbar": "^1.26",
        "drupal/block_class": "^1.0",
        "drupal/bootstrap": "^3.19",
        "drupal/ckeditor_accordion": "^1.2",
        "drupal/ckeditor_templates": "^1.1",
        "drupal/console": "^1.0.2",
        "drupal/core": "^8.7.0",
        "drupal/date_recur": "^2.0@beta",
        "drupal/date_recur_interactive": "^2.0@alpha",
        "drupal/dropdown_language": "^2.2",
        "drupal/flexslider": "^2.0@beta",
        "drupal/fontawesome_menu_icons": "^1.5",
        "drupal/gtranslate": "^1.13",
        "drupal/jquery_carousel": "^1.0@beta",
        "drupal/lang_dropdown": "^2.0@beta",
        "drupal/maillog": "1.x-dev",
        "drupal/menu_breadcrumb": "^1.9",
        "drupal/owlcarousel": "^1.0@alpha",
        "drupal/pathauto": "^1.4",
        "drupal/redirect": "^1.3",
        "drupal/scheduler": "^1.0",
        "drupal/smtp": "^1.0@beta",
        "drupal/social_media": "^1.3",
        "drupal/social_share": "^2.0@beta",
        "drupal/socialfeed": "^1.0",
        "drupal/webform": "^5.2",
        "drush/drush": "^9.0.0",
        "richardscarrott/jquery-ui-carousel": "dev-master",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "^8.7.0"
    },
    "conflict": {
        "drupal/drupal": "*",
        "symfony/http-foundation": "3.4.24"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "enable-patching": true,
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
          "drupal/core": {
            "Add option to show only start or end date in the DateTime Range custom formatter": "https://www.drupal.org/files/issues/2018-05-23/drupal-display-one-date-formatter-2827055-25.patch"
          }
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/{$name}": ["type:drupal-drush"]
        },
        "drupal-scaffold": {
            "initial": {
                ".editorconfig": "../.editorconfig",
                ".gitattributes": "../.gitattributes"
            }
        }
    }
}
MCDELTAT commented 5 years ago

Closing: User error. Apparently the two servers in question somehow didn't have the patch utility installed, so it obviously couldn't call it.

Perhaps as part of this issue, I might look into how to throw a more meaningful error, I.E. that patch isn't installed, but not sure how to do that.

JackG102 commented 1 year ago

I am trying to debug a similar issue on AWS Elastic Beanstalk. I am a neophyte when it comes to servers and infrastructure and trying to resolve an issue where composer can't apply any patches on Elastic Beanstalk. On our local environments, we have no issues and the patching is successful.

Can you say how you found and verified that your 'patch' utility was not installed? If there was a specific packages you were looking for and then installed, may you drop that here?

I appreciate any extra detail that you could provide (I realize this thread is essentially 3-4 years old but thematically seemingly relevant).

Edit: This thread was illustrative to the issue: https://github.com/cweagans/composer-patches/issues/172. Also, when mucking around SSH'ed into our server, it looks like the deployed code is not a git repository when typing 'git status', which might explain why git can't apply the patch in composer install (confirmed that git was installed on the server however.) I'll just leave this here to possibly guide others. I have a few items to run down.