hackage-diff icon indicating copy to clipboard operation
hackage-diff copied to clipboard

Parsehs mode doesn't use the right locations

Open mightybyte opened this issue 8 years ago • 5 comments

When running hackage-diff --mode=parsehs xmlhtml 0.2.2 0.2.4 I get the following output:

Downloading xmlhtml-0.2.2...
Downloading xmlhtml-0.2.4...
Processing /var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.2...
  Parsing Text.XmlHtml
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.2/Text/XmlHtml.hs'
  Parsing Text.XmlHtml.Cursor
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.2/Text/XmlHtml/Cursor.hs'
  Parsing Text.XmlHtml.HTML.Meta
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.2/Text/XmlHtml/HTML/Meta.hs'
  Parsing Text.Blaze.Renderer.XmlHtml
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.2/Text/Blaze/Renderer/XmlHtml.hs'
Processing /var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.4...
  Parsing Text.XmlHtml
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.4/Text/XmlHtml.hs'
  Parsing Text.XmlHtml.Cursor
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.4/Text/XmlHtml/Cursor.hs'
  Parsing Text.XmlHtml.HTML.Meta
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.4/Text/XmlHtml/HTML/Meta.hs'
  Parsing Text.Blaze.Renderer.XmlHtml
    Can't open source file '/var/folders/yw/4lyc2l_n51z601wqjnyc9vvr0000gn/T/hackage-diff/xmlhtml-0.2.4/Text/Blaze/Renderer/XmlHtml.hs'

--- Diff for | 0.2.2 → 0.2.4 | ---

It looks like it's looking for Text/XmlHtml.hs but it should be looking for src/Text/XmlHtml.hs.

mightybyte avatar Aug 14 '17 16:08 mightybyte

The parsehs mode is basically only there for historical reasons. It was the first attempt at solving this problem. Parsing Haskell out of context doesn't work well due to the pre-processor and language extensions. The Hoogle based modes are more useful. Probably not worth fixing this mode, I'd rather remove it.

blitzcode avatar Aug 15 '17 09:08 blitzcode

Hmmm yeah, I definitely understand that. However, my main use case for this tool is comparing my current code to what is released on hackage to check whether I need to do a major or minor version bump. To do this you have to use parsehs mode.

mightybyte avatar Aug 15 '17 14:08 mightybyte

Yes, I added the message to tell you if breaking changes were detected because people told me they like that feature. Of course, for your own code you can of course chose not to use the CPP and don't put language options in the .cabal etc. and the Haskell parser might do am OK job then. For local packages you could always use builddb or specify a Hoogle DB you build yourself.

blitzcode avatar Aug 15 '17 14:08 blitzcode

I tried using builddb locally but it didn't work.

$ hackage-diff --mode=builddb xmlhtml 0.2.4 ~/haskell/xmlhtml/
'/Users/mightybyte/haskell/xmlhtml/' is not a valid version string (1.0[.0[.0]]) or database path

mightybyte avatar Aug 15 '17 15:08 mightybyte

My memory is real hazy here, but that might be one of the cases not covered. I think I added the builddb thing initially because Hackage had a problem and Hoogle DBs were missing. You might need to build the Hoogle DB yourself for the local package and specify its path.

blitzcode avatar Aug 15 '17 15:08 blitzcode