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

Resolve #6369 and #6393: Allow cabal v2-install pkgname:exename or http://example.com/package.tar.gz(#sha256=abcde...) #6576

Merged
merged 3 commits into from
Mar 12, 2020

Conversation

phadej
Copy link
Collaborator

@phadej phadej commented Mar 11, 2020

No description provided.

@phadej phadej force-pushed the issue-6369-install-pkgname-exename branch from 65ca180 to f4ecbf1 Compare March 11, 2020 21:56
@phadej phadej changed the title Resolve #6369: Allow cabal v2-install pkgname:exename Resolve #6369 and #6393: Allow cabal v2-install pkgname:exename or http://example.com/package.tar.gz Mar 11, 2020
We can write URIs with a fragment like

    https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz#sha256=aae556efbcaddfd65c6a1c1811b122b0d8c8d00624c8c2e36aabb5e9f9ea9840

and downloadURI will check the hash after download before continuing.
The hash check supersedes ETag
@phadej
Copy link
Collaborator Author

phadej commented Mar 11, 2020

Also added sha256 checking to fetchAndReadSourcePackageRemoteTarball.

Maybe that functionality should be in downloadURI itself, but this is good for now.

As a side-effect packages: https://... should work with sha256 functionality as well.

demo: incorrect hash

% cabal install 'https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz#sha256=21cdc5661958a703303d2'
Downloading
https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz
cabal: SHA256 doesn't match for
https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz
expected 21cdc5661958a703303d actual
aae556efbcaddfd65c6a1c1811b122b0d8c8d00624c8c2e36aabb5e9f9ea9840

demo: correct hash

% cabal install 'https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz#sha256=aae556efbcaddfd65c6a1c1811b122b0d8c8d00624c8c2e36aabb5e9f9ea9840'
Downloading
https://hackage.haskell.org/package/cabal-fmt-0.1.2/cabal-fmt-0.1.2.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - cabal-fmt-0.1.2 (lib:cabal-fmt-internal) (requires build)
 - cabal-fmt-0.1.2 (exe:cabal-fmt) (requires build)
Configuring library 'cabal-fmt-internal' for cabal-fmt-0.1.2..
Preprocessing library 'cabal-fmt-internal' for cabal-fmt-0.1.2..
Building library 'cabal-fmt-internal' for cabal-fmt-0.1.2..
[ 1 of 13] Compiling CabalFmt.Comments ( src/CabalFmt/Comments.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Comments.o )
[ 2 of 13] Compiling CabalFmt.Error   ( src/CabalFmt/Error.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Error.o )
[ 3 of 13] Compiling CabalFmt.Fields  ( src/CabalFmt/Fields.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Fields.o )
[ 4 of 13] Compiling CabalFmt.Fields.Extensions ( src/CabalFmt/Fields/Extensions.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Fields/Extensions.o )
[ 5 of 13] Compiling CabalFmt.Fields.Modules ( src/CabalFmt/Fields/Modules.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Fields/Modules.o )
[ 6 of 13] Compiling CabalFmt.Options ( src/CabalFmt/Options.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Options.o )
[ 7 of 13] Compiling CabalFmt.Monad   ( src/CabalFmt/Monad.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Monad.o )
[ 8 of 13] Compiling CabalFmt.Fields.TestedWith ( src/CabalFmt/Fields/TestedWith.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Fields/TestedWith.o )
[ 9 of 13] Compiling CabalFmt.Fields.BuildDepends ( src/CabalFmt/Fields/BuildDepends.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Fields/BuildDepends.o )
[10 of 13] Compiling CabalFmt.Parser  ( src/CabalFmt/Parser.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Parser.o )
[11 of 13] Compiling CabalFmt.Pragma  ( src/CabalFmt/Pragma.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Pragma.o )
[12 of 13] Compiling CabalFmt.Refactoring ( src/CabalFmt/Refactoring.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt/Refactoring.o )
[13 of 13] Compiling CabalFmt         ( src/CabalFmt.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/l/cabal-fmt-internal/build/cabal-fmt-internal/CabalFmt.o )
Configuring executable 'cabal-fmt' for cabal-fmt-0.1.2..
Preprocessing executable 'cabal-fmt' for cabal-fmt-0.1.2..
Building executable 'cabal-fmt' for cabal-fmt-0.1.2..
[1 of 2] Compiling Paths_cabal_fmt  ( /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/x/cabal-fmt/build/cabal-fmt/autogen/Paths_cabal_fmt.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/x/cabal-fmt/build/cabal-fmt/cabal-fmt-tmp/Paths_cabal_fmt.o )
[2 of 2] Compiling Main             ( cli/Main.hs, /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/x/cabal-fmt/build/cabal-fmt/cabal-fmt-tmp/Main.o )
Linking /tmp/cabal-install.-130794/dist-newstyle/build/x86_64-linux/ghc-8.6.5/cabal-fmt-0.1.2/x/cabal-fmt/build/cabal-fmt/cabal-fmt ...
Symlinking 'cabal-fmt'

@phadej phadej force-pushed the issue-6369-install-pkgname-exename branch from ffc9154 to c5f777c Compare March 11, 2020 22:59
@phadej phadej changed the title Resolve #6369 and #6393: Allow cabal v2-install pkgname:exename or http://example.com/package.tar.gz Resolve #6369 and #6393: Allow cabal v2-install pkgname:exename or http://example.com/package.tar.gz(#sha256=abcde...) Mar 11, 2020
@phadej phadej merged commit 2e03231 into haskell:master Mar 12, 2020
@phadej phadej deleted the issue-6369-install-pkgname-exename branch March 12, 2020 09:05
@phadej phadej mentioned this pull request Apr 1, 2020
@phadej phadej mentioned this pull request Jul 10, 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant