Git Product home page Git Product logo

Comments (12)

cweagans avatar cweagans commented on May 30, 2024

Sorry for the slow response here. I've been insanely busy for the past month :(

First, please ensure that you're running the latest Compose, as that may affect this functionality.

If the problem persists, are you able to provide a complete composer.json that reproduces this problem reliably? If so, I can dig into it and fix it.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

I'm also running into this problem. I can reproduce it in the following way:

  • Add or remove a patch for drupal/drupal
  • Run composer update.
  • Docroot is deleted but not recreated
  • Run composer update again and it's all back!

Example file:

{
  "name": "example",
  "description": "Example config for a D7 site using composer based build process.",
  "repositories": [{
    "type": "composer",
    "url": "https://packagist.drupal-composer.org"
  }],
  "require": {
    "composer/installers": "~1.0",
    "cweagans/composer-patches": "~1.0",
    "derhasi/composer-preserve-paths": "0.1.*",
    "drupal/drupal": "7.*",
    "drupal/views": "~7.0",
    "drupal/ctools": "~7.0"
  },
  "conflict": {
    "drupal/core": "8.*"
  },
  "scripts": {
    "post-create-project-cmd": [
      "rm README.md LICENSE .travis.yml phpunit.xml.dist"
    ]
  },
  "config": {
    "vendor-dir": "vendor"
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "extra": {
    "_readme": [
      "This is an example comment!"
    ],
    "installer-paths": {
      "docroot/": ["type:drupal-core"],
      "docroot/sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
      "docroot/sites/all/themes/contrib/{$name}/": ["type:drupal-theme"],
      "docroot/sites/all/libraries/{$name}/": ["type:drupal-library"],
      "docroot/sites/all/drush/{$name}/": ["type:drupal-drush"],
      "docroot/profiles/{$name}/": ["type:drupal-profile"]
    },
    "patches": {
      "drupal/drupal": {
        "Scale and crop image effect needs anchor option.": "https://www.drupal.org/files/issues/D7-scale-and-crop-1252606-37.patch",
        "Node access grants should be statically cached": "https://www.drupal.org/files/issues/node_access_grants-static-cache-11.patch",
        "Invalid image style URLs should return 404, not 403.": "https://www.drupal.org/files/issues/drupal-image-style-not-found-2211429-4.patch",
        "Save and restore css/js/head with block cache.": "https://www.drupal.org/files/issues/d7-block-cache-1460766-34.patch"
      }
    },
    "preserve-paths": [
      "docroot/.htaccess",
      "docroot/sites/all/modules/contrib",
      "docroot/sites/all/themes/contrib",
      "docroot/sites/all/libraries",
      "docroot/sites/all/drush",
      "docroot/sites/default/settings.php",
      "docroot/sites/default/files"
    ]
  }
}

Example output after adding a patch and running composer update for the first time:

composer update
Gathering patches for root package.
Removing package drupal/drupal so that it can be re-installed and re-patched.
Deleting docroot/ - deleted
Loading composer repositories with package information
Updating dependencies (including require-dev)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/drupal (7.43.0)
    Loading from cache

  - Applying patches for drupal/drupal
    https://www.drupal.org/files/issues/D7-scale-and-crop-1252606-37.patch (Scale and crop image effect needs anchor option.)
    https://www.drupal.org/files/issues/node_access_grants-static-cache-11.patch (Node access grants should be statically cached)
    https://www.drupal.org/files/issues/drupal-image-style-not-found-2211429-4.patch (Invalid image style URLs should return 404, not 403.)
    https://www.drupal.org/files/issues/d7-block-cache-1460766-34.patch (Save and restore css/js/head with block cache.)
    https://www.drupal.org/files/issues/ignore_frontend_folders-2329453-101-7.x.patch (Ignore front end vendor folders to improve directory search performance)

Writing lock file
Generating autoload files

Output after running for the second time:

Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/ctools (7.1.9)
    Loading from cache

  - Installing drupal/views (7.3.13)
    Loading from cache

drupal/ctools suggests installing drupal/panels (Required by drupal/ctools_plugin_example)
drupal/ctools suggests installing drupal/advanced_help (Required by drupal/ctools_plugin_example)
Generating autoload files

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

I suspect that the issue has to do with how the composer-patches library works in combination with installer-paths. composer-patches see's that drupal/drupal needs to be patched. It sees that drupal/drupal is installed to /docroot, so it delete's /docroot and patches drupal/drupal. But wait! That wipes out the subdirectories :(

from composer-patches.

jurgenhaas avatar jurgenhaas commented on May 30, 2024

I'm seeing the exact same problem and it is fairly annoying especially when using this in an automated deployment context. Every time a patch gets either added or removed from composer.json, the composer update needs to be run twice - which is hard to automate.

This output

Removing package drupal/drupal so that it can be re-installed and re-patched.
Deleting docroot/ - deleted

indicates the right thing: let's delete that package, re-install it and then patch it. Just the middle part (re-install) is missing.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

We've now seen this issue on multiple projects.

When composer install or composer update is run multiple times, it produces inconsistent results. Often an initial composer install will correctly download and patch dependencies, but a subsequent composer update will either:

  1. Remove packages to be patched without re-downloading and installing them, or
  2. Re-download but not patch them.

We've temporarily worked around this by automating a removal of all package directories and clearing composer caches prior to any composer update.

Unfortunately #59 does not appear to resolve the issue.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

Quick reproduction of the issue:

{
  "license": "proprietary",
  "type":    "project",
  "repositories": [
    {
      "type": "composer",
      "url":  "https://packagist.drupal-composer.org"
    }
  ],
  "require": {
    "composer/installers":                        "^1.0.20",
    "cweagans/composer-patches":                  "^1.5.0",
    "drupal/acquia_connector":                    "8.1.*",
    "drupal/acsf":                                "~8.1",
    "drupal/core":                                "~8",
    "drupal/console":                             "~1",
    "drupal/memcache" :                           "8.*",
    "drupal/security_review" :                    "8.*",
    "roave/security-advisories":                  "dev-master",
    "drupal-composer/drupal-security-advisories": "8.0.x-dev",
    "drupal/lightning":                           "8.1.x-dev"
  },
  "require-dev": {
    "behat/behat":                  "3.0.*",
    "behat/mink":                   "1.6@stable",
    "behat/mink-extension":         "*",
    "behat/mink-goutte-driver":     "*",
    "behat/mink-selenium2-driver":  "*",
    "behat/mink-browserkit-driver": "*",
    "drush/drush":                  "^9.0",
    "drupal/drupal-extension":      "~3.0",
    "drupal/coder":                 "~8.2",
    "phpunit/phpunit":             "~5.4",
    "squizlabs/php_codesniffer":    "2.*",
    "phing/phing":                  "dev-master#0ef30e55bb5871cb38903cc0ee9d76074118a22c",
    "jakoch/phantomjs-installer":   "1.9.8",
    "jarnaiz/behat-junit-formatter": "^1.2"
  },
  "autoload-dev": {
    "psr-4": {
      "Drupal\\Tests\\PHPUnit\\": "tests/phpunit/src/"
    }
  },
  "extra": {
    "installer-paths": {
      "docroot/core":                     ["type:drupal-core"],
      "docroot/modules/contrib/{$name}":  ["type:drupal-module"],
      "docroot/profiles/contrib/{$name}": ["type:drupal-profile"],
      "docroot/themes/contrib/{$name}":   ["type:drupal-theme"],
      "drush/contrib/{$name}":            ["type:drupal-drush"]
    },
    "patches": {
      "drupal/core": {
        "Ignore front end vendor folders to improve directory search performance": "https://www.drupal.org/files/issues/ignore_front_end_vendor-2329453-116.patch"
      }
    }
  },
  "scripts": {
    "install-phantomjs": "PhantomInstaller\\Installer::installPhantomJS",
    "post-install-cmd": [
      "PhantomInstaller\\Installer::installPhantomJS"
    ],
    "post-update-cmd": [
      "PhantomInstaller\\Installer::installPhantomJS"
    ]
  },
  "minimum-stability": "dev",
  "prefer-stable":     true
}

Run:

#!/usr/bin/env bash
rm -rf vendor
rm -rf docroot/modules/contrib
composer install
composer update

Output:

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing composer/installers (v1.1.0)
    Loading from cache

  - Installing drupal-composer/drupal-scaffold (2.0.1)
    Loading from cache

  - Installing cweagans/composer-patches (1.5.0)
    Loading from cache

Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing composer/semver (1.4.1)
    Loading from cache

  - Installing doctrine/lexer (v1.0.1)
    Loading from cache

  - Installing doctrine/inflector (v1.1.0)
    Loading from cache

  - Installing doctrine/collections (v1.3.0)
    Loading from cache

  - Installing doctrine/cache (v1.6.0)
    Loading from cache

  - Installing doctrine/annotations (v1.2.7)
    Loading from cache

  - Installing doctrine/common (v2.5.3)
    Loading from cache

  - Installing zendframework/zend-stdlib (3.0.1)
    Loading from cache

  - Installing zendframework/zend-escaper (2.5.2)
    Loading from cache

  - Installing zendframework/zend-feed (2.7.0)
    Loading from cache

  - Installing psr/http-message (1.0)
    Loading from cache

  - Installing zendframework/zend-diactoros (1.3.5)
    Loading from cache

  - Installing twig/twig (v1.24.1)
    Loading from cache

  - Installing symfony/yaml (v2.8.9)
    Loading from cache

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Loading from cache

  - Installing symfony/translation (v2.8.9)
    Loading from cache

  - Installing symfony/validator (v2.8.9)
    Loading from cache

  - Installing ircmaxell/password-compat (v1.0.4)
    Loading from cache

  - Installing symfony/polyfill-php55 (v1.2.0)
    Loading from cache

  - Installing symfony/serializer (v2.8.9)
    Loading from cache

  - Installing symfony/routing (v2.8.9)
    Loading from cache

  - Installing symfony/polyfill-php54 (v1.2.0)
    Loading from cache

  - Installing symfony/http-foundation (v2.8.9)
    Loading from cache

  - Installing symfony/psr-http-message-bridge (v0.2)
    Loading from cache

  - Installing symfony/process (v2.8.9)
    Loading from cache

  - Installing symfony/polyfill-iconv (v1.2.0)
    Loading from cache

  - Installing symfony/event-dispatcher (v2.8.9)
    Loading from cache

  - Installing psr/log (1.0.0)
    Loading from cache

  - Installing symfony/debug (v2.8.9)
    Loading from cache

  - Installing symfony/http-kernel (v2.8.9)
    Loading from cache

  - Installing symfony/dependency-injection (v2.8.9)
    Loading from cache

  - Installing symfony/console (v2.8.9)
    Loading from cache

  - Installing symfony/polyfill-apcu (v1.2.0)
    Loading from cache

  - Installing symfony/class-loader (v2.8.9)
    Loading from cache

  - Installing symfony-cmf/routing (1.3.0)
    Loading from cache

  - Installing stack/builder (v1.0.4)
    Loading from cache

  - Installing paragonie/random_compat (v1.4.1)
    Loading from cache

  - Installing masterminds/html5 (2.2.1)
    Loading from cache

  - Installing guzzlehttp/psr7 (1.3.1)
    Loading from cache

  - Installing guzzlehttp/promises (1.2.0)
    Loading from cache

  - Installing guzzlehttp/guzzle (6.2.1)
    Loading from cache

  - Installing egulias/email-validator (1.2.13)
    Loading from cache

  - Installing easyrdf/easyrdf (0.9.1)
    Loading from cache

  - Installing drupal/core (8.1.7)
    Loading from cache

  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/ignore_front_end_vendor-2329453-116.patch (Ignore front end vendor folders to improve directory search performance)
    https://www.drupal.org/files/issues/Iterating-through-array--2699157.patch (Plugin Lazy loading can cause usort warning)

  - Installing drupal/acsf (8.1.26)
    Loading from cache

  - Installing symfony/finder (v2.8.9)
    Loading from cache

  - Installing symfony/filesystem (v2.8.9)
    Loading from cache

  - Installing symfony/dom-crawler (v2.8.9)
    Loading from cache

  - Installing symfony/css-selector (v2.8.9)
    Loading from cache

  - Installing symfony/config (v2.8.9)
    Loading from cache

  - Installing stecman/symfony-console-completion (0.5.1)
    Loading from cache

  - Installing phpseclib/phpseclib (2.0.2)
    Loading from cache

  - Installing padraic/humbug_get_contents (1.0.4)
    Loading from cache

  - Installing padraic/phar-updater (1.0.3)
    Loading from cache

  - Installing gabordemooij/redbean (v4.3.2)
    Loading from cache

  - Installing dflydev/placeholder-resolver (v1.0.2)
    Loading from cache

  - Installing alchemy/zippy (0.3.5)
    Loading from cache

  - Installing drupal/console (1.0.0-beta5)
    Loading from cache

  - Installing drupal/workbench_moderation (8.1.1)
    Loading from cache

  - Applying patches for drupal/workbench_moderation
    https://www.drupal.org/files/issues/2668006-2.patch (2668006 - Provide logical access control for when IPE should be applied to moderated nodes)

  - Installing drupal/views_infinite_scroll (8.1.2)
    Loading from cache

  - Installing drupal/video_embed_field (8.1.2)
    Loading from cache

  - Installing drupal/token (8.1.0-alpha2)
    Loading from cache

  - Installing drupal/inline_entity_form (8.1.0-alpha6)
    Loading from cache

  - Installing drupal/scheduled_updates (8.1.0-alpha5)
    Loading from cache

  - Applying patches for drupal/scheduled_updates
    https://www.drupal.org/files/issues/schedule_updates-save_type-2674874-2.patch (2674874 - Issue saving Schedule Update Type form)

  - Installing drupal/ctools (8.3.0-alpha26)
    Loading from cache

  - Applying patches for drupal/ctools
    https://www.drupal.org/files/issues/ctools--8.x-3.0-alpha26--1fe3649.patch (2747739 - Mega patch)

  - Installing drupal/pathauto (8.1.0-alpha3)
    Loading from cache

  - Installing drupal/layout_plugin (8.1.0-alpha22)
    Loading from cache

  - Installing drupal/panels (8.3.0-beta4)
    Loading from cache

  - Applying patches for drupal/panels
    https://www.drupal.org/files/issues/panels--beta4-4c4a3a7--2747739-17--binary.patch (2747739 - Mega Patch)
    https://www.drupal.org/files/issues/2667754-3.patch (2667754 - Allow other modules to disable the IPE based on custom logic)
    https://www.drupal.org/files/issues/bandaid.patch (Bandaid tempstore patch)
    https://www.drupal.org/files/issues/2697587-48.patch (2697587 - Wizard API integration)

  - Installing drupal/panelizer (8.3.0-alpha2)
    Loading from cache

  - Applying patches for drupal/panelizer
    https://www.drupal.org/files/issues/panelizer--alpha2-1ddfa61--2747739-5.patch (2747739 - Mega Patch)
    https://www.drupal.org/files/issues/2701349-2.patch (2701349 - Generate new UUIDs for displays when switching from default to field storage)
    https://www.drupal.org/files/issues/panelizer-ipe-url-root-handling.patch (2700597 - Explicitly set the Panels IPE URL root when saving in Panelizer)
    https://www.drupal.org/files/issues/2664682-49.patch (2664682 - Implement admin UI for editing Panelizer defaults)

  - Installing drupal/page_manager (8.1.0-alpha23)
    Loading from cache

  - Applying patches for drupal/page_manager
    https://www.drupal.org/files/issues/page_manager--alpha23-09e79ff--2747739-3.patch (2747739 - Mega Patch)

  - Installing drupal/metatag (8.1.0-beta9)
    Loading from cache

  - Applying patches for drupal/metatag
    https://www.drupal.org/files/issues/2765137-2.patch (2765137 - hook_install() + drupal_set_message() = message displayed several times when using a distro.)

  - Installing j7mbo/twitter-api-php (dev-master 5a1ac48)
    Cloning 5a1ac487adc248b59a73d5edc002b57f8dc211b8

  - Installing drupal/entity (8.1.0-alpha3)
    Loading from cache

  - Installing drupal/media_entity (8.1.2)
    Loading from cache

  - Installing drupal/media_entity_twitter (8.1.1)
    Loading from cache

  - Applying patches for drupal/media_entity_twitter
    https://www.drupal.org/files/issues/2764411_4.patch (2764411 - Tweets embedded in CKEditor do not load when selected from Entity Browser)

  - Installing php-instagram-api/php-instagram-api (dev-master 7a796fd)
    Cloning 7a796fdae715fcdccc00590933ce482437342c35

  - Installing drupal/media_entity_instagram (8.1.1)
    Loading from cache

  - Installing drupal/media_entity_image (8.1.1)
    Loading from cache

  - Installing drupal/media_entity_document (8.1.0)
    Loading from cache

  - Installing drupal/config_update (8.1.1)
    Loading from cache

  - Installing drupal/features (8.3.0-beta6)
    Loading from cache

  - Installing drupal/embed (8.1.0-rc3)
    Loading from cache

  - Installing drupal/entity_embed (8.1.0-alpha2)
    Loading from cache

  - Applying patches for drupal/entity_embed
    https://www.drupal.org/files/issues/2767573_2.patch (2767573 - Use Entity browser's form element)

  - Installing drupal/entity_browser (8.1.0-alpha6)
    Loading from cache

  - Applying patches for drupal/entity_browser
    https://www.drupal.org/files/issues/entity_browser-megapatch-8.x-1.0-alpha6--3d2b6a4cd44657ec495539273243c308c05b2908.patch (Mega patch 8.x-1.0-alpha6 to 3d2b6a)
    https://www.drupal.org/files/issues/2738843-6.patch (2738843 - The view widget should support radio buttons)
    https://www.drupal.org/files/issues/entity-browser-2769401-2.patch (2769401 - Add relationship support to the Views bulk select field)

  - Installing drupal/acquia_connector (8.1.3)
    Loading from cache

  - Installing drupal/lightning (dev-8.x-1.x f0e3cb9)
    Cloning f0e3cb94939fdd1c7af0c0b7c6d22e15ae7d76f7

  - Installing drupal/memcache (8.2.0-alpha1)
    Loading from cache

  - Installing drupal/security_review (dev-8.x-1.x 6c18c36)
    Cloning 6c18c36beebffaa4e7da21fef72685136a79d58d

  - Installing behat/gherkin (v4.4.1)
    Loading from cache

  - Installing symfony/browser-kit (v2.8.9)
    Loading from cache

  - Installing behat/mink (v1.6.0)
    Loading from cache

  - Installing behat/mink-browserkit-driver (v1.2.0)
    Loading from cache

  - Installing behat/transliterator (v1.1.0)
    Loading from cache

  - Installing squizlabs/php_codesniffer (2.6.2)
    Loading from cache

  - Installing drupal/coder (8.2.8)
    Loading from cache

  - Installing drupal/drupal-driver (v1.2.1)
    Loading from cache

  - Installing instaclick/php-webdriver (1.4.3)
    Loading from cache

  - Installing behat/mink-selenium2-driver (v1.2.0)
    Loading from cache

  - Installing fabpot/goutte (v3.1.2)
    Loading from cache

  - Installing behat/mink-goutte-driver (v1.2.1)
    Loading from cache

  - Installing behat/behat (v3.0.15)
    Loading from cache

  - Installing behat/mink-extension (v2.2)
    Loading from cache

  - Installing drupal/drupal-extension (v3.1.5)
    Loading from cache

  - Installing symfony/var-dumper (v3.1.3)
    Loading from cache

  - Installing nikic/php-parser (v2.1.0)
    Loading from cache

  - Installing jakub-onderka/php-console-color (0.1)
    Loading from cache

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Loading from cache

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Loading from cache

  - Installing psy/psysh (v0.7.2)
    Loading from cache

  - Installing pear/console_table (v1.3.0)
    Loading from cache

  - Installing container-interop/container-interop (1.1.0)
    Loading from cache

  - Installing league/container (2.2.0)
    Loading from cache

  - Installing drush/drush (9.0.0-alpha1)
    Loading from cache

  - Applying patches for drush/drush
    https://github.com/drush-ops/drush/commit/ce82b946d49b09cd33da5ca84feb24a6c35f8f8e.patch (Adding composer.json support to make-convert command)
    https://github.com/drush-ops/drush/commit/c389aebb7d3e26ff0f544684d8b3ec3528107e55.diff (The batch table may not exist by the time _drush_backend_batch_process() is called in 8.x-1.x)

  - Installing jakoch/phantomjs-installer (1.9.8)
    Loading from cache

  - Installing jarnaiz/behat-junit-formatter (v1.3.2)
    Loading from cache

  - Installing phing/phing (dev-master 4553e21)
    Cloning 4553e219111166201cfdcb7adcdda47a787031a4

  - Installing webmozart/assert (1.0.2)
    Loading from cache

  - Installing phpdocumentor/reflection-common (1.0)
    Loading from cache

  - Installing phpdocumentor/type-resolver (0.2)
    Loading from cache

  - Installing phpdocumentor/reflection-docblock (3.1.0)
    Loading from cache

  - Installing phpunit/php-token-stream (1.4.8)
    Loading from cache

  - Installing sebastian/version (2.0.0)
    Loading from cache

  - Installing sebastian/resource-operations (1.0.0)
    Loading from cache

  - Installing sebastian/recursion-context (1.0.2)
    Loading from cache

  - Installing sebastian/object-enumerator (1.0.0)
    Loading from cache

  - Installing sebastian/global-state (1.1.1)
    Loading from cache

  - Installing sebastian/exporter (1.2.2)
    Loading from cache

  - Installing sebastian/environment (1.3.7)
    Loading from cache

  - Installing sebastian/diff (1.4.1)
    Loading from cache

  - Installing sebastian/comparator (1.2.0)
    Loading from cache

  - Installing phpunit/php-text-template (1.2.1)
    Loading from cache

  - Installing doctrine/instantiator (1.0.5)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (3.2.3)
    Loading from cache

  - Installing phpunit/php-timer (1.0.8)
    Loading from cache

  - Installing phpunit/php-file-iterator (1.4.1)
    Loading from cache

  - Installing sebastian/code-unit-reverse-lookup (1.0.0)
    Loading from cache

  - Installing phpunit/php-code-coverage (4.0.1)
    Loading from cache

  - Installing phpspec/prophecy (v1.6.1)
    Loading from cache

  - Installing myclabs/deep-copy (1.5.1)
    Loading from cache

  - Installing phpunit/phpunit (5.4.8)
    Loading from cache

zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component, for optionally caching feeds between requests)
zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component, for use with PubSubHubbub)
zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)
zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for easily extending ExtensionManager implementations)
zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent)
symfony/validator suggests installing symfony/expression-language (For using the 2.4 Expression validator)
symfony/validator suggests installing symfony/intl ()
symfony/validator suggests installing symfony/property-access (For using the 2.4 Validator API)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
alchemy/zippy suggests installing guzzle/guzzle (To use the GuzzleTeleporter)
drupal/acquia_connector suggests installing drupal/search_api_solr (Required by drupal/acquia_search)
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
behat/behat suggests installing behat/symfony2-extension (for integration with Symfony2 web framework)
behat/behat suggests installing behat/yii-extension (for integration with Yii web framework)
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
drush/drush suggests installing ext-pcntl (*)
phing/phing suggests installing pdepend/pdepend (PHP version of JDepend)
phing/phing suggests installing pear/archive_tar (Tar file management class)
phing/phing suggests installing pear/versioncontrol_git (A library that provides OO interface to handle Git repository)
phing/phing suggests installing pear/versioncontrol_svn (A simple OO-style interface for Subversion, the free/open-source version control system)
phing/phing suggests installing phpdocumentor/phpdocumentor (Documentation Generator for PHP)
phing/phing suggests installing phploc/phploc (A tool for quickly measuring the size of a PHP project)
phing/phing suggests installing phpmd/phpmd (PHP version of PMD tool)
phing/phing suggests installing sebastian/phpcpd (Copy/Paste Detector (CPD) for PHP code)
phing/phing suggests installing siad007/versioncontrol_hg (A library for interfacing with Mercurial repositories.)
phing/phing suggests installing tedivm/jshrink (Javascript Minifier built in PHP)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.4.0)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Generating autoload files
> PhantomInstaller\Installer::installPhantomJS
  - Installing phantomjs (1.9.8)
    Loading from cache
