Ignore:
Timestamp:
Jan 22, 2015, 7:34:32 PM (4 years ago)
Author:
cal@…
Message:

haskell world: revbump everything (including ghc)

  • Clean up remnants left in GHC's package directory that may be left over from previous installations. See for example #46611, which has a log of all the superfluous files left on the buildbots, which should be cleaned up by this.
  • Modify portgroups to register configuration files in $prefix/lib/ghc-7.8.3/package.conf.d/ directly before calling ghc-pkg recache rather than using activation and deactivation scripts that indirectly create these files to avoid the same mess in the future. This way, the state in the package cache directory will always represent the same state MacPorts expects.
  • Simplify and clean up some of the portgroups, especially related to variable substitution in pre-/post-activation hooks.
  • Avoid duplicating most of the code in the haskellplatform 2.0 portgroup and just refer back to the haskell 1.0 portgroup instead.
  • Apply the hook variable substitution cleanup to the local helper functions in the haskell-platform Portfile.

This change

  • should finally fix #46611 and #42082 and all the weird little misconfigurations that would occasionally occur on users' machines
  • adds helpful debugging information (ghc-pkg list, ghc-pkg check) to the main.log in the configure phase.
  • breaks manual installation of haskell packages (e.g. using cabal) in the system directory, because the ghc Portfile will clean out everything that isn't owned by a port in the package cache directory. If this affects you, be advised that you should not be putting stuff MacPorts doesn't know about in MacPorts' prefix. Instead, please use user installations of these packages.
