<div dir="ltr">Hi,<br><br>> Running `stack build --prefetch --dry-run` lists my local packages as "Would build". How would I get source tarballs of my dependencies and how would I build them on an offline machine?<br><br>I think that means you've already got all the source tarballs that you would need.<br><br>On a reasonably clean machine (no $HOME/.stack directory at least), running `stack setup` and then `stack build --prefetch --dry-run` does a bunch of downloading (but nothing else), such that I can switch to aeroplane mode and then run `stack build` without needing further network access. There's a full transcript below. This certainly seems to imply that all the source tarballs are available locally - I think they go somewhere in $HOME/.stack. What I think this means is that if you do this then copy your $HOME/.stack across to the isolated machine then that should be everything you need in order to build everything.<div><br></div><div>HTH,</div><div><br></div><div>David</div><div><br><div><div><br></div><div><br>$ stack setup<br>Downloaded lts-3.6 build plan.<br>Fetching package index ...remote: Counting objects: 233532, done.<br>remote: Compressing objects: 100% (188553/188553), done.<br>remote: Total 233532 (delta 62098), reused 185305 (delta 42595), pack-reused 0<br>Receiving objects: 100% (233532/233532), 55.26 MiB | 1.97 MiB/s, done.<br>Resolving deltas: 100% (62098/62098), completed with 1 local objects.<br>From <a href="https://github.com/commercialhaskell/all-cabal-hashes">https://github.com/commercialhaskell/all-cabal-hashes</a><br>* [new tag] current-hackage -> current-hackage Fetched package index.<br>Populated index cache.<br>Preparing to install GHC to an isolated location.<br>This will not interfere with any system-level installation.<br>Downloaded ghc-7.10.2.<br>Installed GHC.<br>stack will use a locally installed GHC<br>For more information on paths, see 'stack path' and 'stack exec env'<br>To use this GHC and packages outside of a project, consider using:<br>stack ghc, stack ghci, stack runghc, or stack exec<br>$ stack build --prefetch --dry-run<br>asn1-parse-0.9.1: download<br>ansi-terminal-0.6.2.3: download<br>asn1-types-0.3.0: download<br>aeson-0.8.0.2: download<br>async-2.0.2: download<br>attoparsec-0.12.1.6: download<br>ansi-wl-pprint-0.6.7.3: download<br>base64-bytestring-1.0.0.1: download<br>blaze-builder-0.4.0.1: download<br>byteable-0.1.1: download<br>asn1-encoding-0.9.2: download<br>case-insensitive-1.2.0.4: download<br>cookie-0.4.1.6: download<br>cereal-0.4.1.1: download<br>connection-0.2.5: download<br>cryptonite-0.6: download<br>data-default-class-0.0.1: download<br>exceptions-0.8.0.2: download<br>dlist-0.7.1.2: download<br>http-client-tls-0.2.2: download<br>hourglass-0.2.9: download<br>http-client-0.4.23: download<br>hashable-1.2.3.3: download<br>memory-0.7: download<br>http-types-0.8.6: download<br>mime-types-0.1.0.6: download<br>network-2.6.2.1: download<br>mtl-2.2.1: download<br>old-locale-1.0.0.7: download<br>optparse-applicative-0.11.0.2: download<br>network-uri-2.6.0.3: download<br>parsec-3.1.9: download<br>pem-0.2.2: download<br>scientific-0.3.3.8: download<br>primitive-0.6: download<br>socks-0.5.4: download<br>stm-2.4.4: download<br>random-1.1: download<br>syb-0.5.1: download<br>text-1.2.1.3: download<br>streaming-commons-0.1.13: download<br>transformers-compat-0.4.0.4: download<br>unordered-containers-0.2.5.1: download<br>tls-1.3.2: download<br>x509-1.6.1: download<br>x509-validation-1.6.2: download<br>x509-store-1.6.1: download<br>vector-0.10.12.3: download<br>zlib-0.5.4.2: download<br>x509-system-1.6.1: download<br>No packages would be unregistered.<br><br>Would build:<br>aeson-0.8.0.2: database=snapshot, source=package index, after: attoparsec-0.12.1.6,dlist-0.7.1.2,hashable-1.2.3.3,mtl-2.2.1,scientific-0.3.3.8,syb-0.5.1,text-1.2.1.3,unordered-containers-0.2.5.1,vector-0.10.12.3<br>ansi-terminal-0.6.2.3: database=snapshot, source=package index<br>ansi-wl-pprint-0.6.7.3: database=snapshot, source=package index, after: ansi-terminal-0.6.2.3<br>asn1-encoding-0.9.2: database=snapshot, source=package index, after: asn1-types-0.3.0,hourglass-0.2.9,mtl-2.2.1<br>asn1-parse-0.9.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,mtl-2.2.1<br>asn1-types-0.3.0: database=snapshot, source=package index, after: hourglass-0.2.9<br>async-2.0.2: database=snapshot, source=package index, after: stm-2.4.4<br>attoparsec-0.12.1.6: database=snapshot, source=package index, after: scientific-0.3.3.8,text-1.2.1.3<br>autoharvest-0.1.0.0: database=local, source=/home/davidturner/autoharvest/, after: aeson-0.8.0.2,http-client-0.4.23,http-client-tls-0.2.2,http-types-0.8.6,optparse-applicative-0.11.0.2,text-1.2.1.3<br>base64-bytestring-1.0.0.1: database=snapshot, source=package index<br>blaze-builder-0.4.0.1: database=snapshot, source=package index, after: text-1.2.1.3<br>byteable-0.1.1: database=snapshot, source=package index<br>case-insensitive-1.2.0.4: database=snapshot, source=package index, after: hashable-1.2.3.3,text-1.2.1.3<br>cereal-0.4.1.1: database=snapshot, source=package index<br>connection-0.2.5: database=snapshot, source=package index, after: byteable-0.1.1,data-default-class-0.0.1,network-2.6.2.1,socks-0.5.4,tls-1.3.2,x509-1.6.1,x509-store-1.6.1,x509-system-1.6.1,x509-validation-1.6.2<br>cookie-0.4.1.6: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,data-default-class-0.0.1,old-locale-1.0.0.7,text-1.2.1.3<br>cryptonite-0.6: database=snapshot, source=package index, after: memory-0.7<br>data-default-class-0.0.1: database=snapshot, source=package index<br>dlist-0.7.1.2: database=snapshot, source=package index<br>exceptions-0.8.0.2: database=snapshot, source=package index, after: mtl-2.2.1,stm-2.4.4,transformers-compat-0.4.0.4<br>hashable-1.2.3.3: database=snapshot, source=package index, after: text-1.2.1.3<br>hourglass-0.2.9: database=snapshot, source=package index<br>http-client-0.4.23: database=snapshot, source=package index, after: base64-bytestring-1.0.0.1,blaze-builder-0.4.0.1,case-insensitive-1.2.0.4,cookie-0.4.1.6,data-default-class-0.0.1,exceptions-0.8.0.2,http-types-0.8.6,mime-types-0.1.0.6,network-2.6.2.1,network-uri-2.6.0.3,random-1.1,streaming-commons-0.1.13,text-1.2.1.3<br>http-client-tls-0.2.2: database=snapshot, source=package index, after: connection-0.2.5,data-default-class-0.0.1,http-client-0.4.23,network-2.6.2.1,tls-1.3.2<br>http-types-0.8.6: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,case-insensitive-1.2.0.4,text-1.2.1.3<br>memory-0.7: database=snapshot, source=package index<br>mime-types-0.1.0.6: database=snapshot, source=package index, after: text-1.2.1.3<br>mtl-2.2.1: database=snapshot, source=package index<br>network-2.6.2.1: database=snapshot, source=package index<br>network-uri-2.6.0.3: database=snapshot, source=package index, after: parsec-3.1.9<br>old-locale-1.0.0.7: database=snapshot, source=package index<br>optparse-applicative-0.11.0.2: database=snapshot, source=package index, after: ansi-wl-pprint-0.6.7.3,transformers-compat-0.4.0.4<br>parsec-3.1.9: database=snapshot, source=package index, after: mtl-2.2.1,text-1.2.1.3<br>pem-0.2.2: database=snapshot, source=package index, after: base64-bytestring-1.0.0.1,mtl-2.2.1<br>primitive-0.6: database=snapshot, source=package index<br>random-1.1: database=snapshot, source=package index<br>scientific-0.3.3.8: database=snapshot, source=package index, after: hashable-1.2.3.3,text-1.2.1.3<br>socks-0.5.4: database=snapshot, source=package index, after: cereal-0.4.1.1,network-2.6.2.1<br>stm-2.4.4: database=snapshot, source=package index<br>streaming-commons-0.1.13: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,network-2.6.2.1,random-1.1,stm-2.4.4,text-1.2.1.3,zlib-0.5.4.2<br>syb-0.5.1: database=snapshot, source=package index<br>text-1.2.1.3: database=snapshot, source=package index<br>tls-1.3.2: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,async-2.0.2,cereal-0.4.1.1,cryptonite-0.6,data-default-class-0.0.1,memory-0.7,mtl-2.2.1,network-2.6.2.1,x509-1.6.1,x509-store-1.6.1,x509-validation-1.6.2<br>transformers-compat-0.4.0.4: database=snapshot, source=package index<br>unordered-containers-0.2.5.1: database=snapshot, source=package index, after: hashable-1.2.3.3<br>vector-0.10.12.3: database=snapshot, source=package index, after: primitive-0.6<br>x509-1.6.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-parse-0.9.1,asn1-types-0.3.0,cryptonite-0.6,hourglass-0.2.9,memory-0.7,mtl-2.2.1,pem-0.2.2<br>x509-store-1.6.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,cryptonite-0.6,mtl-2.2.1,pem-0.2.2,x509-1.6.1<br>x509-system-1.6.1: database=snapshot, source=package index, after: mtl-2.2.1,pem-0.2.2,x509-1.6.1,x509-store-1.6.1<br>x509-validation-1.6.2: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,byteable-0.1.1,cryptonite-0.6,data-default-class-0.0.1,hourglass-0.2.9,memory-0.7,mtl-2.2.1,pem-0.2.2,x509-1.6.1,x509-store-1.6.1<br>zlib-0.5.4.2: database=snapshot, source=package index<br><br>No executables to be installed.<br><br><br><br><br>On 24 November 2016 at 12:34, Jan von Löwenstein <<a href="mailto:jan.loewenstein@gmail.com">jan.loewenstein@gmail.com</a>> wrote:<br>><br>> Thanks for all the responses.<br>><br>> @Ivan<br>> I couldn't yet find an option in stack to point to local source tarballs. Custom snapshots at least currently only support Hackage packages and that was the closest I found.<br>><br>> I briefly looked into `stack unpack <package>`, that might indeed provide a workable solution. Although options other than the list of packages would have to be duplicated between my "normal" stack.yaml and the one I use to enable offline compilation.<br>><br>> @Tobias<br>> I already thought about that, yackage sounds like a package that would help implement it. Not sure if I like that option very much though.<br>><br>> @David<br>> Not sure if I get your proposal.<br>> Running `stack build --prefetch --dry-run` lists my local packages as "Would build". How would I get source tarballs of my dependencies and how would I build them on an offline machine?<br>><br>> Best<br>> Jan<br>><br>> David Turner <<a href="mailto:dct25-561bs@mythic-beasts.com">dct25-561bs@mythic-beasts.com</a>> schrieb am Do., 24. Nov. 2016 um 10:13 Uhr:<br>>><br>>> Hi,<br>>><br>>> Does<br>>><br>>>     stack build --prefetch --dry-run<br>>><br>>> get close to what you want? That seems to download all the necessary packages, and by using stack you get the ability to share compiled dependencies between packages.<br>>><br>>> Cheers,<br>>><br>>> David<br>>><br>>> On 24 November 2016 at 06:57, Jan von Löwenstein <<a href="mailto:jan.loewenstein@gmail.com">jan.loewenstein@gmail.com</a>> wrote:<br>>>><br>>>> Hi,<br>>>><br>>>> Consider the following use case:<br>>>> I have to ship a Haskell application as source, bundled with its dependencies and a script that can produce the binary on a machine without internet connectivity.<br>>>><br>>>> Is that possible with Stack or Cabal?<br>>>> Any pointers would be much appreciated.<br>>>>  <br>>>> Ideally I would like to build each dependency package individually. That way I could cache results per Haskell package and don't need to rebuild dependencies until they actually change.<br>>>><br>>>> Best<br>>>> Jan<br>>>><br>>>> _______________________________________________<br>>>> Haskell-Cafe mailing list<br>>>> To (un)subscribe, modify options or view archives go to:<br>>>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>>>> Only members subscribed via the mailman list are allowed to post.</div></div></div></div>