Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling for package conditions and index files. #537

Merged
merged 5 commits into from
Oct 10, 2019

Conversation

nuclearsandwich
Copy link
Contributor

Closes #536 with some improved error messaging and behavior.

  1. In order to release packages with format 3 package.xml files, a v4 rosdistro index is required to provide sufficient context for evaluating package conditions.
    To make it clearer that the problem is the index version and not an invalid / unknown distribution_type, an explicit version check and dedicated error message has been added.

  2. For package formats 1 and 2 conditions are evaluated with an empty context so that downstream code will correctly see all fields without conditions as True.

This improves on the current behavior which treats earlier index files
the same as invalid v4 files.
Package conditions may still be evaluated multiple times but now they
are at least all using a centralized function to do so.

In addition this new function will evaluate format one and two packages
with empty context, since these packages have no condtions it is
expected that the unconditional packages will always evaluate to True.
* Only evaluate conditions for package format 3 and beyond.
* Filter conditions using `is not False` rather than truthiness to allow
for evaluated_condition to be None in earlier package formats.
# Earlier formats should have their conditions evaluated with no context so
# the evaluated_condition is set to True in all cases.
if package.package_format >= 3:
package.evaluate_conditions(package_conditional_context(ros_distro))
Copy link

@lennonwoo lennonwoo May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accorint to the latest implement of catkin_pkg, the package.evaluate_conditions(package_conditional_context(ros_distro)) would work when package_format equal 2. As we can see from there, the package.evaluate_conditions change the method evaluated_condition of every dependence to dependence object's attribute. Consider we use this attribute lately, I think this function should be also executed when package_format equals 2.

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is goodness, but if catkin_pkg can handle calling evaluate_conditions for older package formats, I'm not sure why we don't do that.

Using is not False seems like a safe thing to do regardless.

@nuclearsandwich nuclearsandwich merged commit c8a63a6 into master Oct 10, 2019
@nuclearsandwich nuclearsandwich deleted the improve-conditional-error-handling branch October 10, 2019 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bloom-release 0.8.0 always fails with "Bloom cannot cope with distribution_type 'None'"
4 participants