-
Notifications
You must be signed in to change notification settings - Fork 96
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
Conversation
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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Closes #536 with some improved error messaging and behavior.
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.
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.