Opened 3 years ago
Closed 3 years ago
#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 3 years ago by barracuda156
comment:2 Changed 3 years ago by barracuda156
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

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.)