patch: drush mm enable/disable/dot/uninstall

clemens.tolboom - February 12, 2008 - 20:26
Project:Drush
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

Hi.

This is a functional (as in it worked once for ubercart) patch for:
- generating a dot file (drush pm dot)
- enabling modules (drush pm enable forum)
- disabling modules (drush pm disable forum)

Working examples:

.../drush .... pm enable forum
.../drush .... pm disable forum
.../drush .... pm dot | dot -t png -o ~/test.dot

I'm not sure why it doesn't work for ubercart. Perhaps pm disable uc_cart was disabling too much or module_disabled was to lazy to check?

When testing the patch uncomment the lines where module_enable / module_disable calls are.

Please test and give feedback on these

.../drush .... pm enable uc_cart
.../drush .... pm disable uc_cart (this is not working for a complex tree yet... i know what to do next)

What the code does is:
- generating a list of module info from the 3 three drupal modules locations.
- from that list a dependency tree is build for the given modules to enable/disable.
- that tree is then Topological Sorted for the right order of module enabling.

Regards,
Clemens Tolboom

AttachmentSize
drush-pm-dot-enable-disable.patch8.35 KB

#1

clemens.tolboom - February 13, 2008 - 10:54
Status:active» needs work

Hold your horses... when enabling a module with dependencies to not installed modules the dependency checker fails to halt and just enables the give sub graph.

Scenario

drush pm install og
drush pm enable og <=== this should not enable og but fail on missing views and views_rss

I should have checked for the unavailable views and views_rss!

But you can use it for drush pm dot | dot -T png -o graph.png ;-)

#2

moshe weitzman - February 13, 2008 - 15:51
Status:needs work» won't fix

I'm not putting the graph stuff in drush. Please work with Drupal 7 to nicely expose the dependency checker and hook_requirements so we can just re-use core. Also please help to get updates to happen in right order. See http://drupal.org/node/211182.

If you really need this functionality, please maintain your own set of drush commands. pm is meant to stay clean and close to core.

Unified diffs are preferred. See diff and patch.

#3

clemens.tolboom - February 13, 2008 - 17:55
Status:won't fix» postponed (maintainer needs more info)

I don't understand completely. This code (without the dot stuff and errs) is about enabling modules! Which is super when installing ton's of sites.

Do you want me to deliver a module manager instead? That's fine with me. Then you add them to drush?

About drupal 7 ... do you know who I can talk to?

(Sorry about the patch type ... i was in a hurry)

Regards,
Clemens

#4

moshe weitzman - February 13, 2008 - 19:51
Status:postponed (maintainer needs more info)» won't fix

to contribute to D7, see http://drupal.org/contribute/development. follow the links from there.

#5

clemens.tolboom - February 20, 2008 - 17:15
Title:patch: drush pm enable/disable/dot» patch: drush mm enable/disable/dot/uninstall
Status:won't fix» reviewed & tested by the community

Ok I've created a new module mm (module manager) with the following command.

I'll will note this patch on the develop mailing list today too and hope to talk @ FOSDEM about my thought about this patch and D6 and D7.

It tested it with ubercart installation only
- drush pm install ubercart (and dependant project)
- drush mm list
- drush mm enable uc_cart
- drush mm disable uc_cart
- drush mm uninstall uc_cart

This patch fixes a lot of annoyances for me while installing ie ubercart. But it gives me also the opportunity to graph a modules installation with green (installed), yellow (available), red (in error)

commands:
- list (available modules)
- dot (make a graphviz processable file) (see http://build2be.com/content/modules-err for some colors)
- enable (dependant aware install/enable modules)
- disable (dependant aware disabling modules)
- uninstall (dependant aware disabling modules)

I hope this can help us all too fix problems for D6 and prevent them in D7 because this is about how dependencies should/could be handled.

Regards,
Clemens Tolboom

AttachmentSize
drush-mm.patch 14.72 KB

#6

clemens.tolboom - February 21, 2008 - 15:11

There was a bug introduced by refactoring accepting the installation of a dependency on an non exisiting module. So I tested it on a clean install. And it works great.

It's a little horrifying to do a drush mm uninstall token because a lot of modules get uninstalled in the proces but that's what the --simulate is for ;-)

Doing a drush mm list shows potential blockers for enabling a module due to a missing dependency.

I hope you find time to commit this patch. Maybe we can convince D6 and D7 people to implement this 'graph'. As you may know Karoly Negyesi is 'very happy' with 'Re: [development] How to make better dependency checks in D5, D6, D7?'

Thanks again for making drush.

Regards,
Clemens

AttachmentSize
drush-mm.patch 14.79 KB

#7

moshe weitzman - February 21, 2008 - 15:18
Status:reviewed & tested by the community» needs work

Here is a deal. If you can get this sort of functionality into core so that D7 drush only needs a small amount of code, then I will commit this big monster to the D5 and D6 versions of drush (along with the smaller patch for HEAD).

#8

clemens.tolboom - February 21, 2008 - 15:46

That's great news.

And yes i will certainly try to get this into core. The pointers of Karoly Negyesi should help too.

What people @ FOSDEM are best to convince?

Ehhm patch (code needs work) ... What is the dependency direction? You commit and I try or the other way around? I hope the first as that's a better way to show that it could work.

Regards,
Clemens

#9

clemens.tolboom - February 28, 2008 - 13:08

I'm reworking the patch by using more drupal functions. Providing a patch for D7 is not trivial but this rework effort will make it leaner to try.

Please checkout http://build2be.com/content/configuring-ubercart and http://build2be.com/content/installing-ubercart-through-drush-pm-and-mm for my work in progress.

#10

clemens.tolboom... - March 3, 2008 - 16:23
Status:needs work» active

Dear Moshe,
(patch will be attached into the next comment ... i got problems in creating it :-/
could you please commit this patch. It saves me a lot of work updating my installed drush versions. I agree you do not have to tag this module for a stable release but I think it deserves serious testing through the dev tarball. This patch a a bit cleaner then the previous one. I hope it is stable enough to serve as an example for a D7 implementation.

See my documenting effort on http://build2be.com/content/module-management-drupal and watch the movie about drush_mm. Sorry for making this drush movie but discussing @ FOSDEM didn't result in 'aha erlebnis' I hope this movie helps people to understand what dependencies is about.

Regards,
Clemens

#11

clemens.tolboom... - March 3, 2008 - 16:36

Somehow eclipse takes all files from my drush_mm directory including a swap file and a test file. Now a handedited pacth file is attached. It looks good so I hope for the better :-/

AttachmentSize
drush-mm.patch 14.85 KB

#12

moshe weitzman - March 3, 2008 - 20:06

See my comments in #7 about prerequisites for taking this patch.

#13

moshe weitzman - March 10, 2008 - 22:14
Status:active» needs work

#14

clemens.tolboom - March 13, 2008 - 12:29
Status:needs work» won't fix

You may close this issue. Not that it is not an issue for drupal core, but i submitted my patch as a module. http://drupal.org/project/drush_mm

I decided to do it this way for securing my patch in a 'developer' environment and to get more attention.

Thanks for drush and I hope to contrib again,

Clemens

 
 

Drupal is a registered trademark of Dries Buytaert.