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 240 forks source link

Changing of package manager, error to the first install #11

Closed Calystod closed 8 years ago

Calystod commented 9 years ago

Hello,

We work with vagrant and use composer to install drupal, modules and patch. I test cweagans/composer-patches in replacement of netresearch/composer-patches-plugin. I've change the composer.json file and generated composer.lock.

The problem: when we make the conversion of an other vagrant machine where we have recovered json and lock file of composer, after clear the cache of composer, the first composer install fail. The second works, the error doesn't reappear. Here the log of my error:

composer install --verbose

Gathering patches for root package. Removing package drupal/addressfield so that it can be re-installed and re-patched. Deleting sites/all/modules/contrib/addressfield/ - deleted Removing package drupal/views so that it can be re-installed and re-patched. Deleting sites/all/modules/contrib/views/ - deleted Removing package drupal/chosen so that it can be re-installed and re-patched. Deleting sites/all/modules/contrib/chosen/ - deleted Removing package drupal/globalredirect so that it can be re-installed and re-patched. Deleting sites/all/modules/contrib/globalredirect/ - deleted Removing package drupal/search_api_elasticsearch so that it can be re-installed and re-patched. Deleting sites/all/modules/contrib/search_api_elasticsearch/ - deleted

pre-install-cmd: XXXComposerScripts\PlatformInstall::preventGitReset Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Analyzed 247 packages to resolve dependencies Analyzed 582 rules to resolve dependencies Gathering patches for root package. Gathering patches for dependencies. This might take a minute. Found 2 patches for drupal/search_api_elasticsearch. Found 2 patches for drupal/chosen. Found 1 patches for drupal/addressfield. Found 3 patches for drupal/views. Found 1 patches for drupal/globalredirect. No patches found for XXX/drupal-composer-project-patches.

No patches found for drupal/drupal.

  • Installing drupal/addressfield (7.1.1) Downloading: 100%
    Extracting archive

    • Applying patches for drupal/addressfield

    [ErrorException]
    Array to string conversion

Exception trace: () at /vagrant/src/sites/all/vendor/cweagans/composer-patches/src/Patches.php:227 Composer\Util\ErrorHandler::handle() at /vagrant/src/sites/all/vendor/cweagans/composer-patches/src/Patches.php:227 cweagans\Composer\Patches->postInstall() at n/a:n/a call_user_func() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:152 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:112 Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer/src/Composer/Installer.php:606 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:230 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:131 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:146 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:82 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43 require() at /usr/local/bin/composer:25

Thank you.

cweagans commented 9 years ago

Can you please post your complete composer.json? If there is sensitive information that you'd rather not be put online for whatever reason, you're welcome to email it to me. me@cweagans.net

cweagans commented 9 years ago

Any followup here?

Calystod commented 9 years ago

Very sorry, I had to ask to publish the composer.json. So, I have replaced all sensitive information by letters. Here is my composer.json:

