|
5 | 5 | # sub-ports of the specified ports.
|
6 | 6 | #
|
7 | 7 | # Copyright (c) 2006,2008 Bryan L Blackburn. All rights reserved.
|
8 |
| -# Copyright (c) 2018 The MacPorts Project |
| 8 | +# Copyright (c) 2018-2019 The MacPorts Project |
9 | 9 | #
|
10 | 10 | # Redistribution and use in source and binary forms, with or without
|
11 | 11 | # modification, are permitted provided that the following conditions
|
@@ -65,6 +65,42 @@ if {[catch {mportinit "" "" ""} result]} {
|
65 | 65 | error "Failed to initialize ports system: $result"
|
66 | 66 | }
|
67 | 67 |
|
| 68 | +set archive_site_private "" |
| 69 | +set archive_site_public "" |
| 70 | +set jobs_dir "" |
| 71 | +set license_db_dir "" |
| 72 | +while {[string range [lindex $::argv 0] 0 1] eq "--"} { |
| 73 | + switch -- [lindex $::argv 0] { |
| 74 | + --archive_site_private { |
| 75 | + set archive_site_private [lindex $::argv 1] |
| 76 | + set ::argv [lrange $::argv 1 end] |
| 77 | + } |
| 78 | + --archive_site_public { |
| 79 | + set archive_site_public [lindex $::argv 1] |
| 80 | + set ::argv [lrange $::argv 1 end] |
| 81 | + } |
| 82 | + --jobs_dir { |
| 83 | + set jobs_dir [lindex $::argv 1] |
| 84 | + set ::argv [lrange $::argv 1 end] |
| 85 | + } |
| 86 | + --license_db_dir { |
| 87 | + set license_db_dir [lindex $::argv 1] |
| 88 | + set ::argv [lrange $::argv 1 end] |
| 89 | + } |
| 90 | + default { |
| 91 | + error "unknown option: [lindex $::argv 0]" |
| 92 | + } |
| 93 | + } |
| 94 | + set ::argv [lrange $::argv 1 end] |
| 95 | +} |
| 96 | + |
| 97 | +if {$jobs_dir ne ""} { |
| 98 | + source ${jobs_dir}/distributable_lib.tcl |
| 99 | + if {$license_db_dir ne ""} { |
| 100 | + init_license_db $license_db_dir |
| 101 | + } |
| 102 | +} |
| 103 | + |
68 | 104 | set is_64bit_capable [sysctl hw.cpu64bit_capable]
|
69 | 105 |
|
70 | 106 | array set portdepinfo {}
|
@@ -114,15 +150,39 @@ while {$todo ne {}} {
|
114 | 150 | }
|
115 | 151 | }
|
116 | 152 |
|
| 153 | + set opened 0 |
117 | 154 | if {[info exists outputports($p)] && $outputports($p) == 1} {
|
118 | 155 | if {[info exists portinfo(replaced_by)]} {
|
119 | 156 | puts stderr "Excluding $portinfo(name) because it is replaced by $portinfo(replaced_by)"
|
120 | 157 | set outputports($p) 0
|
121 | 158 | } elseif {[info exists portinfo(known_fail)] && [string is true -strict $portinfo(known_fail)]} {
|
122 | 159 | puts stderr "Excluding $portinfo(name) because it is known to fail"
|
123 | 160 | set outputports($p) 0
|
124 |
| - } elseif {$::macports::os_major <= 10} { |
| 161 | + } elseif {$archive_site_public ne ""} { |
| 162 | + # FIXME: support non-default variants |
125 | 163 | if {![catch {mportopen $portinfo(porturl) [list subport $portinfo(name)] ""} result]} {
|
| 164 | + set opened 1 |
| 165 | + set workername [ditem_key $result workername] |
| 166 | + set archive_name [$workername eval get_portimage_name] |
| 167 | + if {![catch {curl getsize ${archive_site_public}/$portinfo(name)/${archive_name}} size] && $size > 0} { |
| 168 | + puts stderr "Excluding $portinfo(name) because it has already been built and uploaded to the public server" |
| 169 | + set outputports($p) 0 |
| 170 | + } |
| 171 | + } else { |
| 172 | + puts stderr "Excluding $portinfo(name) because it failed to open: $result" |
| 173 | + set outputports($p) 0 |
| 174 | + } |
| 175 | + if {$outputports($p) == 1 && $archive_site_private ne "" && $jobs_dir ne ""} { |
| 176 | + # FIXME: support non-default variants |
| 177 | + set results [check_licenses $portinfo(name) [list]] |
| 178 | + if {[lindex $results 0] == 1 && ![catch {curl getsize ${archive_site_private}/$portinfo(name)/${archive_name}} size] && $size > 0} { |
| 179 | + puts stderr "Excluding $portinfo(name) because it is not distributable and it has already been built and uploaded to the private server" |
| 180 | + set outputports($p) 0 |
| 181 | + } |
| 182 | + } |
| 183 | + } |
| 184 | + if {$outputports($p) == 1 && $::macports::os_major <= 10} { |
| 185 | + if {$opened == 1 || ![catch {mportopen $portinfo(porturl) [list subport $portinfo(name)] ""} result]} { |
126 | 186 | set supported_archs [_mportkey $result supported_archs]
|
127 | 187 | if {$::macports::os_arch eq "i386" && !${is_64bit_capable} && $supported_archs ne "" && ("x86_64" ni $supported_archs || "i386" ni $supported_archs)} {
|
128 | 188 | puts stderr "Excluding $portinfo(name) because the ${::macports::macosx_version}_x86_64 builder will build it"
|
@@ -159,6 +219,10 @@ while {$todo ne {}} {
|
159 | 219 | }
|
160 | 220 | }
|
161 | 221 |
|
| 222 | +if {$jobs_dir ne "" && $license_db_dir ne ""} { |
| 223 | + write_license_db $license_db_dir |
| 224 | +} |
| 225 | + |
162 | 226 | set portlist [list]
|
163 | 227 | foreach portname [lsort -dictionary [array names portdepinfo]] {
|
164 | 228 | if {[info exists portdepinfo($portname)]} {
|
|
0 commit comments