Currently the package manager kindly defaults to downloading the latest recommended release of a project if you pass it bogus release info. This is convenient, but it would be nice if you could tell it to fail if you pass it bad release info.

This is useful in drupalorg_drush, where we need to verify that a release actually exists as part of building a profile's metadata.

The attached patch simply expands on the functionality of a switch arg, (formally $dev) which certain functions used to restrict operations to development branches. This has been converted to a string arg $restrict_to, with options of 'dev' (old $dev switch enabled), 'version' (new exact version restriction enabled), and '' (old $dev switch disabled).

There were some places where the dev restriction was used besides parsing release XML; in those cases I just made our new arg work like the old.

Patch works to fix the problem in drupalorg_drush, now tossing it over the fence for general consideration.

Comments

dww’s picture

Category: feature » task
Priority: Normal » Major
Issue tags: +drupal.org distribution blockers

We need this for #1433784: Fix how drupalorg_drush handles release history XML and propagates data to the packaging script, which is a major bug, so setting the issue metadata a bit more appropriately.

This was a bigger change that I was expecting, but I guess it's good to just consistently clean up $dev. Sadly, I don't have time and bandwidth to do a thorough review and testing. But generally, I'm +1 to the concept of making it possible to restrict the release history searching to a specific release or branch.

moshe weitzman’s picture

Status: Needs review » Needs work

Looks reasonable to me. Lets see if jonhattan or jhedstrom have feedback before this goes in.

Also, needs a test. See releaseInfoCase() for easy unit tests.

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new7.59 KB

This looks good to me. I rerolled with 2 tests.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

jhedstrom’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

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