[engine] Fix bundle rel_path handling in engine

Review Request #4150 — Created Aug. 11, 2016 and submitted

nhoward_tw
pants
3775, 3777
pants-reviews
benjyw, kwlzn, stuhood

When a bundle has a rel_path kwarg, the paths in the fileset kwarg are re-rooted to the rel_path. The engine didn't account for this, so the resulting bundles were missing files because they did not exist under the spec_path of the declaring BUILD file.

This patch fixes the issue.

  • It introduces another condition to the validation in bundle creation so that the specially constructed globs from the engine pass validation.
  • It checks the bundle declaration for a rel_path kwarg and uses that when constructing globs to evaluate in the engine.

Additionally, I added a better __repr__ to the EagerFilesetWithSpec class so error messages contain better information.

Wrote a failing integration test, then followed the thread with unit tests. I ran all of the engine tests locally and CI is away on the PR: https://github.com/pantsbuild/pants/pull/3777

KW
  1. lgtm! thanks!

  2. src/python/pants/engine/legacy/structs.py (Diff revision 1)
     
     
     
     
     

    how about:

    rel_root = getattr(bundle, 'rel_path', self.address.spec_path)
    

    ?

  3. 
      
NH
NH
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as https://github.com/pantsbuild/pants/commit/38ea0a847047a26b0252f41963e30d8d6a428dc1
ST
  1. Ship It!
  2. 
      
Loading...