# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 # $Id: $ PortSystem 1.0 name esorepo-testing version 1.2 categories science license GPL-2+ platforms darwin supported_archs noarch maintainers eso.org:usd-help description ESO testing repository of software for astronomical data reduction long_description \ The European Southern Observatory (ESO) maintains and distributes a number \ of open source software packages (e.g. data reduction pipelines and front-end \ tools) for the astronomical science community. This port provides a convenient \ configuration mechanism to add an additional repository URL to allow further \ installation of ESO software via MacPorts. homepage http://www.eso.org/sci/software master_sites https://ftp.eso.org/pub/dfs/pipelines/repositories/testing/macports/ distfiles use_configure no build { set key_file [open "${workpath}/eso-pubkey.pem" w] puts ${key_file} "-----BEGIN PUBLIC KEY-----" puts ${key_file} "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy2Au5qRNn/zoRRZ7rdsn" puts ${key_file} "g3lbrM33Iz3xew4yZD5L6LI69qVVfmaUsELreeK+bZAf8bLl5+HYHHvM/pBZq/+6" puts ${key_file} "LBf+NnESVwmKfhEppHim3MqRNyTfSOJAM+J1xt1/dvZkBX8ehZO8piRRaKUPzauW" puts ${key_file} "WhahV417jD37AWKXlRCNPxUtgEk7kRrMQuP4olWWVul+m7piGrDMzQsAOtvEMX5R" puts ${key_file} "J5Ygr3iZNq8WSXhAMqfm6cksxq7kMa8sfpw8lU1jXKfN4wREH3w2oJohkkTYFqUq" puts ${key_file} "0FBnqBkGZlv5e1FUEFW1rnvUpbzOxgDgfdOKwzqNWw2EGl6baQT63iIqa752kCE7" puts ${key_file} "SwIDAQAB" puts ${key_file} "-----END PUBLIC KEY-----" close ${key_file} } destroot { xinstall -m 755 -d ${destroot}${prefix}/share/${name} xinstall -m 644 ${workpath}/eso-pubkey.pem ${destroot}${prefix}/share/${name}/eso-pubkey.pem } pre-activate { set config_file [open ${prefix}/etc/macports/sources.conf r] set config_data [read ${config_file}] close ${config_file} set already_in_sources 0 if {[regexp -line {ftp\.eso\.org/pub/dfs/pipelines/repositories/testing/macports/ports\.tar$} ${config_data}]} { set already_in_sources 1 ui_error "${prefix}/etc/macports/sources.conf already contains a reference to ftp.eso.org/pub/dfs/pipelines/repositories/testing/macports/ports.tar." } set config_file [open ${prefix}/etc/macports/archive_sites.conf r] set config_data [read ${config_file}] close ${config_file} set already_in_archive_sites 0 if {[regexp -line {ftp\.eso\.org/pub/dfs/pipelines/repositories/testing/macports/packages$} ${config_data}]} { set already_in_archive_sites 1 ui_error "${prefix}/etc/macports/archive_sites.conf already contains a reference to ftp.eso.org/pub/dfs/pipelines/repositories/testing/macports/packages." } set config_file [open ${prefix}/etc/macports/pubkeys.conf r] set config_data [read ${config_file}] close ${config_file} set already_in_pubkeys 0 # Check for the public key reference with a loop rather than regexp, since ${prefix} may contain one of '[](){}?.\' foreach line [split ${config_data} "\n"] { if {"${line}" == "${prefix}/share/${name}/eso-pubkey.pem"} { set already_in_pubkeys 1 ui_error "${prefix}/etc/macports/pubkeys.conf already contains a reference to ${prefix}/share/${name}/eso-pubkey.pem." break } } if {${already_in_sources} || ${already_in_archive_sites} || ${already_in_pubkeys}} { ui_error "A number of references to the ESO repository have already been configured." ui_error "Thus, either the repository is already accessible, in which case this port is" ui_error "not necessary, or the configuration is not complete." ui_error "If you want to add the ESO repository to MacPorts with this port then remove" ui_error "all references mentioned above and try install this port again." return -code error "ESO repository might have already been configured manually." } set config_file [open ${prefix}/etc/macports/sources.conf a] puts ${config_file} "# ESO MacPorts Portfile source repository (automatically added by ${name})." puts ${config_file} "https://ftp.eso.org/pub/dfs/pipelines/repositories/testing/macports/ports.tar" close ${config_file} set config_file [open ${prefix}/etc/macports/archive_sites.conf a] puts ${config_file} "# ESO MacPorts binary package repository (automatically added by ${name})." puts ${config_file} "name ESO testing repository" puts ${config_file} "type tbz2" puts ${config_file} "prefix /opt/local" puts ${config_file} "applications_dir /Applications/MacPorts" puts ${config_file} "frameworks_dir /opt/local/Library/Frameworks" puts ${config_file} "urls https://ftp.eso.org/pub/dfs/pipelines/repositories/testing/macports/packages" close ${config_file} set config_file [open ${prefix}/etc/macports/pubkeys.conf a] puts ${config_file} "# ESO RSA public signature key (automatically added by ${name})." puts ${config_file} "${prefix}/share/${name}/eso-pubkey.pem" close ${config_file} } post-deactivate { reinplace -E "/^# ESO MacPorts Portfile source repository \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ N;/\\nhttps:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/testing\\/macports\\/ports\\.tar\[\[:space:]]*$/d;}" \ ${prefix}/etc/macports/sources.conf reinplace -E "/^# ESO MacPorts binary package repository \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ N;N;N;N;N;N;/\\nurls \[\[:space:]]*https:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/testing\\/macports\\/packages\[\[:space:]]*$/d;}" \ ${prefix}/etc/macports/archive_sites.conf reinplace -E "/^# ESO RSA public signature key \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ N;/\\n\[^#]*\\/share\\/${name}\\/eso-pubkey\\.pem\[\[:space:]]*$/d;}" \ ${prefix}/etc/macports/pubkeys.conf } notes "\ *** Please run 'sudo port sync' to synchronise with the ESO repository. ***"