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

Never prune seed packages from build #295

Merged
merged 3 commits into from
May 2, 2019

Commits on May 1, 2019

  1. Remove debug logging

    ccollins476ad committed May 1, 2019
    Configuration menu
    Copy the full SHA
    1bdadc4 View commit details
    Browse the repository at this point in the history
  2. Fix split builds - ensure no duplicate packages

    In a split build, three rounds of dependency resolution occur:
    1. Master set (all packages in the build)
    2. Loader set
    3. App set
    
    Each round produces new ResolvePackage objects.  Conceptually, this is
    wrong, since the loader set and app set are meant to share packages, not
    duplicate them.  This was causing a problem during API resolution: the
    Resolution object maps API names to *ResolvePackage, with the package
    pointers coming from the master set.  During rounds 2 and 3, lookups in
    this map yield packages that don't exist in the current working set,
    resulting in this error:
    
    ```
    Error: Unexpected unsatisfied API: foo; required by: bar
    ```
    ccollins476ad committed May 1, 2019
    Configuration menu
    Copy the full SHA
    a64ee7b View commit details
    Browse the repository at this point in the history
  3. Never prune seed packages from build

    This is a fix for split images.
    
    During dependency resolution, newt executes a phase called "imposter
    pruning."  A package is an imposter if it is in the dependency graph by
    virtue of its own syscfg defines and overrides.  For example, say we
    have a package `foo`:
    
    ```
        pkg.name: foo
        syscfg.defs:
            FOO_SETTING:
                value: 1
    ```
    
    Then we have a BSP package:
    
    ```
        pkg.name: my_bsp
        pkg.deps.FOO_SETTING:
            - foo
    ```
    
    If this is the only dependency on `foo`, then `foo` is an imposter.  It
    should be removed from the graph, and its syscfg defines and overrides
    should be deleted.
    
    This commit changes this procedure slightly.  Now, only
    *non-seed-packages* are subject to imposter pruning.  This change is
    necessary due to the way newt builds split images.  A split image
    consits of two parts: 1) loader, and 2) application.  The loader is
    self-contained, whereas the application is allowed to depend on packages
    in the loader.  When newt builds the application, it considers all the
    packages in the loader to be seed packages for the application.  Since
    all these packages are guaranteed to be present (they are already built
    in to the loader), they must not be pruned.
    
    The fix is to never prune seed packages.  While this fix specifically
    addresses split images, conceptually it makes sense to never prune seed
    packages for non-split builds as well.  If the `project.yml` file points
    to a package, that package should be included, even if newt thinks it is
    not needed.
    ccollins476ad committed May 1, 2019
    Configuration menu
    Copy the full SHA
    97a551c View commit details
    Browse the repository at this point in the history