{
  "name": "dev/XXX",
  "minimum-stability": "beta",
  "prefer-stable": true,
  "repositories": [{
    "type": "package",
    "package": {
      "name": "drupal/drupal",
      "type": "non-destructive-archive-installer",
      "version": "7.35",
      "dist": {
        "url": "http://ftp.drupal.org/files/projects/drupal-7.35.zip",
        "type": "zip"
      },
      "require": {
        "azt3k/non-destructive-archive-installer": "*"
      },
      "extra": {
        "target-dir": ".",
        "omit-first-directory": "true"
      },
      "replace": {
        "drupal/aggregator": "self.version",
        "drupal/block": "self.version",
        "drupal/blog": "self.version",
        "drupal/book": "self.version",
        "drupal/color": "self.version",
        "drupal/comment": "self.version",
        "drupal/contact": "self.version",
        "drupal/contextual": "self.version",
        "drupal/dashboard": "self.version",
        "drupal/dblog": "self.version",
        "drupal/field": "self.version",
        "drupal/field_sql_storage": "self.version",
        "drupal/list": "self.version",
        "drupal/number": "self.version",
        "drupal/options": "self.version",
        "drupal/text": "self.version",
        "drupal/field_ui": "self.version",
        "drupal/file": "self.version",
        "drupal/filter": "self.version",
        "drupal/forum": "self.version",
        "drupal/help": "self.version",
        "drupal/image": "self.version",
        "drupal/locale": "self.version",
        "drupal/menu": "self.version",
        "drupal/node": "self.version",
        "drupal/openid": "self.version",
        "drupal/overlay": "self.version",
        "drupal/path": "self.version",
        "drupal/php": "self.version",
        "drupal/poll": "self.version",
        "drupal/profile": "self.version",
        "drupal/rdf": "self.version",
        "drupal/search": "self.version",
        "drupal/shortcut": "self.version",
        "drupal/statistics": "self.version",
        "drupal/syslog": "self.version",
        "drupal/system": "self.version",
        "drupal/taxonomy": "self.version",
        "drupal/toolbar": "self.version",
        "drupal/tracker": "self.version",
        "drupal/translation": "self.version",
        "drupal/trigger": "self.version",
        "drupal/update": "self.version",
        "drupal/user": "self.version",
        "drupal/minimal": "self.version",
        "drupal/standard": "self.version",
        "drupal/bartik": "self.version",
        "drupal/garland": "self.version",
        "drupal/seven": "self.version",
        "drupal/stark": "self.version"
      }
    }
  },
  {
    "type": "git",
    "url": "git@bitbucket.org:ZZZ/XXX-platform.git"
  },
  {
    "type": "composer",
    "url": "http://packagist.drupal-composer.org/"
  }],
  "require": {
    "cweagans/composer-patches": "~1.0",
    "azt3k/non-destructive-archive-installer": "0.2.*",
    "composer/installers": "~1.0",
    "guzzle/guzzle": "~3.9",
    "XXX/YYY": "dev-develop",
    "XXX/drupal-composer-project-patches": "*",

    "drupal/features": "7.2.5",
    "drupal/views": "7.3.11",
    "drupal/navbar": "7.1.6",
    "drupal/field_group": "7.1.4",
    "drupal/link": "7.1.3",
    "drupal/email": "7.1.3",
    "drupal/addressfield": "7.1.1",
    "drupal/field_collection": "7.1.0-beta8",
    "drupal/date": "7.2.x-dev#489ed16",
    "drupal/telephone": "7.1.0-alpha1",
    "drupal/entity": "7.1.6",
    "drupal/ckeditor": "7.1.16",
    "drupal/imce": "7.1.9",
    "drupal/strongarm": "7.2.0",
    "drupal/cool": "7.1.1",
    "drupal/flag": "7.3.6",
    "drupal/draggableviews": "7.2.1",
    "drupal/views_bulk_operations": "7.3.2",
    "drupal/views_limit_grouping": "7.1.x-dev#a6466fc",
    "drupal/entityreference": "7.1.1",
    "drupal/simplify": "7.3.3",
    "drupal/title": "7.1.x-dev",
    "drupal/login_destination": "7.1.1",
    "drupal/pathauto": "7.1.2",
    "drupal/themekey": "7.3.3",
    "drupal/zurb_foundation": "7.5.0-rc6",
    "drupal/views_mediatable": "7.1.1",
    "drupal/better_exposed_filters": "7.3.2",
    "drupal/addressfield_tokens": "7.1.5",
    "drupal/currency": "7.2.4",
    "drupal/money": "7.1.x-dev#7b79f12",
    "drupal/geophp": "7.1.7",
    "drupal/geofield": "7.2.3",
    "drupal/geocoder": "7.1.2",
    "drupal/context": "7.3.6",
    "drupal/context_query_param" : "7.1.3",
    "drupal/jquery_update": "7.2.5",
    "drupal/masonry": "7.2.0",
    "drupal/masonry_views": "7.1.0",
    "drupal/field_multiple_limit": "7.1.0-alpha4",
    "drupal/flexslider": "7.2.0-alpha3",
    "drupal/views_slideshow": "7.3.1",
    "drupal/fences": "7.1.0",
    "drupal/composer_manager": "7.1.7",
    "drupal/search_api": "7.1.14",
    "drupal/search_api_location": "7.2.0-beta2",
    "drupal/search_api_elasticsearch_elastica": "7.1.0-alpha7",
    "drupal/search_api_elasticsearch": "7.1.0-alpha7",
    "ruflin/elastica": ">=v1.3.0.0",
    "drupal/facetapi": "7.1.5",
    "drupal/google_analytics": "7.2.1",
    "drupal/vertical_tabs_responsive": "7.1.0-beta6",
    "drupal/chosen": "7.2.x-dev#e7a0d22",
    "drupal/metatag": "7.1.4",
    "drupal/transliteration": "7.3.2",
    "drupal/menu_block": "7.2.5",
    "drupal/views_data_export": "7.3.0-beta8",
    "drupal/globalredirect": "7.1.5",
    "drupal/captcha": "7.1.3",
    "drupal/recaptcha": "7.1.12",
    "drupal/migrate":"7.2.7",
    "drupal/slick": "7.2.0-beta1",
    "drupal/addthis": "7.4.x-dev#d766ed",
    "drupal/libraries": "7.2.x-dev#744cd04",
    "drupal/mandrill": "7.2.1",
    "mandrill/mandrill": "1.0.54",
    "drupal/mailchimp": "7.3.3",
    "mailchimp/mailchimp": "2.0.6",
    "drupal/git_deploy": "7.2.2",
    "aredridel/glip": "0.1.2",
    "drupal/fastly": "7.2.0",
    "drupal/breakpoints": "7.1.3",
    "drupal/picture": "7.2.11",
    "drupal/taxonomy_machine_name": "7.1.0"
  },
  "require-dev": {
    "drupal/devel": "7.1.5",
    "drupal/diff": "7.3.2"
  },
  "config": {
    "vendor-dir": "sites/all/vendor"
  },
  "extra": {
    "patches": {
      "drupal/search_api_elasticsearch": {
        "Enable namespacing of indexes through provisioning": "https://www.drupal.org/files/issues/search_api_elasticsearch-index-name-2169931-3.patch",
        "Enable aggregations in search results": "https://www.drupal.org/files/issues/search_api_elasticsearch-aggregations-2503343.patch"
      },
      "drupal/chosen": {
        "No CSS loaded when the lib is downloaded with bower": "https://www.drupal.org/files/issues/chosen.min_.css-2492251-1.patch",
        "Enable Chosen on admin page only": "https://www.drupal.org/files/issues/chosen-toggle-admin-pages-option-2534756-3.patch"
      },
      "drupal/addressfield": {
        "Define and use addressfield as a form element type": "https://www.drupal.org/files/issues/addressfield-element_info-970048-105.patch"
      },
      "drupal/views": {
        "Brings the options array from the term's entity_uri() function into the taxonomy term link that is created by Views": "https://www.drupal.org/files/issues/views-taxonomy-uri-options-bug-2328791-0.patch",
        "Search terms: nodes dont appear when using multiple arguments": "https://www.drupal.org/files/search_multiple_terms-1615438-30.patch",
        "Fixes node edit link after AJAX paging includes redirect to AJAX command page.": "https://www.drupal.org/files/issues/views-ajax-nginx-1036962-71.patch"
      },
      "drupal/globalredirect": {
        "Brings the options array from the term's entity_uri() function into the taxonomy term link": "https://www.drupal.org/files/issues/term_path_options-2228557-jv.patch"
      }
    },
    "installer-paths": {
      "sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
      "sites/all/themes/contrib/{$name}/": ["type:drupal-theme"],
      "sites/all/libraries/{$name}/": ["type:drupal-library"],
      "sites/all/drush/{$name}/": ["type:drupal-drush"],
      "profiles/{$name}/": ["type:drupal-profile"]
    }
  },
  "autoload": {
    "psr-4": {"YYYComposerScripts\\": "YYYComposerScripts/"}
  },
  "scripts": {
    "pre-install-cmd": [
      "YYYComposerScripts\\PlatformInstall::preventGitReset"
    ],
    "pre-update-cmd": [
      "YYYComposerScripts\\PlatformInstall::preventGitReset"
    ],
    "post-install-cmd": [
      "curl https://www.drupal.org/files/911354-drupal-profile-85.patch | patch -p1",
      "composer --working-dir=sites/all/modules/contrib/currency/currency install",
      "mkdir -p sites/all/libraries",
      "ln -snf ../vendor/mandrill/mandrill sites/all/libraries/mandrill",
      "ln -snf ../vendor/mailchimp/mailchimp sites/all/libraries/mailchimp",
      "ln -snf ../vendor/aredridel/glip sites/all/libraries/glip"
    ],
    "post-update-cmd": [
      "curl https://www.drupal.org/files/911354-drupal-profile-85.patch | patch -p1",
      "composer --working-dir=sites/all/modules/contrib/currency/currency update",
      "mkdir -p sites/all/libraries",
      "ln -snf ../vendor/mandrill/mandrill sites/all/libraries/mandrill",
      "ln -snf ../vendor/mailchimp/mailchimp sites/all/libraries/mailchimp",
      "ln -snf ../vendor/aredridel/glip sites/all/libraries/glip"
    ]
  }
}
cweagans commented 9 years ago

No problem. I'm looking into this right now.

cweagans commented 9 years ago

Do you know what version of the patches plugin you're on? I think I remember seeing this error in an older version, but I can't reproduce it now. I just copied this composer.json into an empty directory, removed the custom bits that you redacted, ran composer install, and it worked.

This isn't related, but I noticed that you're patching drupal in a post install/update command. You can add that to the patches listing, you know ;)

cweagans commented 8 years ago

@Calystod Are you still having this problem?

cweagans commented 8 years ago

Closing due to inactivity.