Drush Make and Module Dependencies

Drush make is a wonderful tool for constructing Drupal platforms. A lot of Drupal developers are used to adding a list of modules, a few libraries and theme or 2 then running drush make to build their platform. It all seems pretty easy. What if I told you module developers could make things even easier for site builders?

Some contrib modules depend on third party libraries, and due to various reasons they can't always be stored in git repositories on drupal.org and included in the module release. To solve this problem module developers can include a .make file for their module. Drush recursively processes make files, so the module make file would be processed once found by drush make.

A good example of where this could be useful is the SMTP module, which depends on the LGPL licensed PHPMailer library. The module also requires a patch to be applied to the library, which drush make can apply for us. The following .make file could be included in the SMTP module as smtp.make:

core = 6.x
api = 2

libraries[phpmailer][download][type] = "get"
libraries[phpmailer][download][url] = "http://downloads.sourceforge.net/project/phpmailer/phpmailer%20for%20php5_6/Previous%20Versions/2.2.1/phpMailer_v2.2.1_.tar.gz"
libraries[phpmailer][download][md5] = "0bf75c1bcef8bde6adbebcdc69f1a02d"
libraries[phpmailer][directory_name] = "phpmailer"
libraries[phpmailer][destination] = "modules/contrib/smtp"

libraries[phpmailer][patch][drupal-compatibility][url] = "http://drupalcode.org/project/smtp.git/blob_plain/2acaba97adcad7304c22624ceeb009d358b596e3:/class.phpmailer.php.2.2.1.patch"
libraries[phpmailer][patch][drupal-compatibility][md5] = "2d82de03b1a4b60f3b69cc20fae61b76"

Now when the SMTP module is included a normal drush make file it will be downloaded, the PHPMailer library will be downloaded and patched ready for use.

Unfortunately there are some limitations to this approach. Firstly it assumes that the SMTP module will be installed under the modules/contrib directory, which is accepted best practice, but may not suit everyone's needs. When I tested this with the current stable version of drush make (6.x-2.2) it failed, and drush make 6.x-3.x from git needed to be patched. Hopefully a fix for this can be backported to the 6.x-2.x branch and included in a future release.

Update: I have posted the make file for the SMTP module as patch in issue #1159080.

drush_make isn't quite ready for this yet.

adrinux wrote:

While adding make files to modules which drush_make automatically includes and runs is a cool feature, when it breaks, it breaks horribly, causing the entire platform build to fail.

Worse, there are currently no workarounds, no way to override the broken bundled make file. The only way to fix your platform build is fork the problem module and patch the make file.

The same applies if you need to use a different version of the third party code specified in the bundled make file.

I look forward to a day when we can recommend module authors do this, but for the moment I've been advising module developers to name make files as "modulename.make.example" - the platform builder is then able to add the example code to their own make file and retains full control.

Here's a couple of issues that give a taste of what can go wrong: http://drupal.org/node/839580 http://drupal.org/node/1103872

Added Tue, 2011-05-17 03:05

Seems the problem is simply the inability to override?

patcon wrote:

Could drush_make's "includes" declaration be repurposed to work on the *.make.example files?

Or how does drush_make build the whole data structure when it finds sub-makefiles? Does it build each separately, or could it build the whole array first, so that the master makefile could declare a key afterward, overriding the sub-make's settings? (or nullifying them?)

Added Wed, 2011-05-18 03:45

"directory not empty", destination and directory_name

grobot wrote:

Hey Dave - ran into something which brought me here this evg. Have been adding Archimedes to a set of makefiles and found that doing similarly for the required lib would cause the build to fail.

Pointing a lib at a module folder by using destination + directory_name failed on Drush 4.5 for me with Directory not empty

; Archimedes module
projects[archimedes][type] = "module"
projects[archimedes][download][type] = "git"
projects[archimedes][download][directory_name] = "archimedes"
projects[archimedes][download][url] =  "http://git.drupal.org/sandbox/fiasco/1116808.git"
; Archimedes lib class
libraries[archimedes-class][destination] = "modules"
libraries[archimedes-class][directory_name] = "archimedes"
libraries[archimedes-class][download][type] = "file"
libraries[archimedes-class][download][url] = https://github.com/GiantRobot/Archimedes-Library/raw/master/php/archimed...

while combining the directory_name into the destination like this worked -

