Comments

traviscarden’s picture

Title: Add Supported/Recommended info to `info` command. » Indicate Recommended/Supported/Development Releases in `pm-releases` Output

It would indeed be very helpful to print next to each release whether it's recommended, supported, in development, unsupported, etc. For lack of this information, I oftentimes still have to go to Drupal.org to choose a version to download, which of course is precisely what the command is designed to keep you from having to do.

jonhattan’s picture

Status: Active » Needs review
StatusFileSize
new1.89 KB

Here's a patch for review. Haven't explored deeply possible edge cases. It also includes 'Installed' status. Sure there's a better word than status for the new table column.

greg.1.anderson’s picture

Status: Needs review » Needs work

This is awesome, Jonhattan! It does still have a bug, though; using the infamous nodewords example (from #761694: Drush downloading non-recommended release of nodewords), pm-releases does not agree with upc about which version of nodewords is recommended.

$ drush @gkdev dl nodewords-6.x-1.10
Project nodewords (6.x-1.10) downloaded to /srv/www/dev.greenknowe.org/sites/all/modules/nodewords.        [success]
$ drush @gkdev en nodewords
The following projects will be enabled: nodewords
Do you really want to continue? (y/n): y
nodewords was enabled successfully.                                                                        [ok]
$ drush @gkdev upc
Refreshing update status information ...
Done.
Update information last refreshed: Sun, 04/11/2010 - 10:22

Update status information on all installed and enabled Drupal projects:
 Name                            Installed version  Proposed version  Status           
 Nodewords                       6.x-1.10           6.x-1.11          Update available 
$ drush @gkdev pm-releases nodewords
 Project    Release         Date         Status                 
 nodewords  6.x-3.x-dev     2010-Apr-11  Development            
 nodewords  6.x-2.x-dev     2009-Jul-14  Development            
 nodewords  6.x-1.12-beta4  2010-Mar-21  Supported, Recommended 
 nodewords  6.x-1.12-beta3  2010-Feb-17                         
 nodewords  6.x-1.12-beta2  2010-Jan-11                         
 nodewords  6.x-1.12-beta1  2010-Jan-11                         
 nodewords  6.x-1.11        2009-Dec-31                         
 nodewords  6.x-1.10        2009-Dec-29  Installed     
$ drush dl nodewords
Project nodewords (6.x-1.12-beta4) downloaded to /home/ga/local/drush/nodewords.         

So, as you can see, pm-releases agrees with dl, but the algorithm used in these commands does not match what upc does. upc matches what is displayed on the nodewords project page, though, so it is correct and the other two are wrong.

greg.1.anderson’s picture

StatusFileSize
new2.48 KB

I checked out the code at project/release/project_release.module, which is responsible for picking the recommended release to display on a project page. I won't quote the code, but here is the comment that goes with the code:

 * The "latest" release just means the published release node with the highest
 * version string. The "recommended" release is the published release node
 * with the highest version string that doesn't have a "version_extra" field
 * (e.g. "beta1"). If all releases on the given branch have "extra", then the
 * recommended release will be the same as the latest release.

Not surprisingly, this comment matches the documentation on release numbers -- although I found the later to be a bit ambiguous. The comment in the code is non-ambiguous, and the code that follows even matches the comment.

Here's a first-pass at a patch to fix this. It works fine, but it's a bit gitchy and could use some obvious clean-up (should be done in two passes, rather than use the magic index number '4'). I'm posting it early in case I don't have time to do more on it for a while; I'm out of town until Wednesday night.

greg.1.anderson’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new2.69 KB

Here are two patches. Both are good. Pick one.

When I was fixing #4, I realised that I also wanted to see which releases were security updates. In the first version, I added a "type" column that included Security, Feature and Bugfix release information. This is very precise, but also very wordy. Therefore, I made another version that just adds a "Security" tag to the status column. "Features" and "Bugfixes" are not represented. This is less precise, but shows the most important information in a format that is easy to read.

It would also be easy enough to just yank out the security thing if you don't want it; the important part is that this patch makes pm-releases come into alignment with dl and upc.

greg.1.anderson’s picture

FYI, here's what the 'with-security' patch looks like:

$ drush pm-releases nodewords
 Project    Release         Date         Status      
 nodewords  6.x-3.x-dev     2010-Apr-11  Development 
 nodewords  6.x-2.x-dev     2009-Jul-14  Development 
 nodewords  6.x-1.12-beta4  2010-Mar-21  Supported   
 nodewords  6.x-1.12-beta3  2010-Feb-17              
 nodewords  6.x-1.12-beta2  2010-Jan-11              
 nodewords  6.x-1.12-beta1  2010-Jan-11              
 nodewords  6.x-1.11        2009-Dec-31  Recommended 
 nodewords  6.x-1.10        2009-Dec-29  Installed   
 nodewords  6.x-1.9         2009-Dec-24              
 nodewords  6.x-1.8         2009-Dec-10              
 nodewords  6.x-1.7         2009-Dec-08              
 nodewords  6.x-1.6         2009-Dec-07              
 nodewords  6.x-1.5         2009-Dec-03              
 nodewords  6.x-1.4         2009-Dec-03              
 nodewords  6.x-1.3         2009-Dec-02              
 nodewords  6.x-1.3-beta5   2009-Oct-30              
 nodewords  6.x-1.3-beta4   2009-Oct-28              
 nodewords  6.x-1.3-beta3   2009-Oct-24              
 nodewords  6.x-1.3-alpha2  2009-Oct-21              
 nodewords  6.x-1.3-alpha1  2009-Oct-19              
 nodewords  6.x-1.2         2009-Sep-23              
 nodewords  6.x-1.1         2009-Sep-23  Security    
 nodewords  6.x-1.0         2009-Feb-07              
 nodewords  6.x-1.0-rc1     2008-Feb-15              
 nodewords  6.x-1.x-dev     2010-Apr-11  Development 
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

code looks good. if it seems to work right on d5/d6/d7, then feel free to commit. x-platform for this stuff has proven tricky. would be great to get some testers but thats not a prerequisite.

jonhattan’s picture

Little failure with `drush pm-releases views` in D7. $release['terms'] can be empty and not contain the key 'Release type'.

change: if ((isset($release['terms']))&&(!empty($release['terms']))) {

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

Committed the "with security" patch without d5/d7 testing. I am pretty confident that the "Recommended" selection will be stable cross-version. There is some chance that the "Security" mark might disappear in other versions. I'll investigate and test this as time permits, and handle separately if any problems are found.

jonhattan’s picture

Status: Fixed » Needs review

Greg: I reopen in case you didn't see #8

greg.1.anderson’s picture

Status: Needs review » Fixed

Thanks, Jonhattan. I committed that, but used array_key_exists instead to make sure that the 'Release type' element is there.

Status: Fixed » Closed (fixed)

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