cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Add test for build tool depends with per-component builds disabled

Open alex-rozenshteyn-leapyear opened this issue 5 years ago • 12 comments

This seems to be the underlying issue in #6011

I'm not sure how to fix it (yet), but I'm hoping to solicit suggestions. My best guess is that the bug is in Distribution.Client.ProjectPlanning.


Please include the following checklist in your PR:

  • [ ] Patches conform to the coding conventions.
  • [x] Any changes that could be relevant to users have been recorded in the changelog.
  • [ ] The documentation has been updated, if necessary.
  • [ ] If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

I'm a little stuck trying to fix the bug.

For some reason, with --disable-per-component, exe:pre-proc is passed to setup:

Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","build","--verbose=3","--builddir=.../dist-newstyle/build/x86_64-linux/ghc-8.6.5/pre-proc-999.999.999","exe:pre-proc"]

It seems that external_cc_map in Distribution.Client.ProjectPlanning has an entry of

( PackageName "pre-proc" 
, fromList 
    [ 
        ( CExeName ( UnqualComponentName "zero-to-one" )
        , AnnotatedId 
            { ann_pid = PackageIdentifier 
                { pkgName = PackageName "pre-proc" 
                , pkgVersion = mkVersion 
                    [ 999
                    , 999   
                    , 999   
                    ]       
                }       
            , ann_cname = CExeName ( UnqualComponentName "zero-to-one" )
            , ann_id = ComponentId "pre-proc-999.999.999-inplace" 
            }
        )       
    ]
) 

The ComponentId looks suspicious to me, but that could be a result of me not understanding what's supposed to be happening.

Comparing the plan.json files with and without --disable-per-component also might yield some insight.

Thoughts?

-inplace in component id looks correct, it's "package-name-version-inplace" for "local" packages

phadej avatar Nov 01 '19 22:11 phadej

-inplace in component id looks correct, it's "package-name-version-inplace" for "local" packages

So how does the build step get its parameters? It seems to be getting an exe:[component name] parameter, which is correct for per-component builds, but not for per-package builds if the component name is the package name.

Found the source of the problem (turns out there was a TODO about it). I fixed it, but I'm not sure if the fix is the right way to do it. In a per-package build, I explicitly added all executables of a package to the build dependencies if any of the executables was a dependency.

Note that the single failure seems to be unrelated (https://travis-ci.org/haskell/cabal/jobs/606495569):

$ Installing caching utilities
/home/travis/.rvm/scripts/cli: line 872:  4372 Segmentation fault      "$rvm_scripts_path/list" "${rvm_ruby_args[@]}"

@phadej I've been dogfooding the this patch, and it seems to work. CI passed except for an unrelated failure. Is there anything else I need to do to get this merged?

Ping. Is there any action needed on my part to help merge this in?

Sorry, there were a bit of hassle in preparing the release branches. Could you rebase to the current master (the CI setup should be more robust there)

phadej avatar Dec 27 '19 06:12 phadej

Sorry, there were a bit of hassle in preparing the release branches. Could you rebase to the current master (the CI setup should be more robust there)

No worries; I understand release-related stresses. Since you're taking over the issue, I'll leave the rebasing to you to avoid conflicting?

@phadej Is any work being done on this?

Sorry, I have paged out the details already. I'll come back to this eventually.

phadej avatar Apr 09 '20 18:04 phadej

@phadej No worries!

Marking this PR as draft :slightly_smiling_face:

Kleidukos avatar May 17 '23 06:05 Kleidukos