@@ -355,7 +355,7 @@ public function postInstall(PackageEvent $event)
355
355
$ patch ->url = $ providing_install_path .'/ ' .$ patch ->url ;
356
356
}
357
357
358
- $ this ->getAndApplyPatch ($ downloader , $ install_path , $ patch ->url );
358
+ $ this ->getAndApplyPatch ($ downloader , $ install_path , $ patch ->url , $ package );
359
359
$ this ->eventDispatcher ->dispatch (
360
360
null ,
361
361
new PatchEvent (PatchEvents::POST_PATCH_APPLY , $ package , $ patch ->url , $ patch ->description )
@@ -401,9 +401,10 @@ protected function getPackageFromOperation(OperationInterface $operation)
401
401
* @param RemoteFilesystem $downloader
402
402
* @param $install_path
403
403
* @param $patch_url
404
+ * @param PackageInterface $package
404
405
* @throws \Exception
405
406
*/
406
- protected function getAndApplyPatch (RemoteFilesystem $ downloader , $ install_path , $ patch_url )
407
+ protected function getAndApplyPatch (RemoteFilesystem $ downloader , $ install_path , $ patch_url, PackageInterface $ package )
407
408
{
408
409
409
410
// Local patch file.
@@ -430,6 +431,11 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path,
430
431
// it might be useful. p4 is useful for Magento 2 patches
431
432
$ patch_levels = $ this ->getConfig ('patch-levels ' );
432
433
434
+ // Check for specified patch level for this package.
435
+ if (!empty ($ this ->composer ->getPackage ()->getExtra ()['patchLevel ' ][$ package ->getName ()])){
436
+ $ patch_levels = array ($ this ->composer ->getPackage ()->getExtra ()['patchLevel ' ][$ package ->getName ()]);
437
+ }
438
+
433
439
// Attempt to apply with git apply
434
440
$ patched = $ this ->applyPatchWithGit ($ install_path , $ patch_levels , $ filename );
435
441
0 commit comments