You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/11/26 21:53:23 UTC

[GitHub] ccollins476ad opened a new pull request #246: Discard duplicates in merged dep conditional

ccollins476ad opened a new pull request #246: Discard duplicates in merged dep conditional
URL: https://github.com/apache/mynewt-newt/pull/246
 
 
   Newt merges conditional dependencies into a single dependency.  For
   example, newt transforms the following:
   ```
       pkg.deps.SETTING_A:
           - my_package
   
       pkg.deps.SETTING_B:
           - my_package
   ```
   into:
   ```
       pkg.deps.'(SETTING_A || SETTING B):
           - my_package
   ```
   (internally)
   
   This allows a `pkg.yml` file to declare separate conditions under which
   a package gets pulled in, rather than requiring the user to manually
   collapse them all into a single expression.
   
   The bug is that sometimes newt would add duplicate expressions to the
   merged expression, e.g.,
   ```
       pkg.deps.'((SETTING_A || SETTING_B) || SETTING_B)'
   ```
   The resulting dependency graph is unchanged, but the text in the log and
   in the dep / revdep commands was ugly and confusing.
   
   The problem was that newt was not always normalizing each expression
   before comparing it to the previously-seen expressions.  If an
   expression contained extra whitespace, it would not compare equal to the
   equivalent whitespace-free expression. This commit fixes this issue by
   always normalizing conditionals before storing them.
   
   **Note:** Newt should really store these expressions in their primitive AST form rather than as strings.  That turns out to be a fairly large change, so I decided to just fix this bug for now, with the plan to switch to the AST form in the future.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services