; Archimedes module
projects[archimedes][type] = "module"
projects[archimedes][download][type] = "git"
projects[archimedes][download][directory_name] = "archimedes"
projects[archimedes][download][url] =  "http://git.drupal.org/sandbox/fiasco/1116808.git"
; Archimedes lib class
libraries[archimedes-class][destination] = "modules/archimedes"
libraries[archimedes-class][download][type] = "file"
libraries[archimedes-class][download][url] = https://github.com/GiantRobot/Archimedes-Library/raw/master/php/archimed...
Added Sat, 2012-05-12 23:51

Drush Make and Module Dependencies | Dave Hall Consulting

mobile apps wrote:

Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I've been trying for a while but I never seem to get there! Many thanks

Added Fri, 2013-07-19 15:10

Drush Make and Module Dependencies | Dave Hall Consulting

software development services wrote:

Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a little bit, but other than that, this is wonderful blog. A fantastic read. I will certainly be back.

Added Thu, 2013-07-25 08:37

Drush Make and Module Dependencies | Dave Hall Consulting

this content wrote:

Wow, incredible blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is magnificent, as well as the content!

Here is my site this content

Added Sat, 2013-08-03 08:57

Drush Make and Module Dependencies | Dave Hall Consulting

tantra london wrote:

Ultimately, sensual massage is called Ϲream Bath by the Inԁonеsiаn.

Bigеlow appears to have сhoѕen aсtor Rеda Kateb for hiѕ youthful gоoԁ loоks and ρleasant demеanor--qualіtieѕ thаt easіly draw out our sympathieѕ. Erotic classicѕ such as the benеfits of recreating the bluеprint of your mind.

My web blog - tantra london

Added Wed, 2013-08-21 00:21

Reply to comment | Dave Hall Consulting

Dragon City Hack Download wrote:

You can definitely see your expertise within the work you write. The world hopes for even more passionate writers like you who aren't afraid to mention how they believe. Always follow your heart.

Added Tue, 2013-08-27 16:24

Drush Make and Module Dependencies | Dave Hall Consulting

Adrienne wrote:

That is very fascinating, You are an overly skilled blogger. I've joined your feed and sit up for in search of more of your excellent post. Additionally, I've shared your site in my social networks

Added Mon, 2013-09-02 13:31

Drush Make and Module Dependencies | Dave Hall Consulting

good hosting wrote:

If you wish for to increase your experience only keep visiting this web page and be updated with the hottest gossip posted here.

Added Thu, 2013-10-10 02:52

Drush Make and Module Dependencies | Dave Hall Consulting

acid reflux or gerd wrote:

Hey! This post couldn't be written any better! Reading this post reminds me of my good old room mate! He always kept chatting about this. I will forward this post to him. Pretty sure he will have a good read. Many thanks for sharing!

Added Thu, 2013-10-10 14:43

Reply to comment | Dave Hall Consulting

Batman Arkham Origins Mobile Hack wrote:

Fastidious answers in return of this matter with genuine arguments and telling the whole thing about that.

Added Wed, 2014-01-22 04:18

Reply to comment | Dave Hall Consulting

http://47ronintelechargerstreaming.blogspot.com/ wrote:

I enjoy what you guys tend to be up too. This kind of clever work and exposure! Keep up the superb works guys I've added you guys to blogroll.

Added Fri, 2014-01-24 23:00

Actually I read it yesterday

buy real facebook likes wrote:

Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written. Read this: Social media tactics

Added Mon, 2014-03-17 23:17

Make sure that you have the

flower wrote:

Make sure that you have the correct references, and understand the basic needs that can actually bring about the best plumber to your willing. There is also a lot of good methods with which you would be able to check for the various factors of plumbers. home improvement

Added Wed, 2014-04-02 16:44

Learning to read the

Maydi wrote:

Learning to read the formation used by the opposing team is essential when playing is crucial if you play defense. You can anticipate the play by looking at where the receiver is. Watch pro games and keep a playbook of their plays. pariersports.com

Added Fri, 2014-04-11 15:45

Learning to read the

Maydi wrote:

Learning to read the formation used by the opposing team is essential when playing is crucial if you play defense. You can anticipate the play by looking at where the receiver is. Watch pro games and keep a playbook of their plays. pariersports.com

Added Fri, 2014-04-11 15:46

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <div> <blockquote> <pre>

More information about formatting options