It would be very useful to have a way of defining a default path for projects and libraries, e.g.:

paths[projects] = "sites/all/module/contrib"
paths[projects][theme] = "sites/all/themes"
paths[libraries] = "sites/all/libraries"

Right now the only way of doing this globally is the --contrib-destination argument; this has to be manually assigned every time "drush make" is executed, which is a pain & not very workflow-friendly.

Comments

damienmckenna’s picture

Correction, the --contrib-destination argument moves *all* downloads to the specified directory by default, so the only way of doing it right now it to manually specify the [subdir] argument for all projects. Ew.

rjmackay’s picture

subscribing

dmitrig01’s picture

Status: Active » Closed (duplicate)
damienmckenna’s picture

Status: Closed (duplicate) » Active

The other issue is not strictly the same as this request, so this ticket is being reopened.

dmitrig01’s picture

whoops, you're right.

In the .ini format, which .info is based off of, you have something like this.

[section]
subection = 1
subsection2 = 2

[section2]
somethingelse = 52

Which would be able to very nicely solve our problem. However, that format's not really an option. THe only thing that comes to mind is some sort of hack like

subdir = contrib
projects[] = foo
projects[] = bar
subdir = custom
projects[] = baz

for which we'd need to re-write the .info parser anyway, but a hack is a hack. The really tricky thing is we run into issues like this one:

[contrib]
project[foo][bar] = test
[custom]
project[foo][baz] = asdf

where do we put foo? under contrib or custom?

guddomeNt’s picture

The syntax doesn't really cater for it currently, but I think it would be helpful to somehow use a scope for this, rather than a global setting. Eg. semantically something like:

scope {
  subdir = "contrib"
  projects[] = foo
  projects[] = bar
}

I realise that this will derive the syntax from .info files, so I'm not sure if the trade is worth it.

dmitrig01’s picture

I think changing the syntax is fine - but again, you'd run into the problem I had in comment #5.

But, we could do something like this as a shortcut:

(subdir = "contrib", location = "http://code.developmentseed.org/fserver") {
  projects[] = foo
  projects[] = bar
}
dmitrig01’s picture

A side note, while we're talking about this - it'd be great if there was a more concise array notation, f.e.

projects[foo][download] = (type = "get",  url = "http://example.com/example.tgz")

Or extrapolated to

projects[foo] = (download = (type = "get",  url = "http://example.com/example.tgz"))

Though, that's not very pretty - but, while we're looking at enhancing the syntax, I'd like to consider something like this.

damienmckenna’s picture

An alternative method of handling this would be to just add an option to create the "sites/all/modules/contrib" directory, because if it exists then Drush automatically downloads modules to there.

dmitrig01’s picture

yes, though drush make doesn't use drush dl's logic, and as such doesn't automatically download to sites/all/modules/contrib

damienmckenna’s picture

@dmitrig01: .. maybe it should where appropriate, e.g. this case?

guddomeNt’s picture

I'm not sure I understand what you mean by ".. the problem I had in comment #5 .."?

Consider this:

scope {
  subdir = "contrib"
  projects[] = foo
  projects[] = bar
}
projects[] = baz

Which would be semantically synonymous with this:

projects[foo][subdir] = "contrib"
projects[bar][subdir] = "contrib"
projects[] = baz

Since "baz" is outside the scope, it isn't affected by the "subdir" setting. No need for any parenthesis there.

Note that I don't particularly like the syntax I proposed. Perhaps something like this would be more elegant:

projects:
    admin:
        subdir: contrib
        version: 2.0
    admin_language:
        subdir: contrib
        version: 1.4

group:
    subdir: contrib
    projects:
        foo
        bar
dmitrig01’s picture

Yep. To recap, my syntax:

(subdir = "contrib", location = "http://code.developmentseed.org/fserver") {
  projects[] = foo
  projects[] = bar
}

Which is the same as

projects[foo][subdir] = "contrib"
projects[foo][subdir] = "http://code.developmentseed.org/fserver"
projects[bar][subdir] = "contrib"
projects[bar][location] = "http://code.developmentseed.org/fserver"