Location:
trunk/dports/_resources/port1.0/group
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/haskell-1.0.tcl

    r131799 r131981  
    3838# This automatically defines name, version, categories, homepage,
    3939# master_sites, distname, and depends_build as appropriate, and sets up
    40 # the configure, build, destroot, and post-activate stages.  It can do
    41 # pre-deactivate if that ever becomes an option in MacPorts.
    42 #
     40# the configure, build, destroot, and post-activate stages.
     41
    4342
    4443# List of supported compilers
     
    4645
    4746# Configuration for each compiler
     47
     48# I'm explicitly *not* determining the GHC version programatically here,
     49# because doing so would allow GHC packages to continue working when
     50# installed from source after a GHC update without a revbump. That's however
     51# not what I want, because it has previously lead to problems when mixing
     52# buildbot packages with locally compiled ones around the time of GHC
     53# updates.
    4854array set haskell.compiler_configuration {
    4955    ghc {port       ghc
     56         version    7.8.3
    5057         compiler   ${prefix}/bin/ghc
    5158         ghc-pkg    ${prefix}/bin/ghc-pkg}
    5259}
    5360
    54 proc haskell.setup {package version {compiler ghc} {register_scripts "yes"}} {
     61proc haskell.setup {package version {compiler ghc} {register_scripts "yes"} {target "standalone"}} {
    5562    global haskell.compiler_list
    5663    global haskell.compiler_configuration
     
    6168    }
    6269    array set compiler_config [lindex [array get haskell.compiler_configuration $compiler] 1]
    63     name                hs-[string tolower ${package}]
     70
     71    if {${target} eq "standalone"} {
     72        # Do not set name when used for haskell platform port, because those
     73        # are subports and cannot touch $name
     74        name            hs-[string tolower ${package}]
     75    }
    6476    version             ${version}
    6577    categories          devel haskell
     
    8294    destroot.destdir
    8395    destroot.target     Setup copy --destdir=${destroot}
    84         if {${register_scripts} == "yes"} {
    85                 post-destroot {
    86                         system "cd ${worksrcpath} && ${configure.cmd} Setup register --gen-script"
    87                         system "cd ${worksrcpath} && ${configure.cmd} Setup unregister --gen-script"
    88                         xinstall -m 755 -d ${destroot}${prefix}/libexec/${name}
    89                         xinstall -m 755 -W ${worksrcpath} register.sh unregister.sh \
    90                                 ${destroot}${prefix}/libexec/${name}
    91                 }
    92                 post-activate {
    93                         system "${prefix}/libexec/${name}/register.sh"
    94                 }
    95                 pre-deactivate {
    96                         # deactivate even if that would break dependent ports; let MacPorts deal with this problem
    97                         system "${prefix}/libexec/${name}/unregister.sh --force"
    98                 }
    99         }
     96    if {${register_scripts} == "yes"} {
     97        # Create the package config, drop it in package.conf.d for the current
     98        # GHC version and run ghc-pkg recache.
     99        # Do not use the Setup register --gen-script and Setup unregister
     100        # --gen-script method to generate scripts and call them during
     101        # activation. It previously caused a mess that was hard to clean up,
     102        # especially since ghc-pkg is pretty stubborn in removing packages when
     103        # there are still dependencies left.
     104
     105        set package_conf_d ${prefix}/lib/ghc-${compiler_config(version)}/package.conf.d/
     106        set generate_pkg_config_cmdline [list \
     107            ${configure.cmd} Setup register \
     108            --gen-pkg-config=${package}-${version}.conf]
     109        set generate_pkg_config_hook [subst {
     110            xinstall -d -m 755 [list ${destroot}${package_conf_d}]
     111            system -W [list ${worksrcpath}] [list $generate_pkg_config_cmdline]
     112            xinstall -m 644 [list ${worksrcpath}/${package}-${version}.conf] \
     113                [list ${destroot}${package_conf_d}]
     114        }]
     115        post-destroot $generate_pkg_config_hook
     116
     117        set ghc_pkg_recache [list [subst ${compiler_config(ghc-pkg)}] recache -v]
     118        set ghc_pkg_recache_hook [subst {
     119            system [list $ghc_pkg_recache]
     120        }]
     121        post-activate $ghc_pkg_recache_hook
     122        post-deactivate $ghc_pkg_recache_hook
     123    }
     124
     125    set ghc_pkg_list  [list [subst ${compiler_config(ghc-pkg)}] list]
     126    set ghc_pkg_check [list [subst ${compiler_config(ghc-pkg)}] check]
    100127
    101128    pre-configure [subst {
     129        global ports_trace
     130
    102131        ui_debug "Listing installed haskell packages"
    103         catch {system "[subst ${compiler_config(ghc-pkg)}] list"}
    104         ui_debug "Running ghc-pkg check"
    105         catch {system "[subst ${compiler_config(ghc-pkg)}] check; exit 1"}
    106    }]
     132        catch {system [list $ghc_pkg_list]}
    107133
    108     livecheck.type      regex
    109     livecheck.url       http://hackage.haskell.org/package/${package}
    110     livecheck.regex     "/package/[quotemeta ${package}]-\[^/\]+/[quotemeta ${package}]-(\[^\"\]+)[quotemeta ${extract.suffix}]"
     134        if [list {![tbool ports_trace]}] {
     135            ui_debug "Running ghc-pkg check"
     136            catch {system [list $ghc_pkg_check]}
     137        } else {
     138            ui_debug "Skipping ghc-pkg check because it generates wrong results in trace mode"
     139        }
     140    }]
     141
     142    if {${target} eq "standalone"} {
     143        livecheck.type      regex
     144        livecheck.url       http://hackage.haskell.org/package/${package}
     145        livecheck.regex     "/package/[quotemeta ${package}]-\[^/\]+/[quotemeta ${package}]-(\[^\"\]+)[quotemeta ${extract.suffix}]"
     146    } else {
     147        # Disable livecheck for haskell platform ports
     148        livecheck.type      none
     149    }
    111150
    112151    universal_variant   no
    113152}
    114 
  • trunk/dports/_resources/port1.0/group/haskellplatform-2.0.tcl

    r106818 r131981  
    3333# PortGroup                 haskell-platform 2.0
    3434# haskellplatform.setup     haskell_package version [register_scripts]
    35 # where haskell_package is the name of the package (eg, digest), version is the
    36 # version for it. This automatically defines name, version, categories,
    37 # homepage, master_sites, distname, and depends_build as appropriate, and sets
    38 # up the configure, build, destroot, and post-activate stages. It can do
    39 # pre-deactivate if that ever becomes an option in MacPorts. register_scripts
    40 # can be used to deactivate installing register.sh and unregister.sh as might be
    41 # needed for non-library parts of the haskell platform. Set it to "no" to
    42 # achieve this; defaults to "yes".
     35# where haskell_package is the name of the package (eg, digest), version is
     36# the version for it. This automatically defines version, categories,
     37# homepage, master_sites, distname, and depends_build as appropriate, and
     38# sets up the configure, build, destroot, and post-activate stages.
     39# register_scripts can be used to deactivate package registration with
     40# haskell's package database and might be needed for non-library parts of the
     41# haskell platform. Set it to "no" to achieve this; defaults to "yes".
     42#
     43# This uses the haskell 1.0 PortGroup internally.
    4344
     45PortGroup       haskell 1.0
    4446
    4547proc haskellplatform.setup {package version {register_scripts "yes"}} {
    46     global homepage prefix configure.cmd configure.cc destroot worksrcpath name master_sites
    47 
    48         # don't set name, that will prevent using this in subports
    49     version             ${version}
    50     categories          devel haskell
    51     homepage            http://hackage.haskell.org/package/${package}
    52     master_sites        http://hackage.haskell.org/packages/archive/${package}/${version}
    53     distname            ${package}-${version}
    54     depends_lib         port:ghc
    55     configure.args      Setup configure \
    56                         --prefix=${prefix} \
    57                         --with-compiler=${prefix}/bin/ghc \
    58                         -v \
    59                         --enable-library-profiling \
    60                                                 --with-gcc=${configure.cc}
    61     configure.cmd       runhaskell
    62     configure.pre_args
    63 
    64     build.cmd           ${configure.cmd}
    65     build.args          Setup build -v
    66     build.target
    67     destroot.cmd        ${configure.cmd}
    68     destroot.destdir
    69     destroot.target     Setup copy --destdir=${destroot}
    70         if {${register_scripts} == "yes"} {
    71                 post-destroot {
    72             system "cd ${worksrcpath} && ${configure.cmd} Setup register --gen-script"
    73             system "cd ${worksrcpath} && ${configure.cmd} Setup unregister --gen-script"
    74             xinstall -m 755 -d ${destroot}${prefix}/libexec/${subport}
    75             xinstall -m 755 -W ${worksrcpath} register.sh unregister.sh \
    76                 ${destroot}${prefix}/libexec/${subport}
    77         }
    78                 post-activate {
    79             system "${prefix}/libexec/${subport}/register.sh"
    80         }
    81         pre-deactivate {
    82             system "${prefix}/libexec/${subport}/unregister.sh"
    83         }
    84         }
    85     universal_variant   no
    86 
    87     livecheck.type      none
     48    haskell.setup   ${package} ${version} ghc ${register_scripts} haskell-platform
    8849}
Note: See TracChangeset for help on using the changeset viewer.