Skip to content

Instantly share code, notes, and snippets.

@jmroot
Last active April 6, 2024 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmroot/f524dcfe5fdadcd8b7a9c2e46151e0d4 to your computer and use it in GitHub Desktop.
Save jmroot/f524dcfe5fdadcd8b7a9c2e46151e0d4 to your computer and use it in GitHub Desktop.
Check which MacPorts ports have binary archives available
#!/usr/bin/env port-tclsh
# For every available port, outputs the port name to available.txt
# if a binary archive is available on packages.macports.org, or to
# unavailable.txt if not.
package require macports
mportinit
set yesfile [open ./available.txt w]
set nofile [open ./unavailable.txt w]
set archive_site http://packages.macports.org
foreach {portname portinfo} [mportlistall] {
if {[catch {mportopen [dict get $portinfo porturl] [dict create subport $portname] ""} mport]} {
ui_warn "Failed to open portfile for ${portname}: $mport"
continue
}
set archive_name [[ditem_key $mport workername] eval {portfetch::percent_encode [get_portimage_name]}]
mportclose $mport
if {![catch {curl getsize ${archive_site}/${portname}/${archive_name}} size] && $size > 0} {
puts $yesfile $portname
} else {
puts $nofile $portname
}
}
close $yesfile
close $nofile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment