backdrop-contrib / backdrop-drush-extension

A set of commands and boot class for Drush and Backdrop CMS.
GNU General Public License v2.0
14 stars 18 forks source link

This breaks drush make on Drupal (7) sites #14

Closed MrHaroldA closed 8 years ago

MrHaroldA commented 8 years ago
Make new site in the current directory? (y/n): y
Beginning to build dvg.make.                                                                                                                      [ok]
dvg_appointments cloned from http://git.drupal.org/project/dvg_appointments.git.                                                                    [ok]
Checked out revision 4d801e7.                                                                                                                       [ok]
dvg_appointments patched with additional_customer_duration-2661756-3.patch.                                                                         [ok]
dvg_appointments patched with clean_up-2661836-2.patch.                                                                                             [ok]
Generated PATCHES.txt file for dvg_appointments                                                                                                     [ok]
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
error:  must specify directory to which to extract with -d option
rm: cannot remove ‘/entityreference_autocomplete-7.x-1.10.zip’: No such file or directory
entityreference_autocomplete-7.x-1.10 downloaded.                                                                                                   [ok]
wget: missing URL
Usage: wget [OPTION]... [URL]...

Moving backdrop-drush out of .drush/commands solves these error messages.

serundeputy commented 8 years ago

hello @mrharolda thanks for reporting this.

i think this is the same issue as #9 here is how i solve that problem for now:http://serundrop.staffordtavern.com/using-drush-backdrop-cms

if you agree i think we should close this and move your comments to #9 and continue to work over there.

if you disagree leave this open and please state why.

thanks

MrHaroldA commented 8 years ago

I'd say that this is a separate issue as I don't have any problem with base classes. Without looking into the code; backdrop-drush should not act on anything if Backdrop isn't found.

jenlampton commented 8 years ago

@MrHaroldA would you please double check that you are running the latest tip of the 8.x branch of Drush? That change seemed to fix the other issues with Drush not working on Drupal once the Backdrop commands had been installed.

MrHaroldA commented 8 years ago

I'm using 8.0.2, as 8.0.3 acted a bit weird here. I'll check if the error posted above is still present; I believe I was on 8.0.1 when I posted this.

MrHaroldA commented 8 years ago

I updated to Drush 8.0.5 today; and this is the output of drush dl drupal:

harold /tmp/test
$ drush dl drupal
Project drupal (8.0.5) downloaded to /tmp/test/drupal-8.0.5.                                                 [success]
Project drupal contains:                                                                                     [success]
 - 1 profile: standard
 - 13 themes: minimal, drupal_system_listing_compatible_test, testing, testing_multilingual_with_english,
testing_config_import, testing_config_overrides, testing_multilingual, bartik, stable, seven, twig, stark,
classy
 - 64 modules: book, shortcut, automated_cron, contact, image, field_ui, hal, dblog, search, help,
dynamic_page_cache, serialization, file, forum, responsive_image, locale, config_translation, block,
views_ui, tour, syslog, editor, language, quickedit, node, telephone, update, breakpoint, statistics,
contextual, text, menu_link_content, datetime, action, views, menu_ui, system, field, block_content, rdf,
path, migrate, user, toolbar, color, ban, config, basic_auth, rest, content_translation, migrate_drupal,
history, entity_reference, comment, ckeditor, aggregator, inline_form_errors, taxonomy, filter, options,
tracker, simpletest, page_cache, link

wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
error:  must specify directory to which to extract with -d option
rm: cannot remove '/drupal.zip': No such file or directory

     Error:  Project drupal could not be found.

After removing the Backdrop commands from Drush, this is the output of the same command:

harold /tmp/test
$ drush dl drupal
Project drupal (8.0.5) downloaded to /tmp/test/drupal-8.0.5.                                                                                        [success]
Project drupal contains:                                                                                                                            [success]
 - 1 profile: standard
 - 13 themes: minimal, drupal_system_listing_compatible_test, testing, testing_multilingual_with_english, testing_config_import,
testing_config_overrides, testing_multilingual, bartik, stable, seven, twig, stark, classy
 - 64 modules: book, shortcut, automated_cron, contact, image, field_ui, hal, dblog, search, help, dynamic_page_cache, serialization, file, forum,
