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

cabal-bundler --openbsd prunes some used packages #85

Open
blackgnezdo opened this issue May 17, 2021 · 2 comments
Open

cabal-bundler --openbsd prunes some used packages #85

blackgnezdo opened this issue May 17, 2021 · 2 comments

Comments

@blackgnezdo
Copy link
Contributor

Something is busted in CabalBundler.OpenBSD:

# This reports nothing
% cabal-bundler --openbsd stack-2.7.1 2>&1 | grep cmdargs
# This correctly lists cmdargs
% cabal-bundler --curl stack-2.7.1 2>&1 | grep cmdargs
f7d8ea5c4e6af368d9b5d2eb994fc29235406fbe91916a6dc63bd883025eca75  cmdargs-0.10.21.tar.gz
curl --silent --location --output cmdargs-0.10.21.tar.gz 'http://hackage.haskell.org/package/cmdargs-0.10.21/cmdargs-0.10.21.tar.gz'

More specifically, its bfs function seems to be to blame. Given this patch:

@@ -34,9 +35,12 @@ generateOpenBSD tracer packageName exeName' plan meta = do
     let units :: Map P.UnitId P.Unit
         units = P.pjUnits plan
 
+    flip traverse_ (M.keys units) $ \u -> putDebug tracer (show u)
     case findExe packageName exeName units of
         [(uid0, pkgId0)] -> do
             usedUnits <- bfs tracer units uid0
+            putDebug tracer "Used units"
+            flip traverse_ usedUnits $ \u -> putDebug tracer (show u)
             deps <- unitsToDeps meta usedUnits
             case partition ((pkgId0 == ) . depPkgId) deps of
                 (mainPackage : _, depUnits) -> do

I see that units contains cmdargs and usedUnits does not.

[  14.51226] debug: UnitId "cmdargs-0.10.21-4a200e2c22dceb11fcfc14a75b5ccfc97e5beabff692ce78854608622c5379d6"

@phadej if you happen to spot the bug, I'll happily skip the hunt. Otherwise I'll figure it out.

@blackgnezdo
Copy link
Contributor Author

I believe cabal-bundler is doing the right thing here. The problematic dependency chains are:

  1. mustache:exe:haskell-mustache->cmdargs
  2. stack->mustache:lib:mustache

Now, cabal-bundler seems to correctly omit cmdargs as it is not a transitive dependency of stack. Yet, when I try to build stack with cabal in network-isolated environment which doesn't have cmdargs, cabal-install fails:

$ cabal v2-build --offline --disable-benchmarks --disable-tests -j1  --flags=""   exe:stack
Warning: No remote package servers have been specified. Usually you would have
one specified in the config file.
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: mustache-2.3.1 (user goal)
[__1] unknown package: cmdargs (dependency of mustache)
[__1] fail (backjumping, conflict set: cmdargs, mustache)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: mustache, cmdargs

I don't know why cabal wants cmdargs to exist, is this a known cabal limitation?

@phadej
Copy link
Owner

phadej commented May 23, 2021

@blackgnezdo cmdargs is a dependency of an executable in mustache package. cabal doesn't have component solving, and solves for all components. See haskell/cabal#4087

I'm 👎 in taking also executables into account, as it will make code a lot more complicated. Rather, we have yet another reason to figure out per component solving

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants