1 | # -*- 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 |
---|
2 | # $Id: $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | name esorepo |
---|
7 | version 1.0 |
---|
8 | categories science |
---|
9 | license GPL |
---|
10 | platforms darwin |
---|
11 | supported_archs noarch |
---|
12 | maintainers eso.org:usd-help |
---|
13 | |
---|
14 | description ESO repository of software for astronomical data reduction |
---|
15 | |
---|
16 | long_description \ |
---|
17 | The European Southern Observatory (ESO) maintains and distributes a number \ |
---|
18 | of open source software packages (e.g. data reduction pipelines and front-end \ |
---|
19 | tools) for the astronomical science community. This port provides a convenient \ |
---|
20 | configuration mechanism to add an additional repository URL to allow further \ |
---|
21 | installation of ESO software via MacPorts. |
---|
22 | |
---|
23 | homepage http://www.eso.org/sci/software |
---|
24 | master_sites ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/ |
---|
25 | |
---|
26 | fetch {} |
---|
27 | checksum {} |
---|
28 | test {} |
---|
29 | |
---|
30 | configure { |
---|
31 | set config_file [open ${prefix}/etc/macports/sources.conf r] |
---|
32 | set config_data [read ${config_file}] |
---|
33 | close ${config_file} |
---|
34 | set already_in_sources 0 |
---|
35 | if {[regexp -line {^ftp://ftp\.eso\.org/pub/dfs/pipelines/repositories/macports/ports\.tar$} ${config_data}]} { |
---|
36 | set already_in_sources 1 |
---|
37 | ui_error "${prefix}/etc/macports/sources.conf already contains a reference to ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/ports.tar." |
---|
38 | } |
---|
39 | set config_file [open ${prefix}/etc/macports/archive_sites.conf r] |
---|
40 | set config_data [read ${config_file}] |
---|
41 | close ${config_file} |
---|
42 | set already_in_archive_sites 0 |
---|
43 | if {[regexp -line {^urls\s+ftp://ftp\.eso\.org/pub/dfs/pipelines/repositories/macports/packages$} ${config_data}]} { |
---|
44 | set already_in_archive_sites 1 |
---|
45 | ui_error "${prefix}/etc/macports/archive_sites.conf already contains a reference to ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/packages." |
---|
46 | } |
---|
47 | set config_file [open ${prefix}/etc/macports/pubkeys.conf r] |
---|
48 | set config_data [read ${config_file}] |
---|
49 | close ${config_file} |
---|
50 | set already_in_pubkeys 0 |
---|
51 | # Check for the public key reference with a loop rather than regexp, since ${prefix} may contain one of '[](){}?.\' |
---|
52 | foreach line [split ${config_data} "\n"] { |
---|
53 | if {"${line}" == "${prefix}/share/${name}/eso-pubkey.pem"} { |
---|
54 | set already_in_pubkeys 1 |
---|
55 | ui_error "${prefix}/etc/macports/pubkeys.conf already contains a reference to ${prefix}/share/${name}/eso-pubkey.pem." |
---|
56 | break |
---|
57 | } |
---|
58 | } |
---|
59 | if {${already_in_sources} || ${already_in_archive_sites} || ${already_in_pubkeys}} { |
---|
60 | ui_error "A number of references to the ESO repository have already been configured." |
---|
61 | ui_error "Thus, either the repository is already accessible, in which case this port is" |
---|
62 | ui_error "not necessary, or the configuration is not complete." |
---|
63 | ui_error "If you want to add the ESO repository to MacPorts with this port then remove" |
---|
64 | ui_error "all references mentioned above and try install this port again." |
---|
65 | return -code error "ESO repository might have already been configured manually." |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | build { |
---|
70 | set key_file [open "${workpath}/eso-pubkey.pem" w] |
---|
71 | puts ${key_file} "-----BEGIN PUBLIC KEY-----" |
---|
72 | puts ${key_file} "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy2Au5qRNn/zoRRZ7rdsn" |
---|
73 | puts ${key_file} "g3lbrM33Iz3xew4yZD5L6LI69qVVfmaUsELreeK+bZAf8bLl5+HYHHvM/pBZq/+6" |
---|
74 | puts ${key_file} "LBf+NnESVwmKfhEppHim3MqRNyTfSOJAM+J1xt1/dvZkBX8ehZO8piRRaKUPzauW" |
---|
75 | puts ${key_file} "WhahV417jD37AWKXlRCNPxUtgEk7kRrMQuP4olWWVul+m7piGrDMzQsAOtvEMX5R" |
---|
76 | puts ${key_file} "J5Ygr3iZNq8WSXhAMqfm6cksxq7kMa8sfpw8lU1jXKfN4wREH3w2oJohkkTYFqUq" |
---|
77 | puts ${key_file} "0FBnqBkGZlv5e1FUEFW1rnvUpbzOxgDgfdOKwzqNWw2EGl6baQT63iIqa752kCE7" |
---|
78 | puts ${key_file} "SwIDAQAB" |
---|
79 | puts ${key_file} "-----END PUBLIC KEY-----" |
---|
80 | close ${key_file} |
---|
81 | } |
---|
82 | |
---|
83 | destroot { |
---|
84 | xinstall -m 755 -d ${destroot}${prefix}/share/${name} |
---|
85 | xinstall -m 644 ${workpath}/eso-pubkey.pem ${destroot}${prefix}/share/${name}/eso-pubkey.pem |
---|
86 | } |
---|
87 | |
---|
88 | pre-activate { |
---|
89 | set config_file [open ${prefix}/etc/macports/sources.conf a] |
---|
90 | puts ${config_file} "# ESO MacPorts Portfile source repository (automatically added by ${name})." |
---|
91 | puts ${config_file} "ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/ports.tar" |
---|
92 | close ${config_file} |
---|
93 | set config_file [open ${prefix}/etc/macports/archive_sites.conf a] |
---|
94 | puts ${config_file} "# ESO MacPorts binary package repository (automatically added by ${name})." |
---|
95 | puts ${config_file} "name ESO repository" |
---|
96 | puts ${config_file} "urls ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/packages" |
---|
97 | close ${config_file} |
---|
98 | set config_file [open ${prefix}/etc/macports/pubkeys.conf a] |
---|
99 | puts ${config_file} "# ESO RSA public signature key (automatically added by ${name})." |
---|
100 | puts ${config_file} "${prefix}/share/${name}/eso-pubkey.pem" |
---|
101 | close ${config_file} |
---|
102 | } |
---|
103 | |
---|
104 | post-activate { |
---|
105 | ui_msg "*** Please run 'sudo port sync' to synchronise with the ESO repository. ***" |
---|
106 | } |
---|
107 | |
---|
108 | post-deactivate { |
---|
109 | reinplace -E "/^# ESO MacPorts Portfile source repository \\(automatically added by ${name}\\)\\.$/,/^ftp:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/macports\\/ports\\.tar$/d" ${prefix}/etc/macports/sources.conf |
---|
110 | reinplace -E "/^# ESO MacPorts binary package repository \\(automatically added by ${name}\\)\\.$/,/^urls ftp:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/macports\\/packages/d" ${prefix}/etc/macports/archive_sites.conf |
---|
111 | reinplace -E "/^# ESO RSA public signature key \\(automatically added by ${name}\\)\\.$/,/^\[^#]*\\/share\\/${name}\\/eso-pubkey\\.pem$/d" ${prefix}/etc/macports/pubkeys.conf |
---|
112 | } |
---|
113 | |
---|