$ composer update
    1/4:    https://packagist.drupal-composer.org/p/provider-latest$bfb560ffe0d57a7fe66a0358d35867fc491cee19ba44b106363fd2ac46018fba.json
    2/4:    https://packagist.drupal-composer.org/p/provider-2016-07$0e90d08f2a26f7219ed529dadaf842c13ac8509794a6ab5f5e4a9d9e7eefb3a3.json
    3/4:    https://packagist.drupal-composer.org/p/provider-2016-04$d8ad38b410c6db802912077db46e845d8a40edaa81c29d91311ac7be54f0be1c.json
    4/4:    https://packagist.drupal-composer.org/p/provider-2016-01$49faf876ce5541c769649a47d8dae936d9e73f65c03d39a17aea4906b8fbedb7.json
    Finished: success: 4, skipped: 0, failure: 0, total: 4
    1/4:    http://packagist.org/p/provider-latest$abf91ef42e86356b1e973356f7a3b0c30cecb1ce080a4045ab408600d61c3da5.json
    2/4:    http://packagist.org/p/provider-2016-07$9eafb5c87098eda2cc63625b77cd2a8d5bd1ba057d79a22a3ca955ec73571321.json
    3/4:    http://packagist.org/p/provider-2015-10$b5eda6797814bab076029219f3a7a4a59e866d980c0c3de1f7282ded22322267.json
    4/4:    http://packagist.org/p/provider-2016-04$c995eab10075bb7dea0eec5c33106ee009911d7310d920f209f3c1c8f0828130.json
    Finished: success: 4, skipped: 0, failure: 0, total: 4
