I'm trying to use drush to download Drupal core into a folder called "d6".. So I execute and get the following...
[nthompson@devbox html]$ drush pm-download --drupal-project-rename=d6 drupal
Project drupal (6.17) downloaded to /var/www/html/drupal.
Why is it not putting it in a d6 folder?
In my drushrc.php I have uncommented the line for CVS ($options['package-handler'] = 'cvs';), could this be the problem?
If I execute the above command verbosely, I get:
[nthompson@devbox html]$ drush pm-download --drupal-project-rename=d6 drupal --verbose
Downloading release history from http://updates.drupal.org/release-history/drupal/6.x
Executing: wget http://updates.drupal.org/release-history/drupal/6.x
Calling unlink(6.x)
Executing: svn info '/var/www/html/'
Downloading project drupal ...
Executing: cd /var/www/html/ ; cvs -z6 -dP -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-6-17 -d drupal drupal
Checking out drupal was successful.
Project drupal (6.17) downloaded to /var/www/html/drupal.
Command dispatch complete
Any clues?
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | drush-826720.patch | 51.14 KB | jonhattan |
| #14 | drush-826720.patch | 47.16 KB | jonhattan |
| #12 | drush-826720.patch | 43.78 KB | jonhattan |
Comments
Comment #1
nicholasthompsonFyi... I have the same problem with HEAD.
Comment #2
nicholasthompsonThere is a similar close ticket here: #750722: pm-download (dl) - destination and project-drupal-rename parameters not working as expected
Comment #3
add1sun commentedI have the same problem with the latest version of HEAD. No worky.
Comment #4
greg.1.anderson commentedComment #5
corbacho commentedThis is fixed in HEAD?
I'm using Drush All versions-3.0
drush dl drupal-6.x --drupal-project-rename=demoIt works as expected. It is renamed to "demo"
drush dl drupal-6.x --drupal-project-rename=demo --package-handler=cvsIt doesn't work the renaming.
It has different errors with verbose mode on:
First time I run it:
Second time (now there is a existing directory called "drupal" )
Note that error path cvs.inc:95
The folder drupal is being cvs-updated when I didn't specify the folder "drupal",
Comment #6
jonhattan--drupal-project-rename is only implemented for wget package handler. I'm working on cvs support.
Comment #7
jonhattanFixing to make --drupal-project-rename is not hard but is a bit hackish as there're several overlapping things here I want to address altogether:
1/
both behaviours are legitimate but both package handlers doesn't behave the same, as it could be expected. In my opinion cvs should checkout to drupal-6.19, you can always do --drupal-project-rename if prefer just `drupal`.
2/
drush package handlers should fetch each project to a tmp folder (as drush_make), untar, and move to destination a/o relocate afterwards. Currently it does a chdir to destination directory and works on it (cwd if no --destination). It can be harmful. Example: /var/www/drupal-6.19 is my rocking website. I want to create another site:
What happen is:
a) drupal-6.19 has been downloaded and untarred over the preexisting site.
b) my rocking website is now at /var/www/otherdrupal
Also, working on current folder makes cvs package handler to update instead of check out because it detects drupal/CVS does exist. This is what @corbacho reports in #5.
3/
pm-download should warn if the destination folder already exists. Currently it's just ignored. Same for relocation.
So we need to warn the user at two times: before download/checkout if --destination a/o --drupal-project-rename OR after download/co if no --destination and relocation wanted.
4/
package handlers should receive the path to tmp folder to work in and the definitive directory name (that is the project name or --drupal-project-rename). pm-download can move to destination or relocate after the package handler had made its work.
5/
Code in wget.inc seems to reveal there was an attempt to implement this:
I see it of interest in some cases:
---
I'll work on all of this but 5/. Some feedback specially on that point will be appreciated.
Comment #8
corbacho commentedawesome analysis Jonathan. Would be nice to get all that in drush, specially working on a temp folder to avoid surprises.
btw, the original issue was that --drupal-project-rename was not working with wget, but I think was fixed. I couldn't replicate that.
Comment #9
moshe weitzman commentedLooks like that rename code was last touched by Greg in #727436: drush dl drupal reports wrong directory path. The feature you describe in 5) looks quite exotic to me. I don't mind if we drop it. All the other points looks great.
Comment #10
moshe weitzman commented@jonhattan is welcome to implement and commit #7
Comment #11
jonhattanI'm working on this.
Comment #12
jonhattanThis is a big change. Attached patch to get feedback. I think still needs work on updatecode. not tested.
Summary of changes:
* + verbosity for drush help dl.
* supress trailing slashes.
* refactor destination lookup / relocation.
* --destination check moved to pm_download_validate().
* change hook adjust_download_destination to download_destination_alter. Simplified.
* do the work in a tmp directory and move to really final destination at the end (after "relocation").
* if destination exists ask the user to overwrite.
* some logic moved ot of wget package-handler (dodgy name, drupal-project-rename).
* handle edge cases as dl translation or profile variant core from cvs.
* fix #909008: Project drupal contains 39 cores.
Comment #13
moshe weitzman commentedI took a look at the code and that looks good to me. Nice code comments and sensible flow. Should we test pm-download now or does that untested too?
Comment #14
jonhattanpm-download was ready to test. pm-updatecode doesn't seem to be affected by this changes.
I tested pm-download even more and found some glitches:
* install profiles: by default we were downloading the core variant even if in a drupal root. So I've put some validation.
* translations. It worked fine before this patch. Now that we work on a tmp dir it is a special case.
Comment #15
sunOverall, this patch looks very good. The functional changes really make sense.
Minor: Trailing white-space (also elsewhere in this patch).
"If no destination is provided, then it depends on the project type:"
I think the added "stable" is incorrect -- it downloads the latest recommended release, AFAIK.
The second sentence can be shortened to
'Defaults to "drupal".'
Circumvents the --simulate flag.
Should be
"Implements [hook-name]."
(i.e., third-person form)
"highests" looks odd. "So here we do." can be removed. Also, it would be good to document why this is preferred.
"a/o" is a very uncommon abbreviation, and in general, an "and/or" construct usually means that something can be expressed in a simpler way. E.g.,
"Validate --variant or enforce a sane default."
All code comments should wrap at 80 chars. See http://drupal.org/node/1354 for documentation standards. (also many times elsewhere in this patch)
That looks a bit odd. It's better to move the information about the special case into the phpDoc description of the function.
Powered by Dreditor.
Comment #16
jonhattanMuch more testing here. New patch with fixes for updatecode and some corrections pointed by sun. Note: --simulate is not circumvented as this command finally relies on drush_shell_exec that is --simulate aware.
Will take a coffee, review again and commit this in some minutes.
Comment #17
jonhattancommitted.
Comment #18
sunugh :)
Powered by Dreditor.
Comment #19
jonhattanIt was actually fixed in #17_validate :)
http://drupalcode.org/viewvc/drupal/contributions/modules/drush/commands...
Comment #20
corbacho commentedThanks for this patch jonhattan. Good work. I tested --drupal-project-rename with --package-handler=cvs and worked smoothly. Nice message:
Project drupal contains: [success]
- 1 profile: default
- 6 themes: pushbutton, minnelli, garland, marvin, chameleon,
bluemarine
- 33 modules: user, upload, ...
How was managing drupal before drush? :)