responsive_image, locale, config_translation, block, views_ui, tour, syslog, editor, language, quickedit, node, telephone, update, breakpoint,
statistics, contextual, text, menu_link_content, datetime, action, views, menu_ui, system, field, block_content, rdf, path, migrate, user, toolbar,
color, ban, config, basic_auth, rest, content_translation, migrate_drupal, history, entity_reference, comment, ckeditor, aggregator,
inline_form_errors, taxonomy, filter, options, tracker, simpletest, page_cache, link

I get the same wget error when using drush make:

$ drush make ~/checkout/d.o/dvg/drupal-org.make --no-core --projects=views
Make new site in the current directory? (y/n): y
Drush make restricted to the following entries:                                                                                                     [ok]
Projects: views
Beginning to build /home/harold/checkout/d.o/dvg/drupal-org.make.                                                                                   [ok]
Project views contains 2 modules: views_ui, views.
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
error:  must specify directory to which to extract with -d option
rm: cannot remove '/views-7.x-3.11.zip': No such file or directory

     Error:  Project views-7.x-3.11 could not be found.

views-7.x-3.11 downloaded.                                                                                                                          [ok]
views patched with views_access_arguments-0.patch.                                                                                                  [ok]
views patched with Deprecating-PHP4-Style-Constructors-2579819-2.patch.                                                                             [ok]
Generated PATCHES.txt file for views                                                                                                                [ok]

Updating to drush/dev-master just results in fatal errors:

$ drush cc drush
PHP Fatal error:  Uncaught Error: Call to undefined function drush_get_bootstrap_object() in /home/harold/checkout/backdrop-drush/backdrop.drush.inc:28
Stack trace:
#0 /home/harold/.composer/vendor/drush/drush/includes/command.inc(1436): backdrop_drush_command_alter(Array)
#1 /home/harold/.composer/vendor/drush/drush/includes/command.inc(172): drush_command_invoke_all_ref('drush_command_a...', Array)
#2 /home/harold/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(72): drush_dispatch(Array)
#3 /home/harold/.composer/vendor/drush/drush/includes/preflight.inc(68): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#4 /home/harold/.composer/vendor/drush/drush/drush.php(12): drush_main()
#5 {main}
  thrown in /home/harold/checkout/backdrop-drush/backdrop.drush.inc on line 28
serundeputy commented 8 years ago

@MrHaroldA thanks for the additional info; hopefully that can help us dig through these issues.

One thing I notice is that you are using official releases of drush such as 8.0.5 at this time the backdrop/drush extension only works on the 8.x branch of the drush project. I would suspect if that even on the 8.x branch with the current state of backdrop/drush extension may still break your Drupal/drush integration.

To work with drupal sites and backdrop sites I've had to use a separate drush install that works off of the 8.x branch.

I know this is just a workaround and does not solve your issue, so we will leave this open, but just wanted to make the workaround known to you.

thanks, ~Geoff

quicksketch commented 8 years ago

I think I see what's happening here.

Our code is all correct as far as replacing Drupal commands with Backdrop ones. And we're not accidentally replacing commands on D7 in our alternations.

What seems to be happening is that _drush_invoke_hooks() builds an extensive list of possible validation hooks. Our extension name is "backdrop", and Drush apparently is invoking a hook with the name of drush_[extension_name]_[command_name]. So for a command like cache-clear, it would assemble drush_backdrop_cache_clear() as a hook to invoke.

That happens to be a function name we used for our own cache clearing command. So we're the victim of an accidental hook invocation. Note this doesn't happen in reverse, because the Backdrop cache clear command is backdrop-cache-clear, so the conflict only happens in D7 and not Backdrop.

We can fix this problem by giving our callbacks new names.

quicksketch commented 8 years ago

I've re-namespaced all our functions to prevent these cache collisions: https://github.com/backdrop-contrib/drush/commit/7d8d81cf4b627a24c43275c1c278f1be17496ed7

For the sake of preventing this issue again, I've omitted the word "drush" entire and used the word "command" for all our command callbacks. That should prevent any more accidental collisions. As it was, most of our command callbacks were colliding with their D7 equivalents.

Please reopen if this continues to be a problem.

MrHaroldA commented 8 years ago

A preliminary report shows that my errors have been solved by the re-namespace! :D