Gathering patches for root package.
Removing package drupal/core so that it can be re-installed and re-patched.
Deleting docroot/core - deleted
Removing package drupal/workbench_moderation so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/workbench_moderation - deleted
Removing package drupal/scheduled_updates so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/scheduled_updates - deleted
Removing package drupal/ctools so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/ctools - deleted
Removing package drupal/panels so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/panels - deleted
Removing package drupal/panelizer so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/panelizer - deleted
Removing package drupal/page_manager so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/page_manager - deleted
Removing package drupal/metatag so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/metatag - deleted
Removing package drupal/media_entity_twitter so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/media_entity_twitter - deleted
Removing package drupal/entity_embed so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/entity_embed - deleted
Removing package drupal/entity_browser so that it can be re-installed and re-patched.
Deleting docroot/modules/contrib/entity_browser - deleted
Removing package drush/drush so that it can be re-installed and re-patched.
  - Removing drush/drush (9.0.0-alpha1)
Loading composer repositories with package information
Updating dependencies (including require-dev)
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/core (8.1.7)
    Loading from cache

  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/ignore_front_end_vendor-2329453-116.patch (Ignore front end vendor folders to improve directory search performance)

  - Installing drupal/scheduled_updates (8.1.0-alpha5)
    Loading from cache

  - Installing drupal/ctools (8.3.0-alpha26)
    Loading from cache

  - Installing drupal/panels (8.3.0-beta4)
    Loading from cache

  - Installing drupal/page_manager (8.1.0-alpha23)
    Loading from cache

  - Installing drupal/panelizer (8.3.0-alpha2)
    Loading from cache

  - Installing drupal/entity_embed (8.1.0-alpha2)
    Loading from cache

  - Installing drupal/entity_browser (8.1.0-alpha6)
    Loading from cache

  - Installing drush/drush (9.0.0-alpha1)
    Loading from cache

  - Installing drupal/media_entity_twitter (8.1.1)
    Loading from cache

  - Installing drupal/metatag (8.1.0-beta9)
    Loading from cache

  - Installing drupal/workbench_moderation (8.1.1)
    Loading from cache

  - Updating phing/phing dev-master (4553e21 => 0ef30e5)
    Checking out 0ef30e55bb5871cb38903cc0ee9d76074118a22c

drush/drush suggests installing ext-pcntl (*)
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
Generating autoload files
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
    Downloading: 100%
> PhantomInstaller\Installer::installPhantomJS
  - Installing phantomjs (1.9.8)
    Loading from cache

Notice that entity_browser is patched initially after running composer install. It is then removed, re-installed, but not patched after running composer update.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

A couple of observations:

  • This happens with both composer install and composer update. The salient factor is that the patch is applied the first time that it is downloaded and not applied the second time.
  • Root patches appear to be exempt from the bug. Only patches defined in dependencies are missed.
  • After adding -v to composer install, I see that "No patches found for drupal/entity_browser." in the second run.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

It seems that packages are correctly removed here: https://github.com/cweagans/composer-patches/blob/master/src/Patches.php#L117

However, when they are re-downloaded, the patches are not applied. This is because the re-downloaded packages have $extra['patches'] unset here:
https://github.com/cweagans/composer-patches/blob/master/src/Patches.php#L157

Instead, $extra['patches_applied'] is already set for the re-downloaded packages, so the patches are not re-applied.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

Not really sure how to reset the patches and patches_applied arrays. Seems like this is the right place:
https://github.com/cweagans/composer-patches/blob/master/src/Patches.php#L116

But, using setExtra() doesn't appear to persist data.

            // Mark patches as un-applied.
            $extra['patches'] = $extra['patches_applied'];
            $extra['patches_applied'] = array();
            $localPackage = $localRepository->findPackage($package_name, $package->getVersion());
            $localPackage->setExtra($extra);

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

@cweagans I think we have a good read on the root cause at this point. I'm going to pause and wait for your input before pushing forward with a fix.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

It seems that when composer-patches removes and re-downloads a packages, the re-downloaded package is missing its patch information in $extra['patches']. This issue does not apply to root patches because they are defined in the root composer.json and do not rely on upstream information.

from composer-patches.

grasmash avatar grasmash commented on May 30, 2024

This is resolved by #30

from composer-patches.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.