composer-patches: patches-search not working as documented?

patches-search seems to not be functional

Pre-requisites

  1. Using laravel framework (with laravel-enso on top)

To Reproduce Steps to reproduce the behavior:

  1. create patches_composer folder
  2. create a laravel-compile-unique.patch inside contents:
pre-support unique indexes on nullable fields

@package laravel/framework

--- src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php.org
+++ src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
@@ -105,10 +105,11 @@
      */
     public function compileUnique(Blueprint $blueprint, Fluent $command)
     {
-        return sprintf('create unique index %s on %s (%s)',
+        return sprintf('create unique index %s on %s (%s) where %s is not null',
             $this->wrap($command->index),
             $this->wrapTable($blueprint),
-            $this->columnize($command->columns)
+            $this->columnize($command->columns),
+            implode(' is not null and ', $this->wrapArray($command->columns))
         );
     }
  1. ensure "patches-search": "patches_composer" is part of the extra key in composer.json

Expected

laravel/framework
  ~ my-package: patches_composer/laravel-compile-unique.patch [NEW]
    pre-support unique indexes on nullable fields

Actual A clear and concise description of what actually happened. No patches appearing at all

Notes (Optional) Add any other context about the problem here. Tested both on my local (windows 10-based) dev machine with PHP 7.1 and on the deployment CentOs server with PHP 7.2.

 composer patch:list --from-source -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\<redacted>.tmp: valid
Executing command (C:\<redacted>): git branch --no-color --no-abbrev -v
Reading C:/Users/<redacted>/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/<redacted>/AppData/Roaming/Composer/composer.json
Reading C:\Users\<redacted>/vendor/composer/installed.json
Reading C:/Users/<redacted>/AppData/Roaming/Composer/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Loading plugin Vaimo\ComposerPatches\Plugin
Running 1.8.0 (2018-12-03 10:31:16) with PHP 7.1.20 on Windows NT / 10.0

and

$ composer patch:list --from-source -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/home/gitlab-runner/builds/f67e7d46/1/<redacted>): git branch --no-color --no-abbrev -v
Executing command (/home/gitlab-runner/builds/f67e7d46/1/<redacted>): git describe --exact-match --tags
Reading /home/gitlab-runner/.config/composer/composer.json
Loading config file /home/gitlab-runner/.config/composer/composer.json
Reading /home/gitlab-runner/builds/f67e7d46/1/<redacted>/vendor/composer/installed.json
Reading /home/gitlab-runner/.config/composer/vendor/composer/installed.json
Loading plugin PackageVersions\Installer
Loading plugin Vaimo\ComposerPatches\Plugin
Running 1.6.5 (2018-05-04 11:44:59) with PHP 7.2.16 on Linux / 3.10.0-957.5.1.el7.x86_64

Using

        "patches": {
            "laravel/framework": {
                "pre-support unique indexes on nullable fields": "patches_composer/laravel-compile-unique.patch"
            }
        }

does seem to work as expected.

I assume I’m doing something wrong, but I can’t figure out what.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

Will snoop around to get a finite answer to that πŸ˜ƒ But yeah. It was a dodgy solution before. Using file() to load the lines is - for sure - much better way to go about it.

Fixes to this are in the latest releases btw:

Okay so the line endings are not properly dealt with so the whole file ends up being just one big chunk of data πŸ˜ƒ Nice

Ξ» composer patch:list --from-source -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\Users\<username>\AppData\Local\Temp\ope2407.tmp: valid
Executing command (C:\Users\<username>\playground\test_201904\tmp-composer-patches-issue-26): git branch --no-color --no-abbrev -v
Reading C:/Users/<username>/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/<username>/AppData/Roaming/Composer/composer.json
Reading C:\Users\<username>\playground\test_201904\tmp-composer-patches-issue-26/vendor/composer/installed.json
Reading C:/Users/<username>/AppData/Roaming/Composer/vendor/composer/installed.json
Loading plugin Vaimo\ComposerPatches\Plugin
Running 1.8.0 (2018-12-03 10:31:16) with PHP 7.1.20 on Windows NT / 10.0
Scanning packages for patches:
vaimo/tmp-composer-patches-issue-26
> patches-search
Scanning search sources:
> composer_patches
Search config:
C:\Users\<username>\playground\test_201904\tmp-composer-patches-issue-26\composer_patches
/^.+\.patch/i
Search results:
C:\Users\<username>\playground\test_201904\tmp-composer-patches-issue-26\composer_patches\visible-patch.patch
[]
Apply loaders:
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\BundleComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\LocalExcludeComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\RootPatchComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\CustomExcludeComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\PathNormalizerComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\ConstraintsComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\DownloaderComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\ValidatorComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\TargetsResolverComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\MergerComponent
Patches: 0
Vaimo\ComposerPatches\Patch\DefinitionList\LoaderComponents\SorterComponent
Patches: 0

Hmm. Okay from that I’m sure that the issue is the speculation no. 1 πŸ˜ƒ Will keep you posted on the fix πŸ˜ƒ