Better patch management

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
frankcarey's picture

Everyone seems to have their own ways of dealing with patch maintenance. I'd like to see this improved and standardized.

So far there is one module called patch_manager I've found that attempts this, but it tries to alter the source code from the UI, which seems unnecessary, and uses nodes for patch metadata. See https://www.drupal.org/project/patch_manager

Here are some ideas for features I'd like to see:

Standard place to track patches

Put them into sites/all/patches/.. (users can then organize that folder as they like and we can make sure not to show anything in there with htaccess rules.

Track patch application

  • Track if the patch has been applied to the code or not via a UI.
  • Alerts in status report for unapplied patches.

Patch metadata

  • Track issue queue numbers, d.o issue and patch status (like if a patch has been applied to dev or a release)
  • Check for newer versions of patches in issue queues (provide feedback not autoupdate)

Features Integration

  • If a UI is needed, then be able to export it and keep the patch data in code.

Hooks for modules requiring patches.

  • allow modules to specify the patches that they might require of other contrib modules, etc.

Comments

I was thinking about writing

sinasalek's picture

I was thinking about writing a solution for this but didn't have time to make, but i'm totally agree with you that we need a better solution.
However i don't think that altering codes from UI is unnecessary specially for people with limiting coding experience.
The ideal way is to support Drush as well.

Also it might be good idea for handling patch conflicts in a way

Check out this module too https://www.drupal.org/project/patchdoq

Some ideas :
PHP Community is rapidly moving towards composer, so is Drupal community. Composer can apply patches and take care of dependencies quite efficiently, Drupal 8 uses composer as well. so may want to take that into account;
https://github.com/reload/drupal-composer-project
https://github.com/netresearch/composer-patches-plugin
https://www.drupal.org/project/composer_manager
https://www.previousnext.com.au/blog/drupal-8-now-composer-dependencies-...

I think a module that would

guardiola86's picture

I think a module that would do the following would be ok:

-Allow you to specify the path to your patch folder
-Scan it, read the name and add it to a list. This list would have as well the link to the issue (taken from the node id in the file name). Ideally it would tell you if it's applied or not.
-For the files that doesn't have the Drupal patch format ([project_name]-[short-description]-[issue-number]-[comment-number]-[drupal-version].patch), allow you to enter a description of what the patch does.

I wouldn't add an option to apply the patch in the UI due to security issues.

I could start working on a module with this functionality if I see interest on it.

You can also look at Dave

jygastaud's picture

You can also look at Dave Reid drush module which try to solved that kind of issue. https://github.com/davereid/drush-patchfile

I've created a sandbox

guardiola86's picture

I've created a sandbox project called Patch Report: https://www.drupal.org/sandbox/sguardiola/2444305
Still a lot to do but it does the following things:
-It allows you to specify in which folder your patches are.
-It generates a report and tells you for each patch the link to the issue (if the file name follows Drupal patch standards).