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

Inform user the full path where the executable is copied/symlinked with v2-install #6575

Closed
jneira opened this issue Mar 10, 2020 · 7 comments

Comments

@jneira
Copy link
Member

jneira commented Mar 10, 2020

Actually cabal install output ends with (you can replace Copying with Symlinking)

Copying 'executable1.exe'
Copying 'executable2.exe'
...

and cabal install -v3 with:

creating D:\bin 
Copying 'executable1.exe'
Copying 'executable2.exe'
....

being D:\bin the dir where the executables are being copied/symlinked. Even when the directory already exists (but that is not the goal of this issue)!

I think it would be great show the absolute path where the artifacts are being created even with the default verbosity:

Copying 'executable1.exe' to 'D:\bin'
Copying 'executable2.exe' to 'D:\bin'

or, if all of them only could be created in one location (not sure about that)

Copying executables to 'D:\bin'
Copying 'executable1.exe'
Copying 'executable2.exe'

It seems a small change but the directory value can come from several sources and beginners not always are aware of them.
I think bug fixes should be the priority here but this seems to be easy to implement (ha! 😝)

@emlautarom1
Copy link
Contributor

Could you point to where these messages are generated? I would like to look into this. Seems fairly easy

@jneira
Copy link
Member Author

jneira commented Mar 14, 2020

I think this is the main functions where several executables are copying/symlinking:

installUnitExes verbosity overwritePolicy
mkSourceBinDir mkExeName mkFinalExeName
installdir installMethod
(unit, components) =
traverse_ installAndWarn exes
where
exes = catMaybes $ (exeMaybe . fst) <$> components
exeMaybe (ComponentTarget (CExeName exe) _) = Just exe
exeMaybe _ = Nothing
installAndWarn exe = do
success <- installBuiltExe
verbosity overwritePolicy
(mkSourceBinDir unit) (mkExeName exe)
(mkFinalExeName exe)
installdir installMethod

It calls this for each one:
-- | Install a specific exe.
installBuiltExe
:: Verbosity -> OverwritePolicy
-> FilePath -- ^ The directory where the built exe is located
-> FilePath -- ^ The exe's filename
-> FilePath -- ^ The exe's filename in the public install directory
-> FilePath -- ^ the directory where it should be installed
-> InstallMethod
-> IO Bool -- ^ Whether the installation was successful

@emlautarom1
Copy link
Contributor

emlautarom1 commented Mar 15, 2020

I'll take a look into it.

Some questions:

  • Displaying the path where files are being copied should be the default behavior or it should depend on some verbosity flags? It seems a little change, so I'll show it by default, but I don't know what everyone thinks.
  • What about Symlinking? should we also show were we are linking files?

@phadej
Copy link
Collaborator

phadej commented Mar 15, 2020

What about Symlinking? should we also show were we are linking files?

Yes

Displaying the...

Let's not parameterize that output by verbosity. Then it should be one line change (if tests don't need to be updated).

@emlautarom1
Copy link
Contributor

emlautarom1 commented Mar 15, 2020

I think it's good to go, please, take a look at: #6582

@phadej
Copy link
Collaborator

phadej commented Mar 16, 2020

Resolved in #6582 + #6590

@phadej phadej closed this as completed Mar 16, 2020
@jneira
Copy link
Member Author

jneira commented Mar 16, 2020

Thanks @emlautarom1 and @phadej (it is clear that maintaining a package like cabal is really, really hard)!

@phadej phadej mentioned this issue Apr 1, 2020
@phadej phadej added this to the 3.4.0.0-rc1 milestone Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants