Patch source, then pickup compile

Hi, I’m trying to install Hakyll within a cabal sandbox. The issue I’m running into is that the current version of Pandoc doesn’t build because of this bug: https://github.com/jgm/pandoc/issues/1590 The bug is a simple fix, and is fixed on github, but not in the version on hackage. I’d like to use ‘cabal get’ to download the source, manually fix the source, then compile. The question I have is how do I pick up the installation process after fixing the source? So far this is what I’ve done: $ mkdir hakyll $ cabal update $ cd hakyll $ cabal sandbox init --sandbox . $ cabal install -j hakyll [this is the spot where pandoc fails to install] $ cabal get pandoc-1.13.1 $ cd pandoc-1.13.1/ [patch the source] At this point I need to resume the compilation and installation process. How do I do that? Do I move back up to the parent directory and then issue the 'cabal install -j hakyll’ command again? Thanks, James

On Fri, Sep 19, 2014 at 9:48 PM, James Toll
At this point I need to resume the compilation and installation process. How do I do that? Do I move back up to the parent directory and then issue the 'cabal install -j hakyll’ command again?
"cabal install -j" without a package name should install the package in the current directory as it is. Specifying a package name will cause that package to be downloaded from Hackage, which in this case you don't want. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Sep 19, 2014, at 8:54 PM, Brandon Allbery
On Fri, Sep 19, 2014 at 9:48 PM, James Toll
wrote: At this point I need to resume the compilation and installation process. How do I do that? Do I move back up to the parent directory and then issue the 'cabal install -j hakyll’ command again? "cabal install -j" without a package name should install the package in the current directory as it is. Specifying a package name will cause that package to be downloaded from Hackage, which in this case you don't want.
Thank you for your suggestion. I think you're saying that I should ‘cabal install -j’ from within the pandoc-1.13.1 directory to build pandoc. But then I will still need to build hakyll, so do I cd up to the hakyll parent directory and cabal install -j from there as well? Thanks, James

