#67696 closed defect (fixed)

ghc-ppc-bootstrap @7.0.4: Hardcoded references to /opt/local and 7.0.4

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: ghc-ppc-bootstrap

Description

Where the Portfile says:

        reinplace "s|/Library/Frameworks/GHC.framework/Versions/7.0.4-powerpc/usr|/opt/local/share/ghc-ppc-bootstrap|" \

/opt/local should not be hardcoded; use ${prefix}; and 7.0.4 would be better replaced with ${version} to avoid needing to remember to change it every time the version is increased. And in a regular expression . means "any character" so when you want to match a literal period it should be preceded by a \. The quotemeta procedure can be used to add backslashes before special regular expression characters. You might also wish to use ${name} here instead of repeating the name of the port, in case the name ever changes or this code needs to be copied to another port. So it should probably be changed to:

        reinplace "s|[quotemeta /Library/Frameworks/GHC.framework/Versions/${version}-powerpc/usr]|${prefix}/share/${name}|" \

And where in the Portfile it says:

        reinplace "s|/Library|/opt/local/Library|" \

if what you're replacing is references to /Library/Frameworks then it should be changed to:

        reinplace "s|/Library/Frameworks|${frameworks_dir}|" \

or if you're replacing references to paths in /Library other than /Library/Frameworks, then:

        reinplace "s|/Library|${prefix}/Library|" \

There are other places in the Portfile where 7.0.4 could be changed as well.

Change History (2)

comment:1 Changed 17 months ago by barracuda156

Thank you, hardcoded prefix is clearly a mistake, I will fix it.

Version in this particular case is fine (though using ${version} is fine either). It is the last binary supplied by Haskell upstream, so it won’t be increased. (I think this port will be pegged to 7.0.4 in any case. If we fix a newer GHC, perhaps we will need to use our own boot binaries, but that won’t need this port to be changed. Let it stay with the last kind-of-official release for PPC.)

comment:2 Changed 15 months ago by barracuda156

Resolution: fixed
Status: assignedclosed

In 4d6f7cf1d38f7f10156528dbb1b90a0c7b098123/macports-ports (master):

ghc-ppc-bootstrap: do not hardcode prefix and version

Fixes: #67696

Note: See TracTickets for help on using tickets.