I prefer my syntax because:
1. The scope { syntax is confusing, because you're doin a lot of hardcoding in there, and what if someone were to write this?

scope {
  projects[] = foo
  subdir = "contrib"
}

2. The second, almost YAML-like format is also not preferable IMO because first, it falls under the same problem as #1, and 2, an .info/.ini-based format is closer to what most people are familiar with (as in, PHP) - [] is used for arrays, and {} is used for nesting. The parenthesis in my example is similar to a function declaration, but it declares specifically _what_ the scope is.

It's also easily nestable:

(subdir = "contrib") {
  projects[] = foo
  (location = "http://code.developmentseed.org/fserver") {
    projects[] = bar
  }
}

should be fairly understandable - both foo and bar have subdir = contrib, but only bar has the modified location = code.developmentseed.org...

dmitrig01’s picture

Also, when I referred to comment #5, I meant the following problem.
Using your syntax:

scope {
  subdir = "contrib"
  projects[foo][a] = 1
}
scope {
  subdir = "custom"
  projects[foo][b] = 1
}

Now, under what subdir does projects[foo] fall (yes, one could say either the first or last, but how will most people who don't rtfm know)? However, I've since realized that we probably could just throw an error in this situation (i.e., setting attributes in different scopes). So, disregard that issue, and let's continue discussing the syntax itself - I'd like to hear any cons you have about my syntax.

damienmckenna’s picture

An alternative syntax idea.

  • Attributes (subdir, location) are taken for all relevant definitions (project, etc), e.g.:
    subdir = "contrib"
    project[] = "cck"
    project[] = "views"
    
  • Repeated attributes override the previous setting for that attribute, e.g.:
    subdir = "contrib"
    project[] = "cck" ; goes in sites/all/modules/contrib/cck
    project[] = "views" ; goes in sites/all/modules/contrib/views
    subdir = "custom"
    location = "http://example.com/fserver"
    project[] = "funkychicken" ; goes in sites/all/modules/custom/monkeychicken, loaded from example.com/fserver
    location = "http://example2.com/fserver"
    project[] = "monkeychicken" ; goes in sites/all/modules/custom/monkeychicken, loaded from example2.com/fserver
    
  • The attribute value "default" reverts to the default setting for that attribute, e.g.:
    subdir = "contrib"
    project[] = "cck" ; goes in sites/all/modules/contrib/cck
    project[] = "views" ; goes in sites/all/modules/contrib/views
    subdir = "custom"
    location = "http://example.com/fserver"
    project[] = "funkychicken" ; goes in sites/all/modules/custom/monkeychicken, loaded from example.com/fserver
    location = "http://example2.com/fserver"
    project[] = "monkeychicken" ; goes in sites/all/modules/custom/monkeychicken, loaded from example2.com/fserver
    subdir = "default"
    project[] = "curriedchicken" ; goes in sites/all/modules/curriedchicken, loaded from example2.com/fserver
    

The key rationale for suggesting this was to avoid adding more syntax hacks.

dmitrig01’s picture

That is an interesting idea, but I see two problems with this:

The first is that it needs the hardcoded of "subdir means this inherits, project means it doesn't inherit", etc - what if we introduce a new property? Do we have to update the index of inheritable properties?

Also, a lesser problem, what if you wanted something to go in sites/all/modules/default?

To me, this solution seems to be a bit less elegant - it seems simply to try to massage the existing syntax into something that could work, but to me, just doesn't feel completely "correct."

What do you think of the syntax in #13 - would that work? What I like about it is that a makes a distinction between properties that should be set (those are in the parenthesis) and info definitions themselves (which stay the same).

damienmckenna’s picture

@dmitrig01: you make valid points. Could the syntax from #13 be done without the extra brackets, e.g.:

subdir = "contrib" {
  projects[] = foo
  location = "http://code.developmentseed.org/fserver" {
    projects[] = bar
  }
}
dmitrig01’s picture

sure. i just thought it made it a little bit easier to read and separated out, especially with multiple:

(subdir = "contrib", location = "http://code.developmentseed.org/fserver") {
  projects[] = foo
  projects[] = bar
}
damienmckenna’s picture

Maybe make the parenthesis required for multiple terms but have it optional for single terms?

dmitrig01’s picture

Maybe. but that still could create some confusion if written oddly

projects[] = foo
subdir = custom
{
projects[] = bar
}

Not to mention that it would be easier for a parser if it had ().

dmitrig01’s picture

[edit: double post]

dmitrig01’s picture

Also of note: my proposed format (especially as opposed to #12) is fully backwards-compatible

dmitrig01’s picture

Status: Active » Postponed

I'm going to mark this "postponed" as this is something I'd like to see in 3.x, but to get 2.0 out the door I don't think writing a new grammar parser is feasible.

dmitrig01’s picture

However, let's continue the discussion - I am looking forward to implementing this and we might as well straighten out all the details beforehand.

winston’s picture

Not 100% sure this is related, but fishing through the issue queue led me here.

I would like to be able to download files using drush make as well. For example download an archive an have it placed in a files folder (or some other arbitrary folder either under sites or under the drupal root).

In my specific use case this would be to provide demo snapshots, but I could foresee other uses.

sime’s picture

Feels like some of the ideas are over-worked and the syntax being suggested seriously reduces the readability of the make file (one of the makefile's strengths IMO). There is no additional functionality being introduced here, just the desire to simplify the make file and make it more readable and maintainable.

defaults[subdir] = contrib

;Put this module and 30 or so others in whatever the default is.
projects[] = views	
projects[] = ctools	

;Put this *one* module in an alternative location. Usually there are not many.
projects[adhoc][subdir] = custom

Alternatively, the OP raises the idea of a generic solution for setting default arguments (which can be overridden on CLI):

; Default --contrib-destination
default_arguments[contrib-destination] = sites/all/modules/contrib
; Default --working-copy
default_arguments[working-copy] = TRUE
dmitrig01’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

damienmckenna’s picture

Was this closed prematurely, or is there another way of doing this? Thanks.

dtwork’s picture

Status: Closed (fixed) » Active

can 'fixed' be further explained? what's the solution?

dtwork’s picture

Version: 6.x-2.0-beta9 » 6.x-2.x-dev
dtwork’s picture

Bueller?... Bueller?... Bueller?

helmo’s picture

Project: Drush Make » Drush
Version: 6.x-2.x-dev »
Component: Code » Make

[ Powered by #1115636: Issue Macros and Templates - Drush Make]

Drush make is being merged into drush core (discussed in issue:#1310130: Put drush make in drush core)
This means that the issue queue is also moving. The drush queue has a component 'Make' especially for drush_make.

More information will be posted on the drush_make and drush project pages.

NOTE: related: #1337468: --contrib-destination adds folder like modules or themes

boztek’s picture

I agree a simple solution where a default can be set either as a command line option or in a defaults array would be a useful first step.

Here is a patch with both a 'default-subdir' option and a defaults[subdir] make file option as sketched by sime in #26.

boztek’s picture

Status: Active » Needs review
StatusFileSize
new2.52 KB

Updated comment.

dmitrig01’s picture

Sorry, what I meant when I fixed this issue was I fixed it in the 3.x version, using notation similar to what I outlined in #13, with all kinds of additional crazyness. However, that was not ported to Drush core -- only 2.x was. So this functionality got lost in 'the void'. I don't have time to port this forward, but if someone would like to take it up, I think it shouldn't be too difficult but it would be a major improvement.

moshe weitzman’s picture

Status: Needs review » Postponed (maintainer needs more info)

It is possible that this lower priority now that we are integrated with pm-download. please add current summary if needed.

jonhattan’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Another solution was recently commited in #1633050: Create defaults array in .make files for specifying attributes common to all projects. So marking this as duplicate. Reopen for further discussion.

The approach is simpler than proposals in this issue:

core = "7.x"
api = 2

defaults[projects][subdir] = contrib
projects[] = ctools