On Fri, Sep 19, 2014 at 10:03 PM, James Toll
Thank you for your suggestion. I think you're saying that I should ‘cabal install -j’ from within the pandoc-1.13.1 directory to build pandoc. But then I will still need to build hakyll, so do I cd up to the hakyll parent directory and cabal install -j from there as well?
Just "cabal install -j hakyll" as usual. It'll see the installed pandoc and, as long as the version is compatible, not reinstall it. It should give you a warning if it's incompatible. In that case, you'll need to ask the hakyll folks and possibly have to install whatever package requires it manually in the same way you are installing pandoc, but in this case you would just be editing the cabal file to fix the version. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Sep 19, 2014, at 9:06 PM, Brandon Allbery
On Fri, Sep 19, 2014 at 10:03 PM, James Toll
wrote: Thank you for your suggestion. I think you're saying that I should ‘cabal install -j’ from within the pandoc-1.13.1 directory to build pandoc. But then I will still need to build hakyll, so do I cd up to the hakyll parent directory and cabal install -j from there as well? Just "cabal install -j hakyll" as usual. It'll see the installed pandoc and, as long as the version is compatible, not reinstall it. It should give you a warning if it's incompatible. In that case, you'll need to ask the hakyll folks and possibly have to install whatever package requires it manually in the same way you are installing pandoc, but in this case you would just be editing the cabal file to fix the version.
Unfortunately this isn’t working. The pandoc build appears to work with the patched source, but then the hakyll build fails. If I’m reading this properly, it appears that pandoc is not getting installed in the sandbox. Then it appears that hakyll is not finding the successful pandoc build (probably because it wasn’t installed to the sandbox) and is trying to build pandoc again, using un-patched code and failing with the same original error. Here is the output, truncated a bit during the pandoc build. Any suggestions on how to fix this? Thanks. James [james ~/src/haskell/sandboxes/hakyll]$ cd pandoc-1.13.1/ [james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cabal install -j Resolving dependencies... In order, the following will be installed: pandoc-1.13.1 -network-uri (reinstall) Warning: Note that reinstalls are always dangerous. Continuing anyway... Configuring pandoc-1.13.1... Building pandoc-1.13.1... Installed pandoc-1.13.1 Updating documentation index /Users/james/Library/Haskell/share/doc/index.html [james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cd .. [james ~/src/haskell/sandboxes/hakyll]$ cabal install -j hakyll Resolving dependencies... Notice: installing into a sandbox located at /Users/james/src/haskell/sandboxes/hakyll Configuring pandoc-1.13.1... Building pandoc-1.13.1... Failed to install pandoc-1.13.1 Build log ( /Users/james/src/haskell/sandboxes/hakyll/logs/pandoc-1.13.1.log ): [1 of 1] Compiling Main ( /var/folders/jl/h90f3bxs7hxb389cvjdc6k5w0000gn/T/pandoc-1.13.1-84931/pandoc-1.13.1/dist/dist-sandbox-8fe59d82/setup/setup.hs, /var/folders/jl/h90f3bxs7hxb389cvjdc6k5w0000gn/T/pandoc-1.13.1-84931/pandoc-1.13.1/dist/dist-sandbox-8fe59d82/setup/Main.o ) Linking /var/folders/jl/h90f3bxs7hxb389cvjdc6k5w0000gn/T/pandoc-1.13.1-84931/pandoc-1.13.1/dist/dist-sandbox-8fe59d82/setup/setup ... Configuring pandoc-1.13.1... Building pandoc-1.13.1... Preprocessing library pandoc-1.13.1... [ 1 of 67] Compiling Text.Pandoc.Asciify etc . . . [19 of 67] Compiling Text.Pandoc.Shared ( src/Text/Pandoc/Shared.hs, dist/dist-sandbox-8fe59d82/build/Text/Pandoc/Shared.o ) src/Text/Pandoc/Shared.hs:808:55: Not in scope: ‘toChunks’ cabal: Error: some packages failed to install: hakyll-4.5.5.0 depends on pandoc-1.13.1 which failed to install. pandoc-1.13.1 failed during the building phase. The exception was: ExitFailure 1 pandoc-citeproc-0.4.0.1 depends on pandoc-1.13.1 which failed to install.

On Sat, Sep 20, 2014 at 12:01 AM, James Toll
[james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cabal install -j Resolving dependencies... In order, the following will be installed:
This sounds like it did not indeed install in the sandbox (compare the notice after "Resolving dependencies" in the hakyll install). Unfortunately I don't know what follows from here; it sounds like a cabal bug to me, but maybe being in the patched pandoc source directory keeps it from seeing the sandbox, in which case maybe there's an option to point to a specific sandbox for installs? (I still don't have a working Haskell install on my new machine, and am not sure at this point when I'll be able to get to it, sigh.) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Sep 19, 2014, at 11:05 PM, Brandon Allbery
On Sat, Sep 20, 2014 at 12:01 AM, James Toll
wrote: [james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cabal install -j Resolving dependencies... In order, the following will be installed: This sounds like it did not indeed install in the sandbox (compare the notice after "Resolving dependencies" in the hakyll install). Unfortunately I don't know what follows from here; it sounds like a cabal bug to me, but maybe being in the patched pandoc source directory keeps it from seeing the sandbox, in which case maybe there's an option to point to a specific sandbox for installs? (I still don't have a working Haskell install on my new machine, and am not sure at this point when I'll be able to get to it, sigh.)
Thank you for the help. I wonder if I need to set this up as a shared sandbox so that pandoc gets installed to the sandbox in the parent directory. Kind of like the first example from the “Advanced usage” section of: http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html Anyway, thank you for pointing me in the right direction. James

On Sep 20, 2014, at 12:04 AM, James Toll
On Sep 19, 2014, at 11:05 PM, Brandon Allbery
wrote: On Sat, Sep 20, 2014 at 12:01 AM, James Toll
wrote: [james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cabal install -j Resolving dependencies... In order, the following will be installed: This sounds like it did not indeed install in the sandbox (compare the notice after "Resolving dependencies" in the hakyll install). Unfortunately I don't know what follows from here; it sounds like a cabal bug to me, but maybe being in the patched pandoc source directory keeps it from seeing the sandbox, in which case maybe there's an option to point to a specific sandbox for installs? (I still don't have a working Haskell install on my new machine, and am not sure at this point when I'll be able to get to it, sigh.)
Thank you for the help. I wonder if I need to set this up as a shared sandbox so that pandoc gets installed to the sandbox in the parent directory. Kind of like the first example from the “Advanced usage” section of:
Creating a shared sandbox ended up working. I don’t know it that’s the proper way to do this kind of thing. For reference, here is what I did to get Hakyll installed with the broken Pandoc dependency: $ mkdir hakyll $ cd hakyll $ cabal sandbox init --sandbox . $ cabal install -j hakyll [compilation fails at Pandoc] $ cabal get pandoc-1.13.1 $ cd pandoc-1.13.1/ $ cabal sandbox init --sandbox ../ [make trivial source change] $ cabal install -j $ cd .. $ cabal install -j hakyll I’ve not tested the Hakyll installation yet to see if it works properly, but the installation succeeded. James

I ran into this same build problem myself the other day. I believe that
forcing pandoc to build with the https flag set is a workaround until the
next hackage release. You can add this on the command line with:
$ cabal install pandoc -fhttps
or in the cabal.config file:
constraints: pandoc +https
--
Benjamin Jones
On Fri, Sep 19, 2014 at 11:06 PM, James Toll
On Sep 20, 2014, at 12:04 AM, James Toll
wrote: On Sep 19, 2014, at 11:05 PM, Brandon Allbery
wrote: On Sat, Sep 20, 2014 at 12:01 AM, James Toll
wrote: [james ~/src/haskell/sandboxes/hakyll/pandoc-1.13.1]$ cabal install -j Resolving dependencies... In order, the following will be installed: This sounds like it did not indeed install in the sandbox (compare the notice after "Resolving dependencies" in the hakyll install). Unfortunately I don't know what follows from here; it sounds like a cabal bug to me, but maybe being in the patched pandoc source directory keeps it from seeing the sandbox, in which case maybe there's an option to point to a specific sandbox for installs? (I still don't have a working Haskell install on my new machine, and am not sure at this point when I'll be able to get to it, sigh.)
Thank you for the help. I wonder if I need to set this up as a shared sandbox so that pandoc gets installed to the sandbox in the parent directory. Kind of like the first example from the “Advanced usage” section of:
Creating a shared sandbox ended up working. I don’t know it that’s the proper way to do this kind of thing. For reference, here is what I did to get Hakyll installed with the broken Pandoc dependency:
$ mkdir hakyll $ cd hakyll $ cabal sandbox init --sandbox . $ cabal install -j hakyll [compilation fails at Pandoc] $ cabal get pandoc-1.13.1 $ cd pandoc-1.13.1/ $ cabal sandbox init --sandbox ../ [make trivial source change] $ cabal install -j $ cd .. $ cabal install -j hakyll
I’ve not tested the Hakyll installation yet to see if it works properly, but the installation succeeded.
James
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

I wonder if I need to set this up as a shared sandbox so that pandoc gets installed to the sandbox in the parent directory. Kind of like the first example from the “Advanced usage” section of:
Creating a shared sandbox ended up working. I don’t know it that’s the
Hello, proper way to do this kind of thing. For the moment Benjamin's solution seems the best way to go but, just for the record, I think the command you're looking for might be `cabal sandbox add-source ./your-local-patched-pandoc/` and then `install` (see http://www.haskell.org/cabal/users-guide/installing-packages.html under "Sandboxes: Basic usage" or probably the very same article you referred to, which seems the source for the wiki). -- Nadir

Get (patched) package into a separate dir
$ cabal sandbox add-source /my/patched/library # Add a new add-source dependency
$ cabal install --dependencies-only # Install it into the sandbox
$ cabal build # Build the local package
This way cabal first searches in the add-source dir for any dependency, and
builds it from there. You can add several dirs with patched packages
You can/might have to add constraints in local cabal.config file (in sandboxed
dir) to force cabal to use the latest version of the package
If a file in any add-source dir is changed, cabal will rebuild it automatically
Take a look at cabal user guide
http://www.haskell.org/cabal/users-guide/installing-packages.html
vlatko
-------- Original Message --------
Subject: [Haskell-beginners] Patch source, then pickup compile
From: James Toll
Hi,
I’m trying to install Hakyll within a cabal sandbox. The issue I’m running into is that the current version of Pandoc doesn’t build because of this bug:
https://github.com/jgm/pandoc/issues/1590
The bug is a simple fix, and is fixed on github, but not in the version on hackage. I’d like to use ‘cabal get’ to download the source, manually fix the source, then compile. The question I have is how do I pick up the installation process after fixing the source?
So far this is what I’ve done:
$ mkdir hakyll $ cabal update $ cd hakyll $ cabal sandbox init --sandbox . $ cabal install -j hakyll [this is the spot where pandoc fails to install] $ cabal get pandoc-1.13.1 $ cd pandoc-1.13.1/ [patch the source]
At this point I need to resume the compilation and installation process. How do I do that? Do I move back up to the parent directory and then issue the 'cabal install -j hakyll’ command again?
Thanks,
James _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Sep 20, 2014, at 2:43 AM, Vlatko Basic
Get (patched) package into a separate dir $ cabal sandbox add-source /my/patched/library # Add a new add-source dependency $ cabal install --dependencies-only # Install it into the sandbox $ cabal build # Build the local package
This way cabal first searches in the add-source dir for any dependency, and builds it from there. You can add several dirs with patched packages
You can/might have to add constraints in local cabal.config file (in sandboxed dir) to force cabal to use the latest version of the package
Thanks to you, Nadir, and Benjamin for the follow-up emails explaining the proper way to handle this. From your emails, it sounds like instead of using a shared sandbox, I should have added the Pandoc source using 'cabal sandbox add-source'. What I’m wondering now is what are the implications of the way I managed to get it to work? And whether I should go back and re-do it the way you’ve described. I do have one concern though. The part where you mention that if any of the source files are changed, then cabal will rebuild. I don’t want or need that functionality given that this is supposed to be a temporary work around until the fixed version of Pandoc is in Hackage.
If a file in any add-source dir is changed, cabal will rebuild it automatically
If possible, I might prefer to just delete the pandoc-1.13.1 source subdirectory entirely, as long as it doesn’t mess up the current hakyll installation. Is that possible? If not, in the future, once the version of Pandoc in Hackage has been updated, is it then possible to remove the added source? Thanks, James

Il 20/set/2014 18:58 "James Toll"
I do have one concern though. The part where you mention that if any of
the source files are changed, then cabal will rebuild. I don’t want or need that functionality given that this is supposed to be a temporary work around until the fixed version of Pandoc is in Hackage. According to the wiki ("sandboxes: advanced usage" section) you should use `cabal sandbox add-source --snapshot` "which disables the change tracking".
If possible, I might prefer to just delete the pandoc-1.13.1 source
subdirectory entirely, as long as it doesn’t mess up the current hakyll installation. Is that possible? If not, in the future, once the version of Pandoc in Hackage has been updated, is it then possible to remove the added source? To remove an added source I think the correct sandbox subcommand is `delete-source`. See the --help for more info. -- Nadir

On Sep 20, 2014, at 12:08 PM, Nadir Sampaoli
Il 20/set/2014 18:58 "James Toll"
wrote: I do have one concern though. The part where you mention that if any of the source files are changed, then cabal will rebuild. I don’t want or need that functionality given that this is supposed to be a temporary work around until the fixed version of Pandoc is in Hackage.
According to the wiki ("sandboxes: advanced usage" section) you should use `cabal sandbox add-source --snapshot` "which disables the change tracking".
If possible, I might prefer to just delete the pandoc-1.13.1 source subdirectory entirely, as long as it doesn’t mess up the current hakyll installation. Is that possible? If not, in the future, once the version of Pandoc in Hackage has been updated, is it then possible to remove the added source?
To remove an added source I think the correct sandbox subcommand is `delete-source`. See the --help for more info.
Yes, thank you. The ‘—snapshot' was in the documentation. I should have noticed it. The 'delete-source' doesn’t appear to be in the ‘cabal sandbox —help’ page, although 'cabal sandbox list-sources’ supposedly mentions it once you have local build trees. I'll see if that ends up being the case. Thank you. James

On Sep 20, 2014, at 12:08 PM, Nadir Sampaoli
Il 20/set/2014 18:58 "James Toll"
wrote: I do have one concern though. The part where you mention that if any of the source files are changed, then cabal will rebuild. I don’t want or need that functionality given that this is supposed to be a temporary work around until the fixed version of Pandoc is in Hackage.
According to the wiki ("sandboxes: advanced usage" section) you should use `cabal sandbox add-source --snapshot` "which disables the change tracking".
If possible, I might prefer to just delete the pandoc-1.13.1 source subdirectory entirely, as long as it doesn’t mess up the current hakyll installation. Is that possible? If not, in the future, once the version of Pandoc in Hackage has been updated, is it then possible to remove the added source?
To remove an added source I think the correct sandbox subcommand is `delete-source`. See the --help for more info.
I wish I could say that I got this to work, but I’ve had no success. The problem I’m having is that I can’t even get 'cabal sandbox add-source --snapshot’ to work. This is what I’m trying to do, and the output: $ mkdir hakyll $ cd hakyll $ cabal sandbox init --sandbox . $ cabal install -j hakyll [compilation fails] $ cabal get pandoc-1.13.1 $ cabal sandbox add-source --snapshot pandoc-1.13.1/ cabal: Error: Could not find module: Text.Pandoc.Data with any suffix: ["gc","chs","hsc","x","y","ly","cpphs","hs","lhs”] This last command creates the ’snapshots' directory within the hakyll directory. Snapshots contains an empty subdirectory called ‘pandoc-1.13.1-tmp’. If I then try a different slightly different path to pandoc, it fails, but differently: $ cabal sandbox add-source --snapshot ./pandoc-1.13.1/ cabal: /Users/james/src/haskell/sandboxes/hakyll/snapshots/pandoc-1.13.1: does not exist If I delete the ‘snapshots’ directory, it fails with the first error where it can’t find the module. What am I doing wrong? I’ve tried many different iterations of this. Executing the command from within the pandoc directory, renaming the directory, plus many other variations. Nothing has worked. How is this supposed to work. It just doesn’t seem like it should be this hard. Thanks. James
participants (5)
-
Benjamin Jones
-
Brandon Allbery
-
James Toll
-
Nadir Sampaoli
-
Vlatko Basic