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.1 |
---|
8 | categories science |
---|
9 | license GPL-2+ |
---|
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 | configure {} |
---|
30 | |
---|
31 | build { |
---|
32 | set key_file [open "${workpath}/eso-pubkey.pem" w] |
---|
33 | puts ${key_file} "-----BEGIN PUBLIC KEY-----" |
---|
34 | puts ${key_file} "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy2Au5qRNn/zoRRZ7rdsn" |
---|
35 | puts ${key_file} "g3lbrM33Iz3xew4yZD5L6LI69qVVfmaUsELreeK+bZAf8bLl5+HYHHvM/pBZq/+6" |
---|
36 | puts ${key_file} "LBf+NnESVwmKfhEppHim3MqRNyTfSOJAM+J1xt1/dvZkBX8ehZO8piRRaKUPzauW" |
---|
37 | puts ${key_file} "WhahV417jD37AWKXlRCNPxUtgEk7kRrMQuP4olWWVul+m7piGrDMzQsAOtvEMX5R" |
---|
38 | puts ${key_file} "J5Ygr3iZNq8WSXhAMqfm6cksxq7kMa8sfpw8lU1jXKfN4wREH3w2oJohkkTYFqUq" |
---|
39 | puts ${key_file} "0FBnqBkGZlv5e1FUEFW1rnvUpbzOxgDgfdOKwzqNWw2EGl6baQT63iIqa752kCE7" |
---|
40 | puts ${key_file} "SwIDAQAB" |
---|
41 | puts ${key_file} "-----END PUBLIC KEY-----" |
---|
42 | close ${key_file} |
---|
43 | } |
---|
44 | |
---|
45 | destroot { |
---|
46 | xinstall -m 755 -d ${destroot}${prefix}/share/${name} |
---|
47 | xinstall -m 644 ${workpath}/eso-pubkey.pem ${destroot}${prefix}/share/${name}/eso-pubkey.pem |
---|
48 | } |
---|
49 | |
---|
50 | pre-activate { |
---|
51 | set config_file [open ${prefix}/etc/macports/sources.conf r] |
---|
52 | set config_data [read ${config_file}] |
---|
53 | close ${config_file} |
---|
54 | set already_in_sources 0 |
---|
55 | if {[regexp -line {^ftp://ftp\.eso\.org/pub/dfs/pipelines/repositories/macports/ports\.tar$} ${config_data}]} { |
---|
56 | set already_in_sources 1 |
---|
57 | ui_error "${prefix}/etc/macports/sources.conf already contains a reference to ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/ports.tar." |
---|
58 | } |
---|
59 | set config_file [open ${prefix}/etc/macports/archive_sites.conf r] |
---|
60 | set config_data [read ${config_file}] |
---|
61 | close ${config_file} |
---|
62 | set already_in_archive_sites 0 |
---|
63 | if {[regexp -line {^urls\s+ftp://ftp\.eso\.org/pub/dfs/pipelines/repositories/macports/packages$} ${config_data}]} { |
---|
64 | set already_in_archive_sites 1 |
---|
65 | ui_error "${prefix}/etc/macports/archive_sites.conf already contains a reference to ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/packages." |
---|
66 | } |
---|
67 | set config_file [open ${prefix}/etc/macports/pubkeys.conf r] |
---|
68 | set config_data [read ${config_file}] |
---|
69 | close ${config_file} |
---|
70 | set already_in_pubkeys 0 |
---|
71 | # Check for the public key reference with a loop rather than regexp, since ${prefix} may contain one of '[](){}?.\' |
---|
72 | foreach line [split ${config_data} "\n"] { |
---|
73 | if {"${line}" == "${prefix}/share/${name}/eso-pubkey.pem"} { |
---|
74 | set already_in_pubkeys 1 |
---|
75 | ui_error "${prefix}/etc/macports/pubkeys.conf already contains a reference to ${prefix}/share/${name}/eso-pubkey.pem." |
---|
76 | break |
---|
77 | } |
---|
78 | } |
---|
79 | if {${already_in_sources} || ${already_in_archive_sites} || ${already_in_pubkeys}} { |
---|
80 | ui_error "A number of references to the ESO repository have already been configured." |
---|
81 | ui_error "Thus, either the repository is already accessible, in which case this port is" |
---|
82 | ui_error "not necessary, or the configuration is not complete." |
---|
83 | ui_error "If you want to add the ESO repository to MacPorts with this port then remove" |
---|
84 | ui_error "all references mentioned above and try install this port again." |
---|
85 | return -code error "ESO repository might have already been configured manually." |
---|
86 | } |
---|
87 | set config_file [open ${prefix}/etc/macports/sources.conf a] |
---|
88 | puts ${config_file} "# ESO MacPorts Portfile source repository (automatically added by ${name})." |
---|
89 | puts ${config_file} "ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/ports.tar" |
---|
90 | close ${config_file} |
---|
91 | set config_file [open ${prefix}/etc/macports/archive_sites.conf a] |
---|
92 | puts ${config_file} "# ESO MacPorts binary package repository (automatically added by ${name})." |
---|
93 | puts ${config_file} "name ESO repository" |
---|
94 | puts ${config_file} "type tbz2" |
---|
95 | puts ${config_file} "prefix /opt/local" |
---|
96 | puts ${config_file} "applications_dir /Applications/MacPorts" |
---|
97 | puts ${config_file} "frameworks_dir /opt/local/Library/Frameworks" |
---|
98 | puts ${config_file} "urls ftp://ftp.eso.org/pub/dfs/pipelines/repositories/macports/packages" |
---|
99 | close ${config_file} |
---|
100 | set config_file [open ${prefix}/etc/macports/pubkeys.conf a] |
---|
101 | puts ${config_file} "# ESO RSA public signature key (automatically added by ${name})." |
---|
102 | puts ${config_file} "${prefix}/share/${name}/eso-pubkey.pem" |
---|
103 | close ${config_file} |
---|
104 | } |
---|
105 | |
---|
106 | post-activate { |
---|
107 | ui_msg "*** Please run 'sudo port sync' to synchronise with the ESO repository. ***" |
---|
108 | } |
---|
109 | |
---|
110 | post-deactivate { |
---|
111 | reinplace -E "/^# ESO MacPorts Portfile source repository \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ |
---|
112 | N;/\\nftp:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/macports\\/ports\\.tar\[\[:space:]]*$/d;}" \ |
---|
113 | ${prefix}/etc/macports/sources.conf |
---|
114 | reinplace -E "/^# ESO MacPorts binary package repository \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ |
---|
115 | N;N;N;N;N;N;/\\nurls \[\[:space:]]*ftp:\\/\\/ftp\\.eso\\.org\\/pub\\/dfs\\/pipelines\\/repositories\\/macports\\/packages\[\[:space:]]*$/d;}" \ |
---|
116 | ${prefix}/etc/macports/archive_sites.conf |
---|
117 | reinplace -E "/^# ESO RSA public signature key \\(automatically added by ${name}\\)\\.\[\[:space:]]*$/{ \ |
---|
118 | N;/\\n\[^#]*\\/share\\/${name}\\/eso-pubkey\\.pem\[\[:space:]]*$/d;}" \ |
---|
119 | ${prefix}/etc/macports/pubkeys.conf |
---|
120 | } |
---|
